@itwin/components-react 4.13.2 → 4.13.4
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 +13 -1
- package/lib/cjs/components-react/UiComponents.js +1 -1
- package/lib/cjs/components-react/UiComponents.js.map +1 -1
- package/lib/cjs/components-react/common/DateUtils.js.map +1 -1
- package/lib/cjs/components-react/common/HighlightedText.js.map +1 -1
- package/lib/cjs/components-react/common/ImageRenderer.js +1 -1
- package/lib/cjs/components-react/common/ImageRenderer.js.map +1 -1
- package/lib/cjs/components-react/common/Links.js.map +1 -1
- package/lib/cjs/components-react/common/UseAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
- package/lib/cjs/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/cjs/components-react/common/UseElementsScrollStorage.js.map +1 -1
- package/lib/cjs/components-react/common/countMatchesInString.js.map +1 -1
- package/lib/cjs/components-react/common/selection/SelectionHandler.js.map +1 -1
- package/lib/cjs/components-react/common/selection/SelectionModes.js +2 -2
- package/lib/cjs/components-react/common/selection/SelectionModes.js.map +1 -1
- package/lib/cjs/components-react/converters/BooleanTypeConverter.js +1 -1
- package/lib/cjs/components-react/converters/BooleanTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/CompositeTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/DateTimeTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/EnumTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/PointTypeConverter.js.map +1 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.js +1 -1
- package/lib/cjs/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DateField.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePicker.js.map +1 -1
- package/lib/cjs/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
- package/lib/cjs/components-react/datepicker/IntlFormatter.js.map +1 -1
- package/lib/cjs/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/cjs/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/cjs/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/IconEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/PopupButton.js.map +1 -1
- package/lib/cjs/components-react/editors/PropertyEditorManager.js +1 -1
- package/lib/cjs/components-react/editors/PropertyEditorManager.js.map +1 -1
- package/lib/cjs/components-react/editors/SliderEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/TextEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/cjs/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertiesRenderer.d.ts.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertiesRenderer.js +1 -0
- package/lib/cjs/components-react/favorite/FavoritePropertiesRenderer.js.map +1 -1
- package/lib/cjs/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.js +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRangeValue.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/cjs/components-react/filter-builder/Operators.js +2 -2
- package/lib/cjs/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.js +1 -1
- package/lib/cjs/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/cjs/components-react/filtering/ResultSelector.js.map +1 -1
- package/lib/cjs/components-react/iconpicker/IconPickerButton.js +1 -1
- package/lib/cjs/components-react/iconpicker/IconPickerButton.js.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.d.ts +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/cjs/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/cjs/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/cjs/components-react/properties/ValueRendererManager.js +1 -1
- package/lib/cjs/components-react/properties/ValueRendererManager.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/ArrayPropertyValueRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/ArrayPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/StructPropertyValueRenderer.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/StructPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
- package/lib/cjs/components-react/properties/renderers/value/WithContextStyle.d.ts +1 -1
- package/lib/cjs/components-react/properties/renderers/value/WithContextStyle.d.ts.map +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js +1 -1
- package/lib/cjs/components-react/propertygrid/PropertyCategoryRendererManager.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/SimplePropertyDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js +1 -1
- package/lib/cjs/components-react/propertygrid/component/ColumnResizingPropertyListPropsSupplier.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/FlatItemNestedBorderWrapper.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/CompositePropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js +1 -1
- package/lib/cjs/components-react/propertygrid/dataproviders/filterers/PropertyDataFiltererBase.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js +1 -1
- package/lib/cjs/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +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/FlatPropertyRenderer.js.map +1 -1
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js +3 -3
- package/lib/cjs/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Items.js.map +1 -1
- package/lib/cjs/components-react/toolbar/Overflow.js.map +1 -1
- package/lib/cjs/components-react/toolbar/OverflowPanel.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/cjs/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/cjs/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
- package/lib/cjs/components-react/toolbar/utilities/Direction.js +4 -4
- package/lib/cjs/components-react/toolbar/utilities/Direction.js.map +1 -1
- package/lib/cjs/components-react/tree/HighlightingEngine.js +1 -1
- package/lib/cjs/components-react/tree/HighlightingEngine.js.map +1 -1
- package/lib/cjs/components-react/tree/SimpleTreeDataProvider.js.map +1 -1
- package/lib/cjs/components-react/tree/TreeComponentTestId.js +1 -1
- package/lib/cjs/components-react/tree/TreeComponentTestId.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeModelSource.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/NodeContent.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/cjs/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/cjs/components-react/useTranslation.js.map +1 -1
- package/lib/esm/components-react/UiComponents.js +1 -2
- package/lib/esm/components-react/UiComponents.js.map +1 -1
- package/lib/esm/components-react/common/DateUtils.js.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.js.map +1 -1
- package/lib/esm/components-react/common/ImageRenderer.js +1 -2
- package/lib/esm/components-react/common/ImageRenderer.js.map +1 -1
- package/lib/esm/components-react/common/Links.js.map +1 -1
- package/lib/esm/components-react/common/UseAsyncValue.js.map +1 -1
- package/lib/esm/components-react/common/UseContextWithMandatoryProvider.js.map +1 -1
- package/lib/esm/components-react/common/UseDebouncedAsyncValue.js.map +1 -1
- package/lib/esm/components-react/common/UseElementsScrollStorage.js.map +1 -1
- package/lib/esm/components-react/common/countMatchesInString.js.map +1 -1
- package/lib/esm/components-react/common/selection/SelectionHandler.js.map +1 -1
- package/lib/esm/components-react/converters/BooleanTypeConverter.js +1 -2
- package/lib/esm/components-react/converters/BooleanTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/CompositeTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/DateTimeTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/EnumTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/NumericTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/PointTypeConverter.js.map +1 -1
- package/lib/esm/components-react/converters/TypeConverterManager.js +1 -2
- package/lib/esm/components-react/converters/TypeConverterManager.js.map +1 -1
- package/lib/esm/components-react/datepicker/DateField.js.map +1 -1
- package/lib/esm/components-react/datepicker/DatePicker.js.map +1 -1
- package/lib/esm/components-react/datepicker/DatePickerPopupButton.js.map +1 -1
- package/lib/esm/components-react/datepicker/IntlFormatter.js.map +1 -1
- package/lib/esm/components-react/datepicker/TimeField.js.map +1 -1
- package/lib/esm/components-react/editors/BooleanEditor.js.map +1 -1
- package/lib/esm/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/esm/components-react/editors/DateTimeEditor.js.map +1 -1
- package/lib/esm/components-react/editors/EditorContainer.js.map +1 -1
- package/lib/esm/components-react/editors/EnumButtonGroupEditor.js.map +1 -1
- package/lib/esm/components-react/editors/EnumEditor.js.map +1 -1
- package/lib/esm/components-react/editors/IconEditor.js.map +1 -1
- package/lib/esm/components-react/editors/ImageCheckBoxEditor.js.map +1 -1
- package/lib/esm/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/esm/components-react/editors/PopupButton.js.map +1 -1
- package/lib/esm/components-react/editors/PropertyEditorManager.js +1 -2
- package/lib/esm/components-react/editors/PropertyEditorManager.js.map +1 -1
- package/lib/esm/components-react/editors/SliderEditor.js.map +1 -1
- package/lib/esm/components-react/editors/TextEditor.js.map +1 -1
- package/lib/esm/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/esm/components-react/editors/ToggleEditor.js.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertiesRenderer.d.ts.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertiesRenderer.js +1 -0
- package/lib/esm/components-react/favorite/FavoritePropertiesRenderer.js.map +1 -1
- package/lib/esm/components-react/favorite/FavoritePropertyList.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRangeValue.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleGroup.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderRuleOperator.js.map +1 -1
- package/lib/esm/components-react/filter-builder/FilterBuilderState.js.map +1 -1
- package/lib/esm/components-react/filter-builder/Operators.js.map +1 -1
- package/lib/esm/components-react/filtering/FilteringInput.js.map +1 -1
- package/lib/esm/components-react/filtering/ResultSelector.js.map +1 -1
- package/lib/esm/components-react/iconpicker/IconPickerButton.js +1 -2
- package/lib/esm/components-react/iconpicker/IconPickerButton.js.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.d.ts +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.d.ts.map +1 -1
- package/lib/esm/components-react/inputs/ParsedInput.js.map +1 -1
- package/lib/esm/components-react/properties/LinkHandler.js.map +1 -1
- package/lib/esm/components-react/properties/ValueRendererManager.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/CommonPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyGridColumns.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/PropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/ArrayPropertyValueRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/ArrayPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/StructPropertyValueRenderer.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/StructPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/UrlPropertyValueRenderer.js.map +1 -1
- package/lib/esm/components-react/properties/renderers/value/WithContextStyle.d.ts +1 -1
- package/lib/esm/components-react/properties/renderers/value/WithContextStyle.d.ts.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/SimplePropertyDataProvider.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/FlatItemNestedBorderWrapper.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js +1 -2
- package/lib/esm/components-react/propertygrid/component/PropertyGridCommons.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/PropertyGridEventsRelatedPropsSupplier.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGrid.js.map +1 -1
- package/lib/esm/components-react/propertygrid/component/VirtualizedPropertyGridWithDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/FilteringDataProvider.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/DisplayValuePropertyDataFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/LabelPropertyDataFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/dataproviders/filterers/PropertyCategoryLabelFilterer.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModel.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/PropertyGridModelSource.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedArrayProperty.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableCategorizedStructProperty.js.map +1 -1
- package/lib/esm/components-react/propertygrid/internal/flat-items/MutableFlatGridItem.js.map +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/FlatPropertyRenderer.js.map +1 -1
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js +1 -2
- package/lib/esm/components-react/toolbar/InternalToolbarComponent.js.map +1 -1
- package/lib/esm/components-react/toolbar/Items.js.map +1 -1
- package/lib/esm/components-react/toolbar/Overflow.js.map +1 -1
- package/lib/esm/components-react/toolbar/OverflowPanel.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemWithDrag.js.map +1 -1
- package/lib/esm/components-react/toolbar/PopupItemsPanel.js.map +1 -1
- package/lib/esm/components-react/toolbar/useConditionalSynchedItems.js.map +1 -1
- package/lib/esm/components-react/toolbar/utilities/Direction.js +2 -4
- package/lib/esm/components-react/toolbar/utilities/Direction.js.map +1 -1
- package/lib/esm/components-react/tree/HighlightingEngine.js +1 -2
- package/lib/esm/components-react/tree/HighlightingEngine.js.map +1 -1
- package/lib/esm/components-react/tree/SimpleTreeDataProvider.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeModelSource.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/NodeContent.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/esm/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/esm/components-react/useTranslation.js.map +1 -1
- package/package.json +13 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilteringInput.js","sourceRoot":"","sources":["../../../../src/components-react/filtering/FilteringInput.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AA0CjE;;;GAGG;A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AoB,iBACtB,qBAAqB,EACjC,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,WAAW;wBAElB,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,SAAS,OAAG,GAAI;wBAAC,GAAG,CAChC,CACR,CAAC,CAAC,CAAC,SAAS;oBACZ,MAAM,KAAK,oBAAoB,CAAC,mBAAmB,CAAC,CAAC,CAAC;oBACrD,iEAAiE;oBACjE,8BACE,SAAS,EAAC,MAAM,EAChB,OAAO,EAAE,IAAI,CAAC,oBAAoB,iBACtB,oBAAoB,EAChC,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,eAAe,CAAC;wBAE9C,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,QAAQ,OAAG,GAAI;wBAAC,GAAG,CAC/B,CACR,CAAC,CAAC,CAAC,SAAS;oBACZ,MAAM,KAAK,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,CAAC;oBACnD,iEAAiE;oBACjE,8BACE,SAAS,EAAC,uCAAuC,EACjD,OAAO,EAAE,IAAI,CAAC,mBAAmB,iBACrB,oBAAoB,EAChC,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,eAAe,CAAC;wBAE9C,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,QAAQ,OAAG,GAAI;wBAAC,GAAG,CAC/B,CACR,CAAC,CAAC,CAAC,SAAS,CACR,CACF,CACH,CACP,CAAC;IACJ,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 Filtering\n */\n\nimport \"./FilteringInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport type { ResultSelectorProps } from \"./ResultSelector\";\nimport { ResultSelector } from \"./ResultSelector\";\nimport { SvgClose, SvgSearch } from \"@itwin/itwinui-icons-react\";\n\n/** [[FilteringInput]] React Component state\n * @internal\n */\ninterface FilteringInputState {\n /** A string which will be used for search */\n searchText: string;\n /**\n * Tells the component if the search was started.\n * Gets reset to false if search is canceled/cleared or searchText is changed.\n */\n searchStarted: boolean;\n /* Used for resetting the state of [[ResultSelector]] component */\n resultSelectorKey: number;\n}\n\n/**\n * [[FilteringInput]] React Component properties\n * @public\n */\nexport interface FilteringInputProps extends CommonProps {\n /** Filtering should start */\n onFilterStart: (searchText: string) => void;\n /** Filtering is canceled while still in progress */\n onFilterCancel: () => void;\n /** Filtering is cleared after everything's loaded */\n onFilterClear: () => void;\n /**\n * Tells the component what is the status of filtering.\n */\n status: FilteringInputStatus;\n /**\n * [[ResultSelector]] React Component properties.\n * Attribute should be memoized and updated when [[ResultSelector]] state needs to be reset.\n * This allows resetting the selected active match index back to 0.\n */\n resultSelectorProps?: ResultSelectorProps;\n /** Specify that the <input> element should automatically get focus */\n autoFocus?: boolean;\n}\n\n/**\n * Enumeration of possible component contexts\n * @public\n */\nexport enum FilteringInputStatus {\n /** Component is ready to filter */\n ReadyToFilter,\n /** Component's parent is currently filtering */\n FilteringInProgress,\n /** Component's parent has finished filtering */\n FilteringFinished,\n}\n\n/** A helper component for filtering trees and stepping through results\n * @public\n */\nexport class FilteringInput extends React.PureComponent<\n FilteringInputProps,\n FilteringInputState\n> {\n private _inputElement = React.createRef<HTMLInputElement>();\n\n constructor(props: FilteringInputProps) {\n super(props);\n this.state = {\n searchText: \"\",\n searchStarted: false,\n resultSelectorKey: 0,\n };\n }\n\n private focus() {\n // istanbul ignore next\n if (this._inputElement.current) this._inputElement.current.focus();\n }\n\n private _onSearchButtonClick = () => {\n if (!this.state.searchText) {\n // Empty search string is the same as clearing the search.\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n return;\n }\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n };\n\n private _onCancelButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterCancel();\n this.focus();\n };\n\n private _onClearButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n this.focus();\n };\n\n private _onFilterKeyDown = (e: React.KeyboardEvent<HTMLElement>): void => {\n if (e.key !== Key.Enter.valueOf()) return;\n\n if (!this.state.searchText) return;\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n e.stopPropagation();\n };\n\n private _onInputChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (this.state.searchStarted) {\n this.props.onFilterCancel();\n }\n this.setState({ searchText: e.target.value, searchStarted: false });\n };\n\n /** @internal */\n public override componentDidUpdate(prevProps: FilteringInputProps) {\n if (this.props.resultSelectorProps !== prevProps.resultSelectorProps) {\n this.setState((state) => ({\n resultSelectorKey: state.resultSelectorKey + 1,\n }));\n }\n }\n\n public override render() {\n const status = this.props.status;\n const searchLabel = UiComponents.translate(\"general.search\");\n return (\n // TODO: What is filtering-input-preload-images?\n <div\n className={classnames(\n \"components-filtering-input\",\n \"filtering-input-preload-images\",\n this.props.className\n )}\n style={this.props.style}\n onKeyDown={this._onFilterKeyDown}\n role=\"presentation\"\n >\n <span className=\"components-filtering-input-input\">\n <Input\n type=\"text\"\n placeholder={UiComponents.translate(\"filteringInput.placeholder\")}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.props.autoFocus}\n onKeyDown={this._onFilterKeyDown}\n value={this.state.searchText}\n onChange={this._onInputChanged}\n aria-label={searchLabel}\n size=\"small\"\n />\n\n <span className=\"components-filtering-input-input-components\">\n {status === FilteringInputStatus.FilteringFinished &&\n this.props.resultSelectorProps ? (\n <ResultSelector\n key={this.state.resultSelectorKey}\n {...this.props.resultSelectorProps}\n />\n ) : undefined}\n {status === FilteringInputStatus.ReadyToFilter ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"icon\"\n onClick={this._onSearchButtonClick}\n data-testid=\"filter-input-search\"\n role=\"button\"\n tabIndex={-1}\n title={searchLabel}\n >\n <Icon iconSpec={<SvgSearch />} />{\" \"}\n </span>\n ) : undefined}\n {status === FilteringInputStatus.FilteringInProgress ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"icon\"\n onClick={this._onCancelButtonClick}\n data-testid=\"filter-input-close\"\n role=\"button\"\n tabIndex={-1}\n title={UiComponents.translate(\"dialog.cancel\")}\n >\n <Icon iconSpec={<SvgClose />} />{\" \"}\n </span>\n ) : undefined}\n {status === FilteringInputStatus.FilteringFinished ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"components-filtering-input-clear icon\"\n onClick={this._onClearButtonClick}\n data-testid=\"filter-input-close\"\n role=\"button\"\n tabIndex={-1}\n title={UiComponents.translate(\"general.clear\")}\n >\n <Icon iconSpec={<SvgClose />} />{\" \"}\n </span>\n ) : undefined}\n </span>\n </span>\n </div>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FilteringInput.js","sourceRoot":"","sources":["../../../../src/components-react/filtering/FilteringInput.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,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AC;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 Filtering\n */\n\nimport \"./FilteringInput.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport type { ResultSelectorProps } from \"./ResultSelector\";\nimport { ResultSelector } from \"./ResultSelector\";\nimport { SvgClose, SvgSearch } from \"@itwin/itwinui-icons-react\";\n\n/** [[FilteringInput]] React Component state\n * @internal\n */\ninterface FilteringInputState {\n /** A string which will be used for search */\n searchText: string;\n /**\n * Tells the component if the search was started.\n * Gets reset to false if search is canceled/cleared or searchText is changed.\n */\n searchStarted: boolean;\n /* Used for resetting the state of [[ResultSelector]] component */\n resultSelectorKey: number;\n}\n\n/**\n * [[FilteringInput]] React Component properties\n * @public\n */\nexport interface FilteringInputProps extends CommonProps {\n /** Filtering should start */\n onFilterStart: (searchText: string) => void;\n /** Filtering is canceled while still in progress */\n onFilterCancel: () => void;\n /** Filtering is cleared after everything's loaded */\n onFilterClear: () => void;\n /**\n * Tells the component what is the status of filtering.\n */\n status: FilteringInputStatus;\n /**\n * [[ResultSelector]] React Component properties.\n * Attribute should be memoized and updated when [[ResultSelector]] state needs to be reset.\n * This allows resetting the selected active match index back to 0.\n */\n resultSelectorProps?: ResultSelectorProps;\n /** Specify that the <input> element should automatically get focus */\n autoFocus?: boolean;\n}\n\n/**\n * Enumeration of possible component contexts\n * @public\n */\nexport enum FilteringInputStatus {\n /** Component is ready to filter */\n ReadyToFilter,\n /** Component's parent is currently filtering */\n FilteringInProgress,\n /** Component's parent has finished filtering */\n FilteringFinished,\n}\n\n/** A helper component for filtering trees and stepping through results\n * @public\n */\nexport class FilteringInput extends React.PureComponent<\n FilteringInputProps,\n FilteringInputState\n> {\n private _inputElement = React.createRef<HTMLInputElement>();\n\n constructor(props: FilteringInputProps) {\n super(props);\n this.state = {\n searchText: \"\",\n searchStarted: false,\n resultSelectorKey: 0,\n };\n }\n\n private focus() {\n // istanbul ignore next\n if (this._inputElement.current) this._inputElement.current.focus();\n }\n\n private _onSearchButtonClick = () => {\n if (!this.state.searchText) {\n // Empty search string is the same as clearing the search.\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n return;\n }\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n };\n\n private _onCancelButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterCancel();\n this.focus();\n };\n\n private _onClearButtonClick = () => {\n this.setState({ searchStarted: false, searchText: \"\" });\n this.props.onFilterClear();\n this.focus();\n };\n\n private _onFilterKeyDown = (e: React.KeyboardEvent<HTMLElement>): void => {\n if (e.key !== Key.Enter.valueOf()) return;\n\n if (!this.state.searchText) return;\n\n this.props.onFilterStart(this.state.searchText);\n this.setState({ searchStarted: true });\n e.stopPropagation();\n };\n\n private _onInputChanged = (e: React.ChangeEvent<HTMLInputElement>) => {\n if (this.state.searchStarted) {\n this.props.onFilterCancel();\n }\n this.setState({ searchText: e.target.value, searchStarted: false });\n };\n\n /** @internal */\n public override componentDidUpdate(prevProps: FilteringInputProps) {\n if (this.props.resultSelectorProps !== prevProps.resultSelectorProps) {\n this.setState((state) => ({\n resultSelectorKey: state.resultSelectorKey + 1,\n }));\n }\n }\n\n public override render() {\n const status = this.props.status;\n const searchLabel = UiComponents.translate(\"general.search\");\n return (\n // TODO: What is filtering-input-preload-images?\n <div\n className={classnames(\n \"components-filtering-input\",\n \"filtering-input-preload-images\",\n this.props.className\n )}\n style={this.props.style}\n onKeyDown={this._onFilterKeyDown}\n role=\"presentation\"\n >\n <span className=\"components-filtering-input-input\">\n <Input\n type=\"text\"\n placeholder={UiComponents.translate(\"filteringInput.placeholder\")}\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus={this.props.autoFocus}\n onKeyDown={this._onFilterKeyDown}\n value={this.state.searchText}\n onChange={this._onInputChanged}\n aria-label={searchLabel}\n size=\"small\"\n />\n\n <span className=\"components-filtering-input-input-components\">\n {status === FilteringInputStatus.FilteringFinished &&\n this.props.resultSelectorProps ? (\n <ResultSelector\n key={this.state.resultSelectorKey}\n {...this.props.resultSelectorProps}\n />\n ) : undefined}\n {status === FilteringInputStatus.ReadyToFilter ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"icon\"\n onClick={this._onSearchButtonClick}\n data-testid=\"filter-input-search\"\n role=\"button\"\n tabIndex={-1}\n title={searchLabel}\n >\n <Icon iconSpec={<SvgSearch />} />{\" \"}\n </span>\n ) : undefined}\n {status === FilteringInputStatus.FilteringInProgress ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"icon\"\n onClick={this._onCancelButtonClick}\n data-testid=\"filter-input-close\"\n role=\"button\"\n tabIndex={-1}\n title={UiComponents.translate(\"dialog.cancel\")}\n >\n <Icon iconSpec={<SvgClose />} />{\" \"}\n </span>\n ) : undefined}\n {status === FilteringInputStatus.FilteringFinished ? (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <span\n className=\"components-filtering-input-clear icon\"\n onClick={this._onClearButtonClick}\n data-testid=\"filter-input-close\"\n role=\"button\"\n tabIndex={-1}\n title={UiComponents.translate(\"general.clear\")}\n >\n <Icon iconSpec={<SvgClose />} />{\" \"}\n </span>\n ) : undefined}\n </span>\n </span>\n </div>\n );\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResultSelector.js","sourceRoot":"","sources":["../../../../src/components-react/filtering/ResultSelector.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,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AK,EAAE,EAAE,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAClE,SAAS,EAAC,2CAA2C,EACrD,OAAO,EAAE,IAAI,CAAC,sBAAsB,EACpC,IAAI,EAAC,cAAc;gBAElB,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CACrC,+BACE,IAAI,EAAC,QAAQ,EACb,KAAK,EAAE;wBACL,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI;qBAC7D,EACD,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,kBAAkB,EACpC,QAAQ,EAAE,IAAI,CAAC,wBAAwB,EACvC,MAAM,EAAE,IAAI,CAAC,0BAA0B,EACvC,SAAS,EAAE,IAAI,CAAC,wBAAwB,GACxC,CACH,CAAC,CAAC,CAAC,CACF,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAC5B;gBACD,8BAAM,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,IACnD,YAAY,CAAC,SAAS,CAAC,YAAY,CAAC,CAChC;gBACP,kCAAO,IAAI,CAAC,KAAK,CAAC,WAAW,CAAQ,CAChC;YAEP,gCACE,SAAS,EAAC,wCAAwC,iBACtC,aAAa,EACzB,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC;gBAErC,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,eAAe,OAAG,GAAI,CAChC,CACJ,CACR,CAAC;IACJ,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 Filtering\n */\n\nimport \"./ResultSelector.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\n\n/** [[ResultSelector]] React Component state\n * @internal\n */\ninterface ResultSelectorState {\n /** Currently selected result/entry index */\n selectedResultId: number;\n /** Input string */\n selectedResultEdit: string;\n /** Informs if selectedResult is currently being edited */\n selectedResultInEditMode: boolean;\n}\n\n/** [[ResultSelector]] React Component properties\n * @public\n */\nexport interface ResultSelectorProps extends CommonProps {\n /** Total number of results/entries */\n resultCount: number;\n /** Callback to currently selected result/entry change */\n onSelectedChanged: (index: number) => void;\n}\n\n/** Component for stepping through results/entries\n * @public\n */\nexport class ResultSelector extends React.PureComponent<\n ResultSelectorProps,\n ResultSelectorState\n> {\n /** @internal */\n constructor(props: ResultSelectorProps) {\n super(props);\n this.state = {\n selectedResultId: props.resultCount ? 1 : 0,\n selectedResultEdit: \"\",\n selectedResultInEditMode: false,\n };\n }\n\n private _onClickPrevious = () => {\n if (this.state.selectedResultInEditMode) {\n this._onSelectedResultConfirmed();\n return;\n }\n if (this.state.selectedResultId > 1) {\n this.props.onSelectedChanged(this.state.selectedResultId - 1);\n this.setState((state) => ({\n selectedResultId: state.selectedResultId - 1,\n }));\n }\n };\n\n private _onClickNext = () => {\n if (this.state.selectedResultInEditMode) {\n this._onSelectedResultConfirmed();\n return;\n }\n if (this.state.selectedResultId < this.props.resultCount) {\n this.props.onSelectedChanged(this.state.selectedResultId + 1);\n this.setState((state) => ({\n selectedResultId: state.selectedResultId + 1,\n }));\n }\n };\n\n private get _maxSelectedResultInputLength() {\n return this.props.resultCount.toString().length;\n }\n\n private _onSelectedResultChanged = (\n event: React.ChangeEvent<HTMLInputElement>\n ) => {\n if (event.target.value.length <= this._maxSelectedResultInputLength)\n this.setState({ selectedResultEdit: event.target.value });\n };\n\n private _onSelectedResultConfirmed = () => {\n let selectedId = +this.state.selectedResultEdit;\n if (selectedId > this.props.resultCount)\n selectedId = this.props.resultCount;\n else if (selectedId < 1) selectedId = 1;\n\n this.setState({\n selectedResultInEditMode: false,\n selectedResultId: selectedId,\n });\n this.props.onSelectedChanged(selectedId);\n };\n\n private _onSelectedResultClick = () => {\n this.setState((state) => ({\n selectedResultInEditMode: true,\n selectedResultEdit: state.selectedResultId.toString(),\n }));\n };\n\n private _onSelectedResultKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === Key.Enter.valueOf()) this._onSelectedResultConfirmed();\n };\n\n /** @internal */\n public override componentDidMount() {\n this.props.onSelectedChanged(this.props.resultCount ? 1 : 0);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: ResultSelectorProps) {\n if (this.props.resultCount !== prevProps.resultCount) {\n this.props.onSelectedChanged(this.props.resultCount ? 1 : 0);\n }\n }\n\n /** @internal */\n public override render() {\n return (\n <span\n className={classnames(\n \"components-result-selector\",\n this.props.className\n )}\n style={this.props.style}\n >\n <button\n className={classnames(\"components-result-selector-button\", \"icon\")}\n data-testid=\"previous-button\"\n onClick={this._onClickPrevious}\n disabled={this.props.resultCount <= 0}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n\n <span\n style={{ pointerEvents: this.props.resultCount ? \"auto\" : \"none\" }}\n className=\"components-result-selector-current-result\"\n onClick={this._onSelectedResultClick}\n role=\"presentation\"\n >\n {this.state.selectedResultInEditMode ? (\n <input\n type=\"number\"\n style={{\n width: `${this.state.selectedResultEdit.length * 0.6 + 1}em`,\n }}\n value={this.state.selectedResultEdit}\n onChange={this._onSelectedResultChanged}\n onBlur={this._onSelectedResultConfirmed}\n onKeyDown={this._onSelectedResultKeyDown}\n />\n ) : (\n this.state.selectedResultId\n )}\n <span style={{ marginLeft: \"5px\", marginRight: \"5px\" }}>\n {UiComponents.translate(\"general.of\")}\n </span>\n <span>{this.props.resultCount}</span>\n </span>\n\n <button\n className=\"components-result-selector-button icon\"\n data-testid=\"next-button\"\n onClick={this._onClickNext}\n disabled={this.props.resultCount <= 0}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </span>\n );\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ResultSelector.js","sourceRoot":"","sources":["../../../../src/components-react/filtering/ResultSelector.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,uBAAuB,CAAC;AAC/B,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAwB7E;;GAEG;AACH,MAAM,OAAO,cAAe,SAAQ,KAAK,CAAC,aAGzC;IACC,gBAAgB;IAChB,YAAY,KAA0B;QACpC,KAAK,CAAC,KAAK,CAAC,CAAC;QAQP,qBAAgB,GAAG,GAAG,EAAE;YAC9B,IAAI,IAAI,CAAC,KAAK,CAAC,wBAAwB,EAAE,CAAC;gBACxC,IAAI,CAAC,0BAA0B,EAAE,CAAC;gBAClC,OAAO;YACT,CAAC;YACD,IAAI,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,CAAC,EAAE,CAAC;gBACpC,IAAI,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;gBAC9D,IAAI,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;oBACxB,gBAAgB,EAAE,KAAK,CAAC,gBAAgB,GAAG,CAAC;iBAC7C,CAAC,CAAC,CAAC;YACN,CAA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;YAEP,gCACE,SAAS,EAAC,wCAAwC,iBACtC,aAAa,EACzB,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,WAAW,IAAI,CAAC;gBAErC,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,eAAe,OAAG,GAAI,CAChC,CACJ,CACR,CAAC;IACJ,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 Filtering\n */\n\nimport \"./ResultSelector.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { UiComponents } from \"../UiComponents\";\nimport { SvgChevronLeft, SvgChevronRight } from \"@itwin/itwinui-icons-react\";\n\n/** [[ResultSelector]] React Component state\n * @internal\n */\ninterface ResultSelectorState {\n /** Currently selected result/entry index */\n selectedResultId: number;\n /** Input string */\n selectedResultEdit: string;\n /** Informs if selectedResult is currently being edited */\n selectedResultInEditMode: boolean;\n}\n\n/** [[ResultSelector]] React Component properties\n * @public\n */\nexport interface ResultSelectorProps extends CommonProps {\n /** Total number of results/entries */\n resultCount: number;\n /** Callback to currently selected result/entry change */\n onSelectedChanged: (index: number) => void;\n}\n\n/** Component for stepping through results/entries\n * @public\n */\nexport class ResultSelector extends React.PureComponent<\n ResultSelectorProps,\n ResultSelectorState\n> {\n /** @internal */\n constructor(props: ResultSelectorProps) {\n super(props);\n this.state = {\n selectedResultId: props.resultCount ? 1 : 0,\n selectedResultEdit: \"\",\n selectedResultInEditMode: false,\n };\n }\n\n private _onClickPrevious = () => {\n if (this.state.selectedResultInEditMode) {\n this._onSelectedResultConfirmed();\n return;\n }\n if (this.state.selectedResultId > 1) {\n this.props.onSelectedChanged(this.state.selectedResultId - 1);\n this.setState((state) => ({\n selectedResultId: state.selectedResultId - 1,\n }));\n }\n };\n\n private _onClickNext = () => {\n if (this.state.selectedResultInEditMode) {\n this._onSelectedResultConfirmed();\n return;\n }\n if (this.state.selectedResultId < this.props.resultCount) {\n this.props.onSelectedChanged(this.state.selectedResultId + 1);\n this.setState((state) => ({\n selectedResultId: state.selectedResultId + 1,\n }));\n }\n };\n\n private get _maxSelectedResultInputLength() {\n return this.props.resultCount.toString().length;\n }\n\n private _onSelectedResultChanged = (\n event: React.ChangeEvent<HTMLInputElement>\n ) => {\n if (event.target.value.length <= this._maxSelectedResultInputLength)\n this.setState({ selectedResultEdit: event.target.value });\n };\n\n private _onSelectedResultConfirmed = () => {\n let selectedId = +this.state.selectedResultEdit;\n if (selectedId > this.props.resultCount)\n selectedId = this.props.resultCount;\n else if (selectedId < 1) selectedId = 1;\n\n this.setState({\n selectedResultInEditMode: false,\n selectedResultId: selectedId,\n });\n this.props.onSelectedChanged(selectedId);\n };\n\n private _onSelectedResultClick = () => {\n this.setState((state) => ({\n selectedResultInEditMode: true,\n selectedResultEdit: state.selectedResultId.toString(),\n }));\n };\n\n private _onSelectedResultKeyDown = (event: React.KeyboardEvent) => {\n if (event.key === Key.Enter.valueOf()) this._onSelectedResultConfirmed();\n };\n\n /** @internal */\n public override componentDidMount() {\n this.props.onSelectedChanged(this.props.resultCount ? 1 : 0);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: ResultSelectorProps) {\n if (this.props.resultCount !== prevProps.resultCount) {\n this.props.onSelectedChanged(this.props.resultCount ? 1 : 0);\n }\n }\n\n /** @internal */\n public override render() {\n return (\n <span\n className={classnames(\n \"components-result-selector\",\n this.props.className\n )}\n style={this.props.style}\n >\n <button\n className={classnames(\"components-result-selector-button\", \"icon\")}\n data-testid=\"previous-button\"\n onClick={this._onClickPrevious}\n disabled={this.props.resultCount <= 0}\n >\n <Icon iconSpec={<SvgChevronLeft />} />\n </button>\n\n <span\n style={{ pointerEvents: this.props.resultCount ? \"auto\" : \"none\" }}\n className=\"components-result-selector-current-result\"\n onClick={this._onSelectedResultClick}\n role=\"presentation\"\n >\n {this.state.selectedResultInEditMode ? (\n <input\n type=\"number\"\n style={{\n width: `${this.state.selectedResultEdit.length * 0.6 + 1}em`,\n }}\n value={this.state.selectedResultEdit}\n onChange={this._onSelectedResultChanged}\n onBlur={this._onSelectedResultConfirmed}\n onKeyDown={this._onSelectedResultKeyDown}\n />\n ) : (\n this.state.selectedResultId\n )}\n <span style={{ marginLeft: \"5px\", marginRight: \"5px\" }}>\n {UiComponents.translate(\"general.of\")}\n </span>\n <span>{this.props.resultCount}</span>\n </span>\n\n <button\n className=\"components-result-selector-button icon\"\n data-testid=\"next-button\"\n onClick={this._onClickNext}\n disabled={this.props.resultCount <= 0}\n >\n <Icon iconSpec={<SvgChevronRight />} />\n </button>\n </span>\n );\n }\n}\n"]}
|
|
@@ -36,7 +36,7 @@ class IconItem extends React.PureComponent {
|
|
|
36
36
|
* @internal
|
|
37
37
|
*/
|
|
38
38
|
// istanbul ignore next
|
|
39
|
-
class IconPickerButton extends React.PureComponent {
|
|
39
|
+
export class IconPickerButton extends React.PureComponent {
|
|
40
40
|
/** @internal */
|
|
41
41
|
constructor(props) {
|
|
42
42
|
super(props);
|
|
@@ -84,5 +84,4 @@ class IconPickerButton extends React.PureComponent {
|
|
|
84
84
|
IconPickerButton.defaultProps = {
|
|
85
85
|
numColumns: 4,
|
|
86
86
|
};
|
|
87
|
-
export { IconPickerButton };
|
|
88
87
|
//# sourceMappingURL=IconPickerButton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconPickerButton.js","sourceRoot":"","sources":["../../../../src/components-react/iconpicker/IconPickerButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAc5D;;GAEG;AACH,uBAAuB;AACvB,MAAM,QAAS,SAAQ,KAAK,CAAC,aAA4B;IACvD,gBAAgB;IAChB,YAAY,KAAoB;QAC9B,KAAK,CAAC,KAAK,CAAC,CAAC;IACf,CAAC;IAEe,MAAM;QACpB,MAAM,EACJ,OAAO,EACP,IAAI,EAAE,qCAAqC;QAC3C,GAAG,UAAU,EACd,GAAG,IAAI,CAAC,KAAK,CAAC;QAEf,MAAM,WAAW,GAAG,CAAC,EAAoB,EAAE,EAAE;YAC3C,IAAI,OAAO;gBAAE,OAAO,EAAE,CAAC;QACzB,CAAC,CAAC;QAEF,MAAM,OAAO,GAAG,UAAU,CAAC,wBAAwB,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAE3E,OAAO,CACL,mCACM,UAAU,EACd,SAAS,EAAE,OAAO,EAClB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,EACvB,OAAO,EAAE,WAAW;YAEpB,oBAAC,IAAI,IAAC,QAAQ,EAAE,IAAI,GAAI,CACjB,CACV,CAAC;IACJ,CAAC;CACF;AA+BD;;GAEG;AACH,uBAAuB;AACvB,
|
|
1
|
+
{"version":3,"file":"IconPickerButton.js","sourceRoot":"","sources":["../../../../src/components-react/iconpicker/IconPickerButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,yBAAyB,CAAC;AACjC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAA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C,8BAA8B,EAC9B,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,UAAU,EACjC,IAAI,CAAC,KAAK,CAAC,SAAS,CACrB,CAAC;QAEF,OAAO,CACL;YACE,+CACc,8BAA8B,EAC1C,OAAO,EAAE,IAAI,CAAC,YAAY,EAC1B,SAAS,EAAE,gBAAgB,EAC3B,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,GAAG,EAAE,IAAI,CAAC,OAAO;gBAEjB,oBAAC,IAAI,IACH,SAAS,EAAC,0BAA0B,EACpC,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GACzB;gBACF,8BAAM,SAAS,EAAC,MAAM;oBACnB,GAAG;oBACJ,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,cAAc,OAAG,GAAI;oBAAC,GAAG,CACrC,CACA;YACT,oBAAC,KAAK,IACJ,SAAS,EAAC,6BAA6B,EACvC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC5B,QAAQ,EAAE,gBAAgB,CAAC,UAAU,EACrC,OAAO,EAAE,IAAI,CAAC,WAAW,EACzB,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO,IAE3B,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CACrC,CACP,CACJ,CAAC;IACJ,CAAC;;AA5FD,gBAAgB;AACF,6BAAY,GAA6B;IACrD,UAAU,EAAE,CAAC;CACd,AAFyB,CAExB","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 IconPicker\n */\n\nimport \"./IconPickerButton.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { RelativePosition } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon, Popup } from \"@itwin/core-react\";\nimport { SvgChevronDown } from \"@itwin/itwinui-icons-react\";\n\n/** Properties for the [[IconItem]] React component\n * @internal\n */\ninterface IconItemProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n CommonProps {\n /** icon specification */\n icon: string;\n /** function to run when user selects icon */\n onClick?: () => void;\n}\n\n/** IconItem Functional component\n * @internal\n */\n// istanbul ignore next\nclass IconItem extends React.PureComponent<IconItemProps> {\n /** @internal */\n constructor(props: IconItemProps) {\n super(props);\n }\n\n public override render() {\n const {\n onClick,\n icon, // do not pass on item specific props\n ...otherProps\n } = this.props;\n\n const handleClick = (_e: React.MouseEvent) => {\n if (onClick) onClick();\n };\n\n const classes = classnames(\"components-icon-swatch\", this.props.className);\n\n return (\n <button\n {...otherProps}\n className={classes}\n style={this.props.style}\n onClick={handleClick}\n >\n <Icon iconSpec={icon} />\n </button>\n );\n }\n}\n\n/** Properties for the [[IconPicker]] React component\n * @internal\n */\n// istanbul ignore next\nexport interface IconPickerProps\n extends React.ButtonHTMLAttributes<HTMLButtonElement>,\n CommonProps {\n /** active string */\n icon: string;\n /** available icons */\n icons: string[];\n /** function to run when user selects icon */\n onIconChange?: ((icon: string) => void) | undefined;\n /** Disabled or not */\n disabled?: boolean;\n /** Readonly or not */\n readonly?: boolean;\n /** Title to show at top of DropDown */\n dropDownTitle?: string;\n /** Number of columns */\n numColumns: number;\n}\n\n/** @internal */\ninterface IconPickerState {\n showPopup: boolean;\n icon: string;\n}\n\n/** IconPickerButton component\n * @internal\n */\n// istanbul ignore next\nexport class IconPickerButton extends React.PureComponent<\n IconPickerProps,\n IconPickerState\n> {\n private _target = React.createRef<HTMLButtonElement>();\n\n /** @internal */\n public static defaultProps: Partial<IconPickerProps> = {\n numColumns: 4,\n };\n\n /** @internal */\n constructor(props: IconPickerProps) {\n super(props);\n\n this.state = { showPopup: false, icon: this.props.icon };\n }\n\n private _togglePopup = () => {\n if (this.props.readonly) return;\n\n this.setState((prevState) => ({ showPopup: !prevState.showPopup }));\n };\n\n private _closePopup = () => {\n this.setState({ showPopup: false });\n };\n\n private _handleIconPicked = (icon: string) => {\n this.setState({ showPopup: false, icon }, () => {\n // istanbul ignore else\n if (this.props.onIconChange) this.props.onIconChange(icon);\n });\n };\n\n private renderPopup(title: string | undefined) {\n const containerStyle: React.CSSProperties = {\n gridTemplateColumns: `repeat(${this.props.numColumns}, 1fr)`,\n };\n return (\n <div className=\"components-iconpicker-popup-container\">\n {title && <h4>{title}</h4>}\n <div\n data-testid=\"components-iconpicker-popup-icons\"\n className=\"components-iconpicker-popup-icons\"\n style={containerStyle}\n >\n {this.props.icons.map((icon: string, index: number) => (\n <IconItem\n key={index}\n icon={icon}\n onClick={this._handleIconPicked.bind(this, icon)}\n />\n ))}\n </div>\n </div>\n );\n }\n\n /** @internal */\n public override render() {\n const buttonStyle = { ...this.props.style } as React.CSSProperties;\n const buttonClassNames = classnames(\n \"components-iconpicker-button\",\n this.props.readonly && \"readonly\",\n this.props.className\n );\n\n return (\n <>\n <button\n data-testid=\"components-iconpicker-button\"\n onClick={this._togglePopup}\n className={buttonClassNames}\n style={buttonStyle}\n disabled={this.props.disabled}\n ref={this._target}\n >\n <Icon\n className=\"iconpicker-button-sprite\"\n iconSpec={this.state.icon}\n />\n <span className=\"icon\">\n {\" \"}\n <Icon iconSpec={<SvgChevronDown />} />{\" \"}\n </span>\n </button>\n <Popup\n className=\"components-iconpicker-popup\"\n isOpen={this.state.showPopup}\n position={RelativePosition.BottomLeft}\n onClose={this._closePopup}\n target={this._target.current}\n >\n {this.renderPopup(this.props.dropDownTitle)}\n </Popup>\n </>\n );\n }\n}\n"]}
|
|
@@ -25,5 +25,5 @@ export interface ParsedInputProps extends CommonProps {
|
|
|
25
25
|
/** Generic Input component that requires formatting and parsing functions to be passed in as props.
|
|
26
26
|
* @public
|
|
27
27
|
*/
|
|
28
|
-
export declare const ParsedInput: (props: ParsedInputProps) => React.
|
|
28
|
+
export declare const ParsedInput: (props: ParsedInputProps) => React.ReactNode;
|
|
29
29
|
//# sourceMappingURL=ParsedInput.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ParsedInput.d.ts","sourceRoot":"","sources":["../../../../src/components-react/inputs/ParsedInput.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD,0EAA0E;IAC1E,YAAY,EAAE,MAAM,CAAC;IACrB,wCAAwC;IACxC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IACvC,qDAAqD;IACrD,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,YAAY,CAAC;IACnD,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,+DAA+D;IAC/D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;CACnC;AA+HD;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"ParsedInput.d.ts","sourceRoot":"","sources":["../../../../src/components-react/inputs/ParsedInput.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,oBAAoB,CAAC;AAE5B;;GAEG;AACH,MAAM,W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AAE;QAC/C,uBAAuB;QACvB,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC;YACtC,qBAAqB,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACjD,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,CAAC;QACD,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,CAAC;YACvC,iBAAiB,CAAC,WAAW,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC;YACxD,cAAc,CAAC,KAAK,CAAC,CAAC;YACtB,KAAK,CAAC,cAAc,EAAE,CAAC;QACzB,CAAC;IACH,CAAC,EACD,CAAC,WAAW,EAAE,qBAAqB,CAAC,CACrC,CAAC;IAEF,MAAM,UAAU,GAAG,UAAU,CAC3B,SAAS,EACT,yBAAyB,EACzB,WAAW,IAAI,mCAAmC,CACnD,CAAC;IAEF,OAAO,CACL,oBAAC,KAAK,mBACQ,yBAAyB,EACrC,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,UAAU,EACrB,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,UAAU,EAClB,QAAQ,EAAE,YAAY,EACtB,KAAK,EAAE,cAAc,EACrB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ,CACH,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GACtB,qBAAqB,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 Inputs\n */\n\nimport * as React from \"react\";\nimport classnames from \"classnames\";\nimport { Key } from \"ts-key-enum\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type { ParseResults } from \"@itwin/appui-abstract\";\nimport \"./ParsedInput.scss\";\n\n/** Props for [[ParsedInput]] control\n * @public\n */\nexport interface ParsedInputProps extends CommonProps {\n /** InitialValue which is used to restore input field if ESC is pressed */\n initialValue: number;\n /** Function used to format the value */\n formatValue: (value: number) => string;\n /** Function used to parse user input into a value */\n parseString: (stringValue: string) => ParseResults;\n /** Function to call when value is changed */\n onChange?: (newValue: number) => void;\n /** if readonly then only the formatValue function is used. */\n readonly?: boolean;\n /** Provides ability to return reference to HTMLInputElement */\n ref?: React.Ref<HTMLInputElement>;\n}\n\nconst ForwardRefParsedInput = React.forwardRef<\n HTMLInputElement,\n ParsedInputProps\n>(function ForwardRefParsedInput(\n {\n initialValue,\n formatValue,\n parseString,\n readonly,\n className,\n style,\n onChange,\n },\n ref\n) {\n const currentValueRef = React.useRef(initialValue);\n const isMountedRef = React.useRef(false);\n const lastFormattedValueRef = React.useRef(formatValue(initialValue));\n const [formattedValue, setFormattedValue] = React.useState(\n () => lastFormattedValueRef.current\n );\n const [hasBadInput, setHasBadInput] = React.useState(false);\n\n React.useEffect(() => {\n isMountedRef.current = true;\n return () => {\n isMountedRef.current = false;\n };\n }, []);\n\n // See if new initialValue props have changed since component mounted\n React.useEffect(() => {\n currentValueRef.current = initialValue;\n const currentFormattedValue = formatValue(currentValueRef.current);\n if (currentFormattedValue !== lastFormattedValueRef.current) {\n lastFormattedValueRef.current = currentFormattedValue;\n setFormattedValue(lastFormattedValueRef.current);\n setHasBadInput(false);\n }\n }, [formatValue, initialValue]);\n\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setFormattedValue(event.currentTarget.value);\n },\n []\n );\n\n const updateValueFromString = React.useCallback(\n (strVal: string) => {\n if (lastFormattedValueRef.current === strVal) return;\n\n const parseResults = parseString(strVal);\n // istanbul ignore else\n if (!parseResults.parseError) {\n // istanbul ignore else\n if (\n undefined !== parseResults.value &&\n typeof parseResults.value === \"number\"\n ) {\n const currentValue = parseResults.value;\n // istanbul ignore else\n if (currentValue !== currentValueRef.current) {\n currentValueRef.current = currentValue;\n onChange && onChange(currentValueRef.current);\n }\n // istanbul ignore else\n if (isMountedRef.current) {\n lastFormattedValueRef.current = formatValue(currentValue);\n setFormattedValue(lastFormattedValueRef.current);\n setHasBadInput(false);\n }\n }\n } else {\n setHasBadInput(true);\n }\n },\n [formatValue, onChange, parseString]\n );\n\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n updateValueFromString(event.target.value);\n },\n [updateValueFromString]\n );\n\n const handleKeyDown = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (event.key === Key.Enter.valueOf()) {\n updateValueFromString(event.currentTarget.value);\n event.preventDefault();\n }\n if (event.key === Key.Escape.valueOf()) {\n setFormattedValue(formatValue(currentValueRef.current));\n setHasBadInput(false);\n event.preventDefault();\n }\n },\n [formatValue, updateValueFromString]\n );\n\n const classNames = classnames(\n className,\n \"components-parsed-input\",\n hasBadInput && \"components-parsed-input-has-error\"\n );\n\n return (\n <Input\n data-testid=\"components-parsed-input\"\n ref={ref}\n style={style}\n className={classNames}\n onKeyDown={handleKeyDown}\n onBlur={handleBlur}\n onChange={handleChange}\n value={formattedValue}\n disabled={readonly}\n size=\"small\"\n />\n );\n});\n\n/** Generic Input component that requires formatting and parsing functions to be passed in as props.\n * @public\n */\nexport const ParsedInput: (props: ParsedInputProps) => React.ReactNode =\n ForwardRefParsedInput;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../../src/components-react/properties/LinkHandler.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,gBAAgB,E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,OAAO,EAAE;
|
|
1
|
+
{"version":3,"file":"LinkHandler.js","sourceRoot":"","sources":["../../../../src/components-react/properties/LinkHandler.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAErD,iCAAiC;AACjC,SAAS,SAAS,CAChB,IAAY,EACZ,KAAuB,EACvB,SAA6C;IAE7C,OAAO;IACL,mDAAmD;IACnD,oBAAC,gBAAgB,IACf,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,cAAc,EAAE,CAAC;YACnB,CAAC,CAAC,eAAe,EAAE,CAAC;YACpB,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACtB,CAAC,IAEA,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAClB,CACpB,CAAC;AACJ,CAAC;AAOD,SAAS,eAAe,CAAC,MAAa,EAAE,MAAa;IACnD,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC;IAC1C,IAAI,MAAM,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK;QAAE,OAAO,CAAC,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAS,cAAc,CACrB,IAAY,EACZ,SAA6C;IAE7C,OAAO,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC5C,CAAC;AAED,SAAS,UAAU,CACjB,IAAY,EACZ,KAAuB,EACvB,SAA6C;IAE7C,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1B,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS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,SAA4C;IAE5C,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,IAAY,EACZ,KAAuB,EACvB,SAA6C,EAC5B,EAAE;IACnB,OAAO,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,WAAmB,EACnB,KAAwB,EACxB,SAA6C,EAC5B,EAAE;IACnB,IAAI,KAAK;QAAE,OAAO,WAAW,CAAC,WAAW,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IAC7D,IAAI,SAAS;QAAE,OAAO,iBAAiB,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;IAChE,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAYF;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,OAAO,0CAAG,SAAS,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,WAAW,CAAC,CAAI,CAAC;AACvE,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 Properties\n */\n\nimport * as React from \"react\";\nimport { BentleyError, BentleyStatus } from \"@itwin/core-bentley\";\nimport type { LinkElementsInfo } from \"@itwin/appui-abstract\";\nimport { UnderlinedButton } from \"@itwin/core-react\";\n\n/** Render a single anchor tag */\nfunction renderTag(\n text: string,\n links: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n) {\n return (\n // eslint-disable-next-line deprecation/deprecation\n <UnderlinedButton\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n links.onClick(text);\n }}\n >\n {highlight ? highlight(text) : text}\n </UnderlinedButton>\n );\n}\n\ninterface Match {\n start: number;\n end: number;\n}\n\nfunction matchComparison(matchA: Match, matchB: Match) {\n if (matchA.start > matchB.start) return 1;\n if (matchB.start > matchA.start) return -1;\n return 0;\n}\n\nfunction renderTextPart(\n text: string,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode {\n return highlight ? highlight(text) : text;\n}\n\nfunction renderText(\n text: string,\n links: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode {\n const { matcher } = links;\n\n if (!matcher) return renderTag(text, links, highlight);\n\n const matches = matcher(text);\n\n // Sort just to be sure\n matches.sort(matchComparison);\n\n const parts: React.ReactNode[] = [];\n let lastIndex = 0;\n for (const match of matches) {\n // If matches overlap there must be something wrong with the matcher\n if (lastIndex > match.start)\n throw new BentleyError(\n BentleyStatus.ERROR,\n \"renderText: matcher returned overlapping matches\"\n );\n\n if (lastIndex < match.start)\n parts.push(\n renderTextPart(text.substring(lastIndex, match.start), highlight)\n );\n\n const anchorText = text.substring(match.start, match.end);\n parts.push(renderTag(anchorText, links, highlight));\n\n lastIndex = match.end;\n }\n if (text.length > lastIndex)\n parts.push(renderTextPart(text.substring(lastIndex), highlight));\n\n // Need to map, because React complains about the lack of keys\n return parts.map((part, index) => (\n <React.Fragment key={index}>{part}</React.Fragment>\n ));\n}\n\nfunction renderHighlighted(\n text: string,\n highlight: (text: string) => React.ReactNode\n) {\n return highlight(text);\n}\n\n/** Renders anchor tag by wrapping or splitting provided text\n * @public\n */\nexport const renderLinks = (\n text: string,\n links: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode => {\n return renderText(text, links, highlight);\n};\n\n/** If record has links, wraps stringValue in them, otherwise returns unchanged stringValue\n * Optionally it can highlight text\n * @public\n */\nexport const withLinks = (\n stringValue: string,\n links?: LinkElementsInfo,\n highlight?: (text: string) => React.ReactNode\n): React.ReactNode => {\n if (links) return renderLinks(stringValue, links, highlight);\n if (highlight) return renderHighlighted(stringValue, highlight);\n return stringValue;\n};\n\n/**\n * Properties for [[LinksRenderer]] component.\n * @public\n */\nexport interface LinksRendererProps {\n value: string;\n links?: LinkElementsInfo;\n highlighter?: (text: string) => React.ReactNode;\n}\n\n/**\n * React component for rendering string with links.\n * @public\n */\nexport function LinksRenderer(props: LinksRendererProps) {\n return <>{withLinks(props.value, props.links, props.highlighter)}</>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValueRendererManager.js","sourceRoot":"","sources":["../../../../src/components-react/properties/ValueRendererManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAC1F,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,kCAAkC,EAAE,MAAM,sDAAsD,CAAC;AAC1G,OAAO,EAAE,8BAA8B,EAAE,MAAM,kDAAkD,CAAC;AAClG,OAAO,EAAE,2BAA2B,EAAE,MAAM,+CAA+C,CAAC;AAC5F,OAAO,EAAE,wBAAwB,EAAE,MAAM,4CAA4C,CAAC;AAEtF;;GAEG;AACH,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,8CAAqB,CAAA;IACrB,wCAAe,CAAA;IACf,sCAAa,CAAA;AACf,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC;AA8DD;;GAEG;AACH,MAAM,OAAO,4BAA4B;IAAzC;QAGY,uBAAkB,GAAwC,IAAI,GAAG,EAGxE,CAAC;QACM,mCAA8B,GACtC,IAAI,8BAA8B,EAAE,CAAC;QAC7B,+BAA0B,GAClC,IAAI,0BAA0B,EAAE,CAAC;QACzB,gCAA2B,GACnC,IAAI,2BAA2B,EAAE,CAAC;QAC1B,gCAA2B,GACnC,IAAI,2BAA2B,EAAE,CAAC;IAsFtC,CAAC;I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wB,EAAE,CAC/B,CAAC;AACF,4BAA4B,CAAC,cAAc,CAAC,gBAAgB,CAC1D,WAAW,EACX,IAAI,kCAAkC,EAAE,CACzC,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 Properties\n */\n\nimport type * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation } from \"@itwin/core-react\";\nimport { ArrayPropertyValueRenderer } from \"./renderers/value/ArrayPropertyValueRenderer\";\nimport { MergedPropertyValueRenderer } from \"./renderers/value/MergedPropertyValueRenderer\";\nimport { MultilineTextPropertyValueRenderer } from \"./renderers/value/MultilineTextPropertyValueRenderer\";\nimport { PrimitivePropertyValueRenderer } from \"./renderers/value/PrimitivePropertyValueRenderer\";\nimport { StructPropertyValueRenderer } from \"./renderers/value/StructPropertyValueRenderer\";\nimport { UrlPropertyValueRenderer } from \"./renderers/value/UrlPropertyValueRenderer\";\n\n/** Types of property containers\n * @public\n */\nexport enum PropertyContainerType {\n PropertyPane = \"pane\",\n Table = \"table\",\n Tree = \"tree\",\n}\n\n/** State of the Dialog component in a container which renders properties\n * @public\n */\nexport interface PropertyDialogState {\n title: string;\n content: React.ReactNode;\n}\n\n/** State of the Popup component in a container which renders properties\n * @public\n */\nexport interface PropertyPopupState {\n fixedPosition: { top: number; left: number };\n content: React.ReactNode;\n}\n\n/** Additional parameters to the renderer\n * @public\n */\nexport interface PropertyValueRendererContext {\n /** Type of container that holds the property */\n containerType?: string;\n /** Style that should be applied to the rendered element */\n style?: React.CSSProperties;\n /** Orientation of property/container */\n orientation?: Orientation;\n /** Callback to request for a Popup to be shown. */\n onPopupShow?: (popupState: PropertyPopupState) => void;\n /** Callback to request for a Popup to be hidden. */\n onPopupHide?: () => void;\n /** Callback to request for Dialog to be opened. */\n onDialogOpen?: (dialogState: PropertyDialogState) => void;\n /** Callback to highlight text */\n textHighlighter?: (text: string) => React.ReactNode;\n /** Default value to show if value rendering is asynchronous */\n defaultValue?: React.ReactNode;\n /** Whether property value is expanded. */\n isExpanded?: boolean;\n /** Called when property value expansion or collapse is requested. */\n onExpansionToggled?: () => void;\n /** Called when property value element height changes. */\n onHeightChanged?: (newHeight: number) => void;\n}\n\n/** Custom property value renderer interface\n * @public\n */\nexport interface IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n canRender: (\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) => boolean;\n /** Method that returns a JSX representation of PropertyRecord */\n render: (\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) => React.ReactNode;\n}\n\n/** Default implementation of property value renderer manager\n * @public\n */\nexport class PropertyValueRendererManager {\n private static _defaultRendererManager: PropertyValueRendererManager;\n\n protected _propertyRenderers: Map<string, IPropertyValueRenderer> = new Map<\n string,\n IPropertyValueRenderer\n >();\n protected _defaultPrimitiveValueRenderer: IPropertyValueRenderer =\n new PrimitivePropertyValueRenderer();\n protected _defaultArrayValueRenderer: IPropertyValueRenderer =\n new ArrayPropertyValueRenderer();\n protected _defaultStructValueRenderer: IPropertyValueRenderer =\n new StructPropertyValueRenderer();\n protected _defaultMergedValueRenderer: IPropertyValueRenderer =\n new MergedPropertyValueRenderer();\n\n private getCustomRenderer(record: PropertyRecord) {\n if (\n record.property.renderer &&\n this._propertyRenderers.has(record.property.renderer.name)\n )\n return this._propertyRenderers.get(record.property.renderer.name);\n\n if (this._defaultMergedValueRenderer.canRender(record))\n return this._defaultMergedValueRenderer;\n\n if (this._propertyRenderers.has(record.property.typename))\n return this._propertyRenderers.get(record.property.typename)!;\n\n return undefined;\n }\n\n private selectRenderer(record: PropertyRecord) {\n const customRenderer = this.getCustomRenderer(record);\n if (customRenderer) return customRenderer;\n\n // Use one of default renderers\n switch (record.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return this._defaultPrimitiveValueRenderer;\n case PropertyValueFormat.Array:\n return this._defaultArrayValueRenderer;\n case PropertyValueFormat.Struct:\n return this._defaultStructValueRenderer;\n default:\n return undefined;\n }\n }\n\n /** Render property into JSX element */\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ): React.ReactNode {\n const selectedRenderer = this.selectRenderer(record);\n\n if (!selectedRenderer || !selectedRenderer.canRender(record, context))\n return undefined;\n\n return selectedRenderer.render(record, context);\n }\n\n /** Register a specified property type renderer */\n public registerRenderer(\n rendererType: string,\n propertyRenderer: IPropertyValueRenderer,\n overwrite = false\n ) {\n if (!overwrite && this._propertyRenderers.has(rendererType)) {\n throw Error(\n `PropertyValueRendererManager.registerRenderer error: type '${rendererType}' already registered to '${propertyRenderer.constructor.name}'`\n );\n }\n\n this._propertyRenderers.set(rendererType, propertyRenderer);\n }\n\n /** Unregister a specified property type renderer */\n public unregisterRenderer(rendererType: string) {\n this._propertyRenderers.delete(rendererType);\n }\n\n /** Get the specified property type renderer instance */\n public getRegisteredRenderer(rendererType: string) {\n return this._propertyRenderers.get(rendererType);\n }\n\n /** Check whether a property record has a custom renderer registered that can render it */\n public hasCustomRenderer(record: PropertyRecord): boolean {\n const customRenderer = this.getCustomRenderer(record);\n return !!(customRenderer && customRenderer.canRender(record));\n }\n\n /** Returns default PropertyValueRendererManager instance */\n public static get defaultManager() {\n if (!this._defaultRendererManager)\n this._defaultRendererManager = new PropertyValueRendererManager();\n\n return this._defaultRendererManager;\n }\n}\n\nPropertyValueRendererManager.defaultManager.registerRenderer(\n \"url\",\n new UrlPropertyValueRenderer()\n);\nPropertyValueRendererManager.defaultManager.registerRenderer(\n \"multiline\",\n new MultilineTextPropertyValueRenderer()\n);\n"]}
|
|
1
|
+
{"version":3,"file":"ValueRendererManager.js","sourceRoot":"","sources":["../../../../src/components-react/properties/ValueRendererManager.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAIH,OAAO,EAAE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AAW,CAAC,IAAI,GAAG,CAC3I,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAC;IAC9D,CAAC;IAED,oDAAoD;IAC7C,kBAAkB,CAAC,YAAoB;QAC5C,IAAI,CAAC,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC/C,CAAC;IAED,wDAAwD;IACjD,qBAAqB,CAAC,YAAoB;QAC/C,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACnD,CAAC;IAED,0FAA0F;IACnF,iBAAiB,CAAC,MAAsB;QAC7C,MAAM,cAAc,GAAG,IAAI,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;QACtD,OAAO,CAAC,CAAC,CAAC,cAAc,IAAI,cAAc,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;IAED,4DAA4D;IACrD,MAAM,KAAK,cAAc;QAC9B,IAAI,CAAC,IAAI,CAAC,uBAAuB;YAC/B,IAAI,CAAC,uBAAuB,GAAG,IAAI,4BAA4B,EAAE,CAAC;QAEpE,OAAO,IAAI,CAAC,uBAAuB,CAAC;IACtC,CAAC;CACF;AAED,4BAA4B,CAAC,cAAc,CAAC,gBAAgB,CAC1D,KAAK,EACL,IAAI,wBAAwB,EAAE,CAC/B,CAAC;AACF,4BAA4B,CAAC,cAAc,CAAC,gBAAgB,CAC1D,WAAW,EACX,IAAI,kCAAkC,EAAE,CACzC,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 Properties\n */\n\nimport type * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation } from \"@itwin/core-react\";\nimport { ArrayPropertyValueRenderer } from \"./renderers/value/ArrayPropertyValueRenderer\";\nimport { MergedPropertyValueRenderer } from \"./renderers/value/MergedPropertyValueRenderer\";\nimport { MultilineTextPropertyValueRenderer } from \"./renderers/value/MultilineTextPropertyValueRenderer\";\nimport { PrimitivePropertyValueRenderer } from \"./renderers/value/PrimitivePropertyValueRenderer\";\nimport { StructPropertyValueRenderer } from \"./renderers/value/StructPropertyValueRenderer\";\nimport { UrlPropertyValueRenderer } from \"./renderers/value/UrlPropertyValueRenderer\";\n\n/** Types of property containers\n * @public\n */\nexport enum PropertyContainerType {\n PropertyPane = \"pane\",\n Table = \"table\",\n Tree = \"tree\",\n}\n\n/** State of the Dialog component in a container which renders properties\n * @public\n */\nexport interface PropertyDialogState {\n title: string;\n content: React.ReactNode;\n}\n\n/** State of the Popup component in a container which renders properties\n * @public\n */\nexport interface PropertyPopupState {\n fixedPosition: { top: number; left: number };\n content: React.ReactNode;\n}\n\n/** Additional parameters to the renderer\n * @public\n */\nexport interface PropertyValueRendererContext {\n /** Type of container that holds the property */\n containerType?: string;\n /** Style that should be applied to the rendered element */\n style?: React.CSSProperties;\n /** Orientation of property/container */\n orientation?: Orientation;\n /** Callback to request for a Popup to be shown. */\n onPopupShow?: (popupState: PropertyPopupState) => void;\n /** Callback to request for a Popup to be hidden. */\n onPopupHide?: () => void;\n /** Callback to request for Dialog to be opened. */\n onDialogOpen?: (dialogState: PropertyDialogState) => void;\n /** Callback to highlight text */\n textHighlighter?: (text: string) => React.ReactNode;\n /** Default value to show if value rendering is asynchronous */\n defaultValue?: React.ReactNode;\n /** Whether property value is expanded. */\n isExpanded?: boolean;\n /** Called when property value expansion or collapse is requested. */\n onExpansionToggled?: () => void;\n /** Called when property value element height changes. */\n onHeightChanged?: (newHeight: number) => void;\n}\n\n/** Custom property value renderer interface\n * @public\n */\nexport interface IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n canRender: (\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) => boolean;\n /** Method that returns a JSX representation of PropertyRecord */\n render: (\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) => React.ReactNode;\n}\n\n/** Default implementation of property value renderer manager\n * @public\n */\nexport class PropertyValueRendererManager {\n private static _defaultRendererManager: PropertyValueRendererManager;\n\n protected _propertyRenderers: Map<string, IPropertyValueRenderer> = new Map<\n string,\n IPropertyValueRenderer\n >();\n protected _defaultPrimitiveValueRenderer: IPropertyValueRenderer =\n new PrimitivePropertyValueRenderer();\n protected _defaultArrayValueRenderer: IPropertyValueRenderer =\n new ArrayPropertyValueRenderer();\n protected _defaultStructValueRenderer: IPropertyValueRenderer =\n new StructPropertyValueRenderer();\n protected _defaultMergedValueRenderer: IPropertyValueRenderer =\n new MergedPropertyValueRenderer();\n\n private getCustomRenderer(record: PropertyRecord) {\n if (\n record.property.renderer &&\n this._propertyRenderers.has(record.property.renderer.name)\n )\n return this._propertyRenderers.get(record.property.renderer.name);\n\n if (this._defaultMergedValueRenderer.canRender(record))\n return this._defaultMergedValueRenderer;\n\n if (this._propertyRenderers.has(record.property.typename))\n return this._propertyRenderers.get(record.property.typename)!;\n\n return undefined;\n }\n\n private selectRenderer(record: PropertyRecord) {\n const customRenderer = this.getCustomRenderer(record);\n if (customRenderer) return customRenderer;\n\n // Use one of default renderers\n switch (record.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return this._defaultPrimitiveValueRenderer;\n case PropertyValueFormat.Array:\n return this._defaultArrayValueRenderer;\n case PropertyValueFormat.Struct:\n return this._defaultStructValueRenderer;\n default:\n return undefined;\n }\n }\n\n /** Render property into JSX element */\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ): React.ReactNode {\n const selectedRenderer = this.selectRenderer(record);\n\n if (!selectedRenderer || !selectedRenderer.canRender(record, context))\n return undefined;\n\n return selectedRenderer.render(record, context);\n }\n\n /** Register a specified property type renderer */\n public registerRenderer(\n rendererType: string,\n propertyRenderer: IPropertyValueRenderer,\n overwrite = false\n ) {\n if (!overwrite && this._propertyRenderers.has(rendererType)) {\n throw Error(\n `PropertyValueRendererManager.registerRenderer error: type '${rendererType}' already registered to '${propertyRenderer.constructor.name}'`\n );\n }\n\n this._propertyRenderers.set(rendererType, propertyRenderer);\n }\n\n /** Unregister a specified property type renderer */\n public unregisterRenderer(rendererType: string) {\n this._propertyRenderers.delete(rendererType);\n }\n\n /** Get the specified property type renderer instance */\n public getRegisteredRenderer(rendererType: string) {\n return this._propertyRenderers.get(rendererType);\n }\n\n /** Check whether a property record has a custom renderer registered that can render it */\n public hasCustomRenderer(record: PropertyRecord): boolean {\n const customRenderer = this.getCustomRenderer(record);\n return !!(customRenderer && customRenderer.canRender(record));\n }\n\n /** Returns default PropertyValueRendererManager instance */\n public static get defaultManager() {\n if (!this._defaultRendererManager)\n this._defaultRendererManager = new PropertyValueRendererManager();\n\n return this._defaultRendererManager;\n }\n}\n\nPropertyValueRendererManager.defaultManager.registerRenderer(\n \"url\",\n new UrlPropertyValueRenderer()\n);\nPropertyValueRendererManager.defaultManager.registerRenderer(\n \"multiline\",\n new MultilineTextPropertyValueRenderer()\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommonPropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/CommonPropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAC1B,MAAM,CAAC,cAAc,CAC1B,WAAoB,EACpB,WAAyB,E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iB;SACnC,CAAC;QAEF,IAAI,YAAyC,CAAC;QAC9C,IAAI,4BAA4B;YAC9B,YAAY,GAAG,4BAA4B,CAAC,MAAM,CAChD,cAAc,EACd,eAAe,CAChB,CAAC;;YAEF,YAAY,GAAG,4BAA4B,CAAC,cAAc,CAAC,MAAM,CAC/D,cAAc,EACd,eAAe,CAChB,CAAC;QAEJ,oDAAoD;QACpD,IAAI,WAAW,KAAK,WAAW,CAAC,QAAQ;YACtC,YAAY,GAAG,CACb,8BACE,KAAK,EAAE;oBACL,WAAW,EAAE,sBAAsB,CAAC,cAAc,CAChD,WAAW,EACX,WAAW,CACZ;iBACF,IAEA,YAAY,CACR,CACR,CAAC;QAEJ,OAAO,YAAY,CAAC;IACtB,CAAC;IAEO,MAAM,CAAC,uBAAuB,CACpC,SAAiE,EACjE,cAA8B;QAE9B,MAAM,WAAW,GAAG,SAAS,CAAC,eAAe,CAAC;QAC9C,MAAM,YAAY,GAAG,WAAW,EAAE,yBAAyB,CAAC;QAC5D,MAAM,UAAU,GAAG,WAAW,EAAE,cAAc,IAAI,CAAC,CAAC;QACpD,IAAI,YAAoB,CAAC;QAEzB,IAAI,SAAS,CAAC,YAAY,EAAE;
|
|
1
|
+
{"version":3,"file":"CommonPropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/CommonPropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,yBAAyB,CAAC;AAEjC;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAC1B,MAAM,CAAC,cAAc,CAC1B,WAAoB,EAC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EAAE,gBAAgB,EAClC,UAAU,EAAE,SAAS,CAAC,eAAe,GACrC,CACH,CAAC;QAEF,OAAO,iBAAiB,CAAC;IAC3B,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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport { countMatchesInString } from \"../../common/countMatchesInString\";\nimport { HighlightedText } from \"../../common/HighlightedText\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport type { PropertyValueRendererContext } from \"../ValueRendererManager\";\nimport {\n PropertyContainerType,\n PropertyValueRendererManager,\n} from \"../ValueRendererManager\";\n\n/**\n * @internal\n */\nexport class CommonPropertyRenderer {\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n ): number {\n if (!indentation) return 0;\n\n const maxIndent = 17;\n const minIndent = 6;\n if (\n orientation !== Orientation.Horizontal ||\n !width ||\n !columnRatio ||\n !minColumnLabelWidth\n )\n return indentation * maxIndent;\n\n const currentSize = Math.ceil(width * columnRatio);\n const shrinkThreshold = minColumnLabelWidth + maxIndent * indentation;\n if (currentSize >= shrinkThreshold) return indentation * maxIndent;\n\n const minShrink =\n minColumnLabelWidth + minIndent + maxIndent * (indentation - 1);\n if (currentSize <= minShrink)\n return (\n minIndent +\n this.getLabelOffset(\n indentation - 1,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth\n )\n );\n\n return currentSize - minColumnLabelWidth;\n }\n\n public static createNewDisplayValue(\n orientation: Orientation,\n propertyRecord: PropertyRecord,\n indentation?: number,\n propertyValueRendererManager?: PropertyValueRendererManager,\n isExpanded?: boolean,\n onExpansionToggled?: () => void,\n onHeightChanged?: (newHeight: number) => void,\n highlight?: HighlightingComponentProps & {\n applyOnLabel: boolean;\n applyOnValue: boolean;\n }\n ) {\n const highlightCallback = highlight?.applyOnValue\n ? CommonPropertyRenderer.createHighlightCallback(\n highlight,\n propertyRecord\n )\n : undefined;\n const rendererContext: PropertyValueRendererContext = {\n orientation,\n containerType: PropertyContainerType.PropertyPane,\n isExpanded,\n onExpansionToggled,\n onHeightChanged,\n textHighlighter: highlightCallback,\n };\n\n let displayValue: React.ReactNode | undefined;\n if (propertyValueRendererManager)\n displayValue = propertyValueRendererManager.render(\n propertyRecord,\n rendererContext\n );\n else\n displayValue = PropertyValueRendererManager.defaultManager.render(\n propertyRecord,\n rendererContext\n );\n\n // Align value with label if orientation is vertical\n if (orientation === Orientation.Vertical)\n displayValue = (\n <span\n style={{\n paddingLeft: CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation\n ),\n }}\n >\n {displayValue}\n </span>\n );\n\n return displayValue;\n }\n\n private static createHighlightCallback(\n highlight: HighlightingComponentProps & { applyOnLabel: boolean },\n propertyRecord: PropertyRecord\n ) {\n const activeMatch = highlight.activeHighlight;\n const propertyName = activeMatch?.highlightedItemIdentifier;\n const matchIndex = activeMatch?.highlightIndex ?? 0;\n let labelMatches: number;\n\n if (highlight.applyOnLabel) {\n labelMatches = countMatchesInString(\n propertyRecord.property.displayLabel.toLowerCase(),\n highlight.highlightedText\n );\n } else {\n labelMatches = 0;\n }\n\n const activeMatchIndex =\n propertyRecord.property.name === propertyName &&\n matchIndex - labelMatches >= 0\n ? matchIndex - labelMatches\n : undefined;\n const highlightCallback = (text: string) => (\n <HighlightedText\n text={text}\n activeMatchIndex={activeMatchIndex}\n searchText={highlight.highlightedText}\n />\n );\n\n return highlightCallback;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyGridColumns.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PropertyGridColumns.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUhD,gBAAgB;AAChB,MAAM,OAAO,+BAA+B;IAM1C,YAAmB,UAA8C;QALzD,mBAAc,GAAW,CAAC,CAAC;QAC3B,mBAAc,GAAW,CAAC,CAAC;QAC3B,uBAAkB,GAAW,CAAC,CAAC;QAIrC,IAAI,CAAC,UAAU,EAAE;
|
|
1
|
+
{"version":3,"file":"PropertyGridColumns.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PropertyGridColumns.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAUhD,gBAAgB;AAChB,MAAM,OAAO,+BAA+B;IAM1C,YAAmB,UAA8C;QALzD,mBAAc,GAAW,CAAC,CAAC;QAC3B,mBAAc,GAAW,CAAC,CAAC;QAC3B,uBAAkB,GAAW,CAAC,CAAC;QAIrC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,IAAI,CAAC,2BAA2B,GAAG,KAAK,CAAC;YACzC,OAAO;QACT,CAAC;QAED,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;QAC/C,IAAI,CAAC,cAAc,GAAG,UAAU,CAAC,aAAa,CAAC;QAC/C,IAAI,CAAC,kBAAkB,GAAG,UAAU,CAAC,iBAAiB,CAAC;QACvD,IAAI,CAAC,2BAA2B,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAC3E,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,IAAW,aAAa;QACtB,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,IAAW,iBAAiB;QAC1B,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED,IAAW,0BAA0B;QACnC,OAAO,IAAI,CAAC,2BAA2B,CAAC;IAC1C,CAAC;IA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IAAI,CAAC,aAAa,OAAO,KAAK,GAAG,GAAG,IAAI,CAAC;QACvE,MAAM,WAAW,GAAG,UAAU,IAAI,CAAC,aAAa,UAAU,CAAC;QAE3D,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAC7B,WAAW;YACX,eAAe;YACf,WAAW;YACX,kBAAkB;SACnB,CAAC,CAAC;IACL,CAAC;IAEO,gBAAgB,CAAC,iBAA0B;QACjD,OAAO,IAAI,CAAC,kBAAkB,CAAC;YAC7B,MAAM;YACN,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;SACvC,CAAC,CAAC;IACL,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 Properties\n */\n\nimport { Orientation } from \"@itwin/core-react\";\n\n/** @internal */\nexport interface PropertyGridColumnInfo {\n minLabelWidth: number;\n minValueWidth: number;\n actionButtonWidth: number;\n isMinimumColumnSizeEnabled: boolean;\n}\n\n/** @internal */\nexport class PropertyGridColumnStyleProvider {\n private _minLabelWidth: number = 0;\n private _minValueWidth: number = 0;\n private _actionButtonWidth: number = 0;\n private _isMinimumColumnSizeEnabled: boolean;\n\n public constructor(columnInfo: PropertyGridColumnInfo | undefined) {\n if (!columnInfo) {\n this._isMinimumColumnSizeEnabled = false;\n return;\n }\n\n this._minLabelWidth = columnInfo.minLabelWidth;\n this._minValueWidth = columnInfo.minValueWidth;\n this._actionButtonWidth = columnInfo.actionButtonWidth;\n this._isMinimumColumnSizeEnabled = columnInfo.isMinimumColumnSizeEnabled;\n }\n\n public get minLabelWidth() {\n return this._minLabelWidth;\n }\n\n public get minValueWidth() {\n return this._minValueWidth;\n }\n\n public get actionButtonWidth() {\n return this._actionButtonWidth;\n }\n\n public get isMinimumColumnSizeEnabled() {\n return this._isMinimumColumnSizeEnabled;\n }\n\n public getStyle(\n orientation: Orientation,\n needActionButtons: boolean,\n ratio: number,\n needElementSeparator: boolean\n ): React.CSSProperties {\n switch (orientation) {\n case Orientation.Horizontal:\n return this.getHorizontalStyle(\n needActionButtons,\n ratio,\n needElementSeparator\n );\n case Orientation.Vertical:\n return this.getVerticalStyle(needActionButtons);\n /* istanbul ignore next */\n default:\n const unhandledOrientationType: never = orientation; // Compile time check that all cases handled\n throw new Error(\n `Unhandled orientation type: ${unhandledOrientationType}. Was new orientation added ? `\n );\n }\n }\n\n /** Join columns together in sequence, filtering out undefined column definitions */\n private columnStyleBuilder(\n columns: Array<string | undefined>\n ): React.CSSProperties {\n columns = columns.filter((el) => el !== undefined);\n return { gridTemplateColumns: columns.join(\" \") };\n }\n\n private getHorizontalStyle(\n needActionButtons: boolean,\n ratio: number,\n needElementSeparator: boolean\n ): React.CSSProperties {\n const separatorColumn = needElementSeparator ? \"1px\" : undefined;\n const actionButtonColumn = needActionButtons\n ? this.actionButtonWidth\n ? `${this.actionButtonWidth}px`\n : \"auto\"\n : undefined;\n if (!this.isMinimumColumnSizeEnabled)\n return this.columnStyleBuilder([\n `${ratio * 100}%`,\n separatorColumn,\n \"auto\",\n actionButtonColumn,\n ]);\n\n const labelColumn = `minmax(${this.minLabelWidth}px, ${ratio * 100}%)`;\n const valueColumn = `minmax(${this.minValueWidth}px, 1fr)`;\n\n return this.columnStyleBuilder([\n labelColumn,\n separatorColumn,\n valueColumn,\n actionButtonColumn,\n ]);\n }\n\n private getVerticalStyle(needActionButtons: boolean): React.CSSProperties {\n return this.columnStyleBuilder([\n \"auto\",\n needActionButtons ? \"auto\" : undefined,\n ]);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CA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,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW,EAAE;YACnD,KAAK,mBAAmB,CAAC,SAAS;gBAChC,OAAO,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAAC;YACnE,KAAK,mBAAmB,CAAC,KAAK;gBAC5B,uDAAuD;gBACvD,IACE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,WAAW;oBACzC,mBAAmB,CAAC,KAAK;oBAC3B,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;oBAElD,OAAO,oBAAC,yBAAyB,OAAK,sBAAsB,GAAI,CAAC;YACrE,0CAA0C;YAC1C,KAAK,mBAAmB,CAAC,MAAM;gBAC7B,OAAO,CACL,oBAAC,4BAA4B,IAC3B,aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;SACL;IACH,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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation } from \"@itwin/core-react\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport { EditorContainer } from \"../../editors/EditorContainer\";\nimport { UiComponents } from \"../../UiComponents\";\nimport type { PropertyValueRendererManager } from \"../ValueRendererManager\";\nimport type { ActionButtonRenderer } from \"./ActionButtonRenderer\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"./PropertyGridColumns\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | {\n ratio: number;\n };\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Props used for highlighting. */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<\n PropertyRendererProps,\n PropertyRendererState\n> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n constructor(props: PropertyRendererProps) {\n super(props);\n }\n\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n ): number {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth\n );\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager\n );\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit) this.props.onEditCommit(args);\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel) this.props.onEditCancel();\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue: (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />\n ),\n });\n }\n\n /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (\n prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation\n )\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override render() {\n const {\n propertyValueRendererManager,\n isEditing,\n onEditCommit,\n onEditCancel,\n ...props\n } = this.props;\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (\n this.props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Array &&\n this.props.propertyRecord.value.items.length === 0\n )\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"PropertyRenderer.js","sourceRoot":"","sources":["../../../../../src/components-react/properties/renderers/PropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAGlD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAE9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAyExE;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK,CAAC,SAG3C;IAMC,YAAY,KAA4B;QACtC,KAAK,CAAC,KAAK,CAAC,CAAC;QANf,gBAAgB;QACS,UAAK,GAAoC;YAChE,YAAY,EAAE,YAAY,CAAC,SAAS,CAAC,iBAAiB,CAAC;SACxD,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aAAa,EAAE,IAAI,KACf,sBAAsB,GAC1B,CACH,CAAC;QACN,CAAC;IACH,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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport type { Orientation } from \"@itwin/core-react\";\nimport type { HighlightingComponentProps } from \"../../common/HighlightingComponentProps\";\nimport type { PropertyUpdatedArgs } from \"../../editors/EditorContainer\";\nimport { EditorContainer } from \"../../editors/EditorContainer\";\nimport { UiComponents } from \"../../UiComponents\";\nimport type { PropertyValueRendererManager } from \"../ValueRendererManager\";\nimport type { ActionButtonRenderer } from \"./ActionButtonRenderer\";\nimport { CommonPropertyRenderer } from \"./CommonPropertyRenderer\";\nimport { NonPrimitivePropertyRenderer } from \"./NonPrimitivePropertyRenderer\";\nimport type { PrimitiveRendererProps } from \"./PrimitivePropertyRenderer\";\nimport { PrimitivePropertyRenderer } from \"./PrimitivePropertyRenderer\";\nimport type { PropertyGridColumnInfo } from \"./PropertyGridColumns\";\n\n/** Properties shared by all renderers and PropertyView\n * @public\n */\nexport interface SharedRendererProps {\n /** PropertyRecord to render */\n propertyRecord: PropertyRecord;\n /** Unique string, that identifies this property component. Should be used if onClick or onRightClick are provided */\n uniqueKey?: string;\n /** Orientation to use for displaying the property */\n orientation: Orientation;\n /** Controls component selection */\n isSelected?: boolean;\n /** Called when property gets clicked. If undefined, clicking is disabled */\n onClick?: (property: PropertyRecord, key?: string) => void;\n /** Called when property gets right clicked. If undefined, right clicking is not working */\n onRightClick?: (property: PropertyRecord, key?: string) => void;\n /** Called to show a context menu for properties */\n onContextMenu?: (property: PropertyRecord, e: React.MouseEvent) => void;\n /** Ratio between label and value cells */\n columnRatio?: number;\n /** Callback to column ratio changed event */\n onColumnRatioChanged?: (ratio: number) => void | {\n ratio: number;\n };\n /** Indicates that properties have *hover* effect */\n isHoverable?: boolean;\n /** Indicates that properties can be selected */\n isSelectable?: boolean;\n /** Width of the whole property element */\n width?: number;\n /** Array of action button renderers */\n actionButtonRenderers?: ActionButtonRenderer[];\n /** Is resize handle hovered */\n isResizeHandleHovered?: boolean;\n /** Callback to hover event change */\n onResizeHandleHoverChanged?: (isHovered: boolean) => void;\n /** Is resize handle being dragged */\n isResizeHandleBeingDragged?: boolean;\n /** Callback to drag event change */\n onResizeHandleDragChanged?: (isDragStarted: boolean) => void;\n /** Information for styling property grid columns */\n columnInfo?: PropertyGridColumnInfo;\n}\n\n/** Properties of [[PropertyRenderer]] React component\n * @public\n */\nexport interface PropertyRendererProps extends SharedRendererProps {\n /** Custom value renderer */\n propertyValueRendererManager?: PropertyValueRendererManager;\n /** Multiplier of how much the property is indented to the right */\n indentation?: number;\n /** Indicates property is being edited */\n isEditing?: boolean;\n /** Called when property edit is committed. */\n onEditCommit?: (args: PropertyUpdatedArgs) => void;\n /** Called when property edit is cancelled. */\n onEditCancel?: () => void;\n /** Props used for highlighting. */\n highlight?: HighlightingComponentProps;\n}\n\n/** State of [[PropertyRenderer]] React component\n * @internal\n */\ninterface PropertyRendererState {\n /** Currently loaded property value */\n displayValue?: React.ReactNode;\n}\n\n/** A React component that renders properties\n * @public\n */\nexport class PropertyRenderer extends React.Component<\n PropertyRendererProps,\n PropertyRendererState\n> {\n /** @internal */\n public override readonly state: Readonly<PropertyRendererState> = {\n displayValue: UiComponents.translate(\"general.loading\"),\n };\n\n constructor(props: PropertyRendererProps) {\n super(props);\n }\n\n public static getLabelOffset(\n indentation?: number,\n orientation?: Orientation,\n width?: number,\n columnRatio?: number,\n minColumnLabelWidth?: number\n ): number {\n return CommonPropertyRenderer.getLabelOffset(\n indentation,\n orientation,\n width,\n columnRatio,\n minColumnLabelWidth\n );\n }\n\n private updateDisplayValue(props: PropertyRendererProps) {\n if (props.isEditing) {\n this.updateDisplayValueAsEditor(props);\n return;\n }\n\n const displayValue = CommonPropertyRenderer.createNewDisplayValue(\n props.orientation,\n props.propertyRecord,\n props.indentation,\n props.propertyValueRendererManager\n );\n this.setState({ displayValue });\n }\n\n private _onEditCommit = (args: PropertyUpdatedArgs) => {\n // istanbul ignore else\n if (this.props.onEditCommit) this.props.onEditCommit(args);\n };\n\n private _onEditCancel = () => {\n // istanbul ignore else\n if (this.props.onEditCancel) this.props.onEditCancel();\n };\n\n /** Display property record value in an editor */\n public updateDisplayValueAsEditor(props: PropertyRendererProps) {\n this.setState({\n displayValue: (\n <EditorContainer\n propertyRecord={props.propertyRecord}\n onCommit={this._onEditCommit}\n onCancel={this._onEditCancel}\n setFocus={true}\n />\n ),\n });\n }\n\n /** @internal */\n public override componentDidMount() {\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override componentDidUpdate(prevProps: PropertyRendererProps) {\n if (\n prevProps.propertyRecord !== this.props.propertyRecord ||\n prevProps.isEditing !== this.props.isEditing ||\n prevProps.orientation !== this.props.orientation\n )\n this.updateDisplayValue(this.props);\n }\n\n /** @internal */\n public override render() {\n const {\n propertyValueRendererManager,\n isEditing,\n onEditCommit,\n onEditCancel,\n ...props\n } = this.props;\n const primitiveRendererProps: PrimitiveRendererProps = {\n ...props,\n valueElement: this.state.displayValue,\n indentation: this.props.indentation,\n };\n\n switch (this.props.propertyRecord.value.valueFormat) {\n case PropertyValueFormat.Primitive:\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n case PropertyValueFormat.Array:\n // If array is empty, render it as a primitive property\n if (\n this.props.propertyRecord.value.valueFormat ===\n PropertyValueFormat.Array &&\n this.props.propertyRecord.value.items.length === 0\n )\n return <PrimitivePropertyRenderer {...primitiveRendererProps} />;\n // eslint-disable-next-line no-fallthrough\n case PropertyValueFormat.Struct:\n return (\n <NonPrimitivePropertyRenderer\n isCollapsible={true}\n {...primitiveRendererProps}\n />\n );\n }\n }\n}\n"]}
|
|
@@ -11,6 +11,6 @@ export declare class ArrayPropertyValueRenderer implements IPropertyValueRendere
|
|
|
11
11
|
/** Checks if the renderer can handle given property */
|
|
12
12
|
canRender(record: PropertyRecord): boolean;
|
|
13
13
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
14
|
-
render(record: PropertyRecord, context?: PropertyValueRendererContext): React.ReactNode;
|
|
14
|
+
render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=ArrayPropertyValueRenderer.d.ts.map
|
package/lib/esm/components-react/properties/renderers/value/ArrayPropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/ArrayPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,0BAA0B;IACrC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,KAAK,CAAC;IAChE,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,MAAM,WAAW,GAAI,MAAM,CAAC,KAAoB,CAAC,KAAK,CAAC;QAEvD,IAAI,OAAO,IAAI,OAAO,CAAC,aAAa,KAAK,qBAAqB,CAAC,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"ArrayPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/ArrayPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,0BAA0B;IACrC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,KAAK,CAAC;IAChE,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,MAAM,WAAW,GAAI,MAAM,CAAC,KAAoB,CAAC,KAAK,CAAC;QAEvD,IAAI,OAAO,IAAI,OAAO,CAAC,aAAa,KAAK,qBAAqB,CAAC,KAAK,EAAE,CAAC;YACrE,OAAO,gBAAgB,CACrB,oBAAC,uBAAuB,IACtB,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,OAAO,CAAC,YAAY,EAClC,WAAW,EACT,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,GAEpE,EACF,OAAO,CACR,CAAC;QACJ,CAAC;QAED,IACE,OAAO;YACP,OAAO,CAAC,aAAa,KAAK,qBAAqB,CAAC,YAAY,EAC5D,CAAC;YACD,OAAO,gBAAgB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,gBAAgB,CACrB,WAAW,CAAC,MAAM,KAAK,CAAC;YACtB,CAAC,CAAC,GAAI,MAAM,CAAC,KAAoB,CAAC,aAAa,IAAI,WAAW,CAAC,MAAM,GAAG;YACxE,CAAC,CAAC,GAAI,MAAM,CAAC,KAAoB,CAAC,aAAa,IAAI,EACrD,OAAO,CACR,CAAC;IACJ,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 Properties\n */\n\nimport * as React from \"react\";\nimport type { ArrayValue, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { PropertyContainerType } from \"../../ValueRendererManager\";\nimport { TableArrayValueRenderer } from \"./table/ArrayValueRenderer\";\nimport { withContextStyle } from \"./WithContextStyle\";\n\n/** Default Array Property Renderer\n * @public\n */\nexport class ArrayPropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return record.value.valueFormat === PropertyValueFormat.Array;\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n const recordItems = (record.value as ArrayValue).items;\n\n if (context && context.containerType === PropertyContainerType.Table) {\n return withContextStyle(\n <TableArrayValueRenderer\n propertyRecord={record}\n onDialogOpen={context.onDialogOpen}\n orientation={\n context.orientation ? context.orientation : Orientation.Horizontal\n }\n />,\n context\n );\n }\n\n if (\n context &&\n context.containerType === PropertyContainerType.PropertyPane\n ) {\n return withContextStyle(\"\", context);\n }\n\n return withContextStyle(\n recordItems.length !== 0\n ? `${(record.value as ArrayValue).itemsTypeName}[${recordItems.length}]`\n : `${(record.value as ArrayValue).itemsTypeName}[]`,\n context\n );\n }\n}\n"]}
|
package/lib/esm/components-react/properties/renderers/value/MergedPropertyValueRenderer.d.ts
CHANGED
|
@@ -10,6 +10,6 @@ export declare class MergedPropertyValueRenderer implements IPropertyValueRender
|
|
|
10
10
|
/** Checks if the renderer can handle given property */
|
|
11
11
|
canRender(record: PropertyRecord): boolean;
|
|
12
12
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
13
|
-
render(_record: PropertyRecord, context?: PropertyValueRendererContext): import("react").ReactNode;
|
|
13
|
+
render(_record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable<import("react").ReactNode> | import("react").JSX.Element | null | undefined;
|
|
14
14
|
}
|
|
15
15
|
//# sourceMappingURL=MergedPropertyValueRenderer.d.ts.map
|
package/lib/esm/components-react/properties/renderers/value/StructPropertyValueRenderer.d.ts
CHANGED
|
@@ -11,6 +11,6 @@ export declare class StructPropertyValueRenderer implements IPropertyValueRender
|
|
|
11
11
|
/** Checks if the renderer can handle given property */
|
|
12
12
|
canRender(record: PropertyRecord): boolean;
|
|
13
13
|
/** Method that returns a JSX representation of PropertyRecord */
|
|
14
|
-
render(record: PropertyRecord, context?: PropertyValueRendererContext): React.ReactNode;
|
|
14
|
+
render(record: PropertyRecord, context?: PropertyValueRendererContext): string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=StructPropertyValueRenderer.d.ts.map
|
package/lib/esm/components-react/properties/renderers/value/StructPropertyValueRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StructPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/StructPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,MAAM,CAAC;IACjE,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,IAAI,OAAO,IAAI,OAAO,CAAC,aAAa,KAAK,qBAAqB,CAAC,KAAK,EAAE;
|
|
1
|
+
{"version":3,"file":"StructPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/StructPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD;;GAEG;AACH,MAAM,OAAO,2BAA2B;IACtC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,MAAM,CAAC;IACjE,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,IAAI,OAAO,IAAI,OAAO,CAAC,aAAa,KAAK,qBAAqB,CAAC,KAAK,EAAE,CAAC;YACrE,OAAO,gBAAgB,CACrB,oBAAC,wBAAwB,IACvB,cAAc,EAAE,MAAM,EACtB,YAAY,EAAE,OAAO,CAAC,YAAY,EAClC,WAAW,EACT,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW,CAAC,UAAU,GAEpE,EACF,OAAO,CACR,CAAC;QACJ,CAAC;QAED,IACE,OAAO;YACP,OAAO,CAAC,aAAa,KAAK,qBAAqB,CAAC,YAAY,EAC5D,CAAC;YACD,OAAO,gBAAgB,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;QACvC,CAAC;QAED,OAAO,gBAAgB,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,QAAQ,GAAG,EAAE,OAAO,CAAC,CAAC;IACpE,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 Properties\n */\n\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat } from \"@itwin/appui-abstract\";\nimport { Orientation } from \"@itwin/core-react\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { PropertyContainerType } from \"../../ValueRendererManager\";\nimport { TableStructValueRenderer } from \"./table/StructValueRenderer\";\nimport { withContextStyle } from \"./WithContextStyle\";\n\n/** Default Struct Property Renderer\n * @public\n */\nexport class StructPropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return record.value.valueFormat === PropertyValueFormat.Struct;\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n if (context && context.containerType === PropertyContainerType.Table) {\n return withContextStyle(\n <TableStructValueRenderer\n propertyRecord={record}\n onDialogOpen={context.onDialogOpen}\n orientation={\n context.orientation ? context.orientation : Orientation.Horizontal\n }\n />,\n context\n );\n }\n\n if (\n context &&\n context.containerType === PropertyContainerType.PropertyPane\n ) {\n return withContextStyle(\"\", context);\n }\n\n return withContextStyle(`{${record.property.typename}}`, context);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UrlPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/UrlPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK/E,OAAO,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,wBAAwB;IACnC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;YAC1D;gBACE,iBAAiB,CAAC,GAAG;gBACrB,iBAAiB,CAAC,MAAM;gBACxB,iBAAiB,CAAC,IAAI;aACvB,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,QAA6B,CAAC,CAC1D,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,OAAO,CACL,oBAAC,kCAAkC,IACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,yBAAyB,GACvC,CACH,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QACtD,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;SAClB;
|
|
1
|
+
{"version":3,"file":"UrlPropertyValueRenderer.js","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/UrlPropertyValueRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAK/E,OAAO,EAAE,kCAAkC,EAAE,MAAM,kCAAkC,CAAC;AACtF,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,OAAO,wBAAwB;IACnC,uDAAuD;IAChD,SAAS,CAAC,MAAsB;QACrC,OAAO,CACL,MAAM,CAAC,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS;YAC1D;gBACE,iBAAiB,CAAC,GAAG;gBACrB,iBAAiB,CAAC,MAAM;gBACxB,iBAAiB,CAAC,IAAI;aACvB,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,QAA6B,CAAC,CAC1D,CAAC;IACJ,CAAC;IAED,iEAAiE;IAC1D,MAAM,CACX,MAAsB,EACtB,OAAsC;QAEtC,OAAO,CACL,oBAAC,kCAAkC,IACjC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,qBAAqB,EAAE,qBAAqB,EAC5C,YAAY,EAAE,yBAAyB,GACvC,CACH,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,IAAY;IAC9B,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;QACtD,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC;SAClB,CAAC;QACJ,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC/C,IAAI,UAAU;YAAE,UAAU,CAAC,KAAK,EAAE,CAAC;IACrC,CAAC;AACH,CAAC;AAED,MAAM,yBAAyB,GAAqB;IAClD,OAAO,EAAE,UAAU;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 Properties\n */\n\nimport * as React from \"react\";\nimport type { LinkElementsInfo, PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"../../ValueRendererManager\";\nimport { PrimitivePropertyValueRendererImpl } from \"./PrimitivePropertyValueRenderer\";\nimport { convertRecordToString } from \"./Common\";\n\n/**\n * URL property value renderer that renders the whole value as a URL without matching it\n * against URL regex.\n *\n * @public\n */\nexport class UrlPropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return (\n record.value.valueFormat === PropertyValueFormat.Primitive &&\n [\n StandardTypeNames.URL,\n StandardTypeNames.String,\n StandardTypeNames.Text,\n ].includes(record.property.typename as StandardTypeNames)\n );\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n return (\n <PrimitivePropertyValueRendererImpl\n record={record}\n context={context}\n stringValueCalculator={convertRecordToString}\n linksHandler={URI_PROPERTY_LINK_HANDLER}\n />\n );\n }\n}\n\n/**\n * Default URI onClick event, sets location.href to the whole URI value without matching it\n * against URL regex.\n */\nfunction urlOnClick(text: string) {\n if (text.startsWith(\"mailto:\") || text.startsWith(\"pw:\"))\n location.href = text;\n else {\n const windowOpen = window.open(text, \"_blank\");\n if (windowOpen) windowOpen.focus();\n }\n}\n\nconst URI_PROPERTY_LINK_HANDLER: LinkElementsInfo = {\n onClick: urlOnClick,\n};\n"]}
|
|
@@ -6,5 +6,5 @@ import type { PropertyValueRendererContext } from "../../ValueRendererManager";
|
|
|
6
6
|
/** Wraps a React component with a span element with a given style attribute
|
|
7
7
|
* @public
|
|
8
8
|
*/
|
|
9
|
-
export declare const withContextStyle: (node: React.ReactNode, context?: PropertyValueRendererContext) => React.ReactNode;
|
|
9
|
+
export declare const withContextStyle: (node: React.ReactNode, context?: PropertyValueRendererContext) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
|
|
10
10
|
//# sourceMappingURL=WithContextStyle.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WithContextStyle.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/WithContextStyle.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,gBAAgB,SACrB,MAAM,SAAS,YACX,4BAA4B,
|
|
1
|
+
{"version":3,"file":"WithContextStyle.d.ts","sourceRoot":"","sources":["../../../../../../src/components-react/properties/renderers/value/WithContextStyle.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,4BAA4B,CAAC;AAE/E;;GAEG;AACH,eAAO,MAAM,gBAAgB,SACrB,MAAM,SAAS,YACX,4BAA4B,iGAIvC,CAAC"}
|