@itwin/components-react 4.10.0 → 4.12.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 (347) hide show
  1. package/CHANGELOG.md +21 -1
  2. package/lib/cjs/components-react/UiComponents.d.ts +1 -5
  3. package/lib/cjs/components-react/UiComponents.d.ts.map +1 -1
  4. package/lib/cjs/components-react/UiComponents.js +3 -15
  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 +3 -2
  8. package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
  9. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +2 -1
  10. package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  11. package/lib/cjs/components-react/converters/NumericTypeConverter.js +4 -2
  12. package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
  13. package/lib/cjs/components-react/converters/TypeConverter.js +2 -1
  14. package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
  15. package/lib/cjs/components-react/datepicker/DatePicker.d.ts +2 -0
  16. package/lib/cjs/components-react/datepicker/DatePicker.d.ts.map +1 -1
  17. package/lib/cjs/components-react/datepicker/DatePicker.js +43 -40
  18. package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
  19. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts +5 -2
  20. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  21. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js +8 -7
  22. package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  23. package/lib/cjs/components-react/datepicker/IntlFormatter.d.ts +1 -0
  24. package/lib/cjs/components-react/datepicker/IntlFormatter.d.ts.map +1 -1
  25. package/lib/cjs/components-react/datepicker/IntlFormatter.js +1 -0
  26. package/lib/cjs/components-react/datepicker/IntlFormatter.js.map +1 -1
  27. package/lib/cjs/components-react/datepicker/TimeField.d.ts.map +1 -1
  28. package/lib/cjs/components-react/datepicker/TimeField.js +28 -30
  29. package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
  30. package/lib/cjs/components-react/editors/CustomNumberEditor.js +8 -6
  31. package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
  32. package/lib/cjs/components-react/editors/DateTimeEditor.js +5 -3
  33. package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
  34. package/lib/cjs/components-react/editors/EnumEditor.d.ts +0 -1
  35. package/lib/cjs/components-react/editors/EnumEditor.d.ts.map +1 -1
  36. package/lib/cjs/components-react/editors/EnumEditor.js +2 -3
  37. package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
  38. package/lib/cjs/components-react/editors/PopupButton.d.ts.map +1 -1
  39. package/lib/cjs/components-react/editors/PopupButton.js +8 -5
  40. package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
  41. package/lib/cjs/components-react/editors/TextEditor.d.ts +0 -1
  42. package/lib/cjs/components-react/editors/TextEditor.d.ts.map +1 -1
  43. package/lib/cjs/components-react/editors/TextEditor.js +5 -4
  44. package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
  45. package/lib/cjs/components-react/editors/TextareaEditor.d.ts +0 -1
  46. package/lib/cjs/components-react/editors/TextareaEditor.d.ts.map +1 -1
  47. package/lib/cjs/components-react/editors/TextareaEditor.js +1 -2
  48. package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
  49. package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
  50. package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
  51. package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -1
  52. package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js +4 -3
  53. package/lib/cjs/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -1
  54. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +2 -1
  55. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  56. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
  57. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +6 -5
  58. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  59. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +4 -3
  60. package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  61. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +3 -3
  62. package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  63. package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -1
  64. package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js +4 -3
  65. package/lib/cjs/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -1
  66. package/lib/cjs/components-react/filter-builder/Operators.d.ts +1 -0
  67. package/lib/cjs/components-react/filter-builder/Operators.d.ts.map +1 -1
  68. package/lib/cjs/components-react/filter-builder/Operators.js +1 -0
  69. package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
  70. package/lib/cjs/components-react/filtering/FilteringInput.d.ts +0 -3
  71. package/lib/cjs/components-react/filtering/FilteringInput.d.ts.map +1 -1
  72. package/lib/cjs/components-react/filtering/FilteringInput.js +5 -7
  73. package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
  74. package/lib/cjs/components-react/filtering/ResultSelector.d.ts +0 -1
  75. package/lib/cjs/components-react/filtering/ResultSelector.d.ts.map +1 -1
  76. package/lib/cjs/components-react/filtering/ResultSelector.js +1 -2
  77. package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
  78. package/lib/cjs/components-react/properties/ValueRendererManager.d.ts +3 -0
  79. package/lib/cjs/components-react/properties/ValueRendererManager.d.ts.map +1 -1
  80. package/lib/cjs/components-react/properties/ValueRendererManager.js +12 -1
  81. package/lib/cjs/components-react/properties/ValueRendererManager.js.map +1 -1
  82. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +4 -3
  83. package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  84. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts +25 -0
  85. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts.map +1 -0
  86. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js +62 -0
  87. package/lib/cjs/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -0
  88. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  89. package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  90. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +3 -4
  91. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts.map +1 -1
  92. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js +6 -44
  93. package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  94. package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts +1 -1
  95. package/lib/cjs/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  96. package/lib/cjs/components-react/properties/renderers/PropertyView.js +2 -3
  97. package/lib/cjs/components-react/properties/renderers/PropertyView.js.map +1 -1
  98. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  99. package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  100. package/lib/cjs/components-react/properties/renderers/value/Common.js +2 -1
  101. package/lib/cjs/components-react/properties/renderers/value/Common.js.map +1 -1
  102. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
  103. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +8 -11
  104. package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  105. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +6 -3
  106. package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  107. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +2 -1
  108. package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  109. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +2 -1
  110. package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  111. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -1
  112. package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  113. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  114. package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  115. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
  116. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +1 -3
  117. package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  118. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -3
  119. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  120. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +90 -80
  121. package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  122. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +13 -11
  123. package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  124. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  125. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  126. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +2 -1
  127. package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  128. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +2 -1
  129. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  130. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  131. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  132. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +3 -2
  133. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  134. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  135. package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  136. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  137. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  138. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts +1 -1
  139. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
  140. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +22 -12
  141. package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  142. package/lib/cjs/components-react/selectable-content/SelectableContent.js +3 -2
  143. package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
  144. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  145. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +19 -21
  146. package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  147. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  148. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +1 -4
  149. package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  150. package/lib/cjs/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
  151. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js +2 -3
  152. package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  153. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +6 -5
  154. package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  155. package/lib/cjs/components-react/tree/controlled/TreeModel.js +8 -7
  156. package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
  157. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +8 -6
  158. package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  159. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  160. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +3 -2
  161. package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  162. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +2 -1
  163. package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  164. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +4 -2
  165. package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  166. package/lib/cjs/components-react/useTranslation.d.ts +7 -0
  167. package/lib/cjs/components-react/useTranslation.d.ts.map +1 -0
  168. package/lib/cjs/components-react/useTranslation.js +52 -0
  169. package/lib/cjs/components-react/useTranslation.js.map +1 -0
  170. package/lib/cjs/components-react.d.ts +2 -0
  171. package/lib/cjs/components-react.d.ts.map +1 -1
  172. package/lib/cjs/components-react.js +2 -0
  173. package/lib/cjs/components-react.js.map +1 -1
  174. package/lib/esm/components-react/UiComponents.d.ts +1 -5
  175. package/lib/esm/components-react/UiComponents.d.ts.map +1 -1
  176. package/lib/esm/components-react/UiComponents.js +3 -15
  177. package/lib/esm/components-react/UiComponents.js.map +1 -1
  178. package/lib/esm/components-react/UiComponents.json +153 -0
  179. package/lib/esm/components-react/common/DelayedSpinner.js +3 -2
  180. package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
  181. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +2 -1
  182. package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
  183. package/lib/esm/components-react/converters/NumericTypeConverter.js +4 -2
  184. package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
  185. package/lib/esm/components-react/converters/TypeConverter.js +2 -1
  186. package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
  187. package/lib/esm/components-react/datepicker/DatePicker.d.ts +2 -0
  188. package/lib/esm/components-react/datepicker/DatePicker.d.ts.map +1 -1
  189. package/lib/esm/components-react/datepicker/DatePicker.js +43 -40
  190. package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
  191. package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts +5 -2
  192. package/lib/esm/components-react/datepicker/DatePickerPopupButton.d.ts.map +1 -1
  193. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js +8 -7
  194. package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
  195. package/lib/esm/components-react/datepicker/IntlFormatter.d.ts +1 -0
  196. package/lib/esm/components-react/datepicker/IntlFormatter.d.ts.map +1 -1
  197. package/lib/esm/components-react/datepicker/IntlFormatter.js +1 -0
  198. package/lib/esm/components-react/datepicker/IntlFormatter.js.map +1 -1
  199. package/lib/esm/components-react/datepicker/TimeField.d.ts.map +1 -1
  200. package/lib/esm/components-react/datepicker/TimeField.js +28 -30
  201. package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
  202. package/lib/esm/components-react/editors/CustomNumberEditor.js +8 -6
  203. package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
  204. package/lib/esm/components-react/editors/DateTimeEditor.js +5 -3
  205. package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
  206. package/lib/esm/components-react/editors/EnumEditor.d.ts +0 -1
  207. package/lib/esm/components-react/editors/EnumEditor.d.ts.map +1 -1
  208. package/lib/esm/components-react/editors/EnumEditor.js +2 -3
  209. package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
  210. package/lib/esm/components-react/editors/PopupButton.d.ts.map +1 -1
  211. package/lib/esm/components-react/editors/PopupButton.js +9 -6
  212. package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
  213. package/lib/esm/components-react/editors/TextEditor.d.ts +0 -1
  214. package/lib/esm/components-react/editors/TextEditor.d.ts.map +1 -1
  215. package/lib/esm/components-react/editors/TextEditor.js +5 -4
  216. package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
  217. package/lib/esm/components-react/editors/TextareaEditor.d.ts +0 -1
  218. package/lib/esm/components-react/editors/TextareaEditor.d.ts.map +1 -1
  219. package/lib/esm/components-react/editors/TextareaEditor.js +1 -2
  220. package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
  221. package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
  222. package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
  223. package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.d.ts.map +1 -1
  224. package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js +4 -3
  225. package/lib/esm/components-react/filter-builder/FilterBuilderLogicalOperator.js.map +1 -1
  226. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +2 -1
  227. package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
  228. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.d.ts.map +1 -1
  229. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +6 -5
  230. package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
  231. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +4 -3
  232. package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
  233. package/lib/esm/components-react/filter-builder/FilterBuilderState.js +3 -3
  234. package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
  235. package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.d.ts.map +1 -1
  236. package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js +4 -3
  237. package/lib/esm/components-react/filter-builder/FilterBuilderToolbar.js.map +1 -1
  238. package/lib/esm/components-react/filter-builder/Operators.d.ts +1 -0
  239. package/lib/esm/components-react/filter-builder/Operators.d.ts.map +1 -1
  240. package/lib/esm/components-react/filter-builder/Operators.js +1 -0
  241. package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
  242. package/lib/esm/components-react/filtering/FilteringInput.d.ts +0 -3
  243. package/lib/esm/components-react/filtering/FilteringInput.d.ts.map +1 -1
  244. package/lib/esm/components-react/filtering/FilteringInput.js +6 -8
  245. package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
  246. package/lib/esm/components-react/filtering/ResultSelector.d.ts +0 -1
  247. package/lib/esm/components-react/filtering/ResultSelector.d.ts.map +1 -1
  248. package/lib/esm/components-react/filtering/ResultSelector.js +1 -2
  249. package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
  250. package/lib/esm/components-react/properties/ValueRendererManager.d.ts +3 -0
  251. package/lib/esm/components-react/properties/ValueRendererManager.d.ts.map +1 -1
  252. package/lib/esm/components-react/properties/ValueRendererManager.js +12 -1
  253. package/lib/esm/components-react/properties/ValueRendererManager.js.map +1 -1
  254. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +4 -3
  255. package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
  256. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts +25 -0
  257. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.d.ts.map +1 -0
  258. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js +35 -0
  259. package/lib/esm/components-react/properties/renderers/CustomizablePropertyRenderer.js.map +1 -0
  260. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
  261. package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
  262. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts +3 -4
  263. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.d.ts.map +1 -1
  264. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js +3 -21
  265. package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
  266. package/lib/esm/components-react/properties/renderers/PropertyView.d.ts +1 -1
  267. package/lib/esm/components-react/properties/renderers/PropertyView.d.ts.map +1 -1
  268. package/lib/esm/components-react/properties/renderers/PropertyView.js +2 -3
  269. package/lib/esm/components-react/properties/renderers/PropertyView.js.map +1 -1
  270. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
  271. package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
  272. package/lib/esm/components-react/properties/renderers/value/Common.js +2 -1
  273. package/lib/esm/components-react/properties/renderers/value/Common.js.map +1 -1
  274. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.d.ts.map +1 -1
  275. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +8 -11
  276. package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
  277. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +6 -3
  278. package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
  279. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +2 -1
  280. package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
  281. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +2 -1
  282. package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
  283. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +2 -1
  284. package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
  285. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
  286. package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
  287. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.d.ts.map +1 -1
  288. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js +1 -3
  289. package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
  290. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts +1 -3
  291. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.d.ts.map +1 -1
  292. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +90 -80
  293. package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
  294. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +13 -11
  295. package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
  296. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
  297. package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
  298. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +2 -1
  299. package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
  300. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +2 -1
  301. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
  302. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
  303. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
  304. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +3 -2
  305. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
  306. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
  307. package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
  308. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
  309. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
  310. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts +1 -1
  311. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.d.ts.map +1 -1
  312. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +22 -12
  313. package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
  314. package/lib/esm/components-react/selectable-content/SelectableContent.js +3 -2
  315. package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
  316. package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -1
  317. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +20 -22
  318. package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
  319. package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
  320. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +2 -5
  321. package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
  322. package/lib/esm/components-react/toolbar/PopupItemsPanel.d.ts.map +1 -1
  323. package/lib/esm/components-react/toolbar/PopupItemsPanel.js +3 -4
  324. package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
  325. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +6 -5
  326. package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
  327. package/lib/esm/components-react/tree/controlled/TreeModel.js +8 -7
  328. package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
  329. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +8 -6
  330. package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
  331. package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
  332. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +3 -2
  333. package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
  334. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +2 -1
  335. package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
  336. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +4 -2
  337. package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
  338. package/lib/esm/components-react/useTranslation.d.ts +7 -0
  339. package/lib/esm/components-react/useTranslation.d.ts.map +1 -0
  340. package/lib/esm/components-react/useTranslation.js +25 -0
  341. package/lib/esm/components-react/useTranslation.js.map +1 -0
  342. package/lib/esm/components-react.d.ts +2 -0
  343. package/lib/esm/components-react.d.ts.map +1 -1
  344. package/lib/esm/components-react.js +2 -0
  345. package/lib/esm/components-react.js.map +1 -1
  346. package/lib/public/locales/en/UiComponents.json +7 -1
  347. package/package.json +5 -6
