@itwin/components-react 4.11.0 → 4.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/CHANGELOG.md +18 -1
  2. package/lib/cjs/components-react/UiComponents.d.ts +0 -4
  3. package/lib/cjs/components-react/UiComponents.d.ts.map +1 -1
  4. package/lib/cjs/components-react/UiComponents.js +2 -12
  5. package/lib/cjs/components-react/UiComponents.js.map +1 -1
  6. package/lib/cjs/components-react/UiComponents.json +153 -0
  7. package/lib/cjs/components-react/common/DelayedSpinner.js +2 -3
  8. package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
  9. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +1 -2
  10. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  11. package/lib/cjs/components-react/converters/NumericTypeConverter.js +2 -4
  12. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  13. package/lib/cjs/components-react/converters/TypeConverter.js +1 -2
  14. package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
  15. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js +1 -1
  16. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  17. package/lib/cjs/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  18. package/lib/cjs/components-react/editors/CustomNumberEditor.js +10 -11
  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/EditorContainer.d.ts +2 -24
  23. package/lib/cjs/components-react/editors/EditorContainer.d.ts.map +1 -1
  24. package/lib/cjs/components-react/editors/EditorContainer.js +111 -149
  25. package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
  26. package/lib/cjs/components-react/editors/EnumEditor.js +1 -1
  27. package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
  28. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
  29. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js +3 -1
  30. package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  31. package/lib/cjs/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  32. package/lib/cjs/components-react/editors/NumericInputEditor.js +3 -1
  33. package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
  34. package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
  35. package/lib/cjs/components-react/editors/PopupButton.js +4 -4
  36. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  37. package/lib/cjs/components-react/editors/TextEditor.d.ts.map +1 -1
  38. package/lib/cjs/components-react/editors/TextEditor.js +6 -6
  39. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  40. package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
  41. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  42. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
  43. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  44. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  45. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  46. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  47. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  48. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +3 -3
  49. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  50. package/lib/cjs/components-react/filter-builder/Operators.d.ts +1 -0
  51. package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -1
  52. package/lib/cjs/components-react/filter-builder/Operators.js +1 -0
  53. package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
  54. package/lib/cjs/components-react/properties/LinkHandler.d.ts.map +1 -1
  55. package/lib/cjs/components-react/properties/LinkHandler.js +3 -1
  56. package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
  57. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
  58. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  59. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js +2 -3
  60. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -1
  61. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  62. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  63. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.d.ts +0 -1
  64. package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.d.ts.map +1 -1
  65. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts +4 -2
  66. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  67. package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  68. package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  69. package/lib/cjs/components-react/properties/renderers/PropertyView.js +3 -1
  70. package/lib/cjs/components-react/properties/renderers/PropertyView.js.map +1 -1
  71. package/lib/cjs/components-react/properties/renderers/PropertyView.scss +1 -0
  72. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  73. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  74. package/lib/cjs/components-react/properties/renderers/value/Common.js +1 -2
  75. package/lib/cjs/components-react/properties/renderers/value/Common.js.map +1 -1
  76. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +0 -1
  77. package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
  78. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +2 -4
  79. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  80. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
  81. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  82. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts.map +1 -1
  83. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js +3 -1
  84. package/lib/cjs/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js.map +1 -1
  85. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  86. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  87. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  88. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  89. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  90. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
  91. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  92. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts +0 -1
  93. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  94. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  95. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  96. package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts +4 -2
  97. package/lib/cjs/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  98. package/lib/cjs/components-react/propertygrid/component/PropertyList.js.map +1 -1
  99. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -2
  100. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  101. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +51 -59
  102. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  103. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +4 -0
  104. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  105. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  106. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  107. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  108. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  109. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  110. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  111. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  112. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  113. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  114. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  115. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  116. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  117. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  118. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  119. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  120. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +7 -9
  121. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  122. package/lib/cjs/components-react/selectable-content/SelectableContent.js +2 -3
  123. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  124. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  125. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +9 -14
  126. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  127. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  128. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +1 -4
  129. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  130. package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
  131. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js +2 -3
  132. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  133. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +5 -6
  134. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  135. package/lib/cjs/components-react/tree/controlled/TreeActions.d.ts +0 -1
  136. package/lib/cjs/components-react/tree/controlled/TreeActions.d.ts.map +1 -1
  137. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts +0 -1
  138. package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
  139. package/lib/cjs/components-react/tree/controlled/TreeModel.js +7 -8
  140. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  141. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  142. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  143. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +3 -1
  144. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  145. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +1 -2
  146. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  147. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +0 -1
  148. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
  149. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +9 -9
  150. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  151. package/lib/cjs/components-react/useTranslation.d.ts +4 -7
  152. package/lib/cjs/components-react/useTranslation.d.ts.map +1 -1
  153. package/lib/cjs/components-react/useTranslation.js +39 -7
  154. package/lib/cjs/components-react/useTranslation.js.map +1 -1
  155. package/lib/cjs/components-react.d.ts +1 -0
  156. package/lib/cjs/components-react.d.ts.map +1 -1
  157. package/lib/cjs/components-react.js +1 -0
  158. package/lib/cjs/components-react.js.map +1 -1
  159. package/lib/esm/components-react/UiComponents.d.ts +0 -4
  160. package/lib/esm/components-react/UiComponents.d.ts.map +1 -1
  161. package/lib/esm/components-react/UiComponents.js +2 -12
  162. package/lib/esm/components-react/UiComponents.js.map +1 -1
  163. package/lib/esm/components-react/UiComponents.json +153 -0
  164. package/lib/esm/components-react/common/DelayedSpinner.js +2 -3
  165. package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
  166. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +1 -2
  167. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  168. package/lib/esm/components-react/converters/NumericTypeConverter.js +2 -4
  169. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  170. package/lib/esm/components-react/converters/TypeConverter.js +1 -2
  171. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  172. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +1 -1
  173. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  174. package/lib/esm/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
  175. package/lib/esm/components-react/editors/CustomNumberEditor.js +10 -11
  176. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  177. package/lib/esm/components-react/editors/DateTimeEditor.js +2 -3
  178. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  179. package/lib/esm/components-react/editors/EditorContainer.d.ts +2 -24
  180. package/lib/esm/components-react/editors/EditorContainer.d.ts.map +1 -1
  181. package/lib/esm/components-react/editors/EditorContainer.js +111 -149
  182. package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
  183. package/lib/esm/components-react/editors/EnumEditor.js +1 -1
  184. package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
  185. package/lib/esm/components-react/editors/ImageCheckBoxEditor.d.ts.map +1 -1
  186. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js +3 -1
  187. package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
  188. package/lib/esm/components-react/editors/NumericInputEditor.d.ts.map +1 -1
  189. package/lib/esm/components-react/editors/NumericInputEditor.js +3 -1
  190. package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
  191. package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
  192. package/lib/esm/components-react/editors/PopupButton.js +4 -4
  193. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  194. package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
  195. package/lib/esm/components-react/editors/TextEditor.js +6 -6
  196. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  197. package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
  198. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  199. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
  200. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  201. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
  202. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  203. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +1 -1
  204. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  205. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +3 -3
  206. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  207. package/lib/esm/components-react/filter-builder/Operators.d.ts +1 -0
  208. package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -1
  209. package/lib/esm/components-react/filter-builder/Operators.js +1 -0
  210. package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
  211. package/lib/esm/components-react/properties/LinkHandler.d.ts.map +1 -1
  212. package/lib/esm/components-react/properties/LinkHandler.js +3 -1
  213. package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
  214. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
  215. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  216. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js +2 -3
  217. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -1
  218. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  219. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  220. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.d.ts +0 -1
  221. package/lib/esm/components-react/properties/renderers/PropertyGridColumns.d.ts.map +1 -1
  222. package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts +4 -2
  223. package/lib/esm/components-react/properties/renderers/PropertyRenderer.d.ts.map +1 -1
  224. package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
  225. package/lib/esm/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  226. package/lib/esm/components-react/properties/renderers/PropertyView.js +3 -1
  227. package/lib/esm/components-react/properties/renderers/PropertyView.js.map +1 -1
  228. package/lib/esm/components-react/properties/renderers/PropertyView.scss +1 -0
  229. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  230. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  231. package/lib/esm/components-react/properties/renderers/value/Common.js +1 -2
  232. package/lib/esm/components-react/properties/renderers/value/Common.js.map +1 -1
  233. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +0 -1
  234. package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts.map +1 -1
  235. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +2 -4
  236. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  237. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
  238. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  239. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.d.ts.map +1 -1
  240. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js +3 -1
  241. package/lib/esm/components-react/properties/renderers/value/table/NonPrimitiveValueRenderer.js.map +1 -1
  242. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
  243. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  244. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.d.ts.map +1 -1
  245. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
  246. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  247. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
  248. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  249. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts +0 -1
  250. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.d.ts.map +1 -1
  251. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  252. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  253. package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts +4 -2
  254. package/lib/esm/components-react/propertygrid/component/PropertyList.d.ts.map +1 -1
  255. package/lib/esm/components-react/propertygrid/component/PropertyList.js.map +1 -1
  256. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +3 -2
  257. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  258. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +51 -59
  259. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  260. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.scss +4 -0
  261. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
  262. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  263. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  264. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  265. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
  266. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  267. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
  268. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  269. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  270. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  271. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
  272. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  273. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  274. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  275. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  276. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  277. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +7 -9
  278. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  279. package/lib/esm/components-react/selectable-content/SelectableContent.js +2 -3
  280. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  281. package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  282. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +10 -15
  283. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  284. package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  285. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +2 -5
  286. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  287. package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
  288. package/lib/esm/components-react/toolbar/PopupItemsPanel.js +3 -4
  289. package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  290. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +5 -6
  291. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  292. package/lib/esm/components-react/tree/controlled/TreeActions.d.ts +0 -1
  293. package/lib/esm/components-react/tree/controlled/TreeActions.d.ts.map +1 -1
  294. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts +0 -1
  295. package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
  296. package/lib/esm/components-react/tree/controlled/TreeModel.js +7 -8
  297. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  298. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +6 -8
  299. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  300. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +3 -1
  301. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  302. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +1 -2
  303. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  304. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +0 -1
  305. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
  306. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +9 -9
  307. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  308. package/lib/esm/components-react/useTranslation.d.ts +4 -7
  309. package/lib/esm/components-react/useTranslation.d.ts.map +1 -1
  310. package/lib/esm/components-react/useTranslation.js +14 -5
  311. package/lib/esm/components-react/useTranslation.js.map +1 -1
  312. package/lib/esm/components-react.d.ts +1 -0
  313. package/lib/esm/components-react.d.ts.map +1 -1
  314. package/lib/esm/components-react.js +1 -0
  315. package/lib/esm/components-react.js.map +1 -1
  316. package/package.json +9 -38
package/CHANGELOG.md CHANGED
@@ -1,6 +1,23 @@
1
1
  # Change Log - @itwin/components-react
2
2
 
