@itwin/components-react 4.3.1 → 4.5.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.
- package/CHANGELOG.md +21 -4
- package/lib/cjs/components-react/common/DelayedSpinner.js +2 -3
- package/lib/cjs/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/cjs/components-react/common/SubscriptionScheduler.d.ts +1 -1
- package/lib/cjs/components-react/common/SubscriptionScheduler.d.ts.map +1 -1
- package/lib/cjs/components-react/common/SubscriptionScheduler.js +18 -23
- package/lib/cjs/components-react/common/SubscriptionScheduler.js.map +1 -1
- package/lib/cjs/components-react/common/UseAsyncValue.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseAsyncValue.js +6 -8
- package/lib/cjs/components-react/common/UseAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js +8 -7
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/converters/NumericTypeConverter.js +2 -4
- package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/StringTypeConverter.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/StringTypeConverter.js +3 -5
- package/lib/cjs/components-react/converters/StringTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverter.js +1 -2
- package/lib/cjs/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.d.ts.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.js +8 -2
- package/lib/cjs/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.js +6 -8
- package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/DateTimeEditor.js +2 -3
- package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.js +3 -4
- package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
- package/lib/cjs/components-react/editors/TextEditor.js +2 -4
- package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js +3 -3
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts +23 -9
- package/lib/cjs/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js +19 -8
- package/lib/cjs/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts +8 -5
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js +46 -18
- package/lib/cjs/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js +7 -4
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRule.scss +8 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js +3 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts +11 -2
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js +3 -4
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts +58 -12
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js +107 -13
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
- package/lib/cjs/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
- package/lib/cjs/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
- package/lib/cjs/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -2
- package/lib/cjs/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
- package/lib/cjs/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -2
- package/lib/cjs/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
- package/lib/cjs/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
- package/lib/cjs/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js +48 -54
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
- package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
- package/lib/cjs/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/selectable-content/SelectableContent.js +2 -3
- package/lib/cjs/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts +144 -0
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -0
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +548 -0
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -0
- package/lib/cjs/components-react/toolbar/ItemWrapper.js +3 -3
- package/lib/cjs/components-react/toolbar/ItemWrapper.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Items.js +5 -5
- package/lib/cjs/components-react/toolbar/Items.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.js +3 -3
- package/lib/cjs/components-react/toolbar/Overflow.js.map +1 -1
- package/lib/cjs/components-react/toolbar/OverflowPanel.js +5 -5
- package/lib/cjs/components-react/toolbar/OverflowPanel.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItem.js +4 -4
- package/lib/cjs/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js +4 -4
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.js +2 -2
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.d.ts +3 -3
- package/lib/cjs/components-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/Toolbar.js +2 -69
- package/lib/cjs/components-react/toolbar/Toolbar.js.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts +6 -106
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js +6 -481
- package/lib/cjs/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.d.ts +14 -0
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.d.ts.map +1 -0
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js +118 -0
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -0
- package/lib/cjs/components-react/tree/controlled/Observable.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/Observable.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/Observable.js +3 -4
- package/lib/cjs/components-react/tree/controlled/Observable.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts +1 -2
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js +37 -68
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventHandler.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventHandler.js +6 -7
- package/lib/cjs/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeModel.js +7 -8
- package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js +28 -35
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js +6 -14
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js +3 -3
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js +1 -2
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js +2 -2
- package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +2 -3
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js +53 -100
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/cjs/components-react.d.ts +6 -2
- package/lib/cjs/components-react.d.ts.map +1 -1
- package/lib/cjs/components-react.js +6 -2
- package/lib/cjs/components-react.js.map +1 -1
- package/lib/esm/components-react/common/DelayedSpinner.js +2 -3
- package/lib/esm/components-react/common/DelayedSpinner.js.map +1 -1
- package/lib/esm/components-react/common/SubscriptionScheduler.d.ts +1 -1
- package/lib/esm/components-react/common/SubscriptionScheduler.d.ts.map +1 -1
- package/lib/esm/components-react/common/SubscriptionScheduler.js +12 -17
- package/lib/esm/components-react/common/SubscriptionScheduler.js.map +1 -1
- package/lib/esm/components-react/common/UseAsyncValue.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseAsyncValue.js +1 -3
- package/lib/esm/components-react/common/UseAsyncValue.js.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.d.ts.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js +7 -6
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/esm/components-react/converters/NumericTypeConverter.js +2 -4
- package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/StringTypeConverter.d.ts.map +1 -1
- package/lib/esm/components-react/converters/StringTypeConverter.js +3 -5
- package/lib/esm/components-react/converters/StringTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverter.js +1 -2
- package/lib/esm/components-react/converters/TypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverterManager.d.ts.map +1 -1
- package/lib/esm/components-react/converters/TypeConverterManager.js +7 -1
- package/lib/esm/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.js +6 -8
- package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/esm/components-react/editors/DateTimeEditor.js +2 -3
- package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.js +3 -4
- package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
- package/lib/esm/components-react/editors/TextEditor.js +2 -4
- package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.js +3 -3
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts +23 -9
- package/lib/esm/components-react/filter-builder/FilterBuilder.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilder.js +17 -7
- package/lib/esm/components-react/filter-builder/FilterBuilder.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts +8 -5
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js +46 -18
- package/lib/esm/components-react/filter-builder/FilterBuilderContext.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js +8 -5
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRule.scss +8 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js +3 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.d.ts +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js +1 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js +3 -3
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleProperty.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts +11 -2
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js +3 -4
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleValue.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts +58 -12
- package/lib/esm/components-react/filter-builder/FilterBuilderState.d.ts.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js +100 -7
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js +3 -4
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js +1 -1
- package/lib/esm/components-react/properties/renderers/NonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js +2 -3
- package/lib/esm/components-react/properties/renderers/PrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js +4 -4
- package/lib/esm/components-react/properties/renderers/label/PropertyLabelRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js +1 -2
- package/lib/esm/components-react/properties/renderers/value/DoublePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js +3 -6
- package/lib/esm/components-react/properties/renderers/value/MultilineTextPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js +1 -2
- package/lib/esm/components-react/properties/renderers/value/NavigationPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js +3 -6
- package/lib/esm/components-react/properties/renderers/value/PrimitivePropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -2
- package/lib/esm/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -2
- package/lib/esm/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js +1 -2
- package/lib/esm/components-react/propertygrid/component/PropertyCategoryBlock.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +2 -2
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js +48 -54
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js +11 -13
- package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +2 -2
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js +1 -2
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js +1 -2
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCustomGridCategory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +2 -2
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js +2 -3
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridCategory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableGridItemFactory.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatNonPrimitivePropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js +5 -7
- package/lib/esm/components-react/propertygrid/internal/flat-properties/FlatPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/selectable-content/SelectableContent.js +2 -3
- package/lib/esm/components-react/selectable-content/SelectableContent.js.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts +144 -0
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.d.ts.map +1 -0
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +512 -0
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -0
- package/lib/esm/components-react/toolbar/ItemWrapper.js +1 -1
- package/lib/esm/components-react/toolbar/ItemWrapper.js.map +1 -1
- package/lib/esm/components-react/toolbar/Items.js +1 -1
- package/lib/esm/components-react/toolbar/Items.js.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.js +1 -1
- package/lib/esm/components-react/toolbar/Overflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.js +1 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.js +1 -1
- package/lib/esm/components-react/toolbar/PopupItem.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.js +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.d.ts +3 -3
- package/lib/esm/components-react/toolbar/Toolbar.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/Toolbar.js +2 -66
- package/lib/esm/components-react/toolbar/Toolbar.js.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts +6 -106
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.d.ts.map +1 -1
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js +5 -471
- package/lib/esm/components-react/toolbar/ToolbarWithOverflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.d.ts +14 -0
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.d.ts.map +1 -0
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js +91 -0
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -0
- package/lib/esm/components-react/tree/controlled/Observable.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/Observable.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/Observable.js +1 -2
- package/lib/esm/components-react/tree/controlled/Observable.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts +1 -2
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js +24 -55
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventHandler.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventHandler.js +1 -2
- package/lib/esm/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeModel.js +7 -8
- package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js +18 -25
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.js +6 -14
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js +3 -3
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js +1 -2
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts +2 -3
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js +52 -99
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/esm/components-react.d.ts +6 -2
- package/lib/esm/components-react.d.ts.map +1 -1
- package/lib/esm/components-react.js +6 -2
- package/lib/esm/components-react.js.map +1 -1
- package/lib/public/locales/en/UiComponents.json +4 -1
- package/package.json +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,28 @@
|
|
|
1
1
|
# Change Log - @itwin/components-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Wed, 06 Sep 2023 17:29:22 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
|
-
## 4.
|
|
6
|
-
|
|
5
|
+
## 4.5.0
|
|
6
|
+
Wed, 06 Sep 2023 17:29:22 GMT
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
### Updates
|
|
9
|
+
|
|
10
|
+
- `usePropertyFilterBuilder`: Added ability to build filter without showing errors.
|
|
11
|
+
- Fixed `TreeNodeLoader` adding loaded nodes to model when `loadNode` observable is unsubscribed before nodes request is completed.
|
|
12
|
+
- Remove `require` call in `TypeConverterManager`.
|
|
13
|
+
- Improved `Toolbar` and `ToolbarWithOverflow` documentation regarding orientation.
|
|
14
|
+
- Bump `rxjs` dependency to `7.8.1`.
|
|
15
|
+
- `ControlledTree`: Fixed range selection over nodes that are not loaded causing browser to hang.
|
|
16
|
+
|
|
17
|
+
## 4.4.0
|
|
18
|
+
Tue, 15 Aug 2023 18:02:09 GMT
|
|
19
|
+
|
|
20
|
+
### Updates
|
|
21
|
+
|
|
22
|
+
- Add `PropertyFilterBuilderRenderer`, `PropertyFilterBuilderRendererProps`, `defaultPropertyFilterBuilderRuleValidator`, `UsePropertyFilterBuilderProps`, `UsePropertyFilterBuilderResult`, `usePropertyFilterBuilder`, marked as beta. Promote `isPropertyFilterBuilderRuleGroup`, `PropertyFilterBuilderRule`, `PropertyFilterBuilderRuleGroup`, `PropertyFilterBuilderRuleGroupItem`, `PropertyFilterBuilderState` to beta.
|
|
23
|
+
- `PropertyFilterBuilder`: clear rule values when operator changes.
|
|
24
|
+
- `PropertyFilterBuilder`: Fix bug where user can't change rule group operator.
|
|
25
|
+
- Promote `PropertyFilterBuilderRuleOperatorProps`, `PropertyFilterBuilderRuleValueProps`, `PropertyFilterBuilderRuleValue` to beta, create interface `PropertyFilterBuilderRuleValueRendererProps` which extends `PropertyFilterBuilderRuleValueProps`, pass `PropertyFilterRuleOperator` to custom `PropertyFilterBuilderRuleValue` renderer.
|
|
9
26
|
|
|
10
27
|
## 4.3.0
|
|
11
28
|
Mon, 17 Jul 2023 10:16:20 GMT
|
|
@@ -38,8 +38,7 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
38
38
|
* @internal
|
|
39
39
|
*/
|
|
40
40
|
function DelayedSpinner(props) {
|
|
41
|
-
|
|
42
|
-
const delay = (_a = props.delay) !== null && _a !== void 0 ? _a : 500;
|
|
41
|
+
const delay = props.delay ?? 500;
|
|
43
42
|
const [loadStart] = React.useState(props.loadStart || new Date());
|
|
44
43
|
const currTime = new Date();
|
|
45
44
|
const diff = currTime.getTime() - loadStart.getTime();
|
|
@@ -52,7 +51,7 @@ function DelayedSpinner(props) {
|
|
|
52
51
|
});
|
|
53
52
|
if (diff < delay)
|
|
54
53
|
return null;
|
|
55
|
-
return React.createElement(itwinui_react_1.ProgressRadial, { indeterminate: true, size:
|
|
54
|
+
return React.createElement(itwinui_react_1.ProgressRadial, { indeterminate: true, size: props.size ?? "large" });
|
|
56
55
|
}
|
|
57
56
|
exports.DelayedSpinner = DelayedSpinner;
|
|
58
57
|
const useForceUpdate = () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DelayedSpinner.js","sourceRoot":"","sources":["../../../../src/components-react/common/DelayedSpinner.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,wDAAsD;AAetD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAA0B
|
|
1
|
+
{"version":3,"file":"DelayedSpinner.js","sourceRoot":"","sources":["../../../../src/components-react/common/DelayedSpinner.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,wDAAsD;AAetD;;;GAGG;AACH,SAAgB,cAAc,CAAC,KAA0B;IACvD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC;IACjC,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,IAAI,EAAE,CAAC,CAAC;IAElE,MAAM,QAAQ,GAAG,IAAI,IAAI,EAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,EAAE,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC;IAEtD,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,IAAI,IAAI,KAAK;YAAE,OAAO;QAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,KAAK,GAAG,IAAI,CAAC,CAAC;QAC/C,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;IAEH,IAAI,IAAI,GAAG,KAAK;QAAE,OAAO,IAAI,CAAC;IAE9B,OAAO,oBAAC,8BAAc,IAAC,aAAa,QAAC,IAAI,EAAE,KAAK,CAAC,IAAI,IAAI,OAAO,GAAI,CAAC;AACvE,CAAC;AAjBD,wCAiBC;AAED,MAAM,cAAc,GAAG,GAAG,EAAE;IAC1B,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;AAC3B,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport * as React from \"react\";\nimport type { ProgressRadialProps } from \"@itwin/itwinui-react\";\nimport { ProgressRadial } from \"@itwin/itwinui-react\";\n\n/** Type for ProgressRadialProps.size */\ntype RadialSizeType = ProgressRadialProps[\"size\"];\n\n/**\n * Props for [[DelayedSpinner]] component.\n * @internal\n */\nexport interface DelayedSpinnerProps {\n loadStart?: Date;\n delay?: number;\n size?: RadialSizeType;\n}\n\n/**\n * Spinner that is rendered with delay.\n * @internal\n */\nexport function DelayedSpinner(props: DelayedSpinnerProps) {\n const delay = props.delay ?? 500;\n const [loadStart] = React.useState(props.loadStart || new Date());\n\n const currTime = new Date();\n const diff = currTime.getTime() - loadStart.getTime();\n\n const update = useForceUpdate();\n React.useEffect(() => {\n if (diff >= delay) return;\n const timer = setTimeout(update, delay - diff);\n return () => clearTimeout(timer);\n });\n\n if (diff < delay) return null;\n\n return <ProgressRadial indeterminate size={props.size ?? \"large\"} />;\n}\n\nconst useForceUpdate = () => {\n const [value, set] = React.useState(true);\n return () => set(!value);\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionScheduler.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"SubscriptionScheduler.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAe,UAAU,EAAE,MAAM,MAAM,CAAC;AAmBpD;;;;;;;;GAQG;AACH,qBAAa,qBAAqB,CAAC,CAAC;IAClC,OAAO,CAAC,UAAU,CAAiC;;IA6BnD;;;;;;;;OAQG;IACI,oBAAoB,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC;CAelE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EACpC,SAAS,EAAE,qBAAqB,CAAC,CAAC,CAAC,GAClC,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,UAAU,CAAC,CAAC,CAAC,CAE1C"}
|
|
@@ -8,19 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.scheduleSubscription = exports.SubscriptionScheduler = void 0;
|
|
11
|
-
const
|
|
12
|
-
const empty_1 = require("rxjs/internal/observable/empty");
|
|
13
|
-
const iif_1 = require("rxjs/internal/observable/iif");
|
|
14
|
-
const finalize_1 = require("rxjs/internal/operators/finalize");
|
|
15
|
-
const mergeMap_1 = require("rxjs/internal/operators/mergeMap");
|
|
16
|
-
const observeOn_1 = require("rxjs/internal/operators/observeOn");
|
|
17
|
-
const onErrorResumeNext_1 = require("rxjs/internal/operators/onErrorResumeNext");
|
|
18
|
-
const publish_1 = require("rxjs/internal/operators/publish");
|
|
19
|
-
const refCount_1 = require("rxjs/internal/operators/refCount");
|
|
20
|
-
const subscribeOn_1 = require("rxjs/internal/operators/subscribeOn");
|
|
21
|
-
const asap_1 = require("rxjs/internal/scheduler/asap");
|
|
22
|
-
const queue_1 = require("rxjs/internal/scheduler/queue");
|
|
23
|
-
const Subject_1 = require("rxjs/internal/Subject");
|
|
11
|
+
const rxjs_1 = require("rxjs");
|
|
24
12
|
const MAX_CONCURRENT_SUBSCRIPTIONS = 1;
|
|
25
13
|
/**
|
|
26
14
|
* Limits concurrent observable subscriptions to one.
|
|
@@ -33,18 +21,22 @@ const MAX_CONCURRENT_SUBSCRIPTIONS = 1;
|
|
|
33
21
|
*/
|
|
34
22
|
class SubscriptionScheduler {
|
|
35
23
|
constructor() {
|
|
36
|
-
this._scheduler = new
|
|
24
|
+
this._scheduler = new rxjs_1.Subject();
|
|
37
25
|
this._scheduler
|
|
38
|
-
.pipe((0,
|
|
39
|
-
//
|
|
40
|
-
(0,
|
|
26
|
+
.pipe((0, rxjs_1.mergeMap)((sourceObservable) => sourceObservable.pipe(
|
|
27
|
+
// connect source observable when scheduler subscribes
|
|
28
|
+
(0, rxjs_1.tap)({
|
|
29
|
+
subscribe: () => {
|
|
30
|
+
sourceObservable.connect();
|
|
31
|
+
},
|
|
32
|
+
}),
|
|
41
33
|
// Guard against stack overflow when a lot of observables are scheduled. Without this operation `mergeMap`
|
|
42
34
|
// will process each observable that is present in the pipeline recursively.
|
|
43
|
-
(0,
|
|
35
|
+
(0, rxjs_1.observeOn)(rxjs_1.queueScheduler),
|
|
44
36
|
// Delay the connection until another event loop task
|
|
45
|
-
(0,
|
|
37
|
+
(0, rxjs_1.subscribeOn)(rxjs_1.asapScheduler),
|
|
46
38
|
// Ignore errors in this pipeline without suppressing them for other subscribers
|
|
47
|
-
(0,
|
|
39
|
+
(0, rxjs_1.onErrorResumeNextWith)()), MAX_CONCURRENT_SUBSCRIPTIONS))
|
|
48
40
|
// Start consuming scheduled observables
|
|
49
41
|
.subscribe();
|
|
50
42
|
}
|
|
@@ -58,12 +50,15 @@ class SubscriptionScheduler {
|
|
|
58
50
|
* @returns Hot observable which starts emitting `source` values after subscription.
|
|
59
51
|
*/
|
|
60
52
|
scheduleSubscription(source) {
|
|
61
|
-
return (0,
|
|
53
|
+
return (0, rxjs_1.defer)(() => {
|
|
62
54
|
let unsubscribed = false;
|
|
63
55
|
// Do not subscribe to source observable if it was unsubscribed from before being processed by the scheduler
|
|
64
|
-
const connectableObservable = (0,
|
|
56
|
+
const connectableObservable = (0, rxjs_1.connectable)((0, rxjs_1.iif)(() => unsubscribed, rxjs_1.EMPTY, source), {
|
|
57
|
+
connector: () => new rxjs_1.Subject(),
|
|
58
|
+
resetOnDisconnect: false,
|
|
59
|
+
});
|
|
65
60
|
this._scheduler.next(connectableObservable);
|
|
66
|
-
return connectableObservable.pipe((0,
|
|
61
|
+
return connectableObservable.pipe((0, rxjs_1.finalize)(() => (unsubscribed = true)));
|
|
67
62
|
});
|
|
68
63
|
}
|
|
69
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubscriptionScheduler.js","sourceRoot":"","sources":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;
|
|
1
|
+
{"version":3,"file":"SubscriptionScheduler.js","sourceRoot":"","sources":["../../../../src/components-react/common/SubscriptionScheduler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,+BAcc;AAEd,MAAM,4BAA4B,GAAG,CAAC,CAAC;AAEvC;;;;;;;;GAQG;AACH,MAAa,qBAAqB;IAGhC;QAFQ,eAAU,GAAG,IAAI,cAAO,EAAkB,CAAC;QAGjD,IAAI,CAAC,UAAU;aACZ,IAAI,CACH,IAAA,eAAQ,EACN,CAAC,gBAAgB,EAAE,EAAE,CACnB,gBAAgB,CAAC,IAAI;QACnB,sDAAsD;QACtD,IAAA,UAAG,EAAC;YACF,SAAS,EAAE,GAAG,EAAE;gBACd,gBAAgB,CAAC,OAAO,EAAE,CAAC;YAC7B,CAAC;SACF,CAAC;QACF,0GAA0G;QAC1G,4EAA4E;QAC5E,IAAA,gBAAS,EAAC,qBAAc,CAAC;QACzB,qDAAqD;QACrD,IAAA,kBAAW,EAAC,oBAAa,CAAC;QAC1B,gFAAgF;QAChF,IAAA,4BAAqB,GAAE,CACxB,EACH,4BAA4B,CAC7B,CACF;YACD,wCAAwC;aACvC,SAAS,EAAE,CAAC;IACjB,CAAC;IAED;;;;;;;;OAQG;IACI,oBAAoB,CAAC,MAAqB;QAC/C,OAAO,IAAA,YAAK,EAAC,GAAG,EAAE;YAChB,IAAI,YAAY,GAAG,KAAK,CAAC;YACzB,4GAA4G;YAC5G,MAAM,qBAAqB,GAAG,IAAA,kBAAW,EACvC,IAAA,UAAG,EAAC,GAAG,EAAE,CAAC,YAAY,EAAE,YAAK,EAAE,MAAM,CAAC,EACtC;gBACE,SAAS,EAAE,GAAG,EAAE,CAAC,IAAI,cAAO,EAAK;gBACjC,iBAAiB,EAAE,KAAK;aACzB,CACF,CAAC;YACF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;YAC5C,OAAO,qBAAqB,CAAC,IAAI,CAAC,IAAA,eAAQ,EAAC,GAAG,EAAE,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3E,CAAC,CAAC,CAAC;IACL,CAAC;CACF;AAtDD,sDAsDC;AAED;;;GAGG;AACH,SAAgB,oBAAoB,CAClC,SAAmC;IAEnC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,SAAS,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC5D,CAAC;AAJD,oDAIC","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 type { Connectable, Observable } from \"rxjs\";\nimport {\n asapScheduler,\n connectable,\n defer,\n EMPTY,\n finalize,\n iif,\n mergeMap,\n observeOn,\n onErrorResumeNextWith,\n queueScheduler,\n Subject,\n subscribeOn,\n tap,\n} from \"rxjs\";\n\nconst MAX_CONCURRENT_SUBSCRIPTIONS = 1;\n\n/**\n * Limits concurrent observable subscriptions to one.\n *\n * Scheduled observables are placed at the end of a queue. Each queued observable is subscribed to and awaited until the\n * completion.\n *\n * To schedule an observable, subscribe to the result of `scheduleSubscription()` call.\n * @internal\n */\nexport class SubscriptionScheduler<T> {\n private _scheduler = new Subject<Connectable<T>>();\n\n constructor() {\n this._scheduler\n .pipe(\n mergeMap(\n (sourceObservable) =>\n sourceObservable.pipe(\n // connect source observable when scheduler subscribes\n tap({\n subscribe: () => {\n sourceObservable.connect();\n },\n }),\n // Guard against stack overflow when a lot of observables are scheduled. Without this operation `mergeMap`\n // will process each observable that is present in the pipeline recursively.\n observeOn(queueScheduler),\n // Delay the connection until another event loop task\n subscribeOn(asapScheduler),\n // Ignore errors in this pipeline without suppressing them for other subscribers\n onErrorResumeNextWith()\n ),\n MAX_CONCURRENT_SUBSCRIPTIONS\n )\n )\n // Start consuming scheduled observables\n .subscribe();\n }\n\n /**\n * Schedules `source` for subscription in the current scheduler.\n *\n * The actual scheduling is performed when the returned observable is subscribed to. To cancel, remove all subscribers\n * from the returned observable.\n *\n * @param source Input observable for which to schedule a subscription.\n * @returns Hot observable which starts emitting `source` values after subscription.\n */\n public scheduleSubscription(source: Observable<T>): Observable<T> {\n return defer(() => {\n let unsubscribed = false;\n // Do not subscribe to source observable if it was unsubscribed from before being processed by the scheduler\n const connectableObservable = connectable(\n iif(() => unsubscribed, EMPTY, source),\n {\n connector: () => new Subject<T>(),\n resetOnDisconnect: false,\n }\n );\n this._scheduler.next(connectableObservable);\n return connectableObservable.pipe(finalize(() => (unsubscribed = true)));\n });\n }\n}\n\n/**\n * Helper function for use as a `pipe()` argument with `rxjs` observables.\n * @internal\n */\nexport function scheduleSubscription<T>(\n scheduler: SubscriptionScheduler<T>\n): (source: Observable<T>) => Observable<T> {\n return (source) => scheduler.scheduleSubscription(source);\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseAsyncValue.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/UseAsyncValue.tsx"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"UseAsyncValue.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/UseAsyncValue.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAMH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAiCzE"}
|
|
@@ -32,22 +32,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
33
|
exports.useAsyncValue = void 0;
|
|
34
34
|
const React = __importStar(require("react"));
|
|
35
|
-
const
|
|
36
|
-
const takeUntil_1 = require("rxjs/internal/operators/takeUntil");
|
|
37
|
-
const Subject_1 = require("rxjs/internal/Subject");
|
|
35
|
+
const rxjs_1 = require("rxjs");
|
|
38
36
|
const core_react_1 = require("@itwin/core-react");
|
|
39
37
|
/**
|
|
40
38
|
* Custom hook for working with possibly async values.
|
|
41
39
|
* @public
|
|
42
40
|
*/
|
|
43
41
|
function useAsyncValue(value) {
|
|
44
|
-
const cancelled = React.useMemo(() => new
|
|
42
|
+
const cancelled = React.useMemo(() => new rxjs_1.Subject(), []);
|
|
45
43
|
// cancel any pending promises on unmount
|
|
46
44
|
React.useEffect(() => () => cancelled.next(), [cancelled]);
|
|
47
45
|
const [result, setResult] = React.useState(() => {
|
|
48
46
|
if ((0, core_react_1.isPromiseLike)(value)) {
|
|
49
|
-
(0,
|
|
50
|
-
.pipe((0,
|
|
47
|
+
(0, rxjs_1.from)(value)
|
|
48
|
+
.pipe((0, rxjs_1.takeUntil)(cancelled))
|
|
51
49
|
.subscribe({ next: (resolvedValue) => setResult(resolvedValue) });
|
|
52
50
|
return undefined;
|
|
53
51
|
}
|
|
@@ -59,8 +57,8 @@ function useAsyncValue(value) {
|
|
|
59
57
|
setResult(newValue);
|
|
60
58
|
};
|
|
61
59
|
if ((0, core_react_1.isPromiseLike)(value)) {
|
|
62
|
-
const subscription = (0,
|
|
63
|
-
.pipe((0,
|
|
60
|
+
const subscription = (0, rxjs_1.from)(value)
|
|
61
|
+
.pipe((0, rxjs_1.takeUntil)(cancelled))
|
|
64
62
|
.subscribe({ next: (resolvedValue) => updateValue(resolvedValue) });
|
|
65
63
|
return () => subscription.unsubscribe();
|
|
66
64
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseAsyncValue.js","sourceRoot":"","sources":["../../../../src/components-react/common/UseAsyncValue.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B
|
|
1
|
+
{"version":3,"file":"UseAsyncValue.js","sourceRoot":"","sources":["../../../../src/components-react/common/UseAsyncValue.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAC/B,+BAAgD;AAChD,kDAAsE;AAEtE;;;GAGG;AACH,SAAgB,aAAa,CAAI,KAAyB;IACxD,MAAM,SAAS,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,cAAO,EAAQ,EAAE,EAAE,CAAC,CAAC;IAC/D,yCAAyC;IACzC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAE3D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,GAAG,EAAE;QAC9C,IAAI,IAAA,0BAAa,EAAC,KAAK,CAAC,EAAE;YACxB,IAAA,WAAI,EAAC,KAAK,CAAC;iBACR,IAAI,CAAC,IAAA,gBAAS,EAAC,SAAS,CAAC,CAAC;iBAC1B,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YACpE,OAAO,SAAS,CAAC;SAClB;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;IAEH,IAAA,+BAAkB,EAAC,GAAG,EAAE;QACtB,MAAM,WAAW,GAAG,CAAC,QAAW,EAAE,EAAE;YAClC,SAAS,CAAC,IAAI,EAAE,CAAC;YACjB,SAAS,CAAC,QAAQ,CAAC,CAAC;QACtB,CAAC,CAAC;QAEF,IAAI,IAAA,0BAAa,EAAC,KAAK,CAAC,EAAE;YACxB,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,KAAK,CAAC;iBAC7B,IAAI,CAAC,IAAA,gBAAS,EAAC,SAAS,CAAC,CAAC;iBAC1B,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,aAAa,EAAE,EAAE,CAAC,WAAW,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;YACtE,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC;SACzC;QAED,WAAW,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,SAAS,CAAC;IACnB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC,CAAC;IAEvB,OAAO,MAAM,CAAC;AAChB,CAAC;AAjCD,sCAiCC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Common\n */\n\nimport * as React from \"react\";\nimport { from, Subject, takeUntil } from \"rxjs\";\nimport { isPromiseLike, useEffectSkipFirst } from \"@itwin/core-react\";\n\n/**\n * Custom hook for working with possibly async values.\n * @public\n */\nexport function useAsyncValue<T>(value: T | PromiseLike<T>): T | undefined {\n const cancelled = React.useMemo(() => new Subject<void>(), []);\n // cancel any pending promises on unmount\n React.useEffect(() => () => cancelled.next(), [cancelled]);\n\n const [result, setResult] = React.useState(() => {\n if (isPromiseLike(value)) {\n from(value)\n .pipe(takeUntil(cancelled))\n .subscribe({ next: (resolvedValue) => setResult(resolvedValue) });\n return undefined;\n }\n return value;\n });\n\n useEffectSkipFirst(() => {\n const updateValue = (newValue: T) => {\n cancelled.next();\n setResult(newValue);\n };\n\n if (isPromiseLike(value)) {\n const subscription = from(value)\n .pipe(takeUntil(cancelled))\n .subscribe({ next: (resolvedValue) => updateValue(resolvedValue) });\n return () => subscription.unsubscribe();\n }\n\n updateValue(value);\n return undefined;\n }, [value, cancelled]);\n\n return result;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseDebouncedAsyncValue.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/UseDebouncedAsyncValue.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"UseDebouncedAsyncValue.d.ts","sourceRoot":"","sources":["../../../../src/components-react/common/UseDebouncedAsyncValue.ts"],"names":[],"mappings":"AAIA;;GAEG;AASH;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAC5C,iBAAiB,EAAE,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;;;EAsDxD"}
|
|
@@ -9,9 +9,7 @@
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.useDebouncedAsyncValue = void 0;
|
|
11
11
|
const react_1 = require("react");
|
|
12
|
-
const
|
|
13
|
-
const publish_1 = require("rxjs/internal/operators/publish");
|
|
14
|
-
const refCount_1 = require("rxjs/internal/operators/refCount");
|
|
12
|
+
const rxjs_1 = require("rxjs");
|
|
15
13
|
const SubscriptionScheduler_1 = require("./SubscriptionScheduler");
|
|
16
14
|
/**
|
|
17
15
|
* Custom hook for working with promise values.
|
|
@@ -23,7 +21,6 @@ const SubscriptionScheduler_1 = require("./SubscriptionScheduler");
|
|
|
23
21
|
* @beta
|
|
24
22
|
*/
|
|
25
23
|
function useDebouncedAsyncValue(valueToBeResolved) {
|
|
26
|
-
var _a;
|
|
27
24
|
const scheduler = (0, react_1.useMemo)(() => new SubscriptionScheduler_1.SubscriptionScheduler(), []);
|
|
28
25
|
const [value, setValue] = (0, react_1.useState)();
|
|
29
26
|
const [inProgress, setInProgress] = (0, react_1.useState)(false);
|
|
@@ -39,8 +36,12 @@ function useDebouncedAsyncValue(valueToBeResolved) {
|
|
|
39
36
|
}
|
|
40
37
|
setInProgress(true);
|
|
41
38
|
// schedule and subscribe to the observable emitting value from valueToBeResolved promise
|
|
42
|
-
const subscription = (0,
|
|
43
|
-
.pipe((0,
|
|
39
|
+
const subscription = (0, rxjs_1.defer)(valueToBeResolved)
|
|
40
|
+
.pipe((0, rxjs_1.share)({
|
|
41
|
+
resetOnError: false,
|
|
42
|
+
resetOnComplete: false,
|
|
43
|
+
resetOnRefCountZero: true,
|
|
44
|
+
}), (0, SubscriptionScheduler_1.scheduleSubscription)(scheduler))
|
|
44
45
|
.subscribe({
|
|
45
46
|
next: (data) => {
|
|
46
47
|
setValue(data);
|
|
@@ -56,7 +57,7 @@ function useDebouncedAsyncValue(valueToBeResolved) {
|
|
|
56
57
|
};
|
|
57
58
|
}, [valueToBeResolved, scheduler]);
|
|
58
59
|
if (errorState.hasError)
|
|
59
|
-
throw (
|
|
60
|
+
throw (errorState.error ?? new Error("Exception in `useDebouncedAsyncValue`"));
|
|
60
61
|
return { value, inProgress };
|
|
61
62
|
}
|
|
62
63
|
exports.useDebouncedAsyncValue = useDebouncedAsyncValue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseDebouncedAsyncValue.js","sourceRoot":"","sources":["../../../../src/components-react/common/UseDebouncedAsyncValue.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,iCAAqD;AACrD
|
|
1
|
+
{"version":3,"file":"UseDebouncedAsyncValue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Aa,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC9C,aAAa,CAAC,KAAK,CAAC,CAAC;YACvB,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,UAAU,CAAC,QAAQ;QACrB,MAAM,CACJ,UAAU,CAAC,KAAK,IAAI,IAAI,KAAK,CAAC,uCAAuC,CAAC,CACvE,CAAC;IAEJ,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;AAC/B,CAAC;AAvDD,wDAuDC","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, useMemo, 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 = useMemo(() => new SubscriptionScheduler<TReturn>(), []);\n\n const [value, setValue] = useState<TReturn>();\n const [inProgress, setInProgress] = useState(false);\n const [errorState, setErrorState] = useState<{\n error: Error | undefined;\n hasError: boolean;\n }>({\n error: undefined,\n hasError: false,\n });\n\n useEffect(() => {\n if (!valueToBeResolved) {\n setValue(undefined);\n setInProgress(false);\n return;\n }\n\n setInProgress(true);\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 setValue(data);\n setInProgress(false);\n },\n error: (err) => {\n setErrorState({ error: err, hasError: true });\n setInProgress(false);\n },\n });\n\n return () => {\n subscription.unsubscribe();\n };\n }, [valueToBeResolved, scheduler]);\n\n if (errorState.hasError)\n throw (\n errorState.error ?? new Error(\"Exception in `useDebouncedAsyncValue`\")\n );\n\n return { value, inProgress };\n}\n"]}
|
|
@@ -46,7 +46,6 @@ class FloatTypeConverter extends NumericTypeConverterBase {
|
|
|
46
46
|
return Number.isNaN(parsedValue) ? undefined : parsedValue;
|
|
47
47
|
}
|
|
48
48
|
convertToString(value) {
|
|
49
|
-
var _a;
|
|
50
49
|
if (value === undefined)
|
|
51
50
|
return "";
|
|
52
51
|
let numericValue = 0;
|
|
@@ -56,7 +55,7 @@ class FloatTypeConverter extends NumericTypeConverterBase {
|
|
|
56
55
|
numericValue = 0;
|
|
57
56
|
}
|
|
58
57
|
else {
|
|
59
|
-
numericValue =
|
|
58
|
+
numericValue = FloatTypeConverter.parseString(value) ?? 0;
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
else {
|
|
@@ -88,7 +87,6 @@ class IntTypeConverter extends NumericTypeConverterBase {
|
|
|
88
87
|
return Number.isNaN(parsedValue) ? undefined : parsedValue;
|
|
89
88
|
}
|
|
90
89
|
convertToString(value) {
|
|
91
|
-
var _a;
|
|
92
90
|
if (value === undefined)
|
|
93
91
|
return "";
|
|
94
92
|
let numericValue = 0;
|
|
@@ -98,7 +96,7 @@ class IntTypeConverter extends NumericTypeConverterBase {
|
|
|
98
96
|
numericValue = 0;
|
|
99
97
|
}
|
|
100
98
|
else {
|
|
101
|
-
numericValue =
|
|
99
|
+
numericValue = IntTypeConverter.parseString(value) ?? 0;
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumericTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/NumericTypeConverter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,0DAA0D;AAE1D,mDAAgD;AAChD,iEAA8D;AAE9D;;;GAGG;AACH,MAAsB,wBACpB,SAAQ,6BAAa;IAGrB,IAAoB,iBAAiB;QACnC,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,UAAU,CAAC,CAAqB,EAAE,CAAqB;QAC5D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEM,mBAAmB,CACxB,CAAqB,EACrB,CAAqB;QAErB,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEM,aAAa,CAAC,CAAqB,EAAE,CAAqB;QAC/D,OAAO,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAEM,sBAAsB,CAC3B,CAAqB,EACrB,CAAqB;QAErB,OAAO,CAAC,IAAI,CAAC,CAAC;IAChB,CAAC;IAEM,WAAW,CAChB,CAAqB,EACrB,CAAqB,EACrB,WAAqB;QAErB,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACjB,CAAC;CACF;AArCD,4DAqCC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,wBAAwB;IACtD,MAAM,CAAC,WAAW,CAAC,KAAa;QACtC,MAAM,WAAW,GAAG,UAAU,CAAC,KAAK,CAAC,CAAC;QACtC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC;IAC7D,CAAC;IAEe,eAAe,CAAC,KAAwB
|
|
1
|
+
{"version":3,"file":"NumericTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/conver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,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;AA1BD,4CA0BC;AAED,2CAAoB,CAAC,iBAAiB,CAAC,kCAAiB,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAChF,2CAAoB,CAAC,iBAAiB,CACpC,kCAAiB,CAAC,OAAO,EACzB,gBAAgB,CACjB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module TypeConverters\n */\n\nimport type { Primitives } from \"@itwin/appui-abstract\";\nimport { StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type { LessGreaterOperatorProcessor } from \"./TypeConverter\";\nimport { TypeConverter } from \"./TypeConverter\";\nimport { TypeConverterManager } from \"./TypeConverterManager\";\n\n/**\n * Base Numeric Type Converter.\n * @public\n */\nexport abstract class NumericTypeConverterBase\n extends TypeConverter\n implements LessGreaterOperatorProcessor\n{\n public override get isLessGreaterType(): boolean {\n return true;\n }\n\n public isLessThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\n return a < b;\n }\n\n public isLessThanOrEqualTo(\n a: Primitives.Numeric,\n b: Primitives.Numeric\n ): boolean {\n return a <= b;\n }\n\n public isGreaterThan(a: Primitives.Numeric, b: Primitives.Numeric): boolean {\n return a > b;\n }\n\n public isGreaterThanOrEqualTo(\n a: Primitives.Numeric,\n b: Primitives.Numeric\n ): boolean {\n return a >= b;\n }\n\n public sortCompare(\n a: Primitives.Numeric,\n b: Primitives.Numeric,\n _ignoreCase?: boolean\n ): number {\n return +a - +b;\n }\n}\n\n/**\n * Float Type Converter.\n * @public\n */\nexport class FloatTypeConverter extends NumericTypeConverterBase {\n private static parseString(value: string): number | undefined {\n const parsedValue = parseFloat(value);\n return Number.isNaN(parsedValue) ? undefined : parsedValue;\n }\n\n public override convertToString(value?: Primitives.Float) {\n if (value === undefined) return \"\";\n\n let numericValue = 0;\n if (typeof value === \"string\") {\n if (value === \"-\" || value === \"\" || value === \"-0.0\" || value === \"-0\") {\n // handle these semi-valid values as 0\n numericValue = 0;\n } else {\n numericValue = FloatTypeConverter.parseString(value) ?? 0;\n }\n } else {\n numericValue = value;\n }\n // this is close to calling `toFixed(2)`, but cuts of any trailing zeros\n let stringValue = (Math.round(100 * numericValue) / 100).toString();\n // because this is a _float_ converter, we want to emphasize the number is a float - make\n // sure there's a decimal part\n if (stringValue.indexOf(\".\") === -1) stringValue += \".0\";\n return stringValue;\n }\n\n public override convertFromString(value: string): number | undefined {\n return FloatTypeConverter.parseString(value);\n }\n}\nTypeConverterManager.registerConverter(\n StandardTypeNames.Float,\n FloatTypeConverter\n);\nTypeConverterManager.registerConverter(\n StandardTypeNames.Double,\n FloatTypeConverter\n);\nTypeConverterManager.registerConverter(\n StandardTypeNames.Number,\n FloatTypeConverter\n);\n\n/**\n * Int Type Converter.\n * @public\n */\nexport class IntTypeConverter extends NumericTypeConverterBase {\n private static parseString(value: string): number | undefined {\n const parsedValue = parseInt(value, 10);\n return Number.isNaN(parsedValue) ? undefined : parsedValue;\n }\n\n public override convertToString(value?: Primitives.Int) {\n if (value === undefined) return \"\";\n\n let numericValue = 0;\n if (typeof value === \"string\") {\n if (value === \"-\" || value === \"\" || value === \"-0\") {\n // handle these semi-valid values as 0\n numericValue = 0;\n } else {\n numericValue = IntTypeConverter.parseString(value) ?? 0;\n }\n } else {\n numericValue = value;\n }\n return Math.round(numericValue).toString();\n }\n\n public override convertFromString(value: string): number | undefined {\n return IntTypeConverter.parseString(value);\n }\n}\n\nTypeConverterManager.registerConverter(StandardTypeNames.Int, IntTypeConverter);\nTypeConverterManager.registerConverter(\n StandardTypeNames.Integer,\n IntTypeConverter\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringTypeConverter.d.ts","sourceRoot":"","sources":["../../../../src/components-react/converters/StringTypeConverter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"StringTypeConverter.d.ts","sourceRoot":"","sources":["../../../../src/components-react/converters/StringTypeConverter.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,0DAA0D;IAC1D,UAAU,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAClE,wDAAwD;IACxD,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAChE,uDAAuD;IACvD,QAAQ,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OAAO,GAAG,OAAO,CAAC;IAChE,+DAA+D;IAC/D,cAAc,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,OA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MAAM,EAAE,MAAM,EACd,aAAa,EAAE,OAAO,GACrB,OAAO;IAIH,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAKhC,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAI1C,OAAO,CAAC,aAAa;CAKtB"}
|
|
@@ -8,9 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.StringTypeConverter = void 0;
|
|
11
|
-
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
12
11
|
const TypeConverter_1 = require("./TypeConverter");
|
|
13
|
-
const TypeConverterManager_1 = require("./TypeConverterManager");
|
|
14
12
|
/**
|
|
15
13
|
* String Type Converter.
|
|
16
14
|
* @public
|
|
@@ -93,7 +91,7 @@ class StringTypeConverter extends TypeConverter_1.TypeConverter {
|
|
|
93
91
|
}
|
|
94
92
|
}
|
|
95
93
|
exports.StringTypeConverter = StringTypeConverter;
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
94
|
+
/*
|
|
95
|
+
NOTE: As this is the default type converter, it's registrations are directly in TypeConverterManager file.
|
|
96
|
+
*/
|
|
99
97
|
//# sourceMappingURL=StringTypeConverter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/StringTypeConverter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,
|
|
1
|
+
{"version":3,"file":"StringTypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/StringTypeConverter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAGH,mDAAgD;AAwBhD;;;GAGG;AACH,MAAa,mBACX,SAAQ,6BAAa;IAGL,eAAe,CAAC,KAAyB;QACvD,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,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AO,CAAC,MAAc;QAC3B,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;QAC7C,OAAO,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC;IAC7B,CAAC;IAEM,UAAU,CAAC,MAAc;QAC9B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;IAEO,aAAa,CAAC,MAAc,EAAE,MAAe;QACnD,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QAC7C,IAAI,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,KAAK,CAAC;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAtHD,kDAsHC;AAED;;EAEE","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 { TypeConverter } from \"./TypeConverter\";\n\n/** Operators for string types\n * @public\n */\nexport interface StringOperatorProcessor {\n /** Determines if one string starts with another string */\n startsWith(a: string, b: string, caseSensitive: boolean): boolean;\n /** Determines if one string ends with another string */\n endsWith(a: string, b: string, caseSensitive: boolean): boolean;\n /** Determines if one string contains another string */\n contains(a: string, b: string, caseSensitive: boolean): boolean;\n /** Determines if one string does not contain another string */\n doesNotContain(a: string, b: string, caseSensitive: boolean): boolean;\n /** Determines if one string is contained within another string */\n isContainedIn(a: string, b: string, caseSensitive: boolean): boolean;\n /** Determines if one string is not contained within another string */\n isNotContainedIn(a: string, b: string, caseSensitive: boolean): boolean;\n /** Determines if a string is empty */\n isEmpty(a: string): boolean;\n /** Determines if a string is not empty */\n isNotEmpty(a: string): boolean;\n}\n\n/**\n * String Type Converter.\n * @public\n */\nexport class StringTypeConverter\n extends TypeConverter\n implements StringOperatorProcessor\n{\n public override convertToString(value?: Primitives.String) {\n return value ? value.toString() : \"\";\n }\n\n public override convertFromString(value: string) {\n return value;\n }\n\n public sortCompare(\n valueA: Primitives.String,\n valueB: Primitives.String,\n ignoreCase?: boolean\n ): number {\n if (!this.checkArgTypes(valueA, valueB)) return 0;\n if (ignoreCase)\n return valueA\n .toLocaleLowerCase()\n .localeCompare(valueB.toLocaleLowerCase());\n else return valueA.localeCompare(valueB);\n }\n\n public override get isStringType(): boolean {\n return true;\n }\n\n public startsWith(\n valueA: string,\n valueB: string,\n caseSensitive: boolean\n ): boolean {\n if (!valueA || !valueB || !this.checkArgTypes(valueA, valueB)) return false;\n\n if (caseSensitive) return valueA.substring(0, valueB.length) === valueB;\n\n return (\n valueA.toLocaleUpperCase().substring(0, valueB.length) ===\n valueB.toLocaleUpperCase()\n );\n }\n\n public endsWith(\n valueA: string,\n valueB: string,\n caseSensitive: boolean\n ): boolean {\n if (!valueA || !valueB || !this.checkArgTypes(valueA, valueB)) return false;\n\n const position = valueA.length - valueB.length;\n if (position < 0) return false;\n\n let lastIndex: number;\n if (caseSensitive) lastIndex = valueA.indexOf(valueB, position);\n else\n lastIndex = valueA\n .toLocaleUpperCase()\n .indexOf(valueB.toLocaleUpperCase(), position);\n\n return lastIndex !== -1 && lastIndex === position;\n }\n\n public contains(\n valueA: string,\n valueB: string,\n caseSensitive: boolean\n ): boolean {\n if (!valueA || !valueB || !this.checkArgTypes(valueA, valueB)) return false;\n\n if (valueB.length > valueA.length) return false;\n\n if (caseSensitive) return valueA.indexOf(valueB, 0) !== -1;\n\n return (\n valueA.toLocaleUpperCase().indexOf(valueB.toLocaleUpperCase(), 0) !== -1\n );\n }\n\n public doesNotContain(\n valueA: string,\n valueB: string,\n caseSensitive: boolean\n ): boolean {\n return !this.contains(valueA, valueB, caseSensitive);\n }\n\n public isContainedIn(\n valueA: string,\n valueB: string,\n caseSensitive: boolean\n ): boolean {\n return this.contains(valueB, valueA, caseSensitive);\n }\n\n public isNotContainedIn(\n valueA: string,\n valueB: string,\n caseSensitive: boolean\n ): boolean {\n return this.doesNotContain(valueB, valueA, caseSensitive);\n }\n\n public isEmpty(valueA: string): boolean {\n if (!this.checkArgTypes(valueA)) return true;\n return valueA.length === 0;\n }\n\n public isNotEmpty(valueA: string): boolean {\n return !this.isEmpty(valueA);\n }\n\n private checkArgTypes(valueA: string, valueB?: string): boolean {\n if (typeof valueA !== \"string\") return false;\n if (valueB && typeof valueB !== \"string\") return false;\n return true;\n }\n}\n\n/*\nNOTE: As this is the default type converter, it's registrations are directly in TypeConverterManager file.\n*/\n"]}
|
|
@@ -34,8 +34,7 @@ class TypeConverter {
|
|
|
34
34
|
}
|
|
35
35
|
/** Converts a value associated with a property description to a string */
|
|
36
36
|
convertPropertyToString(propertyDescription, value) {
|
|
37
|
-
|
|
38
|
-
return this.convertToStringWithOptions(value, (_a = propertyDescription.converter) === null || _a === void 0 ? void 0 : _a.options);
|
|
37
|
+
return this.convertToStringWithOptions(value, propertyDescription.converter?.options);
|
|
39
38
|
}
|
|
40
39
|
/** Converts a string with a property record to a property value */
|
|
41
40
|
async convertFromStringToPropertyValue(value, propertyRecord) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/TypeConverter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAWH,0DAA4D;AAiD5D;;;GAGG;AACH,MAAsB,aAAa;IAGjC,6CAA6C;IACtC,eAAe,CAAC,KAAwB;QAC7C,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACnC,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
|
|
1
|
+
{"version":3,"file":"TypeConverter.js","sourceRoot":"","sources":["../../../../src/components-react/converters/TypeConverter.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAWH,0DAA4D;AAiD5D;;;GAGG;AACH,MAAsB,aAAa;IAGjC,6CAA6C;IACtC,eAAe,CAAC,KAAwB;QAC7C,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;IAED,wEAAwE;IACjE,0BAA0B,CAC/B,KAAwB,EACxB,QAAiC;QAEjC,OAAO,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;IAED,6CAA6C;IACtC,iBAAiB,CACtB,MAAc;QAKd,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,0EAA0E;IACnE,4BAA4B,CACjC,KAAa,EACb,QAAiC;QAKjC,OAAO,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;IACvC,CAAC;IAED,0EAA0E;IACnE,uBAAuB,CAC5B,mBAAwC,EACxC,KAAwB;QAExB,OAAO,IAAI,CAAC,0BAA0B,CACpC,KAAK,EACL,mBAAmB,CAAC,SAAS,EAAE,OAAO,CACvC,CAAC;IACJ,CAAC;IAED,mEAAmE;IAC5D,KAAK,CAAC,gCAAgC,CAC3C,KAAa,EACb,cAA+B;QAE/B,MAAM,gBAAgB,GACpB,cAAc,IAAI,cAAc,CAAC,QAAQ,CAAC,SAAS;YACjD,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO;YAC3C,CAAC,CAAC,SAAS,CAAC;QAChB,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,4BAA4B,CACzD,KAAK,EACL,gBAAgB,CACjB,CAAC;QACF,MAAM,aAAa,GAAmB;YACpC,WAAW,EAAE,oCAAmB,CAAC,SAAS;YAC1C,KAAK,EAAE,WAAW;YAClB,YAAY,EAAE,EAAE;SACjB,CAAC;QACF,OAAO,aAAa,CAAC;IACvB,CAAC;IASD,mDAAmD;IAC5C,SAAS,CACd,MAAwB,EACxB,MAAwB;QAExB,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,uDAAuD;IAChD,YAAY,CACjB,MAAwB,EACxB,MAAwB;QAExB,OAAO,MAAM,KAAK,MAAM,CAAC;IAC3B,CAAC;IAED,2DAA2D;IACpD,MAAM,CAAC,KAAuB;QACnC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,mEAAmE;IAC5D,SAAS,CAAC,KAAuB;QACtC,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,CAAC;IAC/C,CAAC;IAED,uDAAuD;IACvD,IAAW,YAAY;QACrB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,wDAAwD;IACxD,IAAW,iBAAiB;QAC1B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,wDAAwD;IACxD,IAAW,aAAa;QACtB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,yDAAyD;IACzD,IAAW,cAAc;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AAvHD,sCAuHC","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 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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeConverterManager.d.ts","sourceRoot":"","sources":["../../../../src/components-react/converters/TypeConverterManager.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"TypeConverterManager.d.ts","sourceRoot":"","sources":["../../../../src/components-react/converters/TypeConverterManager.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;;GAGG;AACH,qBAAa,oBAAoB;IAC/B,OAAO,CAAC,MAAM,CAAC,WAAW,CAA0C;IACpE,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAAgB;IAEpD,OAAO,CAAC,MAAM,CAAC,oBAAoB;WASrB,iBAAiB,CAC7B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,UAAU,aAAa,EAClC,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI;WAkBO,mBAAmB,CAC/B,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM,GACrB,IAAI;WAYO,YAAY,CACxB,QAAQ,EAAE,MAAM,EAChB,aAAa,CAAC,EAAE,MAAM,GACrB,aAAa;CAcjB"}
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.TypeConverterManager = void 0;
|
|
11
|
+
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
12
|
+
const StringTypeConverter_1 = require("./StringTypeConverter");
|
|
11
13
|
/**
|
|
12
14
|
* Manages Type Converters. Type Converters are registered with and obtained from the manager.
|
|
13
15
|
* @public
|
|
@@ -40,12 +42,16 @@ class TypeConverterManager {
|
|
|
40
42
|
if (TypeConverterManager._converters.hasOwnProperty(fullConverterName))
|
|
41
43
|
return TypeConverterManager._converters[fullConverterName];
|
|
42
44
|
if (!TypeConverterManager._defaultTypeConverter) {
|
|
43
|
-
|
|
44
|
-
TypeConverterManager._defaultTypeConverter = new StringTypeConverter();
|
|
45
|
+
TypeConverterManager._defaultTypeConverter = new StringTypeConverter_1.StringTypeConverter();
|
|
45
46
|
}
|
|
46
47
|
return TypeConverterManager._defaultTypeConverter;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
50
|
TypeConverterManager._converters = {};
|
|
50
51
|
exports.TypeConverterManager = TypeConverterManager;
|
|
52
|
+
// Register these here as this is also the default type register, we always want it to be registered
|
|
53
|
+
// and if moved to the StringTypeConverter it causes a dependency loop issue.
|
|
54
|
+
TypeConverterManager.registerConverter(appui_abstract_1.StandardTypeNames.Text, StringTypeConverter_1.StringTypeConverter);
|
|
55
|
+
TypeConverterManager.registerConverter(appui_abstract_1.StandardTypeNames.String, StringTypeConverter_1.StringTypeConverter);
|
|
56
|
+
TypeConverterManager.registerConverter(appui_abstract_1.StandardTypeNames.URL, StringTypeConverter_1.StringTypeConverter);
|
|
51
57
|
//# sourceMappingURL=TypeConverterManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TypeConverterManager.js","sourceRoot":"","sources":["../../../../src/components-react/converters/TypeConverterManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;
|
|
1
|
+
{"version":3,"file":"TypeConverterManager.js","sourceRoot":"","sources":["../../../../src/components-react/converters/TypeConverterManager.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;AAEH,0DAA0D;AAE1D,+DAA4D;AAE5D;;;GAGG;AACH,MAAa,oBAAoB;IAIvB,MAAM,CAAC,oBAAoB,CACjC,QAAgB,EAChB,aAAsB;QAEtB,IAAI,iBAAiB,GAAG,QAAQ,CAAC;QACjC,IAAI,aAAa;YAAE,iBAAiB,IAAI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G,IAAI,yCAAmB,EAAE,CAAC;SACxE;QACD,OAAO,oBAAoB,CAAC,qBAAqB,CAAC;IACpD,CAAC;;AAjEc,gCAAW,GAAuC,EAAE,CAAC;AADzD,oDAAoB;AAqEjC,oGAAoG;AACpG,6EAA6E;AAC7E,oBAAoB,CAAC,iBAAiB,CACpC,kCAAiB,CAAC,IAAI,EACtB,yCAAmB,CACpB,CAAC;AACF,oBAAoB,CAAC,iBAAiB,CACpC,kCAAiB,CAAC,MAAM,EACxB,yCAAmB,CACpB,CAAC;AACF,oBAAoB,CAAC,iBAAiB,CACpC,kCAAiB,CAAC,GAAG,EACrB,yCAAmB,CACpB,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 { StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type { TypeConverter } from \"./TypeConverter\";\nimport { StringTypeConverter } from \"./StringTypeConverter\";\n\n/**\n * Manages Type Converters. Type Converters are registered with and obtained from the manager.\n * @public\n */\nexport class TypeConverterManager {\n private static _converters: { [index: string]: TypeConverter } = {};\n private static _defaultTypeConverter: TypeConverter;\n\n private static getFullConverterName(\n typename: string,\n converterName?: string\n ): string {\n let fullConverterName = typename;\n if (converterName) fullConverterName += `:${converterName}`;\n return fullConverterName;\n }\n\n public static registerConverter(\n typename: string,\n converter: new () => TypeConverter,\n converterName?: string\n ): void {\n const fullConverterName = TypeConverterManager.getFullConverterName(\n typename,\n converterName\n );\n\n if (TypeConverterManager._converters.hasOwnProperty(fullConverterName)) {\n const nameOfConverter =\n TypeConverterManager._converters[fullConverterName].constructor.name;\n throw Error(\n `TypeConverterManager.registerConverter error: type '${typename}' already registered to '${nameOfConverter}'`\n );\n }\n\n const instance = new converter();\n TypeConverterManager._converters[fullConverterName] = instance;\n }\n\n public static unregisterConverter(\n typename: string,\n converterName?: string\n ): void {\n const fullConverterName = TypeConverterManager.getFullConverterName(\n typename,\n converterName\n );\n\n // istanbul ignore else\n if (TypeConverterManager._converters.hasOwnProperty(fullConverterName)) {\n delete TypeConverterManager._converters[fullConverterName];\n }\n }\n\n public static getConverter(\n typename: string,\n converterName?: string\n ): TypeConverter {\n const fullConverterName = TypeConverterManager.getFullConverterName(\n typename,\n converterName\n );\n\n if (TypeConverterManager._converters.hasOwnProperty(fullConverterName))\n return TypeConverterManager._converters[fullConverterName];\n\n if (!TypeConverterManager._defaultTypeConverter) {\n TypeConverterManager._defaultTypeConverter = new StringTypeConverter();\n }\n return TypeConverterManager._defaultTypeConverter;\n }\n}\n\n// Register these here as this is also the default type register, we always want it to be registered\n// and if moved to the StringTypeConverter it causes a dependency loop issue.\nTypeConverterManager.registerConverter(\n StandardTypeNames.Text,\n StringTypeConverter\n);\nTypeConverterManager.registerConverter(\n StandardTypeNames.String,\n StringTypeConverter\n);\nTypeConverterManager.registerConverter(\n StandardTypeNames.URL,\n StringTypeConverter\n);\n"]}
|