@@ -1 +1 @@
1
- {"version":3,"file":"UseDebouncedAsyncValue.js","sourceRoot":"","sources":["../../../../src/components-react/common/UseDebouncedAsyncValue.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAA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G,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,MAAM,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;KAC1E;IAED,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC;AACvC,CAAC;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,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CACpC,iBAAuD;;IAEvD,MAAM,CAAC,SAAS,C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C,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;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"]}
@@ -42,6 +42,7 @@ export class FloatTypeConverter extends NumericTypeConverterBase {
42
42
  return Number.isNaN(parsedValue) ? undefined : parsedValue;
43
43
  }
44
44
  convertToString(value) {
45
+ var _a;
45
46
  if (value === undefined)
46
47
  return "";
47
48
  let numericValue = 0;
@@ -51,7 +52,7 @@ export class FloatTypeConverter extends NumericTypeConverterBase {
51
52
  numericValue = 0;
52
53
  }
53
54
  else {
54
- numericValue = FloatTypeConverter.parseString(value) ?? 0;
55
+ numericValue = (_a = FloatTypeConverter.parseString(value)) !== null && _a !== void 0 ? _a : 0;
55
56
  }
56
57
  }
57
58
  else {
@@ -82,6 +83,7 @@ export class IntTypeConverter extends NumericTypeConverterBase {
82
83
  return Number.isNaN(parsedValue) ? undefined : parsedValue;
83
84
  }
84
85
  convertToString(value) {
86
+ var _a;
85
87
  if (value === undefined)
86
88
  return "";
87
89
  let numericValue = 0;
@@ -91,7 +93,7 @@ export class IntTypeConverter extends NumericTypeConverterBase {
91
93
  numericValue = 0;
92
94
  }
93
95
  else {
94
- numericValue = IntTypeConverter.parseString(value) ?? 0;
96
+ numericValue = (_a = IntTypeConverter.parseString(value)) !== null && _a !== void 0 ? _a : 0;
95
97
  }
96
98
  }
97
99
  else {
@@ -1 +1 @@
1
- {"version":3,"file":"NumericTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/NumericTypeConverter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAgB,wBACpB,SAAQ,aAAa;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;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,wBAAwB;IACtD,MAAM,CAAC,WAAW,CAAC,KAAa;QACtC,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC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C,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,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,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;AAED,oBAAoB,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAChF,oBAAoB,CAAC,iBAAiB,CACpC,iBAAiB,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,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE9D;;;GAGG;AACH,MAAM,OAAgB,wBACpB,SAAQ,aAAa;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,CAA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;QAC7C,OAAO,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAC7C,CAAC;CACF;AAED,oBAAoB,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAChF,oBAAoB,CAAC,iBAAiB,CACpC,iBAAiB,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"]}
@@ -32,7 +32,8 @@ export class TypeConverter {
32
32
  }
33
33
  /** Converts a value associated with a property description to a string */
34
34
  convertPropertyToString(propertyDescription, value) {
35
- return this.convertToStringWithOptions(value, propertyDescription.converter?.options);
35
+ var _a;
36
+ return this.convertToStringWithOptions(value, (_a = propertyDescription.converter) === null || _a === void 0 ? void 0 : _a.options);
36
37
  }
37
38
  /** Converts a string with a property record to a property value */
38
39
  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,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAiD5D;;;GAGG;AACH,MAAM,OAAgB,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,mBAAmB,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","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,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAiD5D;;;GAGG;AACH,MAAM,OAAgB,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,mBAAmB,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","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"]}
@@ -6,6 +6,7 @@ import "./DatePicker.scss";
6
6
  /**
7
7
  * Props for [[DatePicker]] component.
8
8
  * @alpha
9
+ * @deprecated in 4.11.x. Props of deprecated component {@link DatePicker}.
9
10
  */
10
11
  export interface DatePickerProps {
11
12
  /** defines both date and time */
@@ -17,6 +18,7 @@ export interface DatePickerProps {
17
18
  }
18
19
  /** DatePicker component. Show a month selector and a day calendar to select a specific date.
19
20
  * @alpha
21
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
20
22
  */
21
23
  export declare function DatePicker(props: DatePickerProps): React.JSX.Element;
22
24
  //# sourceMappingURL=DatePicker.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,mBAAmB,CAAC;AAY3B;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,QAAQ,EAAE,IAAI,CAAC;IACf,qDAAqD;IACrD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBA4ThD"}
1
+ {"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,OAAO,mBAAmB,CAAC;AAa3B;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,iCAAiC;IACjC,QAAQ,EAAE,IAAI,CAAC;IACf,qDAAqD;IACrD,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,0DAA0D;IAC1D,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AAEH,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAmQhD"}
@@ -8,10 +8,10 @@
8
8
  import * as React from "react";
9
9
  import classnames from "classnames";
10
10
  import { Key } from "ts-key-enum";
11
- import { UiComponents } from "../UiComponents";
12
11
  import { Icon } from "@itwin/core-react";
13
12
  import { SvgChevronLeft, SvgChevronRight } from "@itwin/itwinui-icons-react";
14
13
  import "./DatePicker.scss";
14
+ import { useTranslation } from "../useTranslation";
15
15
  function isSameDay(a, b) {
16
16
  return (a &&
17
17
  b &&
@@ -21,42 +21,45 @@ function isSameDay(a, b) {
21
21
  }
22
22
  /** DatePicker component. Show a month selector and a day calendar to select a specific date.
23
23
  * @alpha
24
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
24
25
  */
26
+ // eslint-disable-next-line deprecation/deprecation
25
27
  export function DatePicker(props) {
26
- const previousMonthLabel = React.useRef(UiComponents.localization.getLocalizedString("UiComponents:datepicker.previousMonth"));
27
- const nextMonthLabel = React.useRef(UiComponents.localization.getLocalizedString("UiComponents:datepicker.nextMonth"));
28
- const monthsLong = React.useRef([
29
- UiComponents.localization.getLocalizedString("UiComponents:month.long.january"),
30
- UiComponents.localization.getLocalizedString("UiComponents:month.long.february"),
31
- UiComponents.localization.getLocalizedString("UiComponents:month.long.march"),
32
- UiComponents.localization.getLocalizedString("UiComponents:month.long.april"),
33
- UiComponents.localization.getLocalizedString("UiComponents:month.long.may"),
34
- UiComponents.localization.getLocalizedString("UiComponents:month.long.june"),
35
- UiComponents.localization.getLocalizedString("UiComponents:month.long.july"),
36
- UiComponents.localization.getLocalizedString("UiComponents:month.long.august"),
37
- UiComponents.localization.getLocalizedString("UiComponents:month.long.september"),
38
- UiComponents.localization.getLocalizedString("UiComponents:month.long.october"),
39
- UiComponents.localization.getLocalizedString("UiComponents:month.long.november"),
40
- UiComponents.localization.getLocalizedString("UiComponents:month.long.december"),
41
- ]);
42
- const daysLong = React.useRef([
43
- UiComponents.localization.getLocalizedString("UiComponents:days.long.sunday"),
44
- UiComponents.localization.getLocalizedString("UiComponents:days.long.monday"),
45
- UiComponents.localization.getLocalizedString("UiComponents:days.long.tuesday"),
46
- UiComponents.localization.getLocalizedString("UiComponents:days.long.wednesday"),
47
- UiComponents.localization.getLocalizedString("UiComponents:days.long.thursday"),
48
- UiComponents.localization.getLocalizedString("UiComponents:days.long.friday"),
49
- UiComponents.localization.getLocalizedString("UiComponents:days.long.saturday"),
50
- ]);
51
- const daysShort = React.useRef([
52
- UiComponents.localization.getLocalizedString("UiComponents:days.short.sunday"),
53
- UiComponents.localization.getLocalizedString("UiComponents:days.short.monday"),
54
- UiComponents.localization.getLocalizedString("UiComponents:days.short.tuesday"),
55
- UiComponents.localization.getLocalizedString("UiComponents:days.short.wednesday"),
56
- UiComponents.localization.getLocalizedString("UiComponents:days.short.thursday"),
57
- UiComponents.localization.getLocalizedString("UiComponents:days.short.friday"),
58
- UiComponents.localization.getLocalizedString("UiComponents:days.short.saturday"),
59
- ]);
28
+ const { translate } = useTranslation();
29
+ const previousMonthLabel = translate("datepicker.previousMonth");
30
+ const nextMonthLabel = translate("datepicker.nextMonth");
31
+ const monthsLong = [
32
+ translate("month.long.january"),
33
+ translate("month.long.february"),
34
+ translate("month.long.march"),
35
+ translate("month.long.april"),
36
+ translate("month.long.may"),
37
+ translate("month.long.june"),
38
+ translate("month.long.july"),
39
+ translate("month.long.august"),
40
+ translate("month.long.september"),
41
+ translate("month.long.october"),
42
+ translate("month.long.november"),
43
+ translate("month.long.december"),
44
+ ];
45
+ const daysLong = [
46
+ translate("days.long.sunday"),
47
+ translate("days.long.monday"),
48
+ translate("days.long.tuesday"),
49
+ translate("days.long.wednesday"),
50
+ translate("days.long.thursday"),
51
+ translate("days.long.friday"),
52
+ translate("days.long.saturday"),
53
+ ];
54
+ const daysShort = [
55
+ translate("days.short.sunday"),
56
+ translate("days.short.monday"),
57
+ translate("days.short.tuesday"),
58
+ translate("days.short.wednesday"),
59
+ translate("days.short.thursday"),
60
+ translate("days.short.friday"),
61
+ translate("days.short.saturday"),
62
+ ];
60
63
  const [selectedDay, setSelectedDay] = React.useState(new Date(props.selected.getTime()));
61
64
  const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(selectedDay.getMonth());
62
65
  const [displayedYear, setDisplayedYear] = React.useState(selectedDay.getFullYear());
@@ -159,16 +162,16 @@ export function DatePicker(props) {
159
162
  const calendarClass = classnames("components-date-picker-calendar-month", props.showFocusOutline && "showFocusOutline");
160
163
  return (React.createElement("div", { className: "components-date-picker-calendar" },
161
164
  React.createElement("div", { className: "components-date-picker-calendar-header-months" },
162
- React.createElement("button", { className: previousButtonClass, title: previousMonthLabel.current, onClick: handleMoveToPreviousMonth },
165
+ React.createElement("button", { className: previousButtonClass, title: previousMonthLabel, onClick: handleMoveToPreviousMonth },
163
166
  React.createElement(Icon, { iconSpec: React.createElement(SvgChevronLeft, null) })),
164
167
  React.createElement("span", { className: "components-month-year" },
165
- monthsLong.current[displayedMonthIndex],
168
+ monthsLong[displayedMonthIndex],
166
169
  " ",
167
170
  displayedYear),
168
- React.createElement("button", { className: nextButtonClass, title: nextMonthLabel.current, onClick: handleMoveToNextMonth },
171
+ React.createElement("button", { className: nextButtonClass, title: nextMonthLabel, onClick: handleMoveToNextMonth },
169
172
  React.createElement(Icon, { iconSpec: React.createElement(SvgChevronRight, null) }))),
170
- React.createElement("div", { className: "components-date-picker-calendar-header-weekdays" }, [0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (React.createElement("div", { key: `day-${dayOfWeek}`, className: "components-date-picker-calendar-header-day-short", title: daysLong.current[dayOfWeek] },
171
- React.createElement("span", null, daysShort.current[dayOfWeek]))))),
173
+ React.createElement("div", { className: "components-date-picker-calendar-header-weekdays" }, [0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (React.createElement("div", { key: `day-${dayOfWeek}`, className: "components-date-picker-calendar-header-day-short", title: daysLong[dayOfWeek] },
174
+ React.createElement("span", null, daysShort[dayOfWeek]))))),
172
175
  React.createElement("ul", { tabIndex: 0, onKeyDown: handleCalendarKeyDown, "data-testid": "components-date-picker-calendar-list", className: calendarClass, role: "listbox" }, weeks.map((weekdays, weekIndex) => (React.createElement(React.Fragment, { key: `week-${weekIndex}` }, weekdays.map((day, dayIndex) => {
173
176
  const isActive = selectedDay && day && isSameDay(selectedDay, day);
174
177
  const isFocused = focusedDay &&
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,mBAAmB,CAAC;AAE3B,SAAS,SAAS,CAAC,CAAO,EAAE,CAAO;IACjC,OAAO,CACL,CAAC;QACD,CAAC;QACD,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE;QACnC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC7B,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAC5B,CAAC;AAC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B,GAAG,EAAE,GAAG,aAAa,IAAI,mBAAmB,QAAQ,QAAQ,EAAE,EAC9D,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAC/B,IAAI,EAAC,QAAQ,mBACE,QAAQ,gBACX,GAAG,CAAC,OAAO,EAAE;gBAEzB,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAClB,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { UiComponents } from \"../UiComponents\";\nimport { Icon } from \"@itwin/core-react\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\nimport \"./DatePicker.scss\";\n\nfunction isSameDay(a: Date, b: Date) {\n return (\n a &&\n b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/**\n * Props for [[DatePicker]] component.\n * @alpha\n */\nexport interface DatePickerProps {\n /** defines both date and time */\n selected: Date;\n /** function to call when date or time has changed */\n onDateChange?: (day: Date) => void;\n /** show focus outlines, useful for keyboard navigation */\n showFocusOutline?: boolean;\n}\n\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\n * @alpha\n */\nexport function DatePicker(props: DatePickerProps) {\n const previousMonthLabel = React.useRef(\n UiComponents.localization.getLocalizedString(\n \"UiComponents:datepicker.previousMonth\"\n )\n );\n const nextMonthLabel = React.useRef(\n UiComponents.localization.getLocalizedString(\n \"UiComponents:datepicker.nextMonth\"\n )\n );\n const monthsLong = React.useRef([\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.january\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.february\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.march\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.april\"\n ),\n UiComponents.localization.getLocalizedString(\"UiComponents:month.long.may\"),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.june\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.july\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.august\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.september\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.october\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.november\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:month.long.december\"\n ),\n ]);\n\n const daysLong = React.useRef([\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.sunday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.monday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.tuesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.wednesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.thursday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.friday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.long.saturday\"\n ),\n ]);\n\n const daysShort = React.useRef([\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.sunday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.monday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.tuesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.wednesday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.thursday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.friday\"\n ),\n UiComponents.localization.getLocalizedString(\n \"UiComponents:days.short.saturday\"\n ),\n ]);\n\n const [selectedDay, setSelectedDay] = React.useState(\n new Date(props.selected.getTime())\n );\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(\n selectedDay.getMonth()\n );\n const [displayedYear, setDisplayedYear] = React.useState(\n selectedDay.getFullYear()\n );\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\n React.useEffect(() => {\n const newSelectedDay = new Date(props.selected);\n setSelectedDay(new Date(props.selected));\n setDisplayedMonthIndex(newSelectedDay.getMonth());\n setDisplayedYear(newSelectedDay.getFullYear());\n setFocusedDay(newSelectedDay);\n }, [props.selected]);\n const days = React.useMemo(() => {\n const msFirstDayOfMonth = new Date(\n displayedYear,\n displayedMonthIndex,\n 1\n ).getTime();\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\n if (0 === offsetToFirst) offsetToFirst = 7;\n\n const daysInMonth: Date[] = [];\n // generate 6 weeks of dates\n for (let i = 0; i < 42; i++) {\n const adjustedDay = 1 + i - offsetToFirst;\n daysInMonth.push(\n new Date(displayedYear, displayedMonthIndex, adjustedDay)\n );\n }\n return daysInMonth;\n }, [displayedMonthIndex, displayedYear]);\n\n const weeks = React.useMemo(() => {\n const weeksInMonth = [];\n const weekCount = Math.ceil(days.length / 7);\n for (let i = 0; i < weekCount; i++) {\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\n }\n return weeksInMonth;\n }, [days]);\n\n const setMonthAndYear = React.useCallback(\n (newMonth: number, newYear: number) => {\n setDisplayedMonthIndex(newMonth);\n setDisplayedYear(newYear);\n if (\n selectedDay.getFullYear() === newYear &&\n selectedDay.getMonth() === newMonth\n ) {\n setFocusedDay(new Date(selectedDay.getTime()));\n } else {\n const newFocusDay = new Date(focusedDay.getTime());\n newFocusDay.setFullYear(newYear, newMonth, 1);\n setFocusedDay(newFocusDay);\n }\n },\n [focusedDay, selectedDay]\n );\n\n const handleMoveToPreviousMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\n const newYear =\n displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n const handleMoveToNextMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\n const newYear =\n displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n // when invoked, it will return another function which can be used for the onClick React listener.\n const handleOnDayChange = React.useCallback(\n (day: Date) => () => {\n setSelectedDay(day);\n setFocusedDay(day);\n props.onDateChange && props.onDateChange(day);\n },\n [props]\n );\n\n const handleCalendarKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === Key.ArrowDown.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex + 7 > 41) setFocusedDay(days[focusedDayIndex % 7]);\n else setFocusedDay(days[focusedDayIndex + 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowUp.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex - 7 < 0)\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\n else setFocusedDay(days[focusedDayIndex - 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowLeft.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n // istanbul ignore else\n if (focusedDayIndex - 1 >= 0) setFocusedDay(days[focusedDayIndex - 1]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowRight.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n // istanbul ignore else\n if (focusedDayIndex + 1 <= 41) setFocusedDay(days[focusedDayIndex + 1]);\n event.preventDefault();\n }\n if (event.key === Key.Enter.valueOf() || event.key === \" \") {\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\n event.preventDefault();\n }\n },\n [days, focusedDay, handleOnDayChange]\n );\n\n const previousButtonClass = classnames(\n \"components-previous-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const nextButtonClass = classnames(\n \"components-next-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const calendarClass = classnames(\n \"components-date-picker-calendar-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n\n return (\n <div className=\"components-date-picker-calendar\">\n <div className=\"components-date-picker-calendar-header-months\">\n <button\n className={previousButtonClass}\n title={previousMonthLabel.current}\n onClick={handleMoveToPreviousMonth}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n <span className=\"components-month-year\">\n {monthsLong.current[displayedMonthIndex]} {displayedYear}\n </span>\n <button\n className={nextButtonClass}\n title={nextMonthLabel.current}\n onClick={handleMoveToNextMonth}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </div>\n <div className=\"components-date-picker-calendar-header-weekdays\">\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (\n <div\n key={`day-${dayOfWeek}`}\n className=\"components-date-picker-calendar-header-day-short\"\n title={daysLong.current[dayOfWeek]}\n >\n <span>{daysShort.current[dayOfWeek]}</span>\n </div>\n ))}\n </div>\n <ul\n tabIndex={0}\n onKeyDown={handleCalendarKeyDown}\n data-testid=\"components-date-picker-calendar-list\"\n className={calendarClass}\n role=\"listbox\"\n >\n {weeks.map((weekdays, weekIndex) => (\n <React.Fragment key={`week-${weekIndex}`}>\n {weekdays.map((day: Date, dayIndex: number) => {\n const isActive =\n selectedDay && day && isSameDay(selectedDay, day);\n const isFocused =\n focusedDay &&\n day &&\n isSameDay(focusedDay, day) &&\n props.showFocusOutline;\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\n const classNames = classnames(\n \"components-date-picker-calendar-day\",\n isActive && \"selected\",\n !isCurrentMonth && \"notCurrentMonth\",\n isFocused && \"focused\"\n );\n const dateValue = day.getDate();\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <li\n className={classNames}\n key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\n onClick={handleOnDayChange(day)}\n role=\"option\"\n aria-selected={isActive}\n data-value={day.getTime()}\n >\n <span>{dateValue}</span>\n </li>\n );\n })}\n </React.Fragment>\n ))}\n </ul>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"DatePicker.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePicker.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7E,OAAO,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,SAAS,SAAS,CAAC,CAAO,EAAE,CAAO;IACjC,OAAO,CACL,CAAC;QACD,CAAC;QACD,CAAC,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE;QACnC,CAAC,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE;QAC7B,CAAC,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,OAAO,EAAE,CAC5B,CAAC;AACJ,CAAC;AAgBD;;;GAGG;AACH,mDAAmD;AACnD,MAAM,UAAU,UAAU,CAAC,KAAsB;IAC/C,MAAM,EAAE,SAAS,EAAE,GAAG,cAAc,EAAE,CAAC;IACvC,MAAM,kBAAkB,GAAG,SAAS,CAAC,0BAA0B,CAAC,CAAC;IACjE,MAAM,cAAc,GAAG,SAAS,CAAC,sBAAs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IAAI,SAAS,CACvB,CAAC;YACF,MAAM,SAAS,GAAG,GAAG,CAAC,OAAO,EAAE,CAAC;YAChC,OAAO;YACL,oEAAoE;YACpE,4BACE,SAAS,EAAE,UAAU,EACrB,GAAG,EAAE,GAAG,aAAa,IAAI,mBAAmB,QAAQ,QAAQ,EAAE,EAC9D,OAAO,EAAE,iBAAiB,CAAC,GAAG,CAAC,EAC/B,IAAI,EAAC,QAAQ,mBACE,QAAQ,gBACX,GAAG,CAAC,OAAO,EAAE;gBAEzB,kCAAO,SAAS,CAAQ,CACrB,CACN,CAAC;QACJ,CAAC,CAAC,CACa,CAClB,CAAC,CACC,CACD,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Date\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { Icon } from \"@itwin/core-react\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\nimport \"./DatePicker.scss\";\nimport { useTranslation } from \"../useTranslation\";\n\nfunction isSameDay(a: Date, b: Date) {\n return (\n a &&\n b &&\n a.getFullYear() === b.getFullYear() &&\n a.getMonth() === b.getMonth() &&\n a.getDate() === b.getDate()\n );\n}\n\n/**\n * Props for [[DatePicker]] component.\n * @alpha\n * @deprecated in 4.11.x. Props of deprecated component {@link DatePicker}.\n */\nexport interface DatePickerProps {\n /** defines both date and time */\n selected: Date;\n /** function to call when date or time has changed */\n onDateChange?: (day: Date) => void;\n /** show focus outlines, useful for keyboard navigation */\n showFocusOutline?: boolean;\n}\n\n/** DatePicker component. Show a month selector and a day calendar to select a specific date.\n * @alpha\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\n// eslint-disable-next-line deprecation/deprecation\nexport function DatePicker(props: DatePickerProps) {\n const { translate } = useTranslation();\n const previousMonthLabel = translate(\"datepicker.previousMonth\");\n const nextMonthLabel = translate(\"datepicker.nextMonth\");\n const monthsLong = [\n translate(\"month.long.january\"),\n translate(\"month.long.february\"),\n translate(\"month.long.march\"),\n translate(\"month.long.april\"),\n translate(\"month.long.may\"),\n translate(\"month.long.june\"),\n translate(\"month.long.july\"),\n translate(\"month.long.august\"),\n translate(\"month.long.september\"),\n translate(\"month.long.october\"),\n translate(\"month.long.november\"),\n translate(\"month.long.december\"),\n ];\n\n const daysLong = [\n translate(\"days.long.sunday\"),\n translate(\"days.long.monday\"),\n translate(\"days.long.tuesday\"),\n translate(\"days.long.wednesday\"),\n translate(\"days.long.thursday\"),\n translate(\"days.long.friday\"),\n translate(\"days.long.saturday\"),\n ];\n\n const daysShort = [\n translate(\"days.short.sunday\"),\n translate(\"days.short.monday\"),\n translate(\"days.short.tuesday\"),\n translate(\"days.short.wednesday\"),\n translate(\"days.short.thursday\"),\n translate(\"days.short.friday\"),\n translate(\"days.short.saturday\"),\n ];\n\n const [selectedDay, setSelectedDay] = React.useState(\n new Date(props.selected.getTime())\n );\n const [displayedMonthIndex, setDisplayedMonthIndex] = React.useState(\n selectedDay.getMonth()\n );\n const [displayedYear, setDisplayedYear] = React.useState(\n selectedDay.getFullYear()\n );\n const [focusedDay, setFocusedDay] = React.useState(selectedDay);\n React.useEffect(() => {\n const newSelectedDay = new Date(props.selected);\n setSelectedDay(new Date(props.selected));\n setDisplayedMonthIndex(newSelectedDay.getMonth());\n setDisplayedYear(newSelectedDay.getFullYear());\n setFocusedDay(newSelectedDay);\n }, [props.selected]);\n const days = React.useMemo(() => {\n const msFirstDayOfMonth = new Date(\n displayedYear,\n displayedMonthIndex,\n 1\n ).getTime();\n let offsetToFirst = new Date(msFirstDayOfMonth).getDay();\n if (0 === offsetToFirst) offsetToFirst = 7;\n\n const daysInMonth: Date[] = [];\n // generate 6 weeks of dates\n for (let i = 0; i < 42; i++) {\n const adjustedDay = 1 + i - offsetToFirst;\n daysInMonth.push(\n new Date(displayedYear, displayedMonthIndex, adjustedDay)\n );\n }\n return daysInMonth;\n }, [displayedMonthIndex, displayedYear]);\n\n const weeks = React.useMemo(() => {\n const weeksInMonth = [];\n const weekCount = Math.ceil(days.length / 7);\n for (let i = 0; i < weekCount; i++) {\n weeksInMonth.push(days.slice(i * 7, (i + 1) * 7));\n }\n return weeksInMonth;\n }, [days]);\n\n const setMonthAndYear = React.useCallback(\n (newMonth: number, newYear: number) => {\n setDisplayedMonthIndex(newMonth);\n setDisplayedYear(newYear);\n if (\n selectedDay.getFullYear() === newYear &&\n selectedDay.getMonth() === newMonth\n ) {\n setFocusedDay(new Date(selectedDay.getTime()));\n } else {\n const newFocusDay = new Date(focusedDay.getTime());\n newFocusDay.setFullYear(newYear, newMonth, 1);\n setFocusedDay(newFocusDay);\n }\n },\n [focusedDay, selectedDay]\n );\n\n const handleMoveToPreviousMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 0 ? displayedMonthIndex - 1 : 11;\n const newYear =\n displayedMonthIndex !== 0 ? displayedYear : displayedYear - 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n const handleMoveToNextMonth = React.useCallback(() => {\n const newMonth = displayedMonthIndex !== 11 ? displayedMonthIndex + 1 : 0;\n const newYear =\n displayedMonthIndex !== 11 ? displayedYear : displayedYear + 1;\n setMonthAndYear(newMonth, newYear);\n }, [displayedMonthIndex, displayedYear, setMonthAndYear]);\n\n // when invoked, it will return another function which can be used for the onClick React listener.\n const handleOnDayChange = React.useCallback(\n (day: Date) => () => {\n setSelectedDay(day);\n setFocusedDay(day);\n props.onDateChange && props.onDateChange(day);\n },\n [props]\n );\n\n const handleCalendarKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLUListElement>) => {\n if (event.key === Key.ArrowDown.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex + 7 > 41) setFocusedDay(days[focusedDayIndex % 7]);\n else setFocusedDay(days[focusedDayIndex + 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowUp.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n if (focusedDayIndex - 7 < 0)\n setFocusedDay(days[(focusedDayIndex % 7) + 35]);\n else setFocusedDay(days[focusedDayIndex - 7]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowLeft.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n // istanbul ignore else\n if (focusedDayIndex - 1 >= 0) setFocusedDay(days[focusedDayIndex - 1]);\n event.preventDefault();\n }\n if (event.key === Key.ArrowRight.valueOf()) {\n const focusedDayIndex = days.findIndex((day) =>\n isSameDay(day, focusedDay)\n );\n // istanbul ignore else\n if (focusedDayIndex + 1 <= 41) setFocusedDay(days[focusedDayIndex + 1]);\n event.preventDefault();\n }\n if (event.key === Key.Enter.valueOf() || event.key === \" \") {\n handleOnDayChange(focusedDay)(); // NB: immediately call returned handler function\n event.preventDefault();\n }\n },\n [days, focusedDay, handleOnDayChange]\n );\n\n const previousButtonClass = classnames(\n \"components-previous-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const nextButtonClass = classnames(\n \"components-next-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n const calendarClass = classnames(\n \"components-date-picker-calendar-month\",\n props.showFocusOutline && \"showFocusOutline\"\n );\n\n return (\n <div className=\"components-date-picker-calendar\">\n <div className=\"components-date-picker-calendar-header-months\">\n <button\n className={previousButtonClass}\n title={previousMonthLabel}\n onClick={handleMoveToPreviousMonth}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n <span className=\"components-month-year\">\n {monthsLong[displayedMonthIndex]} {displayedYear}\n </span>\n <button\n className={nextButtonClass}\n title={nextMonthLabel}\n onClick={handleMoveToNextMonth}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </div>\n <div className=\"components-date-picker-calendar-header-weekdays\">\n {[0, 1, 2, 3, 4, 5, 6].map((dayOfWeek) => (\n <div\n key={`day-${dayOfWeek}`}\n className=\"components-date-picker-calendar-header-day-short\"\n title={daysLong[dayOfWeek]}\n >\n <span>{daysShort[dayOfWeek]}</span>\n </div>\n ))}\n </div>\n <ul\n tabIndex={0}\n onKeyDown={handleCalendarKeyDown}\n data-testid=\"components-date-picker-calendar-list\"\n className={calendarClass}\n role=\"listbox\"\n >\n {weeks.map((weekdays, weekIndex) => (\n <React.Fragment key={`week-${weekIndex}`}>\n {weekdays.map((day: Date, dayIndex: number) => {\n const isActive =\n selectedDay && day && isSameDay(selectedDay, day);\n const isFocused =\n focusedDay &&\n day &&\n isSameDay(focusedDay, day) &&\n props.showFocusOutline;\n const isCurrentMonth = day.getMonth() === displayedMonthIndex;\n const classNames = classnames(\n \"components-date-picker-calendar-day\",\n isActive && \"selected\",\n !isCurrentMonth && \"notCurrentMonth\",\n isFocused && \"focused\"\n );\n const dateValue = day.getDate();\n return (\n /* eslint-disable-next-line jsx-a11y/click-events-have-key-events */\n <li\n className={classNames}\n key={`${displayedYear}.${displayedMonthIndex}.day.${dayIndex}`}\n onClick={handleOnDayChange(day)}\n role=\"option\"\n aria-selected={isActive}\n data-value={day.getTime()}\n >\n <span>{dateValue}</span>\n </li>\n );\n })}\n </React.Fragment>\n ))}\n </ul>\n </div>\n );\n}\n"]}
@@ -6,7 +6,9 @@ import type { DateFormatter, TimeDisplay } from "@itwin/appui-abstract";
6
6
  import type { CommonProps } from "@itwin/core-react";
7
7
  import "./DatePickerPopupButton.scss";
8
8
  /** Props used by [[DatePickerPopupButton]] component.
9
- * @alpha */
9
+ * @alpha
10
+ * @deprecated in 4.11.x. Props of deprecated component {@link DatePickerPopupButton}.
11
+ */
10
12
  export interface DatePickerPopupButtonProps extends CommonProps {
11
13
  /** Date to be shown as the selected date. */
12
14
  selected: Date;
@@ -25,6 +27,7 @@ export interface DatePickerPopupButtonProps extends CommonProps {
25
27
  }
26
28
  /** Component that displays a button used to pick a date and optionally a time.
27
29
  * @alpha
28
- * */
30
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
31
+ */
29
32
  export declare function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter, buttonToolTip, fieldStyle, fieldClassName, style, }: DatePickerPopupButtonProps): React.JSX.Element;
30
33
  //# sourceMappingURL=DatePickerPopupButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAQrD,OAAO,8BAA8B,CAAC;AAEtC;YACY;AACZ,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,6CAA6C;IAC7C,QAAQ,EAAE,IAAI,CAAC;IACf,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yCAAyC;IACzC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAClC;AAED;;KAEK;AACL,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GACN,EAAE,0BAA0B,qBAoI5B"}
1
+ {"version":3,"file":"DatePickerPopupButton.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAExE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOrD,OAAO,8BAA8B,CAAC;AAGtC;;;GAGG;AACH,MAAM,WAAW,0BAA2B,SAAQ,WAAW;IAC7D,6CAA6C;IAC7C,QAAQ,EAAE,IAAI,CAAC;IACf,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE3B,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,yCAAyC;IACzC,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACnC,uBAAuB;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IAGvB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,8CAA8C;IAC9C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,yCAAyC;IACzC,UAAU,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAClC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GACN,EACD,0BAA0B,qBA8HzB"}
@@ -9,20 +9,20 @@ import * as React from "react";
9
9
  import { RelativePosition } from "@itwin/appui-abstract";
10
10
  import { Popup } from "@itwin/core-react";
11
11
  import { Text } from "@itwin/itwinui-react";
12
- import { UiComponents } from "../UiComponents";
13
12
  import { DatePicker } from "./DatePicker";
14
13
  import { DateField } from "./DateField";
15
14
  import { TimeField } from "./TimeField";
16
15
  import "./DatePickerPopupButton.scss";
16
+ import { useTranslation } from "../useTranslation";
17
17
  /** Component that displays a button used to pick a date and optionally a time.
18
18
  * @alpha
19
- * */
19
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
20
+ */
20
21
  export function DatePickerPopupButton({ displayEditField, timeDisplay, selected, onDateChange, dateFormatter, buttonToolTip, fieldStyle, fieldClassName, style, }) {
22
+ const { translate } = useTranslation();
21
23
  const [workingDate, setWorkingDate] = React.useState(new Date(selected.getTime()));
22
24
  const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);
23
- const timeLabelRef = React.useRef(UiComponents.translate("datepicker.time"));
24
- const toolTipLabelRef = React.useRef(UiComponents.translate("datepicker.selectDate"));
25
- const toolTipLabel = React.useMemo(() => (buttonToolTip ? buttonToolTip : toolTipLabelRef.current), [buttonToolTip]);
25
+ const toolTipLabel = buttonToolTip !== null && buttonToolTip !== void 0 ? buttonToolTip : translate("datepicker.selectDate");
26
26
  // See if props have changed since component mounted
27
27
  React.useEffect(() => {
28
28
  const newWorkingDate = new Date(selected.getTime());
@@ -71,9 +71,10 @@ export function DatePickerPopupButton({ displayEditField, timeDisplay, selected,
71
71
  React.createElement("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" })))),
72
72
  React.createElement(Popup, { isOpen: isSettingsOpen, position: RelativePosition.BottomLeft, onClose: handleCloseSetting, target: buttonRef.current, closeOnEnter: false, moveFocus: showFocusOutline, closeOnNestedPopupOutsideClick: true },
73
73
  React.createElement("div", { className: "components-date-picker-calendar-popup-panel", "data-testid": "components-date-picker-calendar-popup-panel" },
74
- React.createElement(DatePicker, { selected: workingDate, onDateChange: handleOnDateChanged, showFocusOutline: showFocusOutline }),
74
+ React.createElement(DatePicker // eslint-disable-line deprecation/deprecation
75
+ , { selected: workingDate, onDateChange: handleOnDateChanged, showFocusOutline: showFocusOutline }),
75
76
  timeDisplay && (React.createElement("div", { className: "time-container" },
76
- React.createElement(Text, { variant: "body", className: "time-label" }, timeLabelRef.current),
77
+ React.createElement(Text, { variant: "body", className: "time-label" }, translate("datepicker.time")),
77
78
  React.createElement(TimeField, { time: timeSpec, timeDisplay: timeDisplay, onTimeChange: handleOnTimeChanged }))))),
78
79
  !!displayEditField && (React.createElement(DateField, { style: fieldStyle, className: fieldClassName, initialDate: workingDate, timeDisplay: timeDisplay, dateFormatter: dateFormatter, onDateChange: handleOnDateChanged }))));
79
80
  }
@@ -1 +1 @@
1
- {"version":3,"file":"DatePickerPopupButton.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/DatePickerPopupButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,8BAA8B,CAAC;AAwBtC;;KAEK;AACL,MAAM,UAAU,qBAAqB,CAAC,EACpC,gBAAgB,EAChB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,aAAa,EACb,aAAa,EACb,UAAU,EACV,cAAc,EACd,KAAK,GACsB;IAC3B,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ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EAAE,mBAAmB,GACjC,CACH,CACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module 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 { UiComponents } from \"../UiComponents\";\nimport { DatePicker } from \"./DatePicker\";\nimport { DateField } from \"./DateField\";\nimport type { TimeSpec } from \"./TimeField\";\nimport { TimeField } from \"./TimeField\";\nimport \"./DatePickerPopupButton.scss\";\n\n/** Props used by [[DatePickerPopupButton]] component.\n * @alpha */\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 * */\nexport function DatePickerPopupButton({\n displayEditField,\n timeDisplay,\n selected,\n onDateChange,\n dateFormatter,\n buttonToolTip,\n fieldStyle,\n fieldClassName,\n style,\n}: DatePickerPopupButtonProps) {\n const [workingDate, setWorkingDate] = React.useState(\n new Date(selected.getTime())\n );\n const [isSettingsOpen, setIsSettingsOpen] = React.useState(false);\n const timeLabelRef = React.useRef(UiComponents.translate(\"datepicker.time\"));\n const toolTipLabelRef = React.useRef(\n UiComponents.translate(\"datepicker.selectDate\")\n );\n const toolTipLabel = React.useMemo(\n () => (buttonToolTip ? buttonToolTip : toolTipLabelRef.current),\n [buttonToolTip]\n );\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\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 {timeLabelRef.current}\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,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAs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AAW,EAAE,WAAW,EACxB,YAAY,EAAE,mBAAmB,GACjC,CACE,CACP,CACG,CACA;QACP,CAAC,CAAC,gBAAgB,IAAI,CACrB,oBAAC,SAAS,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","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"]}
@@ -9,6 +9,7 @@ import type { DateFormatter } from "@itwin/appui-abstract";
9
9
  * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If
10
10
  * a parseData function is implemented then the edit field will be editable.
11
11
  * @alpha
12
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
12
13
  */
13
14
  export declare class IntlFormatter implements DateFormatter {
14
15
  private _intlFormatter?;
@@ -1 +1 @@
1
- {"version":3,"file":"IntlFormatter.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;GAOG;AACH,qBAAa,aAAc,YAAW,aAAa;IACrC,OAAO,CAAC,cAAc,CAAC;gBAAf,cAAc,CAAC,iCAAqB;IAExD,IAAW,SAAS,IAAI,IAAI,CAAC,cAAc,CAgB1C;IAEM,WAAW,CAAC,GAAG,EAAE,IAAI;CAO7B"}
1
+ {"version":3,"file":"IntlFormatter.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;;;;;;;GAQG;AACH,qBAAa,aAAc,YAAW,aAAa;IACrC,OAAO,CAAC,cAAc,CAAC;gBAAf,cAAc,CAAC,iCAAqB;IAExD,IAAW,SAAS,IAAI,IAAI,CAAC,cAAc,CAgB1C;IAEM,WAAW,CAAC,GAAG,EAAE,IAAI;CAO7B"}
@@ -12,6 +12,7 @@
12
12
  * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If
13
13
  * a parseData function is implemented then the edit field will be editable.
14
14
  * @alpha
15
+ * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.
15
16
  */
16
17
  export class IntlFormatter {
17
18
  constructor(_intlFormatter) {
@@ -1 +1 @@
1
- {"version":3,"file":"IntlFormatter.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH;;;;;;;GAOG;AACH,MAAM,OAAO,aAAa;IACxB,YAAoB,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;IAAG,CAAC;IAE5D,IAAW,SAAS;QAClB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,+DAA+D;YAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE;gBACvD,OAAO,EAAE,OAAO,CAAC,+BAA+B;gBAChD,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,KAAK,EAAE,SAAS,CAAC,qDAAqD;gBACtE,GAAG,EAAE,SAAS,CAAC,0BAA0B;gBACzC,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,SAAS,CAAC,0BAA0B;gBAC5C,MAAM,EAAE,SAAS,CAAC,0BAA0B,CAAC,qBAAqB;gBAClE,4BAA4B;aAC7B,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEM,WAAW,CAAC,GAAS;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;CAKF","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 type { DateFormatter } from \"@itwin/appui-abstract\";\n\n/**\n * A basic class that allows user to provide an Intl.DateTimeFormat\n * that can be used to format the date and time display. If no format is\n * specified a default format will be used. This default implementation does not\n * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If\n * a parseData function is implemented then the edit field will be editable.\n * @alpha\n */\nexport class IntlFormatter implements DateFormatter {\n constructor(private _intlFormatter?: Intl.DateTimeFormat) {}\n\n public get formatter(): Intl.DateTimeFormat {\n if (!this._intlFormatter) {\n // https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor\n this._intlFormatter = new Intl.DateTimeFormat(undefined, {\n weekday: \"short\" /* \"narrow\", \"short\", \"long\" */,\n year: \"numeric\" /* \"2-digit\", \"numeric\" */,\n month: \"2-digit\" /* \"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\" */,\n day: \"2-digit\" /* \"2-digit\", \"numeric\" */,\n hour: \"numeric\" /* \"2-digit\", \"numeric\" */,\n hour12: true,\n minute: \"numeric\" /* \"2-digit\", \"numeric\" */,\n second: \"numeric\" /* \"2-digit\", \"numeric\" */ /* \"short\", \"long\" */,\n /* timeZoneName:\t\"short\", */\n });\n }\n return this._intlFormatter;\n }\n\n public formateDate(day: Date) {\n return this.formatter.format(day);\n }\n\n // The default implementation does not currently support parsing. If a derived class supports parsing then the\n // parseDate function must be implemented.\n // parseDate(dateString: string): Date|undefined {}\n}\n"]}
1
+ {"version":3,"file":"IntlFormatter.js","sourceRoot":"","sources":["../../../../src/components-react/datepicker/IntlFormatter.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH;;;;;;;;GAQG;AACH,MAAM,OAAO,aAAa;IACxB,YAAoB,cAAoC;QAApC,mBAAc,GAAd,cAAc,CAAsB;IAAG,CAAC;IAE5D,IAAW,SAAS;QAClB,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;YACxB,+DAA+D;YAC/D,IAAI,CAAC,cAAc,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,SAAS,EAAE;gBACvD,OAAO,EAAE,OAAO,CAAC,+BAA+B;gBAChD,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,KAAK,EAAE,SAAS,CAAC,qDAAqD;gBACtE,GAAG,EAAE,SAAS,CAAC,0BAA0B;gBACzC,IAAI,EAAE,SAAS,CAAC,0BAA0B;gBAC1C,MAAM,EAAE,IAAI;gBACZ,MAAM,EAAE,SAAS,CAAC,0BAA0B;gBAC5C,MAAM,EAAE,SAAS,CAAC,0BAA0B,CAAC,qBAAqB;gBAClE,4BAA4B;aAC7B,CAAC,CAAC;SACJ;QACD,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAEM,WAAW,CAAC,GAAS;QAC1B,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;CAKF","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 type { DateFormatter } from \"@itwin/appui-abstract\";\n\n/**\n * A basic class that allows user to provide an Intl.DateTimeFormat\n * that can be used to format the date and time display. If no format is\n * specified a default format will be used. This default implementation does not\n * support parsing, so when used by [[DatePickerPopup]] the edit field will be readonly. If\n * a parseData function is implemented then the edit field will be editable.\n * @alpha\n * @deprecated in 4.11.x. Use {@link https://itwinui.bentley.com/docs/datepicker iTwinUI date picker} instead.\n */\nexport class IntlFormatter implements DateFormatter {\n constructor(private _intlFormatter?: Intl.DateTimeFormat) {}\n\n public get formatter(): Intl.DateTimeFormat {\n if (!this._intlFormatter) {\n // https://tc39.es/ecma402/#sec-intl-datetimeformat-constructor\n this._intlFormatter = new Intl.DateTimeFormat(undefined, {\n weekday: \"short\" /* \"narrow\", \"short\", \"long\" */,\n year: \"numeric\" /* \"2-digit\", \"numeric\" */,\n month: \"2-digit\" /* \"2-digit\", \"numeric\", \"narrow\", \"short\", \"long\" */,\n day: \"2-digit\" /* \"2-digit\", \"numeric\" */,\n hour: \"numeric\" /* \"2-digit\", \"numeric\" */,\n hour12: true,\n minute: \"numeric\" /* \"2-digit\", \"numeric\" */,\n second: \"numeric\" /* \"2-digit\", \"numeric\" */ /* \"short\", \"long\" */,\n /* timeZoneName:\t\"short\", */\n });\n }\n return this._intlFormatter;\n }\n\n public formateDate(day: Date) {\n return this.formatter.format(day);\n }\n\n // The default implementation does not currently support parsing. If a derived class supports parsing then the\n // parseDate function must be implemented.\n // parseDate(dateString: string): Date|undefined {}\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"TimeField.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/TimeField.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,kBAAkB,CAAC;AAE1B;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,WAAW,CAAC;IACzB,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAwBD;;;GAGG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,WAAW,EACX,QAAQ,EACR,YAAY,GACb,EAAE,cAAc,qBA4VhB"}
1
+ {"version":3,"file":"TimeField.d.ts","sourceRoot":"","sources":["../../../../src/components-react/datepicker/TimeField.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,kBAAkB,CAAC;AAG1B;;;GAGG;AACH,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO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