3
- This log was last generated on Thu, 21 Mar 2024 16:38:04 GMT and should not be manually modified.
3
+ This log was last generated on Tue, 07 May 2024 08:44:06 GMT and should not be manually modified.
4
+
5
+ ## 4.13.0
6
+ Tue, 07 May 2024 08:44:06 GMT
7
+
8
+ ### Updates
9
+
10
+ - Convert EditorContainer to function component.
11
+ - Clipped node content when it does not fit in `VirtualizedPropertyGrid`.
12
+ - Updated `TreeSelectionManager` to not start a drag operation when only one node is selected.
13
+ - Fixed spacing between categories in `VirtualizedPropertyGrid`.
14
+
15
+ ## 4.12.0
16
+ Fri, 05 Apr 2024 09:55:35 GMT
17
+
18
+ ### Updates
19
+
20
+ - Added note to `PropertyFilterRuleOperator` that `Like` operator should be handled as a contains operator.
4
21
 
5
22
  ## 4.11.0
6
23
  Thu, 21 Mar 2024 16:38:04 GMT
@@ -18,10 +18,6 @@ export declare class UiComponents {
18
18
  static terminate(): void;
19
19
  /** Determines if UiComponents has been initialized */
20
20
  static get initialized(): boolean;
21
- /** The internationalization service created by the host application.
22
- * @internal
23
- */
24
- static get localization(): Localization;
25
21
  /** The internationalization service namespace. */
26
22
  static get localizationNamespace(): string;
27
23
  /** @internal */
@@ -1 +1 @@
1
- {"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../../src/components-react/UiComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAKvD;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAS;IACpC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAe;IAE5C;;;OAGG;WACiB,UAAU,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzE,0DAA0D;WAC5C,SAAS;IAWvB,sDAAsD;IACtD,WAAkB,WAAW,IAAI,OAAO,CAEvC;IAED;;OAEG;IACH,WAAkB,YAAY,IAAI,YAAY,CAQ7C;IAED,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;IAED,gBAAgB;IAChB,WAAkB,WAAW,IAAI,MAAM,CAEtC;IAED;;OAEG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM;IAavD,gBAAgB;WACF,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;CAM/C"}
1
+ {"version":3,"file":"UiComponents.d.ts","sourceRoot":"","sources":["../../../src/components-react/UiComponents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAIvD;;;GAGG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,YAAY,CAAS;IACpC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAC,CAAe;IAE5C;;;OAGG;WACiB,UAAU,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBzE,0DAA0D;WAC5C,SAAS;IAWvB,sDAAsD;IACtD,WAAkB,WAAW,IAAI,OAAO,CAEvC;IAED,kDAAkD;IAClD,WAAkB,qBAAqB,IAAI,MAAM,CAEhD;IAED,gBAAgB;IAChB,WAAkB,WAAW,IAAI,MAAM,CAEtC;IAED;;OAEG;WACW,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM;IAavD,gBAAgB;WACF,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM;CAM/C"}
@@ -12,7 +12,6 @@ const immer_1 = require("immer");
12
12
  const core_bentley_1 = require("@itwin/core-bentley");
13
13
  const core_react_1 = require("@itwin/core-react");
14
14
  const core_react_2 = require("@itwin/core-react");
15
- const appui_abstract_1 = require("@itwin/appui-abstract");
16
15
  /**
17
16
  * Manages the localization service for the components-react package.
18
17
  * @public
@@ -45,15 +44,6 @@ class UiComponents {
45
44
  static get initialized() {
46
45
  return UiComponents._initialized;
47
46
  }
48
- /** The internationalization service created by the host application.
49
- * @internal
50
- */
51
- static get localization() {
52
- if (!UiComponents._localization)
53
- // eslint-disable-next-line deprecation/deprecation
54
- throw new appui_abstract_1.UiError(UiComponents.loggerCategory(this), "_localization: UiComponents.initialize has not been called. Unable to return Localization object.");
55
- return UiComponents._localization;
56
- }
57
47
  /** The internationalization service namespace. */
58
48
  static get localizationNamespace() {
59
49
  return "UiComponents";
@@ -66,11 +56,11 @@ class UiComponents {
66
56
  * @internal
67
57
  */
68
58
  static translate(key) {
69
- if (!UiComponents.initialized) {
59
+ if (!UiComponents._localization) {
70
60
  core_bentley_1.Logger.logError(UiComponents.loggerCategory(this), `translate: UiComponents.initialize has not been called. Returning blank string.`);
71
61
  return "";
72
62
  }
73
- return UiComponents.localization.getLocalizedString(`${UiComponents.localizationNamespace}:${key}`);
63
+ return UiComponents._localization.getLocalizedString(`${UiComponents.localizationNamespace}:${key}`);
74
64
  }
75
65
  /** @internal */
76
66
  static loggerCategory(obj) {
@@ -1 +1 @@
1
- {"version":3,"file":"UiComponents.js","sourceRoot":"","sources":["../../../src/components-react/UiComponents.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAAsC;AACtC,sDAA6C;AAE7C,kDAA2C;AAC3C,kDAAuD;AACvD,0DAAgD;AAEhD;;;GAGG;AACH,MAAa,YAAY;IAIvB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,YAA0B;QACvD,IAAI,YAAY,CAAC,YAAY,EAAE;YAC7B,qBAAM,CAAC,OAAO,CACZ,YAAY,CAAC,cAAc,CAAC,YAAY,CAAC,EACzC,wCAAwC,CACzC,CAAC;YACF,OAAO;SACR;QAED,IAAA,qBAAa,GAAE,CAAC;QAChB,YAAY,CAAC,aAAa,GAAG,YAAY,CAAC;QAC1C,MAAM,YAAY,CAAC,aAAa,CAAC,iBAAiB,CAChD,YAAY,CAAC,qBAAqB,CACnC,CAAC;QAEF,MAAM,mBAAM,CAAC,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QACpD,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC;IACnC,CAAC;IAED,0DAA0D;IACnD,MAAM,CAAC,SAAS;QACrB,IAAI,YAAY,CAAC,aAAa;YAC5B,YAAY,CAAC,aAAa,CAAC,mBAAmB,CAC5C,YAAY,CAAC,qBAAqB,CACnC,CAAC;QACJ,YAAY,CAAC,aAAa,GAAG,SAAS,CAAC;QAEvC,mBAAM,CAAC,SAAS,EAAE,CAAC;QACnB,YAAY,CAAC,YAAY,GAAG,KAAK,CAAC;IACpC,CAAC;IAED,sDAAsD;IAC/C,MAAM,KAAK,WAAW;QAC3B,OAAO,YAAY,CAAC,YAAY,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,MAAM,KAAK,YAAY;QAC5B,IAAI,CAAC,YAAY,CAAC,aAAa;YAC7B,mDAAmD;YACnD,MAAM,IAAI,wBAAO,CACf,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,EACjC,mGAAmG,CACpG,CAAC;QACJ,OAAO,YAAY,CAAC,aAAa,CAAC;IACpC,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB;QAC5C,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE;YAC7B,qBAAM,CAAC,QAAQ,CACb,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,EACjC,iFAAiF,CAClF,CAAC;YACF,OAAO,EAAE,CAAC;SACX;QACD,OAAO,YAAY,CAAC,YAAY,CAAC,kBAAkB,CACjD,GAAG,YAAY,CAAC,qBAAqB,IAAI,GAAG,EAAE,CAC/C,CAAC;IACJ,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,IAAA,+BAAkB,EAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GACZ,YAAY,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAChE,OAAO,QAAQ,CAAC;IAClB,CAAC;;AAxFc,yBAAY,GAAG,KAAK,CAAC;AADzB,oCAAY","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 Common\n */\n\nimport { enablePatches } from \"immer\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { Localization } from \"@itwin/core-common\";\nimport { UiCore } from \"@itwin/core-react\";\nimport { getObjectClassName } from \"@itwin/core-react\";\nimport { UiError } from \"@itwin/appui-abstract\";\n\n/**\n * Manages the localization service for the components-react package.\n * @public\n */\nexport class UiComponents {\n private static _initialized = false;\n private static _localization?: Localization;\n\n /**\n * Registers the localization service namespace for UiComponents. Also initializes UiCore.\n * @param localization The internationalization service created by the host application.\n */\n public static async initialize(localization: Localization): Promise<void> {\n if (UiComponents._initialized) {\n Logger.logInfo(\n UiComponents.loggerCategory(UiComponents),\n `UiComponents.initialize already called`\n );\n return;\n }\n\n enablePatches();\n UiComponents._localization = localization;\n await UiComponents._localization.registerNamespace(\n UiComponents.localizationNamespace\n );\n\n await UiCore.initialize(UiComponents._localization);\n UiComponents._initialized = true;\n }\n\n /** Unregisters the UiComponents localization namespace */\n public static terminate() {\n if (UiComponents._localization)\n UiComponents._localization.unregisterNamespace(\n UiComponents.localizationNamespace\n );\n UiComponents._localization = undefined;\n\n UiCore.terminate();\n UiComponents._initialized = false;\n }\n\n /** Determines if UiComponents has been initialized */\n public static get initialized(): boolean {\n return UiComponents._initialized;\n }\n\n /** The internationalization service created by the host application.\n * @internal\n */\n public static get localization(): Localization {\n if (!UiComponents._localization)\n // eslint-disable-next-line deprecation/deprecation\n throw new UiError(\n UiComponents.loggerCategory(this),\n \"_localization: UiComponents.initialize has not been called. Unable to return Localization object.\"\n );\n return UiComponents._localization;\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiComponents\";\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"components-react\";\n }\n\n /** Calls localization.getLocalizedString with the \"UiComponents\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiComponents.initialized) {\n Logger.logError(\n UiComponents.loggerCategory(this),\n `translate: UiComponents.initialize has not been called. Returning blank string.`\n );\n return \"\";\n }\n return UiComponents.localization.getLocalizedString(\n `${UiComponents.localizationNamespace}:${key}`\n );\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getObjectClassName(obj);\n const category =\n UiComponents.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n}\n"]}
1
+ {"version":3,"file":"UiComponents.js","sourceRoot":"","sources":["../../../src/components-react/UiComponents.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAAsC;AACtC,sDAA6C;AAE7C,kDAA2C;AAC3C,kDAAuD;AAEvD;;;GAGG;AACH,MAAa,YAAY;IAIvB;;;OAGG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,YAA0B;QACvD,IAAI,YAAY,CAAC,YAAY,EAAE;YAC7B,qBAAM,CAAC,OAAO,CACZ,YAAY,CAAC,cAAc,CAAC,YAAY,CAAC,EACzC,wCAAwC,CACzC,CAAC;YACF,OAAO;SACR;QAED,IAAA,qBAAa,GAAE,CAAC;QAChB,YAAY,CAAC,aAAa,GAAG,YAAY,CAAC;QAC1C,MAAM,YAAY,CAAC,aAAa,CAAC,iBAAiB,CAChD,YAAY,CAAC,qBAAqB,CACnC,CAAC;QAEF,MAAM,mBAAM,CAAC,UAAU,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QACpD,YAAY,CAAC,YAAY,GAAG,IAAI,CAAC;IACnC,CAAC;IAED,0DAA0D;IACnD,MAAM,CAAC,SAAS;QACrB,IAAI,YAAY,CAAC,aAAa;YAC5B,YAAY,CAAC,aAAa,CAAC,mBAAmB,CAC5C,YAAY,CAAC,qBAAqB,CACnC,CAAC;QACJ,YAAY,CAAC,aAAa,GAAG,SAAS,CAAC;QAEvC,mBAAM,CAAC,SAAS,EAAE,CAAC;QACnB,YAAY,CAAC,YAAY,GAAG,KAAK,CAAC;IACpC,CAAC;IAED,sDAAsD;IAC/C,MAAM,KAAK,WAAW;QAC3B,OAAO,YAAY,CAAC,YAAY,CAAC;IACnC,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,kBAAkB,CAAC;IAC5B,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB;QAC5C,IAAI,CAAC,YAAY,CAAC,aAAa,EAAE;YAC/B,qBAAM,CAAC,QAAQ,CACb,YAAY,CAAC,cAAc,CAAC,IAAI,CAAC,EACjC,iFAAiF,CAClF,CAAC;YACF,OAAO,EAAE,CAAC;SACX;QACD,OAAO,YAAY,CAAC,aAAa,CAAC,kBAAkB,CAClD,GAAG,YAAY,CAAC,qBAAqB,IAAI,GAAG,EAAE,CAC/C,CAAC;IACJ,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,GAAQ;QACnC,MAAM,SAAS,GAAG,IAAA,+BAAkB,EAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,QAAQ,GACZ,YAAY,CAAC,WAAW,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;QAChE,OAAO,QAAQ,CAAC;IAClB,CAAC;;AA3Ec,yBAAY,GAAG,KAAK,CAAC;AADzB,oCAAY","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 Common\n */\n\nimport { enablePatches } from \"immer\";\nimport { Logger } from \"@itwin/core-bentley\";\nimport type { Localization } from \"@itwin/core-common\";\nimport { UiCore } from \"@itwin/core-react\";\nimport { getObjectClassName } from \"@itwin/core-react\";\n\n/**\n * Manages the localization service for the components-react package.\n * @public\n */\nexport class UiComponents {\n private static _initialized = false;\n private static _localization?: Localization;\n\n /**\n * Registers the localization service namespace for UiComponents. Also initializes UiCore.\n * @param localization The internationalization service created by the host application.\n */\n public static async initialize(localization: Localization): Promise<void> {\n if (UiComponents._initialized) {\n Logger.logInfo(\n UiComponents.loggerCategory(UiComponents),\n `UiComponents.initialize already called`\n );\n return;\n }\n\n enablePatches();\n UiComponents._localization = localization;\n await UiComponents._localization.registerNamespace(\n UiComponents.localizationNamespace\n );\n\n await UiCore.initialize(UiComponents._localization);\n UiComponents._initialized = true;\n }\n\n /** Unregisters the UiComponents localization namespace */\n public static terminate() {\n if (UiComponents._localization)\n UiComponents._localization.unregisterNamespace(\n UiComponents.localizationNamespace\n );\n UiComponents._localization = undefined;\n\n UiCore.terminate();\n UiComponents._initialized = false;\n }\n\n /** Determines if UiComponents has been initialized */\n public static get initialized(): boolean {\n return UiComponents._initialized;\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiComponents\";\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"components-react\";\n }\n\n /** Calls localization.getLocalizedString with the \"UiComponents\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiComponents._localization) {\n Logger.logError(\n UiComponents.loggerCategory(this),\n `translate: UiComponents.initialize has not been called. Returning blank string.`\n );\n return \"\";\n }\n return UiComponents._localization.getLocalizedString(\n `${UiComponents.localizationNamespace}:${key}`\n );\n }\n\n /** @internal */\n public static loggerCategory(obj: any): string {\n const className = getObjectClassName(obj);\n const category =\n UiComponents.packageName + (className ? `.${className}` : \"\");\n return category;\n }\n}\n"]}
@@ -0,0 +1,153 @@
1
+ {
2
+ "general": {
3
+ "true": "true",
4
+ "false": "false",
5
+ "loading": "loading",
6
+ "noData": "The data required for this tree layout is not available in this iModel.",
7
+ "length": "Length",
8
+ "label": "Label",
9
+ "of": "of",
10
+ "search": "Search",
11
+ "clear": "Clear"
12
+ },
13
+ "button": {
14
+ "label": {
15
+ "search": "Search",
16
+ "cancel": "Cancel",
17
+ "settings": "Settings",
18
+ "filter": "Filter",
19
+ "selectAll": "Select All"
20
+ }
21
+ },
22
+ "breadcrumb": {
23
+ "invalidBreadcrumbPath": "Path not found.",
24
+ "errorUnknownMode": "Error: Unknown Breadcrumb mode.",
25
+ "name": "Name",
26
+ "icon": "Icon",
27
+ "description": "Description"
28
+ },
29
+ "tree": {
30
+ "noResultsForFilter": "0 matches found for \"{{searchText}}\""
31
+ },
32
+ "table": {
33
+ "filter": {
34
+ "numericTooltip": "Input Methods: Range (x-y), Greater Then (>x), Less Then (<y)",
35
+ "numericPlaceholder": "e.g. 3,10-15,>20"
36
+ }
37
+ },
38
+ "showhide": {
39
+ "noLabel": "[unlabeled]",
40
+ "showAll": "Show all",
41
+ "list": "List...",
42
+ "title": "Show/Hide"
43
+ },
44
+ "property": {
45
+ "varies": "*** Varies ***",
46
+ "arrayLength": "Number of Items",
47
+ "expand": "See more",
48
+ "collapse": "See less"
49
+ },
50
+ "timepicker": {
51
+ "day-period-am": "AM",
52
+ "day-period-pm": "PM"
53
+ },
54
+ "datepicker": {
55
+ "selectDate": "Select Date",
56
+ "time": "Time",
57
+ "previousMonth": "Previous Month",
58
+ "nextMonth": "Next Month"
59
+ },
60
+ "month": {
61
+ "long": {
62
+ "january": "January",
63
+ "february": "February",
64
+ "march": "March",
65
+ "april": "April",
66
+ "may": "May",
67
+ "june": "June",
68
+ "july": "July",
69
+ "august": "August",
70
+ "september": "September",
71
+ "october": "October",
72
+ "november": "November",
73
+ "december": "December"
74
+ },
75
+ "short": {
76
+ "january": "Jan",
77
+ "february": "Feb",
78
+ "march": "Mar",
79
+ "april": "Apr",
80
+ "may": "May",
81
+ "june": "Jun",
82
+ "july": "Jul",
83
+ "august": "Aug",
84
+ "september": "Sep",
85
+ "october": "Oct",
86
+ "november": "Nov",
87
+ "december": "Dec"
88
+ }
89
+ },
90
+ "days": {
91
+ "long": {
92
+ "sunday": "Sunday",
93
+ "monday": "Monday",
94
+ "tuesday": "Tuesday",
95
+ "wednesday": "Wednesday",
96
+ "thursday": "Thursday",
97
+ "friday": "Friday",
98
+ "saturday": "Saturday"
99
+ },
100
+ "short": {
101
+ "sunday": "Su",
102
+ "monday": "Mo",
103
+ "tuesday": "Tu",
104
+ "wednesday": "We",
105
+ "thursday": "Th",
106
+ "friday": "Fr",
107
+ "saturday": "Sa"
108
+ }
109
+ },
110
+ "time": {
111
+ "am": "am",
112
+ "pm": "pm"
113
+ },
114
+ "filteringInput": {
115
+ "placeholder": "Search..."
116
+ },
117
+ "toolbar": {
118
+ "overflow": "More toolbar items"
119
+ },
120
+ "editor": {
121
+ "enum": "Enum Editor",
122
+ "text": "Text Editor",
123
+ "textarea": "Textarea Editor"
124
+ },
125
+ "filterBuilder": {
126
+ "rule": "Rule",
127
+ "ruleGroup": "Rule Group",
128
+ "add": "Add",
129
+ "delete": "Delete",
130
+ "operators": {
131
+ "isTrue": "Is true",
132
+ "isFalse": "Is false",
133
+ "equal": "Equal",
134
+ "notEqual": "Not equal",
135
+ "contains": "Contains",
136
+ "isNull": "Is null",
137
+ "isNotNull": "Is not null",
138
+ "and": "And",
139
+ "or": "Or",
140
+ "between": "Between",
141
+ "notBetween": "Not between"
142
+ },
143
+ "chooseProperty": "Choose property",
144
+ "errorMessages": {
145
+ "emptyValue": "Value is required",
146
+ "invalidRange": "Invalid range"
147
+ }
148
+ },
149
+ "dialog": {
150
+ "ok": "OK",
151
+ "cancel": "Cancel"
152
+ }
153
+ }
@@ -38,8 +38,7 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
38
38
  * @internal
39
39
  */
40
40
  function DelayedSpinner(props) {
41
- var _a, _b;
42
- const delay = (_a = props.delay) !== null && _a !== void 0 ? _a : 500;
41
+ const delay = props.delay ?? 500;
43
42
  const [loadStart] = React.useState(props.loadStart || new Date());
44
43
  const currTime = new Date();
45
44
  const diff = currTime.getTime() - loadStart.getTime();
@@ -52,7 +51,7 @@ function DelayedSpinner(props) {
52
51
  });
53
52
  if (diff < delay)
54
53
  return null;
55
- return (React.createElement(itwinui_react_1.ProgressRadial, { "data-testid": "components-delayed-spinner", indeterminate: true, size: (_b = props.size) !== null && _b !== void 0 ? _b : "large" }));
54
+ return (React.createElement(itwinui_react_1.ProgressRadial, { "data-testid": "components-delayed-spinner", indeterminate: true, size: props.size ?? "large" }));
56
55
  }
57
56
  exports.DelayedSpinner = DelayedSpinner;
58
57
  const useForceUpdate = () => {
@@ -1 +1 @@
1
- {"version":3,"file":"DelayedSpinner.js","sourceRoot":"","sources":["../../../../src/components-react/common/DelayedSpinner.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,wDAAsD;AAmBtD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAA0B;;IACvD,MAAM,KAAK,GAAG,MAAA,KAAK,CAAC,KAAK,mCAAI,GAAG,CAAC;IACjC,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAElE,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;IAEtD,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,IAAI,IAAI,KAAK;YAAE,OAAO;QAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC;QAC/C,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,IAAI,IAAI,GAAG,KAAK;QAAE,OAAO,IAAI,CAAC;IAE9B,OAAO,CACL,oBAAC,8BAAc,mBACD,4BAA4B,EACxC,aAAa,QACb,IAAI,EAAE,MAAA,KAAK,CAAC,IAAI,mCAAI,OAAO,GAC3B,CACH,CAAC;AACJ,CAAC;AAvBD,wCAuBC;AAED,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC,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 Common\n */\n\nimport * as React from \"react\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\ntype ProgressRadialProps = React.ComponentPropsWithoutRef<\n typeof ProgressRadial\n>;\n\n/** Type for ProgressRadialProps.size */\ntype RadialSizeType = ProgressRadialProps[\"size\"];\n\n/**\n * Props for [[DelayedSpinner]] component.\n * @internal\n */\nexport interface DelayedSpinnerProps {\n loadStart?: Date;\n delay?: number;\n size?: RadialSizeType;\n}\n\n/**\n * Spinner that is rendered with delay.\n * @internal\n */\nexport function DelayedSpinner(props: DelayedSpinnerProps) {\n const delay = props.delay ?? 500;\n const [loadStart] = React.useState(props.loadStart || new Date());\n\n const currTime = new Date();\n const diff = currTime.getTime() - loadStart.getTime();\n\n const update = useForceUpdate();\n React.useEffect(() => {\n if (diff >= delay) return;\n const timer = setTimeout(update, delay - diff);\n return () => clearTimeout(timer);\n });\n\n if (diff < delay) return null;\n\n return (\n <ProgressRadial\n data-testid=\"components-delayed-spinner\"\n indeterminate\n size={props.size ?? \"large\"}\n />\n );\n}\n\nconst useForceUpdate = () => {\n const [value, set] = React.useState(true);\n return () => set(!value);\n};\n"]}
1
+ {"version":3,"file":"DelayedSp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esContent":["/*---------------------------------------------------------------------------------------------\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 Common\n */\n\nimport * as React from \"react\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\ntype ProgressRadialProps = React.ComponentPropsWithoutRef<\n typeof ProgressRadial\n>;\n\n/** Type for ProgressRadialProps.size */\ntype RadialSizeType = ProgressRadialProps[\"size\"];\n\n/**\n * Props for [[DelayedSpinner]] component.\n * @internal\n */\nexport interface DelayedSpinnerProps {\n loadStart?: Date;\n delay?: number;\n size?: RadialSizeType;\n}\n\n/**\n * Spinner that is rendered with delay.\n * @internal\n */\nexport function DelayedSpinner(props: DelayedSpinnerProps) {\n const delay = props.delay ?? 500;\n const [loadStart] = React.useState(props.loadStart || new Date());\n\n const currTime = new Date();\n const diff = currTime.getTime() - loadStart.getTime();\n\n const update = useForceUpdate();\n React.useEffect(() => {\n if (diff >= delay) return;\n const timer = setTimeout(update, delay - diff);\n return () => clearTimeout(timer);\n });\n\n if (diff < delay) return null;\n\n return (\n <ProgressRadial\n data-testid=\"components-delayed-spinner\"\n indeterminate\n size={props.size ?? \"large\"}\n />\n );\n}\n\nconst useForceUpdate = () => {\n const [value, set] = React.useState(true);\n return () => set(!value);\n};\n"]}
@@ -21,7 +21,6 @@ const SubscriptionScheduler_1 = require("./SubscriptionScheduler");
21
21
  * @beta
22
22
  */
23
23
  function useDebouncedAsyncValue(valueToBeResolved) {
24
- var _a;
25
24
  const [scheduler] = (0, react_1.useState)(() => new SubscriptionScheduler_1.SubscriptionScheduler());
26
25
  const [{ result, inProgress }, setState] = (0, react_1.useState)({
27
26
  result: undefined,
@@ -60,7 +59,7 @@ function useDebouncedAsyncValue(valueToBeResolved) {
60
59
  };
61
60
  }, [valueToBeResolved, scheduler]);
62
61
  if (isErrorResult(result)) {
63
- throw (_a = result.error) !== null && _a !== void 0 ? _a : new Error("Exception in `useDebouncedAsyncValue`");
62
+ throw result.error ?? new Error("Exception in `useDebouncedAsyncValue`");
64
63
  }
65
64
  return { value: result, inProgress };
66
65
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UseDebouncedAsyncValue.js","sourceRoot":"","sources":["../../../../src/components-react/common/UseDebouncedAsyncValue.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAA4C;AAC5C,+BAAoC;AACpC,mEAGiC;AAEjC;;;;;;;;GAQG;AACH,SAAgB,sBAAsB,CACpC,iBAAuD;;IAEvD,MAAM,CAAC,SAAS,CAAC,GAAG,IAAA,gBAAQ,EAAC,GAAG,EAAE,CAAC,IAAI,6CAAqB,EAAW,CAAC,CAAC;IAEzE,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE,EAAE,QAAQ,CAAC,GAAG,IAAA,gBAAQ,EAGhD;QACD,MAAM,EAAE,SAAS;QACjB,UAAU,EAAE,KAAK;KAClB,CAAC,CAAC;IAEH,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,IAAI,CAAC,iBAAiB,EAAE;YACtB,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACxE,OAAO;SACR;QAED,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAClB,GAAG,IAAI;YACP,UAAU,EAAE,IAAI;SACjB,CAAC,CAAC,CAAC;QACJ,yFAAyF;QACzF,MAAM,YAAY,GAAG,IAAA,YAAK,EAAC,iBAAiB,CAAC;aAC1C,IAAI,CACH,IAAA,YAAK,EAAC;YACJ,YAAY,EAAE,KAAK;YACnB,eAAe,EAAE,KAAK;YACtB,mBAAmB,EAAE,IAAI;SAC1B,CAAC,EACF,IAAA,4CAAoB,EAAC,SAAS,CAAC,CAChC;aACA,SAAS,CAAC;YACT,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE;gBACb,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;YACrE,CAAC;YACD,KAAK,EAAE,CAAC,GAAG,EAAE,EAAE;gBACb,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;oBAClB,GAAG,IAAI;oBACP,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACtC,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC,CAAC;YACN,CAAC;SACF,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC;IAEnC,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QACzB,MAAM,MAAA,MAAM,CAAC,KAAK,mCAAI,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;KAC1E;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACvC,CAAC;AAxDD,wDAwDC;AAOD,SAAS,aAAa,CACpB,GAA2B;IAE3B,OAAO,GAAG,KAAK,SAAS,IAAK,GAAmB,CAAC,QAAQ,CAAC;AAC5D,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 Common\n */\n\nimport { useEffect, useState } from \"react\";\nimport { defer, share } from \"rxjs\";\nimport {\n scheduleSubscription,\n SubscriptionScheduler,\n} from \"./SubscriptionScheduler\";\n\n/**\n * Custom hook for working with promise values.\n * Promises are debounced using trailing and leading edge.\n * The first promise will always be executed.\n * Any promises following the first while it is executing will be scheduled (and unscheduled), leaving only the last promise to be resolved.\n * Once the first promise finishes resolving, the last passed promise starts resolving.\n * @throws if/when `valueToBeResolved` promise is rejected. The error is thrown in the React's render loop, so it can be caught using an error boundary.\n * @beta\n */\nexport function useDebouncedAsyncValue<TReturn>(\n valueToBeResolved: undefined | (() => Promise<TReturn>)\n) {\n const [scheduler] = useState(() => new SubscriptionScheduler<TReturn>());\n\n const [{ result, inProgress }, setState] = useState<{\n result: TReturn | ErrorResult | undefined;\n inProgress: boolean;\n }>({\n result: undefined,\n inProgress: false,\n });\n\n useEffect(() => {\n if (!valueToBeResolved) {\n setState((prev) => ({ ...prev, result: undefined, inProgress: false }));\n return;\n }\n\n setState((prev) => ({\n ...prev,\n inProgress: true,\n }));\n // schedule and subscribe to the observable emitting value from valueToBeResolved promise\n const subscription = defer(valueToBeResolved)\n .pipe(\n share({\n resetOnError: false,\n resetOnComplete: false,\n resetOnRefCountZero: true,\n }),\n scheduleSubscription(scheduler)\n )\n .subscribe({\n next: (data) => {\n setState((prev) => ({ ...prev, result: data, inProgress: false }));\n },\n error: (err) => {\n setState((prev) => ({\n ...prev,\n result: { error: err, hasError: true },\n inProgress: false,\n }));\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [valueToBeResolved, scheduler]);\n\n if (isErrorResult(result)) {\n throw result.error ?? new Error(\"Exception in `useDebouncedAsyncValue`\");\n }\n\n return { value: result, inProgress };\n}\n\ninterface ErrorResult {\n error: Error | undefined;\n hasError: boolean;\n}\n\nfunction isErrorResult<TResult>(\n obj?: TResult | ErrorResult\n): obj is ErrorResult {\n return obj !== undefined && (obj as ErrorResult).hasError;\n}\n"]}
1
+ {"version":3,"file":"UseDebouncedAsyncValue.js","sourceRoot":"","sources":["../../../../src/components-react/common/UseDebouncedAsyncValue.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAA4C;AAC5C,+BAA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CAAC,CAAC;oBAClB,GAAG,IAAI;oBACP,MAAM,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE;oBACtC,UAAU,EAAE,KAAK;iBAClB,CAAC,CAAC,CAAC;YACN,CAAC;SACF,CAAC,CAAC;QAEL,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,WAAW,EAAE,CAAC;QAC7B,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC,CAAC;IAEnC,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QACzB,MAAM,MAAM,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;KAC1E;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACvC,CAAC;AAxDD,wDAwDC;AAOD,SAAS,aAAa,CACpB,GAA2B;IAE3B,OAAO,GAAG,KAAK,SAAS,IAAK,GAAmB,CAAC,QAAQ,CAAC;AAC5D,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 Common\n */\n\nimport { useEffect, useState } from \"react\";\nimport { defer, share } from \"rxjs\";\nimport {\n scheduleSubscription,\n SubscriptionScheduler,\n} from \"./SubscriptionScheduler\";\n\n/**\n * Custom hook for working with promise values.\n * Promises are debounced using trailing and leading edge.\n * The first promise will always be executed.\n * Any promises following the first while it is executing will be scheduled (and unscheduled), leaving only the last promise to be resolved.\n * Once the first promise finishes resolving, the last passed promise starts resolving.\n * @throws if/when `valueToBeResolved` promise is rejected. The error is thrown in the React's render loop, so it can be caught using an error boundary.\n * @beta\n */\nexport function useDebouncedAsyncValue<TReturn>(\n valueToBeResolved: undefined | (() => Promise<TReturn>)\n) {\n const [scheduler] = useState(() => new SubscriptionScheduler<TReturn>());\n\n const [{ result, inProgress }, setState] = useState<{\n result: TReturn | ErrorResult | undefined;\n inProgress: boolean;\n }>({\n result: undefined,\n inProgress: false,\n });\n\n useEffect(() => {\n if (!valueToBeResolved) {\n setState((prev) => ({ ...prev, result: undefined, inProgress: false }));\n return;\n }\n\n setState((prev) => ({\n ...prev,\n inProgress: true,\n }));\n // schedule and subscribe to the observable emitting value from valueToBeResolved promise\n const subscription = defer(valueToBeResolved)\n .pipe(\n share({\n resetOnError: false,\n resetOnComplete: false,\n resetOnRefCountZero: true,\n }),\n scheduleSubscription(scheduler)\n )\n .subscribe({\n next: (data) => {\n setState((prev) => ({ ...prev, result: data, inProgress: false }));\n },\n error: (err) => {\n setState((prev) => ({\n ...prev,\n result: { error: err, hasError: true },\n inProgress: false,\n }));\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [valueToBeResolved, scheduler]);\n\n if (isErrorResult(result)) {\n throw result.error ?? new Error(\"Exception in `useDebouncedAsyncValue`\");\n }\n\n return { value: result, inProgress };\n}\n\ninterface ErrorResult {\n error: Error | undefined;\n hasError: boolean;\n}\n\nfunction isErrorResult<TResult>(\n obj?: TResult | ErrorResult\n): obj is ErrorResult {\n return obj !== undefined && (obj as ErrorResult).hasError;\n}\n"]}
@@ -46,7 +46,6 @@ class FloatTypeConverter extends NumericTypeConverterBase {
46
46
  return Number.isNaN(parsedValue) ? undefined : parsedValue;
47
47
  }
48
48
  convertToString(value) {
49
- var _a;
50
49
  if (value === undefined)
51
50
  return "";
52
51
  let numericValue = 0;
@@ -56,7 +55,7 @@ class FloatTypeConverter extends NumericTypeConverterBase {
56
55
  numericValue = 0;
57
56
  }
58
57
  else {
59
- numericValue = (_a = FloatTypeConverter.parseString(value)) !== null && _a !== void 0 ? _a : 0;
58
+ numericValue = FloatTypeConverter.parseString(value) ?? 0;
60
59
  }
61
60
  }
62
61
  else {
@@ -88,7 +87,6 @@ class IntTypeConverter extends NumericTypeConverterBase {
88
87
  return Number.isNaN(parsedValue) ? undefined : parsedValue;
89
88
  }
90
89
  convertToString(value) {
91
- var _a;
92
90
  if (value === undefined)
93
91
  return "";
94
92
  let numericValue = 0;
@@ -98,7 +96,7 @@ class IntTypeConverter extends NumericTypeConverterBase {
98
96
  numericValue = 0;
99
97
  }
100
98
  else {
101
- numericValue = (_a = IntTypeConverter.parseString(value)) !== null && _a !== void 0 ? _a : 0;
99
+ numericValue = IntTypeConverter.parseString(value) ?? 0;
102
100
  }
103
101
  }
104
102
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"NumericTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/NumericTypeConverter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,0DAA0D;AAE1D,mDAAgD;AAChD,iEAA8D;AAE9D;;;GAGG;AACH,MAAsB,wBACpB,SAAQ,6BAAa;IAGrB,IAAoB,iBAAiB;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,UAAU,CAAC,CAAqB,EAAE,CAAqB;QAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEM,mBAAmB,CACxB,CAAqB,EACrB,CAAqB;QAErB,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEM,aAAa,CAAC,CAAqB,EAAE,CAAqB;QAC/D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEM,sBAAsB,CAC3B,CAAqB,EACrB,CAAqB;QAErB,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEM,WAAW,CAChB,CAAqB,EACrB,CAAqB,EACrB,WAAqB;QAErB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACjB,CAAC;CACF;AArCD,4DAqCC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,wBAAwB;IACtD,MAAM,CAAC,WAAW,CAAC,KAAa;QACtC,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,MAAM,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G;AACH,MAAa,gBAAiB,SAAQ,wBAAwB;IACpD,MAAM,CAAC,WAAW,CAAC,KAAa;QACtC,MAAM,WAAW,GAAG,QAAQ,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;IAC7D,CAAC;IAEe,eAAe,CAAC,KAAsB;;QACpD,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QAEnC,IAAI,YAAY,GAAG,CAAC,CAAC;QACrB,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YAC7B,IAAI,KAAK,KAAK,GAAG,IAAI,KAAK,KAAK,EAAE,IAAI,KAAK,KAAK,IAAI,EAAE;gBACnD,sCAAsC;gBACtC,YAAY,GAAG,CAAC,CAAC;aAClB;iBAAM;gBACL,YAAY,GAAG,MAAA,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,mCAAI,CAAC,CAAC;aACzD;SACF;aAAM;YACL,YAAY,GAAG,KAAK,CAAC;SACtB;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,QAAQ,EAAE,CAAC;IAC7C,CAAC;IAEe,iBAAiB,CAAC,KAAa;QAC7C,OAAO,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF;AA1BD,4CA0BC;AAED,2CAAoB,CAAC,iBAAiB,CAAC,kCAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAChF,2CAAoB,CAAC,iBAAiB,CACpC,kCAAiB,CAAC,OAAO,EACzB,gBAAgB,CACjB,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 TypeConverters\n */\n\nimport type { Primitives } from \"@itwin/appui-abstract\";\nimport { StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type { LessGreaterOperatorProcessor } from \"./TypeConverter\";\nimport { TypeConverter } from \"./TypeConverter\";\nimport { TypeConverterManager } from \"./TypeConverterManager\";\n\n/**\n * Base Numeric Type Converter.\n * @public\n */\nexport abstract class NumericTypeConverterBase\n extends TypeConverter\n implements LessGreaterOperatorProcessor\n{\n public override get isLessGreaterType(): boolean {\n return true;\n }\n\n public isLessThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\n return a < b;\n }\n\n public isLessThanOrEqualTo(\n a: Primitives.Numeric,\n b: Primitives.Numeric\n ): boolean {\n return a <= b;\n }\n\n public isGreaterThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\n return a > b;\n }\n\n public isGreaterThanOrEqualTo(\n a: Primitives.Numeric,\n b: Primitives.Numeric\n ): boolean {\n return a >= b;\n }\n\n public sortCompare(\n a: Primitives.Numeric,\n b: Primitives.Numeric,\n _ignoreCase?: boolean\n ): number {\n return +a - +b;\n }\n}\n\n/**\n * Float Type Converter.\n * @public\n */\nexport class FloatTypeConverter extends NumericTypeConverterBase {\n private static parseString(value: string): number | undefined {\n const parsedValue = parseFloat(value);\n return Number.isNaN(parsedValue) ? undefined : parsedValue;\n }\n\n public override convertToString(value?: Primitives.Float) {\n if (value === undefined) return \"\";\n\n let numericValue = 0;\n if (typeof value === \"string\") {\n if (value === \"-\" || value === \"\" || value === \"-0.0\" || value === \"-0\") {\n // handle these semi-valid values as 0\n numericValue = 0;\n } else {\n numericValue = FloatTypeConverter.parseString(value) ?? 0;\n }\n } else {\n numericValue = value;\n }\n // this is close to calling `toFixed(2)`, but cuts of any trailing zeros\n let stringValue = (Math.round(100 * numericValue) / 100).toString();\n // because this is a _float_ converter, we want to emphasize the number is a float - make\n // sure there's a decimal part\n if (stringValue.indexOf(\".\") === -1) stringValue += \".0\";\n return stringValue;\n }\n\n public override convertFromString(value: string): number | undefined {\n return FloatTypeConverter.parseString(value);\n }\n}\nTypeConverterManager.registerConverter(\n StandardTypeNames.Float,\n FloatTypeConverter\n);\nTypeConverterManager.registerConverter(\n StandardTypeNames.Double,\n FloatTypeConverter\n);\nTypeConverterManager.registerConverter(\n StandardTypeNames.Number,\n FloatTypeConverter\n);\n\n/**\n * Int Type Converter.\n * @public\n */\nexport class IntTypeConverter extends NumericTypeConverterBase {\n private static parseString(value: string): number | undefined {\n const parsedValue = parseInt(value, 10);\n return Number.isNaN(parsedValue) ? undefined : parsedValue;\n }\n\n public override convertToString(value?: Primitives.Int) {\n if (value === undefined) return \"\";\n\n let numericValue = 0;\n if (typeof value === \"string\") {\n if (value === \"-\" || value === \"\" || value === \"-0\") {\n // handle these semi-valid values as 0\n numericValue = 0;\n } else {\n numericValue = IntTypeConverter.parseString(value) ?? 0;\n }\n } else {\n numericValue = value;\n }\n return Math.round(numericValue).toString();\n }\n\n public override convertFromString(value: string): number | undefined {\n return IntTypeConverter.parseString(value);\n }\n}\n\nTypeConverterManager.registerConverter(StandardTypeNames.Int, IntTypeConverter);\nTypeConverterManager.registerConverter(\n StandardTypeNames.Integer,\n IntTypeConverter\n);\n"]}
1
+ {"version":3,"file":"NumericTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/NumericTypeConverter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,0DAA0D;AAE1D,mDAAgD;AAChD,iEAA8D;AAE9D;;;GAGG;AACH,MAAsB,wBACpB,SAAQ,6BAAa;IAGrB,IAAoB,iBAAiB;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,UAAU,CAAC,CAAqB,EAAE,CAAqB;QAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEM,mBAAmB,CACxB,CAAqB,EACrB,CAAqB;QAErB,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEM,aAAa,CAAC,CAAqB,EAAE,CAAqB;QAC/D,OAAO,CAAC,GA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AC,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF;AA1BD,4CA0BC;AAED,2CAAoB,CAAC,iBAAiB,CAAC,kCAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAChF,2CAAoB,CAAC,iBAAiB,CACpC,kCAAiB,CAAC,OAAO,EACzB,gBAAgB,CACjB,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 TypeConverters\n */\n\nimport type { Primitives } from \"@itwin/appui-abstract\";\nimport { StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type { LessGreaterOperatorProcessor } from \"./TypeConverter\";\nimport { TypeConverter } from \"./TypeConverter\";\nimport { TypeConverterManager } from \"./TypeConverterManager\";\n\n/**\n * Base Numeric Type Converter.\n * @public\n */\nexport abstract class NumericTypeConverterBase\n extends TypeConverter\n implements LessGreaterOperatorProcessor\n{\n public override get isLessGreaterType(): boolean {\n return true;\n }\n\n public isLessThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\n return a < b;\n }\n\n public isLessThanOrEqualTo(\n a: Primitives.Numeric,\n b: Primitives.Numeric\n ): boolean {\n return a <= b;\n }\n\n public isGreaterThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\n return a > b;\n }\n\n public isGreaterThanOrEqualTo(\n a: Primitives.Numeric,\n b: Primitives.Numeric\n ): boolean {\n return a >= b;\n }\n\n public sortCompare(\n a: Primitives.Numeric,\n b: Primitives.Numeric,\n _ignoreCase?: boolean\n ): number {\n return +a - +b;\n }\n}\n\n/**\n * Float Type Converter.\n * @public\n */\nexport class FloatTypeConverter extends NumericTypeConverterBase {\n private static parseString(value: string): number | undefined {\n const parsedValue = parseFloat(value);\n return Number.isNaN(parsedValue) ? undefined : parsedValue;\n }\n\n public override convertToString(value?: Primitives.Float) {\n if (value === undefined) return \"\";\n\n let numericValue = 0;\n if (typeof value === \"string\") {\n if (value === \"-\" || value === \"\" || value === \"-0.0\" || value === \"-0\") {\n // handle these semi-valid values as 0\n numericValue = 0;\n } else {\n numericValue = FloatTypeConverter.parseString(value) ?? 0;\n }\n } else {\n numericValue = value;\n }\n // this is close to calling `toFixed(2)`, but cuts of any trailing zeros\n let stringValue = (Math.round(100 * numericValue) / 100).toString();\n // because this is a _float_ converter, we want to emphasize the number is a float - make\n // sure there's a decimal part\n if (stringValue.indexOf(\".\") === -1) stringValue += \".0\";\n return stringValue;\n }\n\n public override convertFromString(value: string): number | undefined {\n return FloatTypeConverter.parseString(value);\n }\n}\nTypeConverterManager.registerConverter(\n StandardTypeNames.Float,\n FloatTypeConverter\n);\nTypeConverterManager.registerConverter(\n StandardTypeNames.Double,\n FloatTypeConverter\n);\nTypeConverterManager.registerConverter(\n StandardTypeNames.Number,\n FloatTypeConverter\n);\n\n/**\n * Int Type Converter.\n * @public\n */\nexport class IntTypeConverter extends NumericTypeConverterBase {\n private static parseString(value: string): number | undefined {\n const parsedValue = parseInt(value, 10);\n return Number.isNaN(parsedValue) ? undefined : parsedValue;\n }\n\n public override convertToString(value?: Primitives.Int) {\n if (value === undefined) return \"\";\n\n let numericValue = 0;\n if (typeof value === \"string\") {\n if (value === \"-\" || value === \"\" || value === \"-0\") {\n // handle these semi-valid values as 0\n numericValue = 0;\n } else {\n numericValue = IntTypeConverter.parseString(value) ?? 0;\n }\n } else {\n numericValue = value;\n }\n return Math.round(numericValue).toString();\n }\n\n public override convertFromString(value: string): number | undefined {\n return IntTypeConverter.parseString(value);\n }\n}\n\nTypeConverterManager.registerConverter(StandardTypeNames.Int, IntTypeConverter);\nTypeConverterManager.registerConverter(\n StandardTypeNames.Integer,\n IntTypeConverter\n);\n"]}
@@ -35,8 +35,7 @@ class TypeConverter {
35
35
  }
36
36
  /** Converts a value associated with a property description to a string */
37
37
  convertPropertyToString(propertyDescription, value) {
38
- var _a;
39
- return this.convertToStringWithOptions(value, (_a = propertyDescription.converter) === null || _a === void 0 ? void 0 : _a.options);
38
+ return this.convertToStringWithOptions(value, propertyDescription.converter?.options);
40
39
  }
41
40
  /** Converts a string with a property record to a property value */
42
41
  async convertFromStringToPropertyValue(value, propertyRecord) {
@@ -1 +1 @@
1
- {"version":3,"file":"TypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/TypeConverter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAWH,0DAA4D;AAiD5D;;;GAGG;AACH,MAAsB,aAAa;IAGjC,6CAA6C;IACtC,eAAe,CAAC,KAAwB;QAC7C,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACnC,gEAAgE;QAChE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,wEAAwE;IACjE,0BAA0B,CAC/B,KAAwB,EACxB,QAAiC;QAEjC,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,6CAA6C;IACtC,iBAAiB,CACtB,MAAc;QAKd,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0EAA0E;IACnE,4BAA4B,CACjC,KAAa,EACb,QAAiC;QAKjC,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,0EAA0E;IACnE,uBAAuB,CAC5B,mBAAwC,EACxC,KAAwB;;QAExB,OAAO,IAAI,CAAC,0BAA0B,CACpC,KAAK,EACL,MAAA,mBAAmB,CAAC,SAAS,0CAAE,OAAO,CACvC,CAAC;IACJ,CAAC;IAED,mEAAmE;IAC5D,KAAK,CAAC,gCAAgC,CAC3C,KAAa,EACb,cAA+B;QAE/B,MAAM,gBAAgB,GACpB,cAAc,IAAI,cAAc,CAAC,QAAQ,CAAC,SAAS;YACjD,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO;YAC3C,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,4BAA4B,CACzD,KAAK,EACL,gBAAgB,CACjB,CAAC;QACF,MAAM,aAAa,GAAmB;YACpC,WAAW,EAAE,oCAAmB,CAAC,SAAS;YAC1C,KAAK,EAAE,WAAW;YAClB,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,OAAO,aAAa,CAAC;IACvB,CAAC;IASD,mDAAmD;IAC5C,SAAS,CACd,MAAwB,EACxB,MAAwB;QAExB,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,uDAAuD;IAChD,YAAY,CACjB,MAAwB,EACxB,MAAwB;QAExB,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,2DAA2D;IACpD,MAAM,CAAC,KAAuB;QACnC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,mEAAmE;IAC5D,SAAS,CAAC,KAAuB;QACtC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,uDAAuD;IACvD,IAAW,YAAY;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,wDAAwD;IACxD,IAAW,iBAAiB;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,wDAAwD;IACxD,IAAW,aAAa;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,yDAAyD;IACzD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAxHD,sCAwHC","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 TypeConverters\n */\n\n// cSpell:ignore valuetypes shortdate\n\nimport type {\n Primitives,\n PrimitiveValue,\n PropertyDescription,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { ConvertedPrimitives } from \"./valuetypes/ConvertedTypes\";\n\n/** Sort compare method for types that support sorting\n * @public\n */\nexport interface SortComparer {\n /** Sort function for two primitive values */\n sortCompare(\n valueA: Primitives.Value,\n valueB: Primitives.Value,\n ignoreCase?: boolean\n ): number;\n}\n\n/** Operators for all filterable types\n * @public\n */\nexport interface OperatorProcessor {\n /** Determines if two primitive values are equal */\n isEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\n /** Determines if two primitive values are not equal */\n isNotEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\n}\n\n/** Operators for Numeric types, DateTime, TimeSpan, or any type that supports these comparisons\n * @public\n */\nexport interface LessGreaterOperatorProcessor {\n /** Determines if a primitive values is less than another primitive value */\n isLessThan(a: Primitives.Value, b: Primitives.Value): boolean;\n /** Determines if a primitive values is less than or equal to another primitive value */\n isLessThanOrEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\n /** Determines if a primitive values is greater than another primitive value */\n isGreaterThan(a: Primitives.Value, b: Primitives.Value): boolean;\n /** Determines if a primitive values is greater than or equal to another primitive value */\n isGreaterThanOrEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\n}\n\n/** Operators for all filterable null-able types\n * @public\n */\nexport interface NullableOperatorProcessor {\n /** Determines if a primitive value is null or undefined */\n isNull(value: Primitives.Value): boolean;\n /** Determines if a primitive value is not null or not undefined */\n isNotNull(value: Primitives.Value): boolean;\n}\n\n/**\n * Type Converter base class.\n * @public\n */\nexport abstract class TypeConverter\n implements SortComparer, OperatorProcessor, NullableOperatorProcessor\n{\n /** Converts a primitive value to a string */\n public convertToString(value?: Primitives.Value): string | Promise<string> {\n if (value === undefined) return \"\";\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n return value.toString();\n }\n\n /** Default implementation just calls convertToString with no options */\n public convertToStringWithOptions(\n value?: Primitives.Value,\n _options?: { [key: string]: any }\n ): string | Promise<string> {\n return this.convertToString(value);\n }\n\n /** Converts a string to a primitive value */\n public convertFromString(\n _value: string\n ):\n | ConvertedPrimitives.Value\n | undefined\n | Promise<ConvertedPrimitives.Value | undefined> {\n return undefined;\n }\n\n /** Default implementation just calls convertFromString with no options */\n public convertFromStringWithOptions(\n value: string,\n _options?: { [key: string]: any }\n ):\n | ConvertedPrimitives.Value\n | undefined\n | Promise<ConvertedPrimitives.Value | undefined> {\n return this.convertFromString(value);\n }\n\n /** Converts a value associated with a property description to a string */\n public convertPropertyToString(\n propertyDescription: PropertyDescription,\n value?: Primitives.Value\n ): string | Promise<string> {\n return this.convertToStringWithOptions(\n value,\n propertyDescription.converter?.options\n );\n }\n\n /** Converts a string with a property record to a property value */\n public async convertFromStringToPropertyValue(\n value: string,\n propertyRecord?: PropertyRecord\n ): Promise<PropertyValue> {\n const converterOptions =\n propertyRecord && propertyRecord.property.converter\n ? propertyRecord.property.converter.options\n : undefined;\n const stringValue = await this.convertFromStringWithOptions(\n value,\n converterOptions\n );\n const propertyValue: PrimitiveValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: stringValue,\n displayValue: \"\",\n };\n return propertyValue;\n }\n\n /** Sort function for two primitive values */\n public abstract sortCompare(\n valueA: Primitives.Value,\n valueB: Primitives.Value,\n _ignoreCase?: boolean\n ): number;\n\n /** Determines if two primitive values are equal */\n public isEqualTo(\n valueA: Primitives.Value,\n valueB: Primitives.Value\n ): boolean {\n return valueA === valueB;\n }\n\n /** Determines if two primitive values are not equal */\n public isNotEqualTo(\n valueA: Primitives.Value,\n valueB: Primitives.Value\n ): boolean {\n return valueA !== valueB;\n }\n\n /** Determines if a primitive value is null or undefined */\n public isNull(value: Primitives.Value): boolean {\n return value === null || value === undefined;\n }\n\n /** Determines if a primitive value is not null or not undefined */\n public isNotNull(value: Primitives.Value): boolean {\n return value !== null && value !== undefined;\n }\n\n /** Determines if the converter is for a string type */\n public get isStringType(): boolean {\n return false;\n }\n /** Determines if the converter is for a numeric type */\n public get isLessGreaterType(): boolean {\n return false;\n }\n /** Determines if the converter is for a boolean type */\n public get isBooleanType(): boolean {\n return false;\n }\n /** Determines if the converter is for a nullable type */\n public get isNullableType(): boolean {\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"TypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/TypeConverter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAWH,0DAA4D;AAiD5D;;;GAGG;AACH,MAAsB,aAAa;IAGjC,6CAA6C;IACtC,eAAe,CAAC,KAAwB;QAC7C,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACnC,gEAAgE;QAChE,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,wEAAwE;IACjE,0BAA0B,CAC/B,KAAwB,EACxB,QAAiC;QAEjC,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,6CAA6C;IACtC,iBAAiB,CACtB,MAAc;QAKd,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0EAA0E;IACnE,4BAA4B,CACjC,KAAa,EACb,QAAiC;QAKjC,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,0EAA0E;IACnE,uBAAuB,CAC5B,mBAAwC,EACxC,KAAwB;QAExB,OAAO,IAAI,CAAC,0BAA0B,CACpC,KAAK,EACL,mBAAmB,CAAC,SAAS,EAAE,OAAO,CACvC,CAAC;IACJ,CAAC;IAED,mEAAmE;IAC5D,KAAK,CAAC,gCAAgC,CAC3C,KAAa,EACb,cAA+B;QAE/B,MAAM,gBAAgB,GACpB,cAAc,IAAI,cAAc,CAAC,QAAQ,CAAC,SAAS;YACjD,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO;YAC3C,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,4BAA4B,CACzD,KAAK,EACL,gBAAgB,CACjB,CAAC;QACF,MAAM,aAAa,GAAmB;YACpC,WAAW,EAAE,oCAAmB,CAAC,SAAS;YAC1C,KAAK,EAAE,WAAW;YAClB,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,OAAO,aAAa,CAAC;IACvB,CAAC;IASD,mDAAmD;IAC5C,SAAS,CACd,MAAwB,EACxB,MAAwB;QAExB,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,uDAAuD;IAChD,YAAY,CACjB,MAAwB,EACxB,MAAwB;QAExB,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,2DAA2D;IACpD,MAAM,CAAC,KAAuB;QACnC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,mEAAmE;IAC5D,SAAS,CAAC,KAAuB;QACtC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,uDAAuD;IACvD,IAAW,YAAY;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,wDAAwD;IACxD,IAAW,iBAAiB;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,wDAAwD;IACxD,IAAW,aAAa;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,yDAAyD;IACzD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAxHD,sCAwHC","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 TypeConverters\n */\n\n// cSpell:ignore valuetypes shortdate\n\nimport type {\n Primitives,\n PrimitiveValue,\n PropertyDescription,\n PropertyRecord,\n PropertyValue,\n} from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { ConvertedPrimitives } from \"./valuetypes/ConvertedTypes\";\n\n/** Sort compare method for types that support sorting\n * @public\n */\nexport interface SortComparer {\n /** Sort function for two primitive values */\n sortCompare(\n valueA: Primitives.Value,\n valueB: Primitives.Value,\n ignoreCase?: boolean\n ): number;\n}\n\n/** Operators for all filterable types\n * @public\n */\nexport interface OperatorProcessor {\n /** Determines if two primitive values are equal */\n isEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\n /** Determines if two primitive values are not equal */\n isNotEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\n}\n\n/** Operators for Numeric types, DateTime, TimeSpan, or any type that supports these comparisons\n * @public\n */\nexport interface LessGreaterOperatorProcessor {\n /** Determines if a primitive values is less than another primitive value */\n isLessThan(a: Primitives.Value, b: Primitives.Value): boolean;\n /** Determines if a primitive values is less than or equal to another primitive value */\n isLessThanOrEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\n /** Determines if a primitive values is greater than another primitive value */\n isGreaterThan(a: Primitives.Value, b: Primitives.Value): boolean;\n /** Determines if a primitive values is greater than or equal to another primitive value */\n isGreaterThanOrEqualTo(a: Primitives.Value, b: Primitives.Value): boolean;\n}\n\n/** Operators for all filterable null-able types\n * @public\n */\nexport interface NullableOperatorProcessor {\n /** Determines if a primitive value is null or undefined */\n isNull(value: Primitives.Value): boolean;\n /** Determines if a primitive value is not null or not undefined */\n isNotNull(value: Primitives.Value): boolean;\n}\n\n/**\n * Type Converter base class.\n * @public\n */\nexport abstract class TypeConverter\n implements SortComparer, OperatorProcessor, NullableOperatorProcessor\n{\n /** Converts a primitive value to a string */\n public convertToString(value?: Primitives.Value): string | Promise<string> {\n if (value === undefined) return \"\";\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n return value.toString();\n }\n\n /** Default implementation just calls convertToString with no options */\n public convertToStringWithOptions(\n value?: Primitives.Value,\n _options?: { [key: string]: any }\n ): string | Promise<string> {\n return this.convertToString(value);\n }\n\n /** Converts a string to a primitive value */\n public convertFromString(\n _value: string\n ):\n | ConvertedPrimitives.Value\n | undefined\n | Promise<ConvertedPrimitives.Value | undefined> {\n return undefined;\n }\n\n /** Default implementation just calls convertFromString with no options */\n public convertFromStringWithOptions(\n value: string,\n _options?: { [key: string]: any }\n ):\n | ConvertedPrimitives.Value\n | undefined\n | Promise<ConvertedPrimitives.Value | undefined> {\n return this.convertFromString(value);\n }\n\n /** Converts a value associated with a property description to a string */\n public convertPropertyToString(\n propertyDescription: PropertyDescription,\n value?: Primitives.Value\n ): string | Promise<string> {\n return this.convertToStringWithOptions(\n value,\n propertyDescription.converter?.options\n );\n }\n\n /** Converts a string with a property record to a property value */\n public async convertFromStringToPropertyValue(\n value: string,\n propertyRecord?: PropertyRecord\n ): Promise<PropertyValue> {\n const converterOptions =\n propertyRecord && propertyRecord.property.converter\n ? propertyRecord.property.converter.options\n : undefined;\n const stringValue = await this.convertFromStringWithOptions(\n value,\n converterOptions\n );\n const propertyValue: PrimitiveValue = {\n valueFormat: PropertyValueFormat.Primitive,\n value: stringValue,\n displayValue: \"\",\n };\n return propertyValue;\n }\n\n /** Sort function for two primitive values */\n public abstract sortCompare(\n valueA: Primitives.Value,\n valueB: Primitives.Value,\n _ignoreCase?: boolean\n ): number;\n\n /** Determines if two primitive values are equal */\n public isEqualTo(\n valueA: Primitives.Value,\n valueB: Primitives.Value\n ): boolean {\n return valueA === valueB;\n }\n\n /** Determines if two primitive values are not equal */\n public isNotEqualTo(\n valueA: Primitives.Value,\n valueB: Primitives.Value\n ): boolean {\n return valueA !== valueB;\n }\n\n /** Determines if a primitive value is null or undefined */\n public isNull(value: Primitives.Value): boolean {\n return value === null || value === undefined;\n }\n\n /** Determines if a primitive value is not null or not undefined */\n public isNotNull(value: Primitives.Value): boolean {\n return value !== null && value !== undefined;\n }\n\n /** Determines if the converter is for a string type */\n public get isStringType(): boolean {\n return false;\n }\n /** Determines if the converter is for a numeric type */\n public get isLessGreaterType(): boolean {\n return false;\n }\n /** Determines if the converter is for a boolean type */\n public get isBooleanType(): boolean {\n return false;\n }\n /** Determines if the converter is for a nullable type */\n public get isNullableType(): boolean {\n return true;\n }\n}\n"]}
@@ -48,7 +48,7 @@ function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDate
48
48
  const { translate } = (0, useTranslation_1.useTranslation)();
49
49
  const [workingDate, setWorkingDate] = React.useState(new Date(selected.getTime()));
50
50
  const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
51
- const toolTipLabel = buttonToolTip !== null && buttonToolTip !== void 0 ? buttonToolTip : translate("datepicker.selectDate");
51
+ const toolTipLabel = buttonToolTip ?? translate("datepicker.selectDate");
52
52
  // See if props have changed since component mounted
53
53
  React.useEffect(() => {
54
54
  const newWorkingDate = new Date(selected.getTime());
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAAyD;AAEzD,kDAA0C;AAC1C,wDAA4C;AAC5C,6CAA0C;AAC1C,2CAAwC;AAExC,2CAAwC;AACxC,wCAAsC;AACtC,sDAAmD;AA0BnD;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GAEmB;IACxB,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,+BAAc,GAAE,CAAC;IACvC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAClD,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAC7B,CAAC;IACF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClE,MAAM,YAAY,GAAG,aAA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AAgB,CAAC,UAAU,EACrC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,gBAAgB,EAC3B,8BAA8B;YAE9B,6BACE,SAAS,EAAC,6CAA6C,iBAC3C,6CAA6C;gBAEzD,oBAAC,uBAAU,CAAC,8CAA8C;oBACxD,QAAQ,EAAE,WAAW,EACrB,YAAY,EAAE,mBAAmB,EACjC,gBAAgB,EAAE,gBAAgB,GAClC;gBACD,WAAW,IAAI,CACd,6BAAK,SAAS,EAAC,gBAAgB;oBAC7B,oBAAC,oBAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IACxC,SAAS,CAAC,iBAAiB,CAAC,CACxB;oBACP,oBAAC,qBAAS,IACR,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,mBAAmB,GACjC,CACE,CACP,CACG,CACA;QACP,CAAC,CAAC,gBAAgB,IAAI,CACrB,oBAAC,qBAAS,IACR,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,mBAAmB,GACjC,CACH,CACA,CACJ,CAAC;AACJ,CAAC;AAzID,sDAyIC","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 Date\n */\n\nimport * as React from \"react\";\nimport type { DateFormatter, TimeDisplay } from \"@itwin/appui-abstract\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Popup } from \"@itwin/core-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { DatePicker } from \"./DatePicker\";\nimport { DateField } from \"./DateField\";\nimport type { TimeSpec } from \"./TimeField\";\nimport { TimeField } from \"./TimeField\";\nimport \"./DatePickerPopupButton.scss\";\nimport { useTranslation } from \"../useTranslation\";\n\n/** Props used by [[DatePickerPopupButton]] component.\n * @alpha\n * @deprecated in 4.11.x. Props of deprecated component {@link DatePickerPopupButton}.\n */\nexport interface DatePickerPopupButtonProps extends CommonProps {\n /** Date to be shown as the selected date. */\n selected: Date;\n /** If true show the date (and optionally time) edit field next to button */\n displayEditField?: boolean;\n // If defined show time in popup and also display time if input field is shown\n timeDisplay?: TimeDisplay;\n /** Function called when Date changes. */\n onDateChange?: (day: Date) => void;\n /** Optional tooltip */\n buttonToolTip?: string;\n /* Custom date formatter. WARNING: if used values will only be shown in specified format and will not be based on locale.\n * If used the existence of a parseDate function will determine if the edit field allows editing. */\n dateFormatter?: DateFormatter;\n /** User defined class name for edit field. */\n fieldClassName?: string;\n /** User defined style for edit field. */\n fieldStyle?: React.CSSProperties;\n}\n\n/** Component that displays a button used to pick a date and optionally a time.\n * @alpha\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\nexport function DatePickerPopupButton({\n displayEditField,\n timeDisplay,\n selected,\n onDateChange,\n dateFormatter,\n buttonToolTip,\n fieldStyle,\n fieldClassName,\n style,\n}: // eslint-disable-next-line deprecation/deprecation\nDatePickerPopupButtonProps) {\n const { translate } = useTranslation();\n const [workingDate, setWorkingDate] = React.useState(\n new Date(selected.getTime())\n );\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const toolTipLabel = buttonToolTip ?? translate(\"datepicker.selectDate\");\n\n // See if props have changed since component mounted\n React.useEffect(() => {\n const newWorkingDate = new Date(selected.getTime());\n setWorkingDate(newWorkingDate);\n }, [selected]);\n\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const togglePopupDisplay = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n event.preventDefault();\n setShowFocusOutline(false);\n setIsSettingsOpen((prev) => !prev);\n },\n [setIsSettingsOpen]\n );\n\n const handleCloseSetting = React.useCallback(() => {\n setIsSettingsOpen(false);\n }, [setIsSettingsOpen]);\n\n const handleOnDateChanged = (day: Date) => {\n // combine current time into selected Date\n const newWorkingDate = new Date(day.getTime());\n newWorkingDate.setHours(\n workingDate.getHours(),\n workingDate.getMinutes(),\n workingDate.getSeconds()\n );\n onDateChange && onDateChange(newWorkingDate);\n !timeDisplay && setIsSettingsOpen(false);\n };\n\n const handleOnTimeChanged = (time: TimeSpec) => {\n // Combine new time into selected Date\n const newWorkingDate = new Date(workingDate.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n setWorkingDate(newWorkingDate);\n onDateChange && onDateChange(newWorkingDate);\n };\n\n const [showFocusOutline, setShowFocusOutline] = React.useState(false);\n const handlePopupKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n // istanbul ignore else\n if (event.key === \" \") {\n setShowFocusOutline(true);\n setIsSettingsOpen(true);\n }\n },\n []\n );\n\n const timeSpec: TimeSpec = {\n hours: workingDate.getHours(),\n minutes: workingDate.getMinutes(),\n seconds: workingDate.getSeconds(),\n };\n return (\n <>\n <button\n title={toolTipLabel}\n style={style}\n className=\"components-date-picker-calendar-popup-button\"\n onKeyDown={handlePopupKeyDown}\n data-testid=\"components-date-picker-calendar-popup-button\"\n onPointerDown={togglePopupDisplay}\n ref={buttonRef}\n >\n <div className=\"datepicker-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M13,13H9V10h4ZM16,3V15a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V3A1,1,0,0,1,1,2H3V0H4V2h8V0h1V2h2A1,1,0,0,1,16,3ZM15,6H1v9H15Z\" />\n </svg>\n </div>\n </button>\n <Popup\n isOpen={isSettingsOpen}\n position={RelativePosition.BottomLeft}\n onClose={handleCloseSetting}\n target={buttonRef.current}\n closeOnEnter={false}\n moveFocus={showFocusOutline}\n closeOnNestedPopupOutsideClick\n >\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker // eslint-disable-line deprecation/deprecation\n selected={workingDate}\n onDateChange={handleOnDateChanged}\n showFocusOutline={showFocusOutline}\n />\n {timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {translate(\"datepicker.time\")}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={timeDisplay}\n onTimeChange={handleOnTimeChanged}\n />\n </div>\n )}\n </div>\n </Popup>\n {!!displayEditField && (\n <DateField\n style={fieldStyle}\n className={fieldClassName}\n initialDate={workingDate}\n timeDisplay={timeDisplay}\n dateFormatter={dateFormatter}\n onDateChange={handleOnDateChanged}\n />\n )}\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,0DAAyD;AAEzD,kDAA0C;AAC1C,wDAA4C;AAC5C,6CAA0C;AAC1C,2CAAwC;AAExC,2CAAwC;AACxC,wCAAsC;AACtC,sDAAmD;AA0BnD;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GAEmB;IACxB,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,+BAAc,GAAE,CAAC;IACvC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAClD,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAC7B,CAAC;IACF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,KAAK,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,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,iCAAgB,CAAC,UAAU,EACrC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,SAAS,CAAC,OAAO,EACzB,YAAY,EAAE,KAAK,EACnB,SAAS,EAAE,gBAAgB,EAC3B,8BAA8B;YAE9B,6BACE,SAAS,EAAC,6CAA6C,iBAC3C,6CAA6C;gBAEzD,oBAAC,uBAAU,CAAC,8CAA8C;oBACxD,QAAQ,EAAE,WAAW,EACrB,YAAY,EAAE,mBAAmB,EACjC,gBAAgB,EAAE,gBAAgB,GAClC;gBACD,WAAW,IAAI,CACd,6BAAK,SAAS,EAAC,gBAAgB;oBAC7B,oBAAC,oBAAI,IAAC,OAAO,EAAC,MAAM,EAAC,SAAS,EAAC,YAAY,IACxC,SAAS,CAAC,iBAAiB,CAAC,CACxB;oBACP,oBAAC,qBAAS,IACR,IAAI,EAAE,QAAQ,EACd,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,mBAAmB,GACjC,CACE,CACP,CACG,CACA;QACP,CAAC,CAAC,gBAAgB,IAAI,CACrB,oBAAC,qBAAS,IACR,KAAK,EAAE,UAAU,EACjB,SAAS,EAAE,cAAc,EACzB,WAAW,EAAE,WAAW,EACxB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,YAAY,EAAE,mBAAmB,GACjC,CACH,CACA,CACJ,CAAC;AACJ,CAAC;AAzID,sDAyIC","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 Date\n */\n\nimport * as React from \"react\";\nimport type { DateFormatter, TimeDisplay } from \"@itwin/appui-abstract\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Popup } from \"@itwin/core-react\";\nimport { Text } from \"@itwin/itwinui-react\";\nimport { DatePicker } from \"./DatePicker\";\nimport { DateField } from \"./DateField\";\nimport type { TimeSpec } from \"./TimeField\";\nimport { TimeField } from \"./TimeField\";\nimport \"./DatePickerPopupButton.scss\";\nimport { useTranslation } from \"../useTranslation\";\n\n/** Props used by [[DatePickerPopupButton]] component.\n * @alpha\n * @deprecated in 4.11.x. Props of deprecated component {@link DatePickerPopupButton}.\n */\nexport interface DatePickerPopupButtonProps extends CommonProps {\n /** Date to be shown as the selected date. */\n selected: Date;\n /** If true show the date (and optionally time) edit field next to button */\n displayEditField?: boolean;\n // If defined show time in popup and also display time if input field is shown\n timeDisplay?: TimeDisplay;\n /** Function called when Date changes. */\n onDateChange?: (day: Date) => void;\n /** Optional tooltip */\n buttonToolTip?: string;\n /* Custom date formatter. WARNING: if used values will only be shown in specified format and will not be based on locale.\n * If used the existence of a parseDate function will determine if the edit field allows editing. */\n dateFormatter?: DateFormatter;\n /** User defined class name for edit field. */\n fieldClassName?: string;\n /** User defined style for edit field. */\n fieldStyle?: React.CSSProperties;\n}\n\n/** Component that displays a button used to pick a date and optionally a time.\n * @alpha\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\nexport function DatePickerPopupButton({\n displayEditField,\n timeDisplay,\n selected,\n onDateChange,\n dateFormatter,\n buttonToolTip,\n fieldStyle,\n fieldClassName,\n style,\n}: // eslint-disable-next-line deprecation/deprecation\nDatePickerPopupButtonProps) {\n const { translate } = useTranslation();\n const [workingDate, setWorkingDate] = React.useState(\n new Date(selected.getTime())\n );\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const toolTipLabel = buttonToolTip ?? translate(\"datepicker.selectDate\");\n\n // See if props have changed since component mounted\n React.useEffect(() => {\n const newWorkingDate = new Date(selected.getTime());\n setWorkingDate(newWorkingDate);\n }, [selected]);\n\n const buttonRef = React.useRef<HTMLButtonElement>(null);\n const togglePopupDisplay = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {\n event.preventDefault();\n setShowFocusOutline(false);\n setIsSettingsOpen((prev) => !prev);\n },\n [setIsSettingsOpen]\n );\n\n const handleCloseSetting = React.useCallback(() => {\n setIsSettingsOpen(false);\n }, [setIsSettingsOpen]);\n\n const handleOnDateChanged = (day: Date) => {\n // combine current time into selected Date\n const newWorkingDate = new Date(day.getTime());\n newWorkingDate.setHours(\n workingDate.getHours(),\n workingDate.getMinutes(),\n workingDate.getSeconds()\n );\n onDateChange && onDateChange(newWorkingDate);\n !timeDisplay && setIsSettingsOpen(false);\n };\n\n const handleOnTimeChanged = (time: TimeSpec) => {\n // Combine new time into selected Date\n const newWorkingDate = new Date(workingDate.getTime());\n newWorkingDate.setHours(time.hours, time.minutes, time.seconds);\n setWorkingDate(newWorkingDate);\n onDateChange && onDateChange(newWorkingDate);\n };\n\n const [showFocusOutline, setShowFocusOutline] = React.useState(false);\n const handlePopupKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLButtonElement>) => {\n // istanbul ignore else\n if (event.key === \" \") {\n setShowFocusOutline(true);\n setIsSettingsOpen(true);\n }\n },\n []\n );\n\n const timeSpec: TimeSpec = {\n hours: workingDate.getHours(),\n minutes: workingDate.getMinutes(),\n seconds: workingDate.getSeconds(),\n };\n return (\n <>\n <button\n title={toolTipLabel}\n style={style}\n className=\"components-date-picker-calendar-popup-button\"\n onKeyDown={handlePopupKeyDown}\n data-testid=\"components-date-picker-calendar-popup-button\"\n onPointerDown={togglePopupDisplay}\n ref={buttonRef}\n >\n <div className=\"datepicker-button\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M13,13H9V10h4ZM16,3V15a1,1,0,0,1-1,1H1a1,1,0,0,1-1-1V3A1,1,0,0,1,1,2H3V0H4V2h8V0h1V2h2A1,1,0,0,1,16,3ZM15,6H1v9H15Z\" />\n </svg>\n </div>\n </button>\n <Popup\n isOpen={isSettingsOpen}\n position={RelativePosition.BottomLeft}\n onClose={handleCloseSetting}\n target={buttonRef.current}\n closeOnEnter={false}\n moveFocus={showFocusOutline}\n closeOnNestedPopupOutsideClick\n >\n <div\n className=\"components-date-picker-calendar-popup-panel\"\n data-testid=\"components-date-picker-calendar-popup-panel\"\n >\n <DatePicker // eslint-disable-line deprecation/deprecation\n selected={workingDate}\n onDateChange={handleOnDateChanged}\n showFocusOutline={showFocusOutline}\n />\n {timeDisplay && (\n <div className=\"time-container\">\n <Text variant=\"body\" className=\"time-label\">\n {translate(\"datepicker.time\")}\n </Text>\n <TimeField\n time={timeSpec}\n timeDisplay={timeDisplay}\n onTimeChange={handleOnTimeChanged}\n />\n </div>\n )}\n </div>\n </Popup>\n {!!displayEditField && (\n <DateField\n style={fieldStyle}\n className={fieldClassName}\n initialDate={workingDate}\n timeDisplay={timeDisplay}\n dateFormatter={dateFormatter}\n onDateChange={handleOnDateChanged}\n />\n )}\n </>\n );\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"CustomNumberEditor.d.ts","sourceRoot":"","sources":["../../../../src/components-react/editors/CustomNumberEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,2BAA2B,CAAC;AAEnC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,KAAK,EAOV,aAAa,EACd,MAAM,uBAAuB,CAAC;AAe/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACzE,OAAO,EACL,kBAAkB,EAEnB,MAAM,yBAAyB,CAAC;AAEjC,gBAAgB;AAChB,UAAU,uBAAuB;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,qBAAa,kBACX,SAAQ,KAAK,CAAC,aAAa,CAAC,mBAAmB,EAAE,uBAAuB,CACxE,YAAW,UAAU;IA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61
61
  this._applyUpdatedValue(e.target.value);
62
62
  };
63
63
  this._onKeyPress = (e) => {
64
- var _a;
65
64
  // istanbul ignore else
66
65
  if (e.key === ts_key_enum_1.Key.Escape.valueOf()) {
67
- const initialDisplayValue = (_a = (this._lastValidValue &&
68
- this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a :
69
- /* istanbul ignore next */ this._getInitialDisplayValue();
66
+ const initialDisplayValue = (this._lastValidValue &&
67
+ this._lastValidValue.displayValue) ??
68
+ /* istanbul ignore next */ this._getInitialDisplayValue();
70
69
  if (initialDisplayValue !== this.state.inputValue) {
71
70
  e.preventDefault();
72
71
  e.stopPropagation();
@@ -261,10 +260,9 @@ class CustomNumberEditor extends React.PureComponent {
261
260
  });
262
261
  }
263
262
  _resetToLastValidDisplayValue() {
264
- var _a;
265
- const initialDisplayValue = (_a = (this._lastValidValue &&
266
- this._lastValidValue.displayValue)) !== null && _a !== void 0 ? _a :
267
- /* istanbul ignore next */ this._getInitialDisplayValue();
263
+ const initialDisplayValue = (this._lastValidValue &&
264
+ this._lastValidValue.displayValue) ??
265
+ /* istanbul ignore next */ this._getInitialDisplayValue();
268
266
  this.setState({ inputValue: initialDisplayValue });
269
267
  }
270
268
  /** @internal */
@@ -295,11 +293,12 @@ class CustomNumberEditor extends React.PureComponent {
295
293
  let reactNode;
296
294
  if (this.state.iconSpec) {
297
295
  const icon = React.createElement(core_react_1.Icon, { iconSpec: this.state.iconSpec });
298
- reactNode = (React.createElement(core_react_1.IconInput, { ...inputProps, ref: this._inputElement, icon: icon, "data-testid": "components-customnumber-editor" }));
296
+ reactNode = (
297
+ // eslint-disable-next-line deprecation/deprecation
298
+ React.createElement(core_react_1.IconInput, { ...inputProps, ref: this._inputElement, icon: icon, "data-testid": "components-customnumber-editor" }));
299
299
  }
300
300
  else {
301
- // NEEDSWORK: still using core-react Input component because of `nativeKeyHandler` prop
302
- reactNode = (React.createElement(itwinui_react_1.Input, { ...inputProps, ref: this._inputElement, "data-testid": "components-customnumber-editor", size: "small" }));
301
+ reactNode = (React.createElement(itwinui_react_1.Input, { ...inputProps, ref: this._inputElement, "data-testid": "components-customnumber-editor", size: "small", id: this.props.propertyRecord?.property.name }));
303
302
  }
304
303
  return reactNode;
305
304
  }