@itwin/imodel-components-react 4.0.0-dev.2 → 4.0.0-dev.21
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 +139 -2
- package/LICENSE.md +1 -1
- package/README.md +2 -2
- package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.js +3 -7
- package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +2 -2
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js +6 -2
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +9 -4
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +90 -90
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +5 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +10 -4
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +62 -63
- package/lib/cjs/imodel-components-react/color/HueSlider.js +5 -1
- package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js +5 -1
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
- package/lib/cjs/imodel-components-react/color/Swatch.js +5 -1
- package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/Swatch.scss +22 -23
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/ColorEditor.js +5 -1
- package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/ColorEditor.scss +18 -18
- package/lib/cjs/imodel-components-react/editors/WeightEditor.js +5 -1
- package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/WeightEditor.scss +16 -16
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +5 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +11 -4
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +106 -107
- package/lib/cjs/imodel-components-react/lineweight/Swatch.js +5 -1
- package/lib/cjs/imodel-components-react/lineweight/Swatch.js.map +1 -1
- package/lib/cjs/imodel-components-react/lineweight/Swatch.scss +48 -48
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +6 -2
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +51 -52
- package/lib/cjs/imodel-components-react/navigationaids/Cube.js +5 -1
- package/lib/cjs/imodel-components-react/navigationaids/Cube.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/Cube.scss +19 -19
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +4 -24
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +46 -54
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -182
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +16 -6
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -134
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +6 -2
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +59 -63
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +7 -4
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +10 -5
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +6 -3
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +6 -3
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +10 -10
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +8 -5
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +6 -3
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +5 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +22 -23
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +5 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +12 -4
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +28 -31
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js +5 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +105 -112
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +13 -5
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +359 -356
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +5 -1
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
- package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +3 -6
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +59 -19
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +178 -164
- package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +3 -32
- package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +12 -10
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/cjs/imodel-components-react.d.ts +0 -1
- package/lib/cjs/imodel-components-react.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react.js +5 -2
- package/lib/cjs/imodel-components-react.js.map +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.js +4 -7
- package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +2 -2
- package/lib/esm/imodel-components-react/color/AlphaSlider.js +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
- package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js +5 -4
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +90 -90
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +6 -4
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +62 -63
- package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
- package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
- package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/esm/imodel-components-react/color/Swatch.scss +22 -23
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/ColorEditor.scss +18 -18
- package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/WeightEditor.scss +16 -16
- package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +7 -4
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +106 -107
- package/lib/esm/imodel-components-react/lineweight/Swatch.js.map +1 -1
- package/lib/esm/imodel-components-react/lineweight/Swatch.scss +48 -48
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +2 -1
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +51 -52
- package/lib/esm/imodel-components-react/navigationaids/Cube.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/Cube.scss +19 -19
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts +4 -24
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +42 -52
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -182
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +12 -5
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -134
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +59 -63
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +2 -3
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +6 -5
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js +1 -2
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +1 -2
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +5 -9
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +3 -4
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +1 -2
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +22 -23
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
- package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js +7 -3
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +28 -31
- package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/Scrubber.scss +105 -112
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +10 -6
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +359 -356
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
- package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +3 -6
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +47 -11
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +178 -164
- package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +3 -32
- package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +7 -9
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +2 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/esm/imodel-components-react.d.ts +0 -1
- package/lib/esm/imodel-components-react.d.ts.map +1 -1
- package/lib/esm/imodel-components-react.js +0 -1
- package/lib/esm/imodel-components-react.js.map +1 -1
- package/lib/public/locales/en/UiIModelComponents.json +139 -139
- package/package.json +38 -39
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +0 -22
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts.map +0 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +0 -146
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +0 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.scss +0 -94
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +0 -22
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts.map +0 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +0 -123
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +0 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +0 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,CAAK,CACvI,CAEJ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { Format, FormatProps, FormatTraits, FormatType, getTraitString, parseFormatType, parseScientificType,\n parseShowSignOption, ScientificType, scientificTypeToString, ShowSignOption, showSignOptionToString,\n} from \"@itwin/core-quantity\";\nimport { SignOptionSelector } from \"./misc/SignOption\";\nimport { ThousandsSeparator } from \"./misc/ThousandsSeparator\";\nimport { DecimalSeparatorSelector } from \"./misc/DecimalSeparator\";\nimport { ScientificTypeSelector } from \"./misc/ScientificType\";\nimport { StationSeparatorSelector } from \"./misc/StationSeparatorSelector\";\nimport { StationSizeSelector } from \"./misc/StationSizeSelector\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties of [[MiscFormatOptions]] component.\n * @alpha\n */\nexport interface MiscFormatOptionsProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n enableMinimumProperties?: boolean;\n showOptions: boolean;\n onShowHideOptions: (show: boolean) => void;\n children?: React.ReactNode;\n}\n\n/** Component use to set miscellaneous properties is a Formatted Quantity.\n * @alpha\n */\nexport function MiscFormatOptions(props: MiscFormatOptionsProps) {\n const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;\n\n const handleSetFormatProps = React.useCallback((newFormatProps: FormatProps) => {\n onChange && onChange(newFormatProps);\n }, [onChange]);\n\n const isFormatTraitSet = React.useCallback((trait: FormatTraits) => {\n return Format.isFormatTraitSetInProps(formatProps, trait);\n }, [formatProps]);\n\n const handleShowSignChange = React.useCallback((option: ShowSignOption) => {\n const newShowSignOption = showSignOptionToString(option);\n const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const setFormatTrait = React.useCallback((trait: FormatTraits, setActive: boolean) => {\n const traitStr = getTraitString(trait);\n let formatTraits: string[] = [traitStr];\n if (setActive) {// setting trait\n // istanbul ignore else\n if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n // istanbul ignore else\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\n formatTraits = [...traits, traitStr];\n }\n }\n } else {// clearing trait\n // istanbul ignore next\n if (!formatProps.formatTraits)\n return;\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\n }\n const newFormatProps = { ...formatProps, formatTraits };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleShowTrailingZeroesChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);\n }, [setFormatTrait]);\n\n const handleKeepDecimalPointChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);\n }, [setFormatTrait]);\n\n const handleKeepSingleZeroChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);\n }, [setFormatTrait]);\n\n const handleZeroEmptyChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);\n }, [setFormatTrait]);\n\n const handleUseFractionDashChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.FractionDash, e.target.checked);\n }, [setFormatTrait]);\n\n const handleDecimalSeparatorChange = React.useCallback((decimalSeparator: string) => {\n let thousandSeparator = formatProps.thousandSeparator;\n // make sure 1000 and decimal separator do not match\n // istanbul ignore else\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\n switch (decimalSeparator) {\n case \".\":\n thousandSeparator = \",\";\n break;\n case \",\":\n thousandSeparator = \".\";\n break;\n }\n }\n const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, isFormatTraitSet, handleSetFormatProps]);\n\n const handleScientificTypeChange = React.useCallback((type: ScientificType) => {\n const newFormatProps = { ...formatProps, scientificType: scientificTypeToString(type) };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleFormatChange = React.useCallback((newFormatProps: FormatProps) => {\n handleSetFormatProps(newFormatProps);\n }, [handleSetFormatProps]);\n\n const formatType = React.useMemo(() => parseFormatType(formatProps.type, \"format\"), [formatProps.type]);\n const showSignOption = React.useMemo(() => parseShowSignOption(formatProps.showSignOption ?? \"onlyNegative\", \"format\"), [formatProps.showSignOption]);\n\n const handleToggleButtonClick = React.useCallback(() => {\n onShowHideOptions(!showOptions);\n }, [onShowHideOptions, showOptions]);\n\n const handleKeyUpOnLink = React.useCallback((e: React.KeyboardEvent<HTMLAnchorElement>) => {\n // istanbul ignore else\n if (e.key === SpecialKey.Enter || e.key === SpecialKey.Space) {\n onShowHideOptions(!showOptions);\n e.preventDefault();\n }\n }, [onShowHideOptions, showOptions]);\n\n const handleStationSeparatorChange = React.useCallback((value: string) => {\n const newFormatProps = { ...formatProps, stationSeparator: value };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleStationOffsetChange = React.useCallback((value: number) => {\n const newFormatProps = { ...formatProps, stationOffsetSize: value };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const signOptionLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.signOptionLabel\"));\n const stationOffsetLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationOffsetLabel\"));\n const stationSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationSeparatorLabel\"));\n const decimalSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.decimalSeparatorLabel\"));\n const showTrailZerosLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.showTrailZerosLabel\"));\n const keepSingleZeroLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepSingleZeroLabel\"));\n const zeroEmptyLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.zeroEmptyLabel\"));\n const moreLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.moreLabel\"));\n const lessLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.lessLabel\"));\n const keepDecimalPointLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepDecimalPointLabel\"));\n const fractionDashLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.fractionDashLabel\"));\n const scientificTypeLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.scientificTypeLabel\"));\n\n return (\n <>\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\n enableMinimumProperties && !showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-more\" tabIndex={0} >{moreLabel.current}</a>}\n {\n (!enableMinimumProperties || showOptions) &&\n <>\n <span className={\"uicore-label\"}>{signOptionLabel.current}</span>\n <SignOptionSelector data-testid=\"sign-option-selector\" signOption={showSignOption} onChange={handleShowSignChange} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationOffsetLabel.current}</span>\n <StationSizeSelector data-testid=\"station-size-selector\" value={(formatProps.stationOffsetSize ?? 2)}\n disabled={formatType !== FormatType.Station} onChange={handleStationOffsetChange} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationSeparatorLabel.current}</span>\n <StationSeparatorSelector data-testid=\"station-separator-selector\" separator={(undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : \"+\")}\n disabled={formatType !== FormatType.Station} onChange={handleStationSeparatorChange} />\n\n <ThousandsSeparator formatProps={formatProps} onChange={handleFormatChange} />\n\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{decimalSeparatorLabel.current}</span>\n <DecimalSeparatorSelector data-testid=\"decimal-separator-selector\" separator={formatProps.decimalSeparator ?? \".\"} onChange={handleDecimalSeparatorChange} disabled={formatType === FormatType.Fractional} />\n\n <span className={\"uicore-label\"}>{showTrailZerosLabel.current}</span>\n <Checkbox data-testid=\"show-trail-zeros\" checked={isFormatTraitSet(FormatTraits.TrailZeroes)} onChange={handleShowTrailingZeroesChange} />\n\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{keepDecimalPointLabel.current}</span>\n <Checkbox data-testid=\"keep-decimal-point\" checked={isFormatTraitSet(FormatTraits.KeepDecimalPoint)} onChange={handleKeepDecimalPointChange} />\n\n <span className={\"uicore-label\"}>{keepSingleZeroLabel.current}</span>\n <Checkbox data-testid=\"keep-single-zero\" checked={isFormatTraitSet(FormatTraits.KeepSingleZero)} onChange={handleKeepSingleZeroChange} />\n\n <span className={\"uicore-label\"}>{zeroEmptyLabel.current}</span>\n <Checkbox data-testid=\"zero-empty\" checked={isFormatTraitSet(FormatTraits.ZeroEmpty)} onChange={handleZeroEmptyChange} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Fractional && \"uicore-disabled\")}>{fractionDashLabel.current}</span>\n <Checkbox data-testid=\"fraction-dash\" checked={isFormatTraitSet(FormatTraits.FractionDash)} onChange={handleUseFractionDashChange} disabled={formatType !== FormatType.Fractional} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Scientific && \"uicore-disabled\")}>{scientificTypeLabel.current}</span>\n <ScientificTypeSelector data-testid=\"scientific-type-selector\" type={(formatProps.scientificType && formatProps.scientificType.length > 0) ? parseScientificType(formatProps.scientificType, \"custom\") : ScientificType.Normalized}\n disabled={formatType !== FormatType.Scientific} onChange={handleScientificTypeChange} />\n\n {props.children}\n\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\n enableMinimumProperties && showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-less\" tabIndex={0}>{lessLabel.current}</a>}\n </>\n }\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MiscFormatOptions.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/MiscFormatOptions.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAe,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,mBAAmB,EAC1G,mBAAmB,EAAE,cAAc,EAAE,sBAAsB,EAAkB,sBAAsB,GACpG,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;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AAC,mBAAmB,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,UAAU,EAChO,QAAQ,EAAE,UAAU,KAAK,UAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,0BAA0B,GAAI;gBAEzF,KAAK,CAAC,QAAQ;gBAGb,uBAAuB,IAAI,WAAW,IAAI,2BAAG,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,iBAAiB,EACvG,SAAS,EAAE,qCAAqC,EAAE,IAAI,EAAC,MAAM,iBAAa,qBAAqB,EAAC,QAAQ,EAAE,CAAC,IAAG,SAAS,CAAC,OAAO,CAAK,CACvI,CAEJ,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Checkbox } from \"@itwin/itwinui-react\";\r\nimport { Format, FormatProps, FormatTraits, FormatType, getTraitString, parseFormatType, parseScientificType,\r\n parseShowSignOption, ScientificType, scientificTypeToString, ShowSignOption, showSignOptionToString,\r\n} from \"@itwin/core-quantity\";\r\nimport { SignOptionSelector } from \"./misc/SignOption\";\r\nimport { ThousandsSeparator } from \"./misc/ThousandsSeparator\";\r\nimport { DecimalSeparatorSelector } from \"./misc/DecimalSeparator\";\r\nimport { ScientificTypeSelector } from \"./misc/ScientificType\";\r\nimport { StationSeparatorSelector } from \"./misc/StationSeparatorSelector\";\r\nimport { StationSizeSelector } from \"./misc/StationSizeSelector\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\n\r\n/** Properties of [[MiscFormatOptions]] component.\r\n * @alpha\r\n */\r\nexport interface MiscFormatOptionsProps extends CommonProps {\r\n formatProps: FormatProps;\r\n onChange?: (format: FormatProps) => void;\r\n enableMinimumProperties?: boolean;\r\n showOptions: boolean;\r\n onShowHideOptions: (show: boolean) => void;\r\n children?: React.ReactNode;\r\n}\r\n\r\n/** Component use to set miscellaneous properties is a Formatted Quantity.\r\n * @alpha\r\n */\r\nexport function MiscFormatOptions(props: MiscFormatOptionsProps) {\r\n const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;\r\n\r\n const handleSetFormatProps = React.useCallback((newFormatProps: FormatProps) => {\r\n onChange && onChange(newFormatProps);\r\n }, [onChange]);\r\n\r\n const isFormatTraitSet = React.useCallback((trait: FormatTraits) => {\r\n return Format.isFormatTraitSetInProps(formatProps, trait);\r\n }, [formatProps]);\r\n\r\n const handleShowSignChange = React.useCallback((option: ShowSignOption) => {\r\n const newShowSignOption = showSignOptionToString(option);\r\n const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const setFormatTrait = React.useCallback((trait: FormatTraits, setActive: boolean) => {\r\n const traitStr = getTraitString(trait);\r\n let formatTraits: string[] = [traitStr];\r\n if (setActive) {// setting trait\r\n // istanbul ignore else\r\n if (formatProps.formatTraits) {\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n // istanbul ignore else\r\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\r\n formatTraits = [...traits, traitStr];\r\n }\r\n }\r\n } else {// clearing trait\r\n // istanbul ignore next\r\n if (!formatProps.formatTraits)\r\n return;\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\r\n }\r\n const newFormatProps = { ...formatProps, formatTraits };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleShowTrailingZeroesChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleKeepDecimalPointChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleKeepSingleZeroChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleZeroEmptyChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleUseFractionDashChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.FractionDash, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleDecimalSeparatorChange = React.useCallback((decimalSeparator: string) => {\r\n let thousandSeparator = formatProps.thousandSeparator;\r\n // make sure 1000 and decimal separator do not match\r\n // istanbul ignore else\r\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\r\n switch (decimalSeparator) {\r\n case \".\":\r\n thousandSeparator = \",\";\r\n break;\r\n case \",\":\r\n thousandSeparator = \".\";\r\n break;\r\n }\r\n }\r\n const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, isFormatTraitSet, handleSetFormatProps]);\r\n\r\n const handleScientificTypeChange = React.useCallback((type: ScientificType) => {\r\n const newFormatProps = { ...formatProps, scientificType: scientificTypeToString(type) };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleFormatChange = React.useCallback((newFormatProps: FormatProps) => {\r\n handleSetFormatProps(newFormatProps);\r\n }, [handleSetFormatProps]);\r\n\r\n const formatType = React.useMemo(() => parseFormatType(formatProps.type, \"format\"), [formatProps.type]);\r\n const showSignOption = React.useMemo(() => parseShowSignOption(formatProps.showSignOption ?? \"onlyNegative\", \"format\"), [formatProps.showSignOption]);\r\n\r\n const handleToggleButtonClick = React.useCallback(() => {\r\n onShowHideOptions(!showOptions);\r\n }, [onShowHideOptions, showOptions]);\r\n\r\n const handleKeyUpOnLink = React.useCallback((e: React.KeyboardEvent<HTMLAnchorElement>) => {\r\n // istanbul ignore else\r\n if (e.key === SpecialKey.Enter || e.key === SpecialKey.Space) {\r\n onShowHideOptions(!showOptions);\r\n e.preventDefault();\r\n }\r\n }, [onShowHideOptions, showOptions]);\r\n\r\n const handleStationSeparatorChange = React.useCallback((value: string) => {\r\n const newFormatProps = { ...formatProps, stationSeparator: value };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleStationOffsetChange = React.useCallback((value: number) => {\r\n const newFormatProps = { ...formatProps, stationOffsetSize: value };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const signOptionLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.signOptionLabel\"));\r\n const stationOffsetLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationOffsetLabel\"));\r\n const stationSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationSeparatorLabel\"));\r\n const decimalSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.decimalSeparatorLabel\"));\r\n const showTrailZerosLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.showTrailZerosLabel\"));\r\n const keepSingleZeroLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepSingleZeroLabel\"));\r\n const zeroEmptyLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.zeroEmptyLabel\"));\r\n const moreLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.moreLabel\"));\r\n const lessLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.lessLabel\"));\r\n const keepDecimalPointLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepDecimalPointLabel\"));\r\n const fractionDashLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.fractionDashLabel\"));\r\n const scientificTypeLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.scientificTypeLabel\"));\r\n\r\n return (\r\n <>\r\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\r\n enableMinimumProperties && !showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\r\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-more\" tabIndex={0} >{moreLabel.current}</a>}\r\n {\r\n (!enableMinimumProperties || showOptions) &&\r\n <>\r\n <span className={\"uicore-label\"}>{signOptionLabel.current}</span>\r\n <SignOptionSelector data-testid=\"sign-option-selector\" signOption={showSignOption} onChange={handleShowSignChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationOffsetLabel.current}</span>\r\n <StationSizeSelector data-testid=\"station-size-selector\" value={(formatProps.stationOffsetSize ?? 2)}\r\n disabled={formatType !== FormatType.Station} onChange={handleStationOffsetChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationSeparatorLabel.current}</span>\r\n <StationSeparatorSelector data-testid=\"station-separator-selector\" separator={(undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : \"+\")}\r\n disabled={formatType !== FormatType.Station} onChange={handleStationSeparatorChange} />\r\n\r\n <ThousandsSeparator formatProps={formatProps} onChange={handleFormatChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{decimalSeparatorLabel.current}</span>\r\n <DecimalSeparatorSelector data-testid=\"decimal-separator-selector\" separator={formatProps.decimalSeparator ?? \".\"} onChange={handleDecimalSeparatorChange} disabled={formatType === FormatType.Fractional} />\r\n\r\n <span className={\"uicore-label\"}>{showTrailZerosLabel.current}</span>\r\n <Checkbox data-testid=\"show-trail-zeros\" checked={isFormatTraitSet(FormatTraits.TrailZeroes)} onChange={handleShowTrailingZeroesChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{keepDecimalPointLabel.current}</span>\r\n <Checkbox data-testid=\"keep-decimal-point\" checked={isFormatTraitSet(FormatTraits.KeepDecimalPoint)} onChange={handleKeepDecimalPointChange} />\r\n\r\n <span className={\"uicore-label\"}>{keepSingleZeroLabel.current}</span>\r\n <Checkbox data-testid=\"keep-single-zero\" checked={isFormatTraitSet(FormatTraits.KeepSingleZero)} onChange={handleKeepSingleZeroChange} />\r\n\r\n <span className={\"uicore-label\"}>{zeroEmptyLabel.current}</span>\r\n <Checkbox data-testid=\"zero-empty\" checked={isFormatTraitSet(FormatTraits.ZeroEmpty)} onChange={handleZeroEmptyChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Fractional && \"uicore-disabled\")}>{fractionDashLabel.current}</span>\r\n <Checkbox data-testid=\"fraction-dash\" checked={isFormatTraitSet(FormatTraits.FractionDash)} onChange={handleUseFractionDashChange} disabled={formatType !== FormatType.Fractional} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Scientific && \"uicore-disabled\")}>{scientificTypeLabel.current}</span>\r\n <ScientificTypeSelector data-testid=\"scientific-type-selector\" type={(formatProps.scientificType && formatProps.scientificType.length > 0) ? parseScientificType(formatProps.scientificType, \"custom\") : ScientificType.Normalized}\r\n disabled={formatType !== FormatType.Scientific} onChange={handleScientificTypeChange} />\r\n\r\n {props.children}\r\n\r\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\r\n enableMinimumProperties && showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\r\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-less\" tabIndex={0}>{lessLabel.current}</a>}\r\n </>\r\n }\r\n </>\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuantityFormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/QuantityFormatPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACuB,kBAAkB,EAAE,SAAS,EAAE,8BAA8B,EAAE,8BAA8B,EACzH,+BAA+B,EAAE,gCAAgC,GAClE,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,SAAS,+BAA+B,CAAC,GAAW,EAAE,KAAa,EAAE,OAAoB,EACvF,SAAyC,EAAE,SAA6D,EAAE,gBAAiD;IAC3J,MAAM,KAAK,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IACjC,OAAO,CACL,oBAAC,KAAK,CAAC,QAAQ,IAAC,GAAG,EAAE,GAAG,GAAG,EAAE;QAC3B,8BAAM,GAAG,EAAE,GAAG,GAAG,QAAQ,EAAE,SAAS,EAAE,cAAc,IAAG,KAAK,CAAQ;QACpE,oBAAC,KAAK,mBAAc,GAAG,GAAG,SAAS,EAAE,GAAG,EAAE,GAAG,GAAG,SAAS,EACvD,KAAK,EAAE,KAAK,EACZ,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;gBACd,MAAM,QAAQ,GAAG,SAAS,CAAC,OAAO,EAAE,CAAC,CAAC,a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AE,EAAE;QAC1E,MAAM,eAAe,GAAG,kBAAkB,CAAC,YAAY,CAAC,CAAC;QACzD,MAAM,sBAAsB,GAAG,SAAS,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACtG,IAAI,sBAAsB,IAAI,8BAA8B,CAAC,sBAAsB,CAAC;YAClF,sBAAsB,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE;YACzD,uBAAuB;YACvB,IAAI,sBAAsB,CAAC,wBAAwB;gBACjD,OAAO,uBAAuB,CAAC,sBAAsB,CAAC,wBAAwB,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;SAC9G;QACD,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,CAAC,uBAAuB,EAAE,YAAY,CAAC,CAAC,CAAC;IAE9C,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CACzC,KAAK,EAAE,OAAoB,EAAE,gBAA2B,EAAE,cAA6B,EAAE,EAAE;QACzF,OAAO,SAAS,CAAC,iBAAiB,CAAC,2BAA2B,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACxF,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,6BAAK,SAAS,EAAC,yCAAyC,IACrD,eAAe,IAAI,WAAW;QAC7B,oBAAC,WAAW,IAAC,cAAc,EAAE,qBAAqB,KAAM,UAAU,EAChE,aAAa,EAAE,WAAW,EAC1B,aAAa,EAAE,SAAS,CAAC,iBAAiB,CAAC,aAAa,EACxD,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,EAC9C,wBAAwB,EAAE,wBAAwB,EAClD,iBAAiB,EAAE,iBAAiB,GACpC,CACA,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport {\n CustomFormatPropEditorSpec, getQuantityTypeKey, IModelApp, isCheckboxFormatPropEditorSpec, isCustomQuantityTypeDefinition,\n isTextInputFormatPropEditorSpec, isTextSelectFormatPropEditorSpec, QuantityTypeArg,\n} from \"@itwin/core-frontend\";\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { Checkbox, Input, Select } from \"@itwin/itwinui-react\";\nimport { FormatPanel } from \"./FormatPanel\";\nimport { DeepCompare } from \"@itwin/core-geometry\";\n\nfunction createTextInputFormatPropEditor(key: string, label: string, inProps: FormatProps,\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\n const value = getString(inProps);\n return (\n <React.Fragment key={`${key}`}>\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\n <Input data-testid={`${key}-editor`} key={`${key}-editor`}\n value={value}\n size=\"small\"\n onChange={(e) => {\n const newProps = setString(inProps, e.currentTarget.value);\n fireFormatChange(newProps);\n }}\n />\n </React.Fragment>\n );\n}\nfunction createSelectFormatPropEditor(key: string, label: string, options: { label: string, value: string }[], inProps: FormatProps,\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\n const value = getString(inProps);\n return (\n <React.Fragment key={`${key}`}>\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\n <Select data-testid={`${key}-editor`} key={`${key}-editor`}\n value={value}\n options={options}\n size={\"small\"}\n onChange={(newValue) => {\n const newProps = setString(inProps, newValue);\n fireFormatChange(newProps);\n }}\n />\n </React.Fragment>\n );\n}\n\nfunction createCheckboxFormatPropEditor(key: string, label: string, inProps: FormatProps,\n getBool: (props: FormatProps) => boolean, setBool: (props: FormatProps, isChecked: boolean) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\n const isChecked = getBool(inProps);\n return (\n <React.Fragment key={`${key}`}>\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\n <Checkbox data-testid={`${key}-editor`} key={`${key}-editor`}\n checked={isChecked}\n onChange={(e) => {\n const newProps = setBool(inProps, e.target.checked);\n fireFormatChange(newProps);\n }} />\n </React.Fragment>\n );\n}\n\nfunction formatAreEqual(obj1: FormatProps, obj2: FormatProps) {\n const compare = new DeepCompare();\n return compare.compare(obj1, obj2);\n}\n\n/** Properties of [[QuantityFormatPanel]] component.\n * @alpha\n */\nexport interface QuantityFormatPanelProps extends CommonProps {\n quantityType: QuantityTypeArg;\n onFormatChange?: (format: FormatProps) => void;\n /** props below are to be passed on to FormatPanel */\n showSample?: boolean;\n initialMagnitude?: number;\n enableMinimumProperties?: boolean;\n}\n\n/** Component to set properties that control Quantity Formatting.\n * @alpha\n */\nexport function QuantityFormatPanel(props: QuantityFormatPanelProps) {\n const { quantityType, onFormatChange, ...otherProps } = props;\n const [formatProps, setFormatProps] = React.useState<FormatProps>();\n const initialFormatProps = React.useRef<FormatProps>();\n\n const [persistenceUnit, setPersistenceUnit] = React.useState<UnitProps>();\n\n React.useEffect(() => {\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\n // istanbul ignore else\n if (!initialFormatProps.current)\n initialFormatProps.current = newFormatProps;\n setFormatProps(newFormatProps);\n const quantityTypeKey = getQuantityTypeKey(quantityType);\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\n // istanbul ignore else\n if (quantityTypeDefinition)\n setPersistenceUnit(quantityTypeDefinition.persistenceUnit);\n else\n throw Error(`Unable to locate a quantity type with type ${quantityType}`);\n }, [quantityType]); // no dependencies defined as we want this to run on every render\n\n // handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)\n // eslint-disable-next-line react-hooks/exhaustive-deps\n React.useEffect(() => {\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\n // istanbul ignore else\n if (initialFormatProps.current && newFormatProps) {\n if (!formatAreEqual(newFormatProps, initialFormatProps.current)) {\n initialFormatProps.current = newFormatProps;\n setFormatProps(newFormatProps);\n }\n }\n }); // no dependencies defined as we want this to run on every render\n\n const handleOnFormatChanged = React.useCallback(async (newProps: FormatProps) => {\n setFormatProps(newProps);\n onFormatChange && onFormatChange(newProps);\n }, [onFormatChange]);\n\n const createCustomPropEditors = React.useCallback((specs: CustomFormatPropEditorSpec[], inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\n return specs.map((spec, index) => {\n if (isCheckboxFormatPropEditorSpec(spec))\n return createCheckboxFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getBool, spec.setBool, fireFormatChange);\n if (isTextSelectFormatPropEditorSpec(spec))\n return createSelectFormatPropEditor(`${spec.editorType}-${index}`, spec.label, spec.selectOptions, inProps, spec.getString, spec.setString, fireFormatChange);\n /* istanbul ignore else */\n if (isTextInputFormatPropEditorSpec(spec))\n return createTextInputFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getString, spec.setString, fireFormatChange);\n /* istanbul ignore next */\n return <div key={index} />;\n });\n }, []);\n\n const providePrimaryChildren = React.useCallback(\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\n const quantityTypeKey = getQuantityTypeKey(quantityType);\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\n // istanbul ignore else\n if (quantityTypeDefinition.primaryPropEditorSpecs)\n return createCustomPropEditors(quantityTypeDefinition.primaryPropEditorSpecs, inProps, fireFormatChange);\n }\n return null;\n }, [createCustomPropEditors, quantityType]);\n\n const provideSecondaryChildren = React.useCallback(\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\n const quantityTypeKey = getQuantityTypeKey(quantityType);\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\n // istanbul ignore else\n if (quantityTypeDefinition.secondaryPropEditorSpecs)\n return createCustomPropEditors(quantityTypeDefinition.secondaryPropEditorSpecs, inProps, fireFormatChange);\n }\n return null;\n }, [createCustomPropEditors, quantityType]);\n\n const provideFormatSpec = React.useCallback(\n async (inProps: FormatProps, _persistenceUnit: UnitProps, _unitsProvider: UnitsProvider) => {\n return IModelApp.quantityFormatter.generateFormatterSpecByType(quantityType, inProps);\n }, [quantityType]);\n\n return (\n <div className=\"components-quantityFormat-quantityPanel\">\n {persistenceUnit && formatProps &&\n <FormatPanel onFormatChange={handleOnFormatChanged} {...otherProps}\n initialFormat={formatProps}\n unitsProvider={IModelApp.quantityFormatter.unitsProvider}\n persistenceUnit={persistenceUnit}\n providePrimaryChildren={providePrimaryChildren}\n provideSecondaryChildren={provideSecondaryChildren}\n provideFormatSpec={provideFormatSpec}\n />}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"QuantityFormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/QuantityFormatPanel.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACuB,kBAAkB,EAAE,SAAS,EAAE,8BAA8B,EAAE,8BAA8B,EACzH,+BAA+B,EAAE,gCAAgC,GAClE,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,SAAS,+BAA+B,C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IACxF,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAErB,OAAO,CACL,6BAAK,SAAS,EAAC,yCAAyC,IACrD,eAAe,IAAI,WAAW;QAC7B,oBAAC,WAAW,IAAC,cAAc,EAAE,qBAAqB,KAAM,UAAU,EAChE,aAAa,EAAE,WAAW,EAC1B,aAAa,EAAE,SAAS,CAAC,iBAAiB,CAAC,aAAa,EACxD,eAAe,EAAE,eAAe,EAChC,sBAAsB,EAAE,sBAAsB,EAC9C,wBAAwB,EAAE,wBAAwB,EAClD,iBAAiB,EAAE,iBAAiB,GACpC,CACA,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport {\r\n CustomFormatPropEditorSpec, getQuantityTypeKey, IModelApp, isCheckboxFormatPropEditorSpec, isCustomQuantityTypeDefinition,\r\n isTextInputFormatPropEditorSpec, isTextSelectFormatPropEditorSpec, QuantityTypeArg,\r\n} from \"@itwin/core-frontend\";\r\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Checkbox, Input, Select } from \"@itwin/itwinui-react\";\r\nimport { FormatPanel } from \"./FormatPanel\";\r\nimport { DeepCompare } from \"@itwin/core-geometry\";\r\n\r\nfunction createTextInputFormatPropEditor(key: string, label: string, inProps: FormatProps,\r\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const value = getString(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Input data-testid={`${key}-editor`} key={`${key}-editor`}\r\n value={value}\r\n size=\"small\"\r\n onChange={(e) => {\r\n const newProps = setString(inProps, e.currentTarget.value);\r\n fireFormatChange(newProps);\r\n }}\r\n />\r\n </React.Fragment>\r\n );\r\n}\r\nfunction createSelectFormatPropEditor(key: string, label: string, options: { label: string, value: string }[], inProps: FormatProps,\r\n getString: (props: FormatProps) => string, setString: (props: FormatProps, value: string) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const value = getString(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Select data-testid={`${key}-editor`} key={`${key}-editor`}\r\n value={value}\r\n options={options}\r\n size={\"small\"}\r\n onChange={(newValue) => {\r\n const newProps = setString(inProps, newValue);\r\n fireFormatChange(newProps);\r\n }}\r\n />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction createCheckboxFormatPropEditor(key: string, label: string, inProps: FormatProps,\r\n getBool: (props: FormatProps) => boolean, setBool: (props: FormatProps, isChecked: boolean) => FormatProps, fireFormatChange: (newProps: FormatProps) => void) {\r\n const isChecked = getBool(inProps);\r\n return (\r\n <React.Fragment key={`${key}`}>\r\n <span key={`${key}-label`} className={\"uicore-label\"}>{label}</span>\r\n <Checkbox data-testid={`${key}-editor`} key={`${key}-editor`}\r\n checked={isChecked}\r\n onChange={(e) => {\r\n const newProps = setBool(inProps, e.target.checked);\r\n fireFormatChange(newProps);\r\n }} />\r\n </React.Fragment>\r\n );\r\n}\r\n\r\nfunction formatAreEqual(obj1: FormatProps, obj2: FormatProps) {\r\n const compare = new DeepCompare();\r\n return compare.compare(obj1, obj2);\r\n}\r\n\r\n/** Properties of [[QuantityFormatPanel]] component.\r\n * @alpha\r\n */\r\nexport interface QuantityFormatPanelProps extends CommonProps {\r\n quantityType: QuantityTypeArg;\r\n onFormatChange?: (format: FormatProps) => void;\r\n /** props below are to be passed on to FormatPanel */\r\n showSample?: boolean;\r\n initialMagnitude?: number;\r\n enableMinimumProperties?: boolean;\r\n}\r\n\r\n/** Component to set properties that control Quantity Formatting.\r\n * @alpha\r\n */\r\nexport function QuantityFormatPanel(props: QuantityFormatPanelProps) {\r\n const { quantityType, onFormatChange, ...otherProps } = props;\r\n const [formatProps, setFormatProps] = React.useState<FormatProps>();\r\n const initialFormatProps = React.useRef<FormatProps>();\r\n\r\n const [persistenceUnit, setPersistenceUnit] = React.useState<UnitProps>();\r\n\r\n React.useEffect(() => {\r\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n // istanbul ignore else\r\n if (!initialFormatProps.current)\r\n initialFormatProps.current = newFormatProps;\r\n setFormatProps(newFormatProps);\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n // istanbul ignore else\r\n if (quantityTypeDefinition)\r\n setPersistenceUnit(quantityTypeDefinition.persistenceUnit);\r\n else\r\n throw Error(`Unable to locate a quantity type with type ${quantityType}`);\r\n }, [quantityType]); // no dependencies defined as we want this to run on every render\r\n\r\n // handle case where quantityType does not change but the formatProps for that quantity type has (ie after a Set or Clear)\r\n // eslint-disable-next-line react-hooks/exhaustive-deps\r\n React.useEffect(() => {\r\n const newFormatProps = IModelApp.quantityFormatter.getFormatPropsByQuantityType(quantityType);\r\n // istanbul ignore else\r\n if (initialFormatProps.current && newFormatProps) {\r\n if (!formatAreEqual(newFormatProps, initialFormatProps.current)) {\r\n initialFormatProps.current = newFormatProps;\r\n setFormatProps(newFormatProps);\r\n }\r\n }\r\n }); // no dependencies defined as we want this to run on every render\r\n\r\n const handleOnFormatChanged = React.useCallback(async (newProps: FormatProps) => {\r\n setFormatProps(newProps);\r\n onFormatChange && onFormatChange(newProps);\r\n }, [onFormatChange]);\r\n\r\n const createCustomPropEditors = React.useCallback((specs: CustomFormatPropEditorSpec[], inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n return specs.map((spec, index) => {\r\n if (isCheckboxFormatPropEditorSpec(spec))\r\n return createCheckboxFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getBool, spec.setBool, fireFormatChange);\r\n if (isTextSelectFormatPropEditorSpec(spec))\r\n return createSelectFormatPropEditor(`${spec.editorType}-${index}`, spec.label, spec.selectOptions, inProps, spec.getString, spec.setString, fireFormatChange);\r\n /* istanbul ignore else */\r\n if (isTextInputFormatPropEditorSpec(spec))\r\n return createTextInputFormatPropEditor(`${spec.editorType}-${index}`, spec.label, inProps, spec.getString, spec.setString, fireFormatChange);\r\n /* istanbul ignore next */\r\n return <div key={index} />;\r\n });\r\n }, []);\r\n\r\n const providePrimaryChildren = React.useCallback(\r\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\r\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\r\n // istanbul ignore else\r\n if (quantityTypeDefinition.primaryPropEditorSpecs)\r\n return createCustomPropEditors(quantityTypeDefinition.primaryPropEditorSpecs, inProps, fireFormatChange);\r\n }\r\n return null;\r\n }, [createCustomPropEditors, quantityType]);\r\n\r\n const provideSecondaryChildren = React.useCallback(\r\n (inProps: FormatProps, fireFormatChange: (newProps: FormatProps) => void) => {\r\n const quantityTypeKey = getQuantityTypeKey(quantityType);\r\n const quantityTypeDefinition = IModelApp.quantityFormatter.quantityTypesRegistry.get(quantityTypeKey);\r\n if (quantityTypeDefinition && isCustomQuantityTypeDefinition(quantityTypeDefinition) &&\r\n quantityTypeDefinition.isCompatibleFormatProps(inProps)) {\r\n // istanbul ignore else\r\n if (quantityTypeDefinition.secondaryPropEditorSpecs)\r\n return createCustomPropEditors(quantityTypeDefinition.secondaryPropEditorSpecs, inProps, fireFormatChange);\r\n }\r\n return null;\r\n }, [createCustomPropEditors, quantityType]);\r\n\r\n const provideFormatSpec = React.useCallback(\r\n async (inProps: FormatProps, _persistenceUnit: UnitProps, _unitsProvider: UnitsProvider) => {\r\n return IModelApp.quantityFormatter.generateFormatterSpecByType(quantityType, inProps);\r\n }, [quantityType]);\r\n\r\n return (\r\n <div className=\"components-quantityFormat-quantityPanel\">\r\n {persistenceUnit && formatProps &&\r\n <FormatPanel onFormatChange={handleOnFormatChanged} {...otherProps}\r\n initialFormat={formatProps}\r\n unitsProvider={IModelApp.quantityFormatter.unitsProvider}\r\n persistenceUnit={persistenceUnit}\r\n providePrimaryChildren={providePrimaryChildren}\r\n provideSecondaryChildren={provideSecondaryChildren}\r\n provideFormatSpec={provideFormatSpec}\r\n />}\r\n </div>\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecimalPrecision.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/DecimalPrecision.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAU5D;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC1F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,sCAAsC,CAAC,EAAE;QACzF,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAA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EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[DecimalPrecisionSelector]] component.\n * @internal\n */\nexport interface DecimalPrecisionSelectorProps extends CommonProps {\n precision: number;\n onChange: (value: number) => void;\n}\n\n/** Component use to set Decimal Precision\n * the unit label.\n * @internal\n */\nexport function DecimalPrecisionSelector(props: DecimalPrecisionSelectorProps) {\n const { precision, onChange, ...otherProps } = props;\n const options = React.useRef<SelectOption<number>[]>([\n { value: 0, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.zero\") },\n { value: 1, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.one\") },\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.two\") },\n { value: 3, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.three\") },\n { value: 4, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.four\") },\n { value: 5, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.five\") },\n { value: 6, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.six\") },\n { value: 7, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.seven\") },\n { value: 8, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.eight\") },\n { value: 9, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.nine\") },\n { value: 10, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.ten\") },\n { value: 11, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.eleven\") },\n { value: 12, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.twelve\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: number) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={options.current} value={precision} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DecimalPrecision.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/DecimalPrecision.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAU5D;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC1F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,sCAAsC,CAAC,EAAE;QACzF,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,sCAAsC,CAAC,EAAE;QACzF,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC3F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC1F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC1F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,sCAAsC,CAAC,EAAE;QACzF,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC3F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC3F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC1F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,sCAAsC,CAAC,EAAE;QAC1F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[DecimalPrecisionSelector]] component.\r\n * @internal\r\n */\r\nexport interface DecimalPrecisionSelectorProps extends CommonProps {\r\n precision: number;\r\n onChange: (value: number) => void;\r\n}\r\n\r\n/** Component use to set Decimal Precision\r\n * the unit label.\r\n * @internal\r\n */\r\nexport function DecimalPrecisionSelector(props: DecimalPrecisionSelectorProps) {\r\n const { precision, onChange, ...otherProps } = props;\r\n const options = React.useRef<SelectOption<number>[]>([\r\n { value: 0, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.zero\") },\r\n { value: 1, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.one\") },\r\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.two\") },\r\n { value: 3, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.three\") },\r\n { value: 4, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.four\") },\r\n { value: 5, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.five\") },\r\n { value: 6, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.six\") },\r\n { value: 7, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.seven\") },\r\n { value: 8, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.eight\") },\r\n { value: 9, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.nine\") },\r\n { value: 10, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.ten\") },\r\n { value: 11, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.eleven\") },\r\n { value: 12, label: UiIModelComponents.translate(\"QuantityFormat.decimal_precision.twelve\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: number) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={options.current} value={precision} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DecimalSeparator.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/DecimalSeparator.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAW5D;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[DecimalSeparatorSelector]] component.\n * @internal\n */\nexport interface DecimalSeparatorSelectorProps extends CommonProps {\n separator: string;\n disabled?: boolean;\n onChange: (value: string) => void;\n}\n\n/** Component use to set Decimal Separator\n * @internal\n */\nexport function DecimalSeparatorSelector(props: DecimalSeparatorSelectorProps) {\n const { separator, onChange, ...otherProps } = props;\n const options = React.useRef<SelectOption<string>[]>([\n { value: \".\", label: UiIModelComponents.translate(\"QuantityFormat.decimal_separator.point\") },\n { value: \",\", label: UiIModelComponents.translate(\"QuantityFormat.decimal_separator.comma\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: string) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={options.current} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"DecimalSeparator.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/DecimalSeparator.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAW5D;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[DecimalSeparatorSelector]] component.\r\n * @internal\r\n */\r\nexport interface DecimalSeparatorSelectorProps extends CommonProps {\r\n separator: string;\r\n disabled?: boolean;\r\n onChange: (value: string) => void;\r\n}\r\n\r\n/** Component use to set Decimal Separator\r\n * @internal\r\n */\r\nexport function DecimalSeparatorSelector(props: DecimalSeparatorSelectorProps) {\r\n const { separator, onChange, ...otherProps } = props;\r\n const options = React.useRef<SelectOption<string>[]>([\r\n { value: \".\", label: UiIModelComponents.translate(\"QuantityFormat.decimal_separator.point\") },\r\n { value: \",\", label: UiIModelComponents.translate(\"QuantityFormat.decimal_separator.comma\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: string) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={options.current} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FractionPrecision.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/FractionPrecision.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAU5D;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAqC;IAC7E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC3F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,0CAA0C,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,6CAA6C,CAAC,EAAE;QACjG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,0CAA0C,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,0CAA0C,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QAChG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;KACjG,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[FractionPrecisionSelector]] component.\n * @internal\n */\nexport interface FractionPrecisionSelectorProps extends CommonProps {\n precision: number;\n onChange: (value: number) => void;\n}\n\n/** Component use to set Fraction precision\n * @internal\n */\nexport function FractionPrecisionSelector(props: FractionPrecisionSelectorProps) {\n const { precision, onChange, ...otherProps } = props;\n const options = React.useRef<SelectOption<number>[]>([\n { value: 1, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.whole\") },\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.half\") },\n { value: 4, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.quarter\") },\n { value: 8, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.eighth\") },\n { value: 16, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.sixteenth\") },\n { value: 32, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over32\") },\n { value: 64, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over64\") },\n { value: 128, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over128\") },\n { value: 256, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over256\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: number) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={options.current} value={precision} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FractionPrecision.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/FractionPrecision.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAU5D;;GAEG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAqC;IAC7E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAyB;QACnD,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC3F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,0CAA0C,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,6CAA6C,CAAC,EAAE;QACjG,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,0CAA0C,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,0CAA0C,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QAChG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;KACjG,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC9G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[FractionPrecisionSelector]] component.\r\n * @internal\r\n */\r\nexport interface FractionPrecisionSelectorProps extends CommonProps {\r\n precision: number;\r\n onChange: (value: number) => void;\r\n}\r\n\r\n/** Component use to set Fraction precision\r\n * @internal\r\n */\r\nexport function FractionPrecisionSelector(props: FractionPrecisionSelectorProps) {\r\n const { precision, onChange, ...otherProps } = props;\r\n const options = React.useRef<SelectOption<number>[]>([\r\n { value: 1, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.whole\") },\r\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.half\") },\r\n { value: 4, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.quarter\") },\r\n { value: 8, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.eighth\") },\r\n { value: 16, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.sixteenth\") },\r\n { value: 32, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over32\") },\r\n { value: 64, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over64\") },\r\n { value: 128, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over128\") },\r\n { value: 256, label: UiIModelComponents.translate(\"QuantityFormat.fraction_precision.over256\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: number) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={options.current} value={precision} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ScientificType.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ScientificType.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAW5D;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAkC;IACvE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAiC;QACjE,EAAE,KAAK,EAAE,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QACtH,EAAE,KAAK,EAAE,cAAc,CAAC,cAAc,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,gDAAgD,CAAC,EAAE;KAChI,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAwB,EAAE,EAAE;QACpE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC/G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { ScientificType } from \"@itwin/core-quantity\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[ScientificTypeSelector]] component.\n * @internal\n */\nexport interface ScientificTypeSelectorProps extends CommonProps {\n type: ScientificType;\n onChange: (value: ScientificType) => void;\n disabled?: boolean;\n}\n\n/** Component use to set Scientific type.\n * @internal\n */\nexport function ScientificTypeSelector(props: ScientificTypeSelectorProps) {\n const { type, onChange, ...otherProps } = props;\n const formatOptions = React.useRef<SelectOption<ScientificType>[]>([\n { value: ScientificType.Normalized, label: UiIModelComponents.translate(\"QuantityFormat.scientific-type.normalized\") },\n { value: ScientificType.ZeroNormalized, label: UiIModelComponents.translate(\"QuantityFormat.scientific-type.zero-normalized\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: ScientificType) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={formatOptions.current} value={type} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ScientificType.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ScientificType.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAW5D;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAkC;IACvE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAAiC;QACjE,EAAE,KAAK,EAAE,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2CAA2C,CAAC,EAAE;QACtH,EAAE,KAAK,EAAE,cAAc,CAAC,cAAc,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,gDAAgD,CAAC,EAAE;KAChI,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAwB,EAAE,EAAE;QACpE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC/G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { ScientificType } from \"@itwin/core-quantity\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[ScientificTypeSelector]] component.\r\n * @internal\r\n */\r\nexport interface ScientificTypeSelectorProps extends CommonProps {\r\n type: ScientificType;\r\n onChange: (value: ScientificType) => void;\r\n disabled?: boolean;\r\n}\r\n\r\n/** Component use to set Scientific type.\r\n * @internal\r\n */\r\nexport function ScientificTypeSelector(props: ScientificTypeSelectorProps) {\r\n const { type, onChange, ...otherProps } = props;\r\n const formatOptions = React.useRef<SelectOption<ScientificType>[]>([\r\n { value: ScientificType.Normalized, label: UiIModelComponents.translate(\"QuantityFormat.scientific-type.normalized\") },\r\n { value: ScientificType.ZeroNormalized, label: UiIModelComponents.translate(\"QuantityFormat.scientific-type.zero-normalized\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: ScientificType) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={formatOptions.current} value={type} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SignOption.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/SignOption.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAU5D;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA8B;IAC/D,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAiC;QAC3D,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAAE;QAC1G,EAAE,KAAK,EAAE,cAAc,CAAC,YAAY,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;QACtH,EAAE,KAAK,EAAE,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAClH,EAAE,KAAK,EAAE,cAAc,CAAC,mBAAmB,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,gDAAgD,CAAC,EAAE;KACrI,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAwB,EAAE,EAAE;QACpE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC/G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { ShowSignOption } from \"@itwin/core-quantity\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[SignOptionSelector]] component.\n * @internal\n */\nexport interface SignOptionSelectorProps extends CommonProps {\n signOption: ShowSignOption;\n onChange: (value: ShowSignOption) => void;\n}\n\n/** Component use to set Sign option.\n * @internal\n */\nexport function SignOptionSelector(props: SignOptionSelectorProps) {\n const { signOption, onChange, ...otherProps } = props;\n const options = React.useRef<SelectOption<ShowSignOption>[]>([\n { value: ShowSignOption.NoSign, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.noSign\") },\n { value: ShowSignOption.OnlyNegative, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.onlyNegative\") },\n { value: ShowSignOption.SignAlways, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.signAlways\") },\n { value: ShowSignOption.NegativeParentheses, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.negativeParentheses\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: ShowSignOption) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={options.current} value={signOption} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"SignOption.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/SignOption.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAU5D;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA8B;IAC/D,MAAM,EAAE,UAAU,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAiC;QAC3D,EAAE,KAAK,EAAE,cAAc,CAAC,MAAM,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAAE;QAC1G,EAAE,KAAK,EAAE,cAAc,CAAC,YAAY,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;QACtH,EAAE,KAAK,EAAE,cAAc,CAAC,UAAU,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAClH,EAAE,KAAK,EAAE,cAAc,CAAC,mBAAmB,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,gDAAgD,CAAC,EAAE;KACrI,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAwB,EAAE,EAAE;QACpE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CAC/G,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { ShowSignOption } from \"@itwin/core-quantity\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[SignOptionSelector]] component.\r\n * @internal\r\n */\r\nexport interface SignOptionSelectorProps extends CommonProps {\r\n signOption: ShowSignOption;\r\n onChange: (value: ShowSignOption) => void;\r\n}\r\n\r\n/** Component use to set Sign option.\r\n * @internal\r\n */\r\nexport function SignOptionSelector(props: SignOptionSelectorProps) {\r\n const { signOption, onChange, ...otherProps } = props;\r\n const options = React.useRef<SelectOption<ShowSignOption>[]>([\r\n { value: ShowSignOption.NoSign, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.noSign\") },\r\n { value: ShowSignOption.OnlyNegative, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.onlyNegative\") },\r\n { value: ShowSignOption.SignAlways, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.signAlways\") },\r\n { value: ShowSignOption.NegativeParentheses, label: UiIModelComponents.translate(\"QuantityFormat.sign_option.negativeParentheses\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: ShowSignOption) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={options.current} value={signOption} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StationSeparatorSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSeparatorSelector.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAW5D;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAyB;QAC7D,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,qBAAqB,GAA2B,EAAE,CAAC;QACzD,0GAA0G;QAC1G,IAAI,SAAS,KAAK,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;YACxF,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;SACpE;QACD,qBAAqB,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACzD,OAAO,qBAAqB,CAAC;IAC/B,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACnI,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[StationSeparatorSelector]] component.\n * @internal\n */\nexport interface StationSeparatorSelectorProps extends CommonProps {\n separator: string;\n disabled: boolean;\n onChange: (value: string) => void;\n}\n\n/** Component use to setStation separator.\n * @internal\n */\nexport function StationSeparatorSelector(props: StationSeparatorSelectorProps) {\n const { separator, disabled, onChange, ...otherProps } = props;\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\n { value: \"+\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.plus\") },\n { value: \"-\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.minus\") },\n { value: \" \", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.blank\") },\n { value: \"^\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.caret\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: string) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n const separatorOptions = React.useMemo(() => {\n const completeListOfEntries: SelectOption<string>[] = [];\n // istanbul ignore next (only used if format already has a character that does not match standard options)\n if (undefined === uomDefaultEntries.current.find((option) => option.value === separator)) {\n completeListOfEntries.push({ value: separator, label: separator });\n }\n completeListOfEntries.push(...uomDefaultEntries.current);\n return completeListOfEntries;\n }, [separator]);\n\n return (\n <Select options={separatorOptions} disabled={disabled} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"StationSeparatorSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSeparatorSelector.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAW5D;;GAEG;AACH,MAAM,UAAU,wBAAwB,CAAC,KAAoC;IAC3E,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAyB;QAC7D,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,EAAE;QAC5F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;QAC7F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wCAAwC,CAAC,EAAE;KAC9F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,qBAAqB,GAA2B,EAAE,CAAC;QACzD,0GAA0G;QAC1G,IAAI,SAAS,KAAK,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;YACxF,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;SACpE;QACD,qBAAqB,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACzD,OAAO,qBAAqB,CAAC;IAC/B,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACnI,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[StationSeparatorSelector]] component.\r\n * @internal\r\n */\r\nexport interface StationSeparatorSelectorProps extends CommonProps {\r\n separator: string;\r\n disabled: boolean;\r\n onChange: (value: string) => void;\r\n}\r\n\r\n/** Component use to setStation separator.\r\n * @internal\r\n */\r\nexport function StationSeparatorSelector(props: StationSeparatorSelectorProps) {\r\n const { separator, disabled, onChange, ...otherProps } = props;\r\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\r\n { value: \"+\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.plus\") },\r\n { value: \"-\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.minus\") },\r\n { value: \" \", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.blank\") },\r\n { value: \"^\", label: UiIModelComponents.translate(\"QuantityFormat.station_separator.caret\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: string) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n const separatorOptions = React.useMemo(() => {\r\n const completeListOfEntries: SelectOption<string>[] = [];\r\n // istanbul ignore next (only used if format already has a character that does not match standard options)\r\n if (undefined === uomDefaultEntries.current.find((option) => option.value === separator)) {\r\n completeListOfEntries.push({ value: separator, label: separator });\r\n }\r\n completeListOfEntries.push(...uomDefaultEntries.current);\r\n return completeListOfEntries;\r\n }, [separator]);\r\n\r\n return (\r\n <Select options={separatorOptions} disabled={disabled} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StationSizeSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSizeSelector.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAW5D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAyB;QAC5D,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC,EAAE;QACpF,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAAE;KACvF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACvI,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[StationSizeSelector]] component.\n * @internal\n */\nexport interface StationSizeSelectorProps extends CommonProps {\n value: number;\n disabled: boolean;\n onChange: (value: number) => void;\n}\n\n/** Component use to set Station size (number of digits from right until '+').\n * @internal\n */\nexport function StationSizeSelector(props: StationSizeSelectorProps) {\n const { value, disabled, onChange, ...otherProps } = props;\n const separatorOptions = React.useRef<SelectOption<number>[]>([\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.station_size.two\") },\n { value: 3, label: UiIModelComponents.translate(\"QuantityFormat.station_size.three\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: number) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n return (\n <Select options={separatorOptions.current} disabled={disabled} value={value} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"StationSizeSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSizeSelector.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAW5D;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAA+B;IACjE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAyB;QAC5D,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC,EAAE;QACpF,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,mCAAmC,CAAC,EAAE;KACvF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACvI,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[StationSizeSelector]] component.\r\n * @internal\r\n */\r\nexport interface StationSizeSelectorProps extends CommonProps {\r\n value: number;\r\n disabled: boolean;\r\n onChange: (value: number) => void;\r\n}\r\n\r\n/** Component use to set Station size (number of digits from right until '+').\r\n * @internal\r\n */\r\nexport function StationSizeSelector(props: StationSizeSelectorProps) {\r\n const { value, disabled, onChange, ...otherProps } = props;\r\n const separatorOptions = React.useRef<SelectOption<number>[]>([\r\n { value: 2, label: UiIModelComponents.translate(\"QuantityFormat.station_size.two\") },\r\n { value: 3, label: UiIModelComponents.translate(\"QuantityFormat.station_size.three\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: number) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n return (\r\n <Select options={separatorOptions.current} disabled={disabled} value={value} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThousandsSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSel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AAqB,CAAC;IAC/B,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACnI,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[ThousandsSelector]] component.\n * @internal\n */\nexport interface ThousandsSelectorProps extends CommonProps {\n separator: string;\n disabled: boolean;\n onChange: (value: string) => void;\n}\n\n/** Component use to set Quantity Format thousand group separator.\n * @internal\n */\nexport function ThousandsSelector(props: ThousandsSelectorProps) {\n const { separator, disabled, onChange, ...otherProps } = props;\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\n { value: \",\", label: UiIModelComponents.translate(\"QuantityFormat.thousand_separator.comma\") },\n { value: \".\", label: UiIModelComponents.translate(\"QuantityFormat.thousand_separator.point\") },\n ]);\n\n const handleOnChange = React.useCallback((newValue: string) => {\n onChange && onChange(newValue);\n }, [onChange]);\n\n const separatorOptions = React.useMemo(() => {\n const completeListOfEntries: SelectOption<string>[] = [];\n // istanbul ignore next (only used if format already has a character that does not match standard options)\n if (undefined === uomDefaultEntries.current.find((option) => option.value === separator)) {\n completeListOfEntries.push({ value: separator, label: separator });\n }\n completeListOfEntries.push(...uomDefaultEntries.current);\n return completeListOfEntries;\n }, [separator]);\n\n return (\n <Select options={separatorOptions} disabled={disabled} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ThousandsSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSelector.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAW5D;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAC/D,MAAM,iBAAiB,GAAG,KAAK,CAAC,MAAM,CAAyB;QAC7D,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;QAC9F,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,yCAAyC,CAAC,EAAE;KAC/F,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,EAAE;QAC5D,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,qBAAqB,GAA2B,EAAE,CAAC;QACzD,0GAA0G;QAC1G,IAAI,SAAS,KAAK,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE;YACxF,qBAAqB,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;SACpE;QACD,qBAAqB,CAAC,IAAI,CAAC,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACzD,OAAO,qBAAqB,CAAC;IAC/B,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC;IAEhB,OAAO,CACL,oBAAC,MAAM,IAAC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,IAAI,EAAC,OAAO,KAAK,UAAU,GAAI,CACnI,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\nimport { Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[ThousandsSelector]] component.\r\n * @internal\r\n */\r\nexport interface ThousandsSelectorProps extends CommonProps {\r\n separator: string;\r\n disabled: boolean;\r\n onChange: (value: string) => void;\r\n}\r\n\r\n/** Component use to set Quantity Format thousand group separator.\r\n * @internal\r\n */\r\nexport function ThousandsSelector(props: ThousandsSelectorProps) {\r\n const { separator, disabled, onChange, ...otherProps } = props;\r\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\r\n { value: \",\", label: UiIModelComponents.translate(\"QuantityFormat.thousand_separator.comma\") },\r\n { value: \".\", label: UiIModelComponents.translate(\"QuantityFormat.thousand_separator.point\") },\r\n ]);\r\n\r\n const handleOnChange = React.useCallback((newValue: string) => {\r\n onChange && onChange(newValue);\r\n }, [onChange]);\r\n\r\n const separatorOptions = React.useMemo(() => {\r\n const completeListOfEntries: SelectOption<string>[] = [];\r\n // istanbul ignore next (only used if format already has a character that does not match standard options)\r\n if (undefined === uomDefaultEntries.current.find((option) => option.value === separator)) {\r\n completeListOfEntries.push({ value: separator, label: separator });\r\n }\r\n completeListOfEntries.push(...uomDefaultEntries.current);\r\n return completeListOfEntries;\r\n }, [separator]);\r\n\r\n return (\r\n <Select options={separatorOptions} disabled={disabled} value={separator} onChange={handleOnChange} size=\"small\" {...otherProps} />\r\n );\r\n}\r\n"]}
|
|
@@ -15,7 +15,6 @@ import { UiIModelComponents } from "../../UiIModelComponents";
|
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
17
|
export function ThousandsSeparator(props) {
|
|
18
|
-
var _a;
|
|
19
18
|
const { formatProps, onChange } = props;
|
|
20
19
|
const handleSetFormatProps = React.useCallback((newProps) => {
|
|
21
20
|
onChange && onChange(newProps);
|
|
@@ -65,6 +64,6 @@ export function ThousandsSeparator(props) {
|
|
|
65
64
|
React.createElement("span", { className: "uicore-label" }, useThousandSeparatorLabel.current),
|
|
66
65
|
React.createElement(Checkbox, { "data-testid": "use-thousands-separator", checked: isFormatTraitSet(FormatTraits.Use1000Separator), onChange: handleUseThousandsSeparatorChange }),
|
|
67
66
|
React.createElement("span", { className: classnames("uicore-label", !(isFormatTraitSet(FormatTraits.Use1000Separator)) && "uicore-disabled") }, thousandSeparatorLabel.current),
|
|
68
|
-
React.createElement(ThousandsSelector, { "data-testid": "thousands-separator-selector", separator:
|
|
67
|
+
React.createElement(ThousandsSelector, { "data-testid": "thousands-separator-selector", separator: formatProps.thousandSeparator ?? ",", disabled: !isFormatTraitSet(FormatTraits.Use1000Separator), onChange: handleThousandSeparatorChange })));
|
|
69
68
|
}
|
|
70
69
|
//# sourceMappingURL=ThousandsSeparator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThousandsSeparator.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSeparator.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAe,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAU9D;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA8B
|
|
1
|
+
{"version":3,"file":"ThousandsSeparator.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSeparator.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,MAAM,EAAe,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAU9D;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,KAA8B;IAC/D,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAExC,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAqB,EAAE,EAAE;QACvE,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAmB,EAAE,SAAkB,EAAE,EAAE;QACnF,MA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C,gBAAgB,CAAC,CAAC,IAAI,iBAAiB,CAAC,IAAG,sBAAsB,CAAC,OAAO,CAAQ;QAC7J,oBAAC,iBAAiB,mBAAa,8BAA8B,EAAC,SAAS,EAAE,WAAW,CAAC,iBAAiB,IAAI,GAAG,EAAE,QAAQ,EAAE,CAAC,gBAAgB,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAAE,QAAQ,EAAE,6BAA6B,GAAI,CACrN,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Format, FormatProps, FormatTraits, getTraitString } from \"@itwin/core-quantity\";\r\nimport { Checkbox } from \"@itwin/itwinui-react\";\r\nimport { ThousandsSelector } from \"./ThousandsSelector\";\r\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\r\n\r\n/** Properties of [[ThousandsSeparator]] component.\r\n * @internal\r\n */\r\nexport interface ThousandsSeparatorProps extends CommonProps {\r\n formatProps: FormatProps;\r\n onChange?: (format: FormatProps) => void;\r\n}\r\n\r\n/** Component use to set Quantity Format thousand group separator.\r\n * @internal\r\n */\r\nexport function ThousandsSeparator(props: ThousandsSeparatorProps) {\r\n const { formatProps, onChange } = props;\r\n\r\n const handleSetFormatProps = React.useCallback((newProps: FormatProps) => {\r\n onChange && onChange(newProps);\r\n }, [onChange]);\r\n\r\n const setFormatTrait = React.useCallback((trait: FormatTraits, setActive: boolean) => {\r\n const traitStr = getTraitString(trait);\r\n let formatTraits: string[] = [traitStr];\r\n if (setActive) {// setting trait\r\n // istanbul ignore else\r\n if (formatProps.formatTraits) {\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n formatTraits = [...traits, traitStr];\r\n }\r\n } else { // clearing trait\r\n // istanbul ignore else\r\n if (formatProps.formatTraits) {\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\r\n }\r\n }\r\n const newFormatProps = { ...formatProps, formatTraits };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleUseThousandsSeparatorChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.Use1000Separator, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const isFormatTraitSet = React.useCallback((trait: FormatTraits) => {\r\n return Format.isFormatTraitSetInProps(formatProps, trait);\r\n }, [formatProps]);\r\n\r\n const handleThousandSeparatorChange = React.useCallback((thousandSeparator: string) => {\r\n let decimalSeparator = formatProps.decimalSeparator;\r\n // make sure 1000 and decimal separator do not match\r\n // istanbul ignore else\r\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\r\n if (thousandSeparator === \".\")\r\n decimalSeparator = \",\";\r\n else // thousandSeparator === \",\"\r\n decimalSeparator = \".\";\r\n }\r\n const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, isFormatTraitSet, handleSetFormatProps]);\r\n\r\n const useThousandSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.useThousandSeparatorLabel\"));\r\n const thousandSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.thousandSeparatorLabel\"));\r\n\r\n return (\r\n <>\r\n <span className={\"uicore-label\"}>{useThousandSeparatorLabel.current}</span>\r\n <Checkbox data-testid=\"use-thousands-separator\" checked={isFormatTraitSet(FormatTraits.Use1000Separator)} onChange={handleUseThousandsSeparatorChange} />\r\n <span className={classnames(\"uicore-label\", !(isFormatTraitSet(FormatTraits.Use1000Separator)) && \"uicore-disabled\")}>{thousandSeparatorLabel.current}</span>\r\n <ThousandsSelector data-testid=\"thousands-separator-selector\" separator={formatProps.thousandSeparator ?? \",\"} disabled={!isFormatTraitSet(FormatTraits.Use1000Separator)} onChange={handleThousandSeparatorChange} />\r\n </>\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnitDescr.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/UnitDescr.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAgB,MAAM,sBAAsB,CAAC;AAgBnE,KAAK,UAAU,qBAAqB,CAAC,aAA0B,EAAE,MAAiB,EAAE,aAA4B;IAC9G,MAAM,qBAAqB,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAC7D,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,aAAa,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QACnE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IACH,OAAO,qBAAqB,CAAC;AAC/B,CAAC;AAED,KAAK,UAAU,gBAAgB,CAAC,UAAqB,EAAE,aAA4B,EAAE,yBAAkC;IACrH,MAAM,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC;IACzC,MAAM,aAAa,GAAG,MAAM,aAAa,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC;IACvE,IAAI,CAAC,yBAAyB;QAC5B,OAAO,aAAa,CAAC;IAEvB,MAAM,kBAAkB,GAAG,MAAM,qBAAqB,CAAC,aAAa,EAAE,UAAU,EAAE,aAAa,CAAC,CAAC;IACjG,MA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1B,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,CAAsC,EAAE,EAAE;QACvF,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,aAAa,IAAI,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC;IAE3B,OAAO,CACL;QACE,oBAAC,MAAM,IAAC,OAAO,EAAE,WAAW,iBAAe,QAAQ,WAAW,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,EAAE,EACtH,QAAQ,EAAE,kBAAkB,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAC,OAAO,GAAG;QACnE,oBAAC,KAAK,mBAAc,cAAc,WAAW,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAC,OAAO,GAAG,CACjH,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { Input, Select, SelectOption } from \"@itwin/itwinui-react\";\n\n/** Properties of [[UnitDescr]] component.\n * @internal\n */\nexport interface UnitDescrProps extends CommonProps {\n name: string;\n parentUnitName?: string;\n label: string;\n index: number;\n unitsProvider: UnitsProvider;\n readonly?: boolean;\n onUnitChange: (value: string, index: number) => void;\n onLabelChange: (value: string, index: number) => void;\n}\n\nasync function getUnitConversionData(possibleUnits: UnitProps[], toUnit: UnitProps, unitsProvider: UnitsProvider) {\n const unitConversionEntries = possibleUnits.map(async (unit) => {\n const conversion = await unitsProvider.getConversion(unit, toUnit);\n return { conversion, unitProps: unit };\n });\n return unitConversionEntries;\n}\n\nasync function getPossibleUnits(parentUnit: UnitProps, unitsProvider: UnitsProvider, ensureCompatibleComposite: boolean) {\n const phenomenon = parentUnit.phenomenon;\n const possibleUnits = await unitsProvider.getUnitsByFamily(phenomenon);\n if (!ensureCompatibleComposite)\n return possibleUnits;\n\n const conversionPromises = await getUnitConversionData(possibleUnits, parentUnit, unitsProvider);\n const conversionEntries = await Promise.all(conversionPromises);\n // sort the entries so the best potential sub unit will be the first one in the array\n return conversionEntries.filter((entry) => ((entry.unitProps.system === parentUnit.system) && (entry.conversion.factor < 1)))\n .sort((a, b) => b.conversion.factor - a.conversion.factor)\n .map((value) => value.unitProps);\n}\n\nfunction getUnitName(fullUnitName: string) {\n const nameParts = fullUnitName.split(/[.:]/);\n // istanbul ignore else\n if (nameParts.length > 0)\n return nameParts[nameParts.length - 1];\n // istanbul ignore next\n throw Error(\"Bad unit name encountered\");\n}\n\n/** Component use to display dropdown list of possible units.\n * @internal\n */\nexport function UnitDescr(props: UnitDescrProps) {\n const { name, label, parentUnitName, index, onUnitChange, onLabelChange, readonly, unitsProvider } = props;\n const [unitOptions, setUnitOptions] = React.useState<SelectOption<string>[]>([{ value: name, label: getUnitName(name) }]);\n const [currentUnit, setCurrentUnit] = React.useState({ name, label });\n const isMounted = React.useRef(false);\n\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n });\n\n React.useEffect(() => {\n async function fetchAllowableUnitSelections() {\n const currentUnitProps = await unitsProvider.findUnitByName(name);\n const parentUnit = await unitsProvider.findUnitByName(parentUnitName ? parentUnitName : name);\n // istanbul ignore else\n if (parentUnit && currentUnitProps) {\n let potentialSubUnit: UnitProps | undefined;\n const potentialUnits = await getPossibleUnits(parentUnit, unitsProvider, index !== 0);\n // istanbul ignore else\n if (index < 3) {\n const potentialSubUnits = await getPossibleUnits(currentUnitProps, unitsProvider, true);\n if (potentialSubUnits.length)\n potentialSubUnit = potentialSubUnits[0];\n }\n\n const options = (potentialUnits.length > 0) ?\n potentialUnits.map((unitValue) => {\n return { value: `${unitValue.name}:${unitValue.label}`, label: getUnitName(unitValue.name) };\n }).sort((a, b) => a.label.localeCompare(b.label))\n : /* istanbul ignore next */\n [{ value: `${currentUnitProps.name}:${currentUnitProps.label}`, label: getUnitName(name) }];\n\n if (potentialSubUnit) {\n // construct an entry that will provide the name and label of the unit to add\n options.push({ value: `ADDSUBUNIT:${potentialSubUnit.name}:${potentialSubUnit.label}`, label: \"Add sub-unit\" }); // NEEDSWORK - i18n\n }\n\n if (index !== 0)\n options.push({ value: \"REMOVEUNIT\", label: \"Remove\" }); // NEEDSWORK - i18n\n\n // istanbul ignore else\n if (isMounted.current) {\n setUnitOptions(options);\n setCurrentUnit(currentUnitProps);\n }\n }\n }\n fetchAllowableUnitSelections(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }, [index, label, name, parentUnitName, unitsProvider]);\n\n const handleOnUnitChange = React.useCallback((newValue: string) => {\n onUnitChange && onUnitChange(newValue, index);\n }, [index, onUnitChange]);\n\n const handleOnLabelChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n e.preventDefault();\n onLabelChange && onLabelChange(e.target.value, index);\n }, [index, onLabelChange]);\n\n return (\n <>\n <Select options={unitOptions} data-testid={`unit-${currentUnit.name}`} value={`${currentUnit.name}:${currentUnit.label}`}\n onChange={handleOnUnitChange} disabled={readonly} size=\"small\" />\n <Input data-testid={`unit-label-${currentUnit.name}`} value={label} onChange={handleOnLabelChange} size=\"small\" />\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"UnitDescr.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/UnitDescr.tsx"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE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AI,EAAC,OAAO,GAAG;QACnE,oBAAC,KAAK,mBAAc,cAAc,WAAW,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,mBAAmB,EAAE,IAAI,EAAC,OAAO,GAAG,CACjH,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Input, Select, SelectOption } from \"@itwin/itwinui-react\";\r\n\r\n/** Properties of [[UnitDescr]] component.\r\n * @internal\r\n */\r\nexport interface UnitDescrProps extends CommonProps {\r\n name: string;\r\n parentUnitName?: string;\r\n label: string;\r\n index: number;\r\n unitsProvider: UnitsProvider;\r\n readonly?: boolean;\r\n onUnitChange: (value: string, index: number) => void;\r\n onLabelChange: (value: string, index: number) => void;\r\n}\r\n\r\nasync function getUnitConversionData(possibleUnits: UnitProps[], toUnit: UnitProps, unitsProvider: UnitsProvider) {\r\n const unitConversionEntries = possibleUnits.map(async (unit) => {\r\n const conversion = await unitsProvider.getConversion(unit, toUnit);\r\n return { conversion, unitProps: unit };\r\n });\r\n return unitConversionEntries;\r\n}\r\n\r\nasync function getPossibleUnits(parentUnit: UnitProps, unitsProvider: UnitsProvider, ensureCompatibleComposite: boolean) {\r\n const phenomenon = parentUnit.phenomenon;\r\n const possibleUnits = await unitsProvider.getUnitsByFamily(phenomenon);\r\n if (!ensureCompatibleComposite)\r\n return possibleUnits;\r\n\r\n const conversionPromises = await getUnitConversionData(possibleUnits, parentUnit, unitsProvider);\r\n const conversionEntries = await Promise.all(conversionPromises);\r\n // sort the entries so the best potential sub unit will be the first one in the array\r\n return conversionEntries.filter((entry) => ((entry.unitProps.system === parentUnit.system) && (entry.conversion.factor < 1)))\r\n .sort((a, b) => b.conversion.factor - a.conversion.factor)\r\n .map((value) => value.unitProps);\r\n}\r\n\r\nfunction getUnitName(fullUnitName: string) {\r\n const nameParts = fullUnitName.split(/[.:]/);\r\n // istanbul ignore else\r\n if (nameParts.length > 0)\r\n return nameParts[nameParts.length - 1];\r\n // istanbul ignore next\r\n throw Error(\"Bad unit name encountered\");\r\n}\r\n\r\n/** Component use to display dropdown list of possible units.\r\n * @internal\r\n */\r\nexport function UnitDescr(props: UnitDescrProps) {\r\n const { name, label, parentUnitName, index, onUnitChange, onLabelChange, readonly, unitsProvider } = props;\r\n const [unitOptions, setUnitOptions] = React.useState<SelectOption<string>[]>([{ value: name, label: getUnitName(name) }]);\r\n const [currentUnit, setCurrentUnit] = React.useState({ name, label });\r\n const isMounted = React.useRef(false);\r\n\r\n React.useEffect(() => {\r\n isMounted.current = true;\r\n return () => {\r\n isMounted.current = false;\r\n };\r\n });\r\n\r\n React.useEffect(() => {\r\n async function fetchAllowableUnitSelections() {\r\n const currentUnitProps = await unitsProvider.findUnitByName(name);\r\n const parentUnit = await unitsProvider.findUnitByName(parentUnitName ? parentUnitName : name);\r\n // istanbul ignore else\r\n if (parentUnit && currentUnitProps) {\r\n let potentialSubUnit: UnitProps | undefined;\r\n const potentialUnits = await getPossibleUnits(parentUnit, unitsProvider, index !== 0);\r\n // istanbul ignore else\r\n if (index < 3) {\r\n const potentialSubUnits = await getPossibleUnits(currentUnitProps, unitsProvider, true);\r\n if (potentialSubUnits.length)\r\n potentialSubUnit = potentialSubUnits[0];\r\n }\r\n\r\n const options = (potentialUnits.length > 0) ?\r\n potentialUnits.map((unitValue) => {\r\n return { value: `${unitValue.name}:${unitValue.label}`, label: getUnitName(unitValue.name) };\r\n }).sort((a, b) => a.label.localeCompare(b.label))\r\n : /* istanbul ignore next */\r\n [{ value: `${currentUnitProps.name}:${currentUnitProps.label}`, label: getUnitName(name) }];\r\n\r\n if (potentialSubUnit) {\r\n // construct an entry that will provide the name and label of the unit to add\r\n options.push({ value: `ADDSUBUNIT:${potentialSubUnit.name}:${potentialSubUnit.label}`, label: \"Add sub-unit\" }); // NEEDSWORK - i18n\r\n }\r\n\r\n if (index !== 0)\r\n options.push({ value: \"REMOVEUNIT\", label: \"Remove\" }); // NEEDSWORK - i18n\r\n\r\n // istanbul ignore else\r\n if (isMounted.current) {\r\n setUnitOptions(options);\r\n setCurrentUnit(currentUnitProps);\r\n }\r\n }\r\n }\r\n fetchAllowableUnitSelections(); // eslint-disable-line @typescript-eslint/no-floating-promises\r\n }, [index, label, name, parentUnitName, unitsProvider]);\r\n\r\n const handleOnUnitChange = React.useCallback((newValue: string) => {\r\n onUnitChange && onUnitChange(newValue, index);\r\n }, [index, onUnitChange]);\r\n\r\n const handleOnLabelChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n e.preventDefault();\r\n onLabelChange && onLabelChange(e.target.value, index);\r\n }, [index, onLabelChange]);\r\n\r\n return (\r\n <>\r\n <Select options={unitOptions} data-testid={`unit-${currentUnit.name}`} value={`${currentUnit.name}:${currentUnit.label}`}\r\n onChange={handleOnUnitChange} disabled={readonly} size=\"small\" />\r\n <Input data-testid={`unit-label-${currentUnit.name}`} value={label} onChange={handleOnLabelChange} size=\"small\" />\r\n </>\r\n );\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSolarDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseSolarDataProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAA4B,YAAY,EAAe,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnG,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQjD;;GAEG;AACH,qBAAa,qBAAsB,YAAW,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EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,IAAI;gBAwB9D,QAAQ,CAAC,EAAE,cAAc,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM;IAiB5E,IAAW,cAAc,IAAI,MAAM,CAElC;IAED,IAAW,WAAW,IAAI,QAAQ,CAEjC;IAED,IAAW,WAAW,CAAC,KAAK,EAAE,QAAQ,EAErC;IAED,IAAW,kBAAkB,YAE5B;IAED,mCAAmC;IACnC,IAAW,SAAS,IAAI,IAAI,CAE3B;IAED;uEACmE;IAC5D,cAAc,CAAC,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,EAAE,OAAO;IAYzD,wBAAwB;IACxB,IAAW,GAAG,IAAI,IAAI,CAErB;IAED,wCAAwC;IACxC,IAAW,UAAU,IAAI,MAAM,CAE9B;IAEM,qBAAqB,CAAC,MAAM,EAAE,gBAAgB,GAAG,YAAY;IASpE,IAAW,QAAQ,CAAC,QAAQ,EAAE,cAAc,GAAG,SAAS,EAMvD;IAED,IAAW,QAAQ,IAAI,cAAc,GAAG,SAAS,CAEhD;IAED,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,YAAY;IAIxC,IAAW,OAAO,IAAI,IAAI,CAEzB;IAED,IAAW,SAAS,IAAI,MAAM,CAE7B;IAED,IAAW,MAAM,IAAI,IAAI,CAExB;IAED,IAAW,QAAQ,IAAI,MAAM,CAE5B;IAEM,aAAa,UAAW,IAAI,UAEjC;CACH"}
|
|
@@ -15,6 +15,28 @@ const millisecPerHour = millisecPerMinute * 60;
|
|
|
15
15
|
* @alpha
|
|
16
16
|
*/
|
|
17
17
|
export class BaseSolarDataProvider {
|
|
18
|
+
// projectTimeZoneOffset = zone offset in hours
|
|
19
|
+
initializeData(projectTimeZoneOffset, initialTime) {
|
|
20
|
+
if (!initialTime)
|
|
21
|
+
initialTime = new Date(Date.now()); // users local time
|
|
22
|
+
this._zoneOffsetMs = projectTimeZoneOffset * millisecPerHour;
|
|
23
|
+
const year = initialTime.getFullYear();
|
|
24
|
+
const month = initialTime.getMonth();
|
|
25
|
+
const date = initialTime.getDate();
|
|
26
|
+
const hours = initialTime.getHours();
|
|
27
|
+
const minutes = initialTime.getMinutes();
|
|
28
|
+
const initialUtcMs = Date.UTC(year, month, date, hours, minutes, 0, 0);
|
|
29
|
+
const initialProjectMs = initialUtcMs - this._zoneOffsetMs;
|
|
30
|
+
this._projectDateTime = new Date(initialProjectMs);
|
|
31
|
+
const utcDayMs = Date.UTC(year, month, date, 0, 0, 0, 0);
|
|
32
|
+
const utcDay = new Date(utcDayMs);
|
|
33
|
+
this._projectDayStartMS = utcDayMs - this._zoneOffsetMs;
|
|
34
|
+
this._projectDay = new Date(this._projectDayStartMS);
|
|
35
|
+
this._projectSunrise = calculateSunriseOrSunset(utcDay, this._cartographicCenter, true);
|
|
36
|
+
this._projectSunset = calculateSunriseOrSunset(utcDay, this._cartographicCenter, false);
|
|
37
|
+
this._projectSunriseMs = this._projectSunrise.getTime();
|
|
38
|
+
this._projectSunsetMs = this._projectSunset.getTime();
|
|
39
|
+
}
|
|
18
40
|
constructor(viewport, longitude, latitude) {
|
|
19
41
|
this._shadowColor = ColorDef.create(ColorByName.gray);
|
|
20
42
|
this.longitude = -75.17035; // long/lat of Philadelphia
|
|
@@ -30,7 +52,6 @@ export class BaseSolarDataProvider {
|
|
|
30
52
|
this._projectSunset = new Date();
|
|
31
53
|
this._projectDateTime = new Date();
|
|
32
54
|
this._projectDay = new Date();
|
|
33
|
-
// instanbul ignore next
|
|
34
55
|
this.onTimeChanged = (_time) => {
|
|
35
56
|
// to be implemented by derived class
|
|
36
57
|
};
|
|
@@ -46,28 +67,6 @@ export class BaseSolarDataProvider {
|
|
|
46
67
|
this._projectTimeZoneOffset = this.getZone(this._cartographicCenter);
|
|
47
68
|
this.initializeData(this._projectTimeZoneOffset);
|
|
48
69
|
}
|
|
49
|
-
// projectTimeZoneOffset = zone offset in hours
|
|
50
|
-
initializeData(projectTimeZoneOffset, initialTime) {
|
|
51
|
-
if (!initialTime)
|
|
52
|
-
initialTime = new Date(Date.now()); // users local time
|
|
53
|
-
this._zoneOffsetMs = projectTimeZoneOffset * millisecPerHour;
|
|
54
|
-
const year = initialTime.getFullYear();
|
|
55
|
-
const month = initialTime.getMonth();
|
|
56
|
-
const date = initialTime.getDate();
|
|
57
|
-
const hours = initialTime.getHours();
|
|
58
|
-
const minutes = initialTime.getMinutes();
|
|
59
|
-
const initialUtcMs = Date.UTC(year, month, date, hours, minutes, 0, 0);
|
|
60
|
-
const initialProjectMs = initialUtcMs - this._zoneOffsetMs;
|
|
61
|
-
this._projectDateTime = new Date(initialProjectMs);
|
|
62
|
-
const utcDayMs = Date.UTC(year, month, date, 0, 0, 0, 0);
|
|
63
|
-
const utcDay = new Date(utcDayMs);
|
|
64
|
-
this._projectDayStartMS = utcDayMs - this._zoneOffsetMs;
|
|
65
|
-
this._projectDay = new Date(this._projectDayStartMS);
|
|
66
|
-
this._projectSunrise = calculateSunriseOrSunset(utcDay, this._cartographicCenter, true);
|
|
67
|
-
this._projectSunset = calculateSunriseOrSunset(utcDay, this._cartographicCenter, false);
|
|
68
|
-
this._projectSunriseMs = this._projectSunrise.getTime();
|
|
69
|
-
this._projectSunsetMs = this._projectSunset.getTime();
|
|
70
|
-
}
|
|
71
70
|
get timeZoneOffset() {
|
|
72
71
|
return this._projectTimeZoneOffset;
|
|
73
72
|
}
|