@itwin/imodel-components-react 4.1.0 → 4.2.0-dev.1
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 +327 -327
- package/LICENSE.md +9 -9
- package/README.md +11 -11
- package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.js +11 -6
- package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js +23 -17
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +71 -63
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +10 -8
- 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.d.ts +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +6 -8
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +11 -12
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +62 -62
- package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +1 -1
- package/lib/cjs/imodel-components-react/color/HueSlider.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/HueSlider.js +32 -15
- package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/HueSlider.scss +78 -61
- package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +1 -1
- package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js +14 -11
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +36 -35
- package/lib/cjs/imodel-components-react/color/Swatch.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/Swatch.js +5 -8
- package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/Swatch.scss +22 -22
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +3 -3
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/editors/ColorEditor.js +17 -9
- 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.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/editors/WeightEditor.js +8 -6
- 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.d.ts +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +18 -12
- 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 +35 -21
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
- package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/lineweight/Swatch.js +12 -16
- 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.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +14 -10
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
- package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/Cube.js +31 -11
- 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.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +98 -39
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -178
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +171 -66
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -135
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +19 -12
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +4 -6
- 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 +12 -8
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +31 -10
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +15 -8
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +34 -22
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +61 -38
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +8 -7
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +55 -16
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +11 -5
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +39 -12
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +11 -5
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +19 -7
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +21 -8
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +11 -5
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +13 -6
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +21 -10
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +30 -13
- 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 +15 -7
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +11 -9
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +7 -4
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +27 -27
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +3 -3
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +28 -28
- package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +1 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js +32 -17
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +105 -105
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +61 -27
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +359 -359
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +4 -5
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +40 -40
- package/lib/cjs/imodel-components-react/timeline/Timeline.scss +165 -165
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +56 -29
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +178 -178
- package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/interfaces.js +3 -3
- package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +2 -2
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +40 -26
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +5 -4
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/cjs/imodel-components-react.js +3 -3
- 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 +11 -6
- package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.js +23 -17
- package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.scss +71 -63
- package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js +10 -8
- 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.d.ts +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +7 -9
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +13 -14
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +62 -62
- package/lib/esm/imodel-components-react/color/HueSlider.d.ts +1 -1
- package/lib/esm/imodel-components-react/color/HueSlider.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/HueSlider.js +32 -15
- package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/HueSlider.scss +78 -61
- package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +1 -1
- package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/SaturationPicker.js +14 -11
- package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/esm/imodel-components-react/color/SaturationPicker.scss +36 -35
- package/lib/esm/imodel-components-react/color/Swatch.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/Swatch.js +5 -8
- package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/esm/imodel-components-react/color/Swatch.scss +22 -22
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +3 -3
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/editors/ColorEditor.js +18 -10
- 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.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/editors/WeightEditor.js +10 -8
- 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.d.ts +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityInput.js +18 -12
- 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 +37 -23
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +106 -106
- package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/lineweight/Swatch.js +12 -16
- 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.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +14 -10
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +51 -51
- package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/Cube.js +31 -11
- 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.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +100 -41
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +178 -178
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +173 -68
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +135 -135
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +19 -12
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +59 -59
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +4 -6
- 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 +12 -8
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js +31 -10
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +15 -8
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +34 -22
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +61 -38
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +8 -7
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +55 -16
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +11 -5
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +39 -12
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +11 -5
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +19 -7
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +21 -8
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +11 -5
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +13 -6
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +21 -10
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +30 -13
- 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 +16 -8
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +11 -9
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.js +7 -4
- package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +27 -27
- package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js +3 -3
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +28 -28
- package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +1 -1
- package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/Scrubber.js +32 -17
- package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/Scrubber.scss +105 -105
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +63 -29
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +359 -359
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +4 -5
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +40 -40
- package/lib/esm/imodel-components-react/timeline/Timeline.scss +165 -165
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +58 -31
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +178 -178
- package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/interfaces.js +3 -3
- package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +2 -2
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +42 -28
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +5 -4
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/esm/imodel-components-react.js +3 -3
- package/lib/esm/imodel-components-react.js.map +1 -1
- package/lib/public/locales/en/UiIModelComponents.json +139 -139
- package/package.json +15 -24
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module QuantityFormat
|
|
8
8
|
*/
|
|
@@ -49,7 +49,7 @@ async function generateFormatSpec(formatProps, persistenceUnit, unitsProvider) {
|
|
|
49
49
|
*/
|
|
50
50
|
function FormatPanel(props) {
|
|
51
51
|
const [formatSpec, setFormatSpec] = React.useState();
|
|
52
|
-
const { initialFormat, showSample, initialMagnitude, unitsProvider, persistenceUnit, onFormatChange, provideFormatSpec, enableMinimumProperties } = props;
|
|
52
|
+
const { initialFormat, showSample, initialMagnitude, unitsProvider, persistenceUnit, onFormatChange, provideFormatSpec, enableMinimumProperties, } = props;
|
|
53
53
|
const [formatProps, setFormatProps] = React.useState(initialFormat);
|
|
54
54
|
const [showOptions, setShowOptions] = React.useState(false);
|
|
55
55
|
React.useEffect(() => {
|
|
@@ -65,9 +65,9 @@ function FormatPanel(props) {
|
|
|
65
65
|
// runs returned function only when component is unmounted.
|
|
66
66
|
React.useEffect(() => {
|
|
67
67
|
isMounted.current = true;
|
|
68
|
-
return (
|
|
68
|
+
return () => {
|
|
69
69
|
isMounted.current = false;
|
|
70
|
-
}
|
|
70
|
+
};
|
|
71
71
|
}, []);
|
|
72
72
|
React.useEffect(() => {
|
|
73
73
|
async function fetchFormatSpec() {
|
|
@@ -82,8 +82,14 @@ function FormatPanel(props) {
|
|
|
82
82
|
isMounted.current && setFormatSpec(newFormatSpec);
|
|
83
83
|
}
|
|
84
84
|
if (!formatSpec)
|
|
85
|
-
fetchFormatSpec();
|
|
86
|
-
}, [
|
|
85
|
+
void fetchFormatSpec();
|
|
86
|
+
}, [
|
|
87
|
+
formatProps,
|
|
88
|
+
formatSpec,
|
|
89
|
+
persistenceUnit,
|
|
90
|
+
provideFormatSpec,
|
|
91
|
+
unitsProvider,
|
|
92
|
+
]);
|
|
87
93
|
const handleFormatChange = React.useCallback((newFormatProps) => {
|
|
88
94
|
handleUserFormatChanges(newFormatProps);
|
|
89
95
|
}, [handleUserFormatChanges]);
|
|
@@ -91,14 +97,15 @@ function FormatPanel(props) {
|
|
|
91
97
|
setShowOptions(show);
|
|
92
98
|
}, []);
|
|
93
99
|
return (React.createElement("div", { className: "components-quantityFormat-panel" },
|
|
94
|
-
showSample &&
|
|
95
|
-
React.createElement(FormatSample_1.FormatSample, { formatSpec: formatSpec, initialMagnitude: initialMagnitude }),
|
|
100
|
+
showSample && (React.createElement(FormatSample_1.FormatSample, { formatSpec: formatSpec, initialMagnitude: initialMagnitude })),
|
|
96
101
|
React.createElement(FormatUnits_1.FormatUnits, { unitsProvider: unitsProvider, persistenceUnit: formatSpec === null || formatSpec === void 0 ? void 0 : formatSpec.persistenceUnit, initialFormat: formatProps, onUnitsChange: handleFormatChange }),
|
|
97
102
|
React.createElement(FormatUnitLabel_1.FormatUnitLabel, { formatProps: formatProps, onUnitLabelChange: handleFormatChange }),
|
|
98
103
|
React.createElement(FormatType_1.FormatTypeOption, { formatProps: formatProps, onChange: handleFormatChange }),
|
|
99
104
|
React.createElement(FormatPrecision_1.FormatPrecision, { formatProps: formatProps, onChange: handleFormatChange }),
|
|
100
|
-
props.providePrimaryChildren &&
|
|
101
|
-
|
|
105
|
+
props.providePrimaryChildren &&
|
|
106
|
+
props.providePrimaryChildren(formatProps, handleFormatChange),
|
|
107
|
+
React.createElement(MiscFormatOptions_1.MiscFormatOptions, { formatProps: formatProps, onChange: handleFormatChange, enableMinimumProperties: enableMinimumProperties, showOptions: showOptions, onShowHideOptions: handleShowOptions }, props.provideSecondaryChildren &&
|
|
108
|
+
props.provideSecondaryChildren(formatProps, handleFormatChange))));
|
|
102
109
|
}
|
|
103
110
|
exports.FormatPanel = FormatPanel;
|
|
104
111
|
//# sourceMappingURL=FormatPanel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPanel.tsx"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"FormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPanel.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8BAA4B;AAC5B,6CAA+B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AAC,iCAAiC;QAC7C,UAAU,IAAI,CACb,oBAAC,2BAAY,IACX,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,GAClC,CACH;QACD,oBAAC,yBAAW,IACV,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,eAAe,EAC5C,aAAa,EAAE,WAAW,EAC1B,aAAa,EAAE,kBAAkB,GACjC;QACF,oBAAC,iCAAe,IACd,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,kBAAkB,GACrC;QACF,oBAAC,6BAAgB,IACf,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,kBAAkB,GAC5B;QACF,oBAAC,iCAAe,IACd,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,kBAAkB,GAC5B;QACD,KAAK,CAAC,sBAAsB;YAC3B,KAAK,CAAC,sBAAsB,CAAC,WAAW,EAAE,kBAAkB,CAAC;QAC/D,oBAAC,qCAAiB,IAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,kBAAkB,EAC5B,uBAAuB,EAAE,uBAAuB,EAChD,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,IAEnC,KAAK,CAAC,wBAAwB;YAC7B,KAAK,CAAC,wBAAwB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAC/C,CAChB,CACP,CAAC;AACJ,CAAC;AAlHD,kCAkHC","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 \"./FormatPanel.scss\";\nimport * as React from \"react\";\nimport type {\n FormatProps,\n UnitProps,\n UnitsProvider,\n} from \"@itwin/core-quantity\";\nimport { Format, FormatterSpec } from \"@itwin/core-quantity\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { FormatPrecision } from \"./FormatPrecision\";\nimport { FormatSample } from \"./FormatSample\";\nimport { FormatTypeOption } from \"./FormatType\";\nimport { FormatUnitLabel } from \"./FormatUnitLabel\";\nimport { FormatUnits } from \"./FormatUnits\";\nimport { MiscFormatOptions } from \"./MiscFormatOptions\";\n\n/** Properties of [[FormatPanel]] component.\n * @alpha\n */\nexport interface FormatPanelProps extends CommonProps {\n initialFormat: FormatProps;\n unitsProvider: UnitsProvider;\n persistenceUnit: Promise<UnitProps> | UnitProps;\n showSample?: boolean;\n initialMagnitude?: number;\n // if true a only primary format properties are initially displayed and a \"More/Less\" link is added.\n enableMinimumProperties?: boolean;\n onFormatChange?: (format: FormatProps) => void;\n provideFormatSpec?: (\n formatProps: FormatProps,\n persistenceUnit: UnitProps,\n unitsProvider: UnitsProvider\n ) => Promise<FormatterSpec>;\n providePrimaryChildren?: (\n formatProps: FormatProps,\n fireFormatChange: (newProps: FormatProps) => void\n ) => React.ReactNode;\n provideSecondaryChildren?: (\n formatProps: FormatProps,\n fireFormatChange: (newProps: FormatProps) => void\n ) => React.ReactNode;\n}\n\nasync function generateFormatSpec(\n formatProps: FormatProps,\n persistenceUnit: UnitProps,\n unitsProvider: UnitsProvider\n) {\n const actualFormat = await Format.createFromJSON(\n \"custom\",\n unitsProvider,\n formatProps\n );\n return FormatterSpec.create(\n actualFormat.name,\n actualFormat,\n unitsProvider,\n persistenceUnit\n );\n}\n\n/** Component to show/edit Quantity Format.\n * @alpha\n */\nexport function FormatPanel(props: FormatPanelProps) {\n const [formatSpec, setFormatSpec] = React.useState<FormatterSpec>();\n const {\n initialFormat,\n showSample,\n initialMagnitude,\n unitsProvider,\n persistenceUnit,\n onFormatChange,\n provideFormatSpec,\n enableMinimumProperties,\n } = props;\n const [formatProps, setFormatProps] = React.useState(initialFormat);\n const [showOptions, setShowOptions] = React.useState(false);\n\n React.useEffect(() => {\n setFormatProps(initialFormat);\n setFormatSpec(undefined); // this will trigger the new spec to be created in the useEffect hook\n }, [initialFormat]);\n\n const handleUserFormatChanges = React.useCallback(\n (newProps: FormatProps) => {\n setFormatProps(newProps);\n setFormatSpec(undefined); // this will trigger the new spec to be created in the useEffect hook\n onFormatChange && onFormatChange(newProps);\n },\n [onFormatChange]\n );\n\n const isMounted = React.useRef(false);\n\n // runs returned function only when component is unmounted.\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n React.useEffect(() => {\n async function fetchFormatSpec() {\n const pu = await persistenceUnit;\n let newFormatSpec: FormatterSpec;\n if (provideFormatSpec) {\n newFormatSpec = await provideFormatSpec(formatProps, pu, unitsProvider);\n } else {\n newFormatSpec = await generateFormatSpec(\n formatProps,\n pu,\n unitsProvider\n );\n }\n isMounted.current && setFormatSpec(newFormatSpec);\n }\n if (!formatSpec) void fetchFormatSpec();\n }, [\n formatProps,\n formatSpec,\n persistenceUnit,\n provideFormatSpec,\n unitsProvider,\n ]);\n\n const handleFormatChange = React.useCallback(\n (newFormatProps: FormatProps) => {\n handleUserFormatChanges(newFormatProps);\n },\n [handleUserFormatChanges]\n );\n\n const handleShowOptions = React.useCallback((show: boolean) => {\n setShowOptions(show);\n }, []);\n\n return (\n <div className=\"components-quantityFormat-panel\">\n {showSample && (\n <FormatSample\n formatSpec={formatSpec}\n initialMagnitude={initialMagnitude}\n />\n )}\n <FormatUnits\n unitsProvider={unitsProvider}\n persistenceUnit={formatSpec?.persistenceUnit}\n initialFormat={formatProps}\n onUnitsChange={handleFormatChange}\n />\n <FormatUnitLabel\n formatProps={formatProps}\n onUnitLabelChange={handleFormatChange}\n />\n <FormatTypeOption\n formatProps={formatProps}\n onChange={handleFormatChange}\n />\n <FormatPrecision\n formatProps={formatProps}\n onChange={handleFormatChange}\n />\n {props.providePrimaryChildren &&\n props.providePrimaryChildren(formatProps, handleFormatChange)}\n <MiscFormatOptions\n formatProps={formatProps}\n onChange={handleFormatChange}\n enableMinimumProperties={enableMinimumProperties}\n showOptions={showOptions}\n onShowHideOptions={handleShowOptions}\n >\n {props.provideSecondaryChildren &&\n props.provideSecondaryChildren(formatProps, handleFormatChange)}\n </MiscFormatOptions>\n </div>\n );\n}\n"]}
|
|
@@ -1,59 +1,59 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import "~@itwin/core-react/lib/cjs/core-react/inputs/variables";
|
|
6
|
-
|
|
7
|
-
.components-quantityFormat-panel {
|
|
8
|
-
display: grid;
|
|
9
|
-
grid-template-columns: auto 1fr;
|
|
10
|
-
row-gap: 0;
|
|
11
|
-
column-gap: 6px;
|
|
12
|
-
align-items: center;
|
|
13
|
-
|
|
14
|
-
> .uicore-label {
|
|
15
|
-
font-size: var(--iui-font-size-1);
|
|
16
|
-
margin: 4.4px 0;
|
|
17
|
-
|
|
18
|
-
/* match margin on other select controls so it spaces properly in grid */
|
|
19
|
-
&.uicore-disabled {
|
|
20
|
-
color: var(--iui-color-text-disabled);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
> span.components-inline {
|
|
25
|
-
display: flex;
|
|
26
|
-
flex-direction: row;
|
|
27
|
-
align-items: center;
|
|
28
|
-
gap: 4px;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
> button.components-quantityFormat-more-button {
|
|
32
|
-
grid-column: 1 / span 2;
|
|
33
|
-
border: none;
|
|
34
|
-
outline: none;
|
|
35
|
-
background: none;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.components-quantityFormat-more-button-label {
|
|
39
|
-
margin-right: 0.25em;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
> a.components-quantityFormat-more-less {
|
|
43
|
-
font-size: var(--iui-font-size-1);
|
|
44
|
-
color: var(--iui-color-text-negative);
|
|
45
|
-
-webkit-transition: text-decoration 1s ease;
|
|
46
|
-
-moz-transition: text-decoration 1s ease;
|
|
47
|
-
-o-transition: text-decoration 1s ease;
|
|
48
|
-
transition: text-decoration 0.1s ease;
|
|
49
|
-
|
|
50
|
-
&:hover {
|
|
51
|
-
text-decoration: underline;
|
|
52
|
-
cursor: pointer;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.iui-input {
|
|
57
|
-
padding: $uicore-iui-input-padding;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
@import "~@itwin/core-react/lib/cjs/core-react/inputs/variables";
|
|
6
|
+
|
|
7
|
+
.components-quantityFormat-panel {
|
|
8
|
+
display: grid;
|
|
9
|
+
grid-template-columns: auto 1fr;
|
|
10
|
+
row-gap: 0;
|
|
11
|
+
column-gap: 6px;
|
|
12
|
+
align-items: center;
|
|
13
|
+
|
|
14
|
+
> .uicore-label {
|
|
15
|
+
font-size: var(--iui-font-size-1);
|
|
16
|
+
margin: 4.4px 0;
|
|
17
|
+
|
|
18
|
+
/* match margin on other select controls so it spaces properly in grid */
|
|
19
|
+
&.uicore-disabled {
|
|
20
|
+
color: var(--iui-color-text-disabled);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
> span.components-inline {
|
|
25
|
+
display: flex;
|
|
26
|
+
flex-direction: row;
|
|
27
|
+
align-items: center;
|
|
28
|
+
gap: 4px;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
> button.components-quantityFormat-more-button {
|
|
32
|
+
grid-column: 1 / span 2;
|
|
33
|
+
border: none;
|
|
34
|
+
outline: none;
|
|
35
|
+
background: none;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.components-quantityFormat-more-button-label {
|
|
39
|
+
margin-right: 0.25em;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
> a.components-quantityFormat-more-less {
|
|
43
|
+
font-size: var(--iui-font-size-1);
|
|
44
|
+
color: var(--iui-color-text-negative);
|
|
45
|
+
-webkit-transition: text-decoration 1s ease;
|
|
46
|
+
-moz-transition: text-decoration 1s ease;
|
|
47
|
+
-o-transition: text-decoration 1s ease;
|
|
48
|
+
transition: text-decoration 0.1s ease;
|
|
49
|
+
|
|
50
|
+
&:hover {
|
|
51
|
+
text-decoration: underline;
|
|
52
|
+
cursor: pointer;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.iui-input {
|
|
57
|
+
padding: $uicore-iui-input-padding;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatPrecision.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPrecision.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"FormatPrecision.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPrecision.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMxD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAkC1D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module QuantityFormat
|
|
8
8
|
*/
|
|
@@ -50,9 +50,7 @@ function FormatPrecision(props) {
|
|
|
50
50
|
const label = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.precision"));
|
|
51
51
|
return (React.createElement(React.Fragment, null,
|
|
52
52
|
React.createElement("span", { className: "uicore-label" }, label.current),
|
|
53
|
-
formatType === core_quantity_1.FormatType.Fractional ?
|
|
54
|
-
React.createElement(FractionPrecision_1.FractionPrecisionSelector, { "data-testid": "fraction-precision-selector", precision: (_a = formatProps.precision) !== null && _a !== void 0 ? _a : 0, onChange: handlePrecisionChange }) :
|
|
55
|
-
React.createElement(DecimalPrecision_1.DecimalPrecisionSelector, { "data-testid": "decimal-precision-selector", precision: (_b = formatProps.precision) !== null && _b !== void 0 ? _b : 0, onChange: handlePrecisionChange })));
|
|
53
|
+
formatType === core_quantity_1.FormatType.Fractional ? (React.createElement(FractionPrecision_1.FractionPrecisionSelector, { "data-testid": "fraction-precision-selector", precision: (_a = formatProps.precision) !== null && _a !== void 0 ? _a : 0, onChange: handlePrecisionChange })) : (React.createElement(DecimalPrecision_1.DecimalPrecisionSelector, { "data-testid": "decimal-precision-selector", precision: (_b = formatProps.precision) !== null && _b !== void 0 ? _b : 0, onChange: handlePrecisionChange }))));
|
|
56
54
|
}
|
|
57
55
|
exports.FormatPrecision = FormatPrecision;
|
|
58
56
|
//# sourceMappingURL=FormatPrecision.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatPrecision.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPrecision.tsx"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"FormatPrecision.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPrecision.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAG/B,wDAAmE;AACnE,8DAAmE;AACnE,gEAAqE;AACrE,8DAA2D;AAU3D;;GAEG;AACH,SAAgB,eAAe,CAAC,KAA2B;;IACzD,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;IAExC,MAAM,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAC7C,CAAC,SAAiB,EAAE,EAAE;QACpB,MAAM,cAAc,GAAG,EAAE,GAAG,WAAW,EAAE,SAAS,EAAE,CAAC;QACrD,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EACD,CAAC,WAAW,EAAE,QAAQ,CAAC,CACxB,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,+BAAe,EAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAE/D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CACxB,uCAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAChE,CAAC;IACF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,cAAc,IAAG,KAAK,CAAC,OAAO,CAAQ;QACtD,UAAU,KAAK,0BAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CACtC,oBAAC,6CAAyB,mBACZ,6BAA6B,EACzC,SAAS,EAAE,MAAA,WAAW,CAAC,SAAS,mCAAI,CAAC,EACrC,QAAQ,EAAE,qBAAqB,GAC/B,CACH,CAAC,CAAC,CAAC,CACF,oBAAC,2CAAwB,mBACX,4BAA4B,EACxC,SAAS,EAAE,MAAA,WAAW,CAAC,SAAS,mCAAI,CAAC,EACrC,QAAQ,EAAE,qBAAqB,GAC/B,CACH,CACA,CACJ,CAAC;AACJ,CAAC;AAlCD,0CAkCC","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 type { CommonProps } from \"@itwin/core-react\";\nimport type { FormatProps } from \"@itwin/core-quantity\";\nimport { FormatType, parseFormatType } from \"@itwin/core-quantity\";\nimport { DecimalPrecisionSelector } from \"./misc/DecimalPrecision\";\nimport { FractionPrecisionSelector } from \"./misc/FractionPrecision\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties of [[FormatPrecision]] component.\n * @alpha\n */\nexport interface FormatPrecisionProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n}\n\n/** Component to show/edit Quantity Format Precision.\n * @alpha\n */\nexport function FormatPrecision(props: FormatPrecisionProps) {\n const { formatProps, onChange } = props;\n\n const handlePrecisionChange = React.useCallback(\n (precision: number) => {\n const newFormatProps = { ...formatProps, precision };\n onChange && onChange(newFormatProps);\n },\n [formatProps, onChange]\n );\n\n const formatType = parseFormatType(formatProps.type, \"format\");\n\n const label = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.precision\")\n );\n return (\n <>\n <span className={\"uicore-label\"}>{label.current}</span>\n {formatType === FormatType.Fractional ? (\n <FractionPrecisionSelector\n data-testid=\"fraction-precision-selector\"\n precision={formatProps.precision ?? 0}\n onChange={handlePrecisionChange}\n />\n ) : (\n <DecimalPrecisionSelector\n data-testid=\"decimal-precision-selector\"\n precision={formatProps.precision ?? 0}\n onChange={handlePrecisionChange}\n />\n )}\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatSample.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatSample.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"FormatSample.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatSample.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMrD;;GAEG;AACH,MAAM,WAAW,iBAAkB,SAAQ,WAAW;IACpD,UAAU,CAAC,EAAE,aAAa,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,eAuFpD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module QuantityFormat
|
|
8
8
|
*/
|
|
@@ -71,18 +71,22 @@ function FormatSample(props) {
|
|
|
71
71
|
e.preventDefault();
|
|
72
72
|
}
|
|
73
73
|
}, [sampleValue]);
|
|
74
|
-
const activePersistenceUnitLabel = formatSpec
|
|
75
|
-
|
|
74
|
+
const activePersistenceUnitLabel = formatSpec
|
|
75
|
+
? formatSpec.persistenceUnit.label
|
|
76
|
+
: "";
|
|
77
|
+
const formattedValue = formatSpec
|
|
78
|
+
? formatSpec.applyFormatting(magnitude)
|
|
79
|
+
: "";
|
|
76
80
|
const valueLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.value"));
|
|
77
81
|
const formattedLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.formatted"));
|
|
78
82
|
return (React.createElement(React.Fragment, null,
|
|
79
|
-
!hideLabels && React.createElement("span", { className: "uicore-label" }, valueLabel.current),
|
|
83
|
+
!hideLabels && (React.createElement("span", { className: "uicore-label" }, valueLabel.current)),
|
|
80
84
|
React.createElement("span", { className: "components-inline" },
|
|
81
85
|
React.createElement(itwinui_react_1.Input, { "data-testid": "format-sample-input", className: "components-quantity-persistence-input", value: sampleValue, onChange: handleOnValueChange, onKeyDown: handleKeyDown, onBlur: handleOnValueBlur, size: "small" }),
|
|
82
86
|
activePersistenceUnitLabel),
|
|
83
|
-
!hideLabels && React.createElement("span", { className: "uicore-label" }, formattedLabel.current),
|
|
87
|
+
!hideLabels && (React.createElement("span", { className: "uicore-label" }, formattedLabel.current)),
|
|
84
88
|
React.createElement("span", { "data-testid": "progress-forward" },
|
|
85
|
-
hideLabels &&
|
|
89
|
+
hideLabels && formattedValue.length > 0 && (React.createElement(core_react_1.Icon, { iconSpec: React.createElement(itwinui_icons_react_1.SvgProgressForward, null) })),
|
|
86
90
|
React.createElement("span", { "data-testid": "format-sample-formatted", className: "uicore-label components-quantity-formatted-sample" }, formattedValue))));
|
|
87
91
|
}
|
|
88
92
|
exports.FormatSample = FormatSample;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatSample.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatSample.tsx"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"FormatSample.js","sourceRoot":"","sources":["../../../../src/imodel-components-react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BACQ,qBAAqB,EACjC,SAAS,EAAE,uCAAuC,EAClD,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAC,OAAO,GACZ;YACD,0BAA0B,CACtB;QACN,CAAC,UAAU,IAAI,CACd,8BAAM,SAAS,EAAE,cAAc,IAAG,cAAc,CAAC,OAAO,CAAQ,CACjE;QACD,6CAAkB,kBAAkB;YACjC,UAAU,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,CAC1C,oBAAC,iBAAI,IAAC,QAAQ,EAAE,oBAAC,wCAAkB,OAAG,GAAI,CAC3C;YACD,6CACc,yBAAyB,EACrC,SAAS,EAAE,mDAAmD,IAE7D,cAAc,CACV,CACF,CACN,CACJ,CAAC;AACJ,CAAC;AAvFD,oCAuFC","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 type { FormatterSpec } from \"@itwin/core-quantity\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { SvgProgressForward } from \"@itwin/itwinui-icons-react\";\n\n/** Properties of [[FormatSample]] component.\n * @alpha\n */\nexport interface FormatSampleProps extends CommonProps {\n formatSpec?: FormatterSpec;\n initialMagnitude?: number;\n hideLabels?: boolean;\n}\n\n/** Component to show the persistence value and formatted value given a FormatterSpec.\n * @alpha\n */\nexport function FormatSample(props: FormatSampleProps) {\n const { initialMagnitude, formatSpec, hideLabels } = props;\n const initialValue = initialMagnitude ?? 0;\n const [magnitude, setMagnitude] = React.useState(initialValue);\n const [sampleValue, setSampleValue] = React.useState(initialValue.toString());\n\n React.useEffect(() => {\n const value = initialMagnitude ?? 0;\n setMagnitude(value);\n setSampleValue(value.toString());\n }, [initialMagnitude]);\n\n const handleOnValueBlur = React.useCallback(() => {\n let newValue = Number.parseFloat(sampleValue);\n if (Number.isNaN(newValue)) newValue = 0;\n setMagnitude(newValue);\n setSampleValue(newValue.toString());\n }, [sampleValue]);\n\n const handleOnValueChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setSampleValue(event.target.value);\n },\n []\n );\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (e.key === SpecialKey.Enter) {\n let newValue = Number.parseFloat(sampleValue);\n if (Number.isNaN(newValue)) newValue = 0;\n setMagnitude(newValue);\n setSampleValue(newValue.toString());\n e.preventDefault();\n }\n },\n [sampleValue]\n );\n\n const activePersistenceUnitLabel = formatSpec\n ? formatSpec.persistenceUnit.label\n : \"\";\n const formattedValue = formatSpec\n ? formatSpec.applyFormatting(magnitude)\n : \"\";\n\n const valueLabel = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.value\")\n );\n const formattedLabel = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.formatted\")\n );\n\n return (\n <>\n {!hideLabels && (\n <span className={\"uicore-label\"}>{valueLabel.current}</span>\n )}\n <span className=\"components-inline\">\n <Input\n data-testid=\"format-sample-input\"\n className={\"components-quantity-persistence-input\"}\n value={sampleValue}\n onChange={handleOnValueChange}\n onKeyDown={handleKeyDown}\n onBlur={handleOnValueBlur}\n size=\"small\"\n />\n {activePersistenceUnitLabel}\n </span>\n {!hideLabels && (\n <span className={\"uicore-label\"}>{formattedLabel.current}</span>\n )}\n <span data-testid=\"progress-forward\">\n {hideLabels && formattedValue.length > 0 && (\n <Icon iconSpec={<SvgProgressForward />} />\n )}\n <span\n data-testid=\"format-sample-formatted\"\n className={\"uicore-label components-quantity-formatted-sample\"}\n >\n {formattedValue}\n </span>\n </span>\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatType.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"FormatType.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AA+DxD;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,eAyD5D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module QuantityFormat
|
|
8
8
|
*/
|
|
@@ -41,10 +41,22 @@ const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
|
41
41
|
function FormatTypeSelector(props) {
|
|
42
42
|
const { type, onChange, ...otherProps } = props;
|
|
43
43
|
const formatOptions = React.useRef([
|
|
44
|
-
{
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
{
|
|
45
|
+
value: core_quantity_1.FormatType.Decimal,
|
|
46
|
+
label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.decimal"),
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
value: core_quantity_1.FormatType.Scientific,
|
|
50
|
+
label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.scientific"),
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
value: core_quantity_1.FormatType.Station,
|
|
54
|
+
label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.station"),
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: core_quantity_1.FormatType.Fractional,
|
|
58
|
+
label: UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.fractional"),
|
|
59
|
+
},
|
|
48
60
|
]);
|
|
49
61
|
const handleOnChange = React.useCallback((newValue) => {
|
|
50
62
|
onChange && onChange(newValue);
|
|
@@ -62,7 +74,8 @@ function FormatTypeOption(props) {
|
|
|
62
74
|
let precision;
|
|
63
75
|
let stationOffsetSize;
|
|
64
76
|
let scientificType;
|
|
65
|
-
switch (newType
|
|
77
|
+
switch (newType // type must be decimal, fractional, scientific, or station
|
|
78
|
+
) {
|
|
66
79
|
case core_quantity_1.FormatType.Scientific:
|
|
67
80
|
precision = core_quantity_1.DecimalPrecision.Six;
|
|
68
81
|
scientificType = (0, core_quantity_1.scientificTypeToString)(core_quantity_1.ScientificType.Normalized);
|
|
@@ -72,13 +85,21 @@ function FormatTypeOption(props) {
|
|
|
72
85
|
break;
|
|
73
86
|
case core_quantity_1.FormatType.Station:
|
|
74
87
|
precision = core_quantity_1.DecimalPrecision.Two;
|
|
75
|
-
stationOffsetSize = ((_a = formatProps.composite) === null || _a === void 0 ? void 0 : _a.units[0].name.toLocaleLowerCase().endsWith("m"))
|
|
88
|
+
stationOffsetSize = ((_a = formatProps.composite) === null || _a === void 0 ? void 0 : _a.units[0].name.toLocaleLowerCase().endsWith("m"))
|
|
89
|
+
? 3
|
|
90
|
+
: 2;
|
|
76
91
|
break;
|
|
77
92
|
case core_quantity_1.FormatType.Fractional:
|
|
78
93
|
precision = core_quantity_1.FractionalPrecision.Eight;
|
|
79
94
|
break;
|
|
80
95
|
}
|
|
81
|
-
const newFormatProps = {
|
|
96
|
+
const newFormatProps = {
|
|
97
|
+
...formatProps,
|
|
98
|
+
type,
|
|
99
|
+
precision,
|
|
100
|
+
scientificType,
|
|
101
|
+
stationOffsetSize,
|
|
102
|
+
};
|
|
82
103
|
onChange && onChange(newFormatProps);
|
|
83
104
|
}, [formatProps, onChange]);
|
|
84
105
|
const formatType = (0, core_quantity_1.parseFormatType)(formatProps.type, "format");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatType.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"FormatType.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAE/B,8DAA2D;AAE3D,wDAQ8B;AAE9B,wDAA8C;AAU9C;;GAEG;AACH,SAAS,kBAAkB,CAAC,KAA8B;IACxD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAA6B;QAC7D;YACE,KAAK,EAAE,0BAAU,CAAC,OAAO;YACzB,KAAK,EAAE,uCAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC;SAC9D;QACD;YACE,KAAK,EAAE,0BAAU,CAAC,UAAU;YAC5B,KAAK,EAAE,uCAAkB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AM;YACR,KAAK,0BAAU,CAAC,OAAO;gBACrB,SAAS,GAAG,gCAAgB,CAAC,GAAG,CAAC;gBACjC,iBAAiB,GAAG,CAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,KAAK,CAAC,CAAC,EAAE,IAAI,CACrD,iBAAiB,GACjB,QAAQ,CAAC,GAAG,CAAC;oBACd,CAAC,CAAC,CAAC;oBACH,CAAC,CAAC,CAAC,CAAC;gBACN,MAAM;YACR,KAAK,0BAAU,CAAC,UAAU;gBACxB,SAAS,GAAG,mCAAmB,CAAC,KAAK,CAAC;gBACtC,MAAM;SACT;QACD,MAAM,cAAc,GAAG;YACrB,GAAG,WAAW;YACd,IAAI;YACJ,SAAS;YACT,cAAc;YACd,iBAAiB;SAClB,CAAC;QACF,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EACD,CAAC,WAAW,EAAE,QAAQ,CAAC,CACxB,CAAC;IAEF,MAAM,UAAU,GAAG,IAAA,+BAAe,EAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CACxB,uCAAkB,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAC3D,CAAC;IAEF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,sBAAsB,IAAG,KAAK,CAAC,OAAO,CAAQ;QAC/D,oBAAC,kBAAkB,mBACL,sBAAsB,EAClC,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,sBAAsB,GAChC,CACD,CACJ,CAAC;AACJ,CAAC;AAzDD,4CAyDC","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 type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport type { FormatProps } from \"@itwin/core-quantity\";\nimport {\n DecimalPrecision,\n FormatType,\n formatTypeToString,\n FractionalPrecision,\n parseFormatType,\n ScientificType,\n scientificTypeToString,\n} from \"@itwin/core-quantity\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } from \"@itwin/itwinui-react\";\n\n/** Properties of [[FormatTypeSelector]] component.\n * @alpha\n */\ninterface FormatTypeSelectorProps extends CommonProps {\n type: FormatType;\n onChange: (value: FormatType) => void;\n}\n\n/** Component to select the format type.\n * @alpha\n */\nfunction FormatTypeSelector(props: FormatTypeSelectorProps) {\n const { type, onChange, ...otherProps } = props;\n const formatOptions = React.useRef<SelectOption<FormatType>[]>([\n {\n value: FormatType.Decimal,\n label: UiIModelComponents.translate(\"QuantityFormat.decimal\"),\n },\n {\n value: FormatType.Scientific,\n label: UiIModelComponents.translate(\"QuantityFormat.scientific\"),\n },\n {\n value: FormatType.Station,\n label: UiIModelComponents.translate(\"QuantityFormat.station\"),\n },\n {\n value: FormatType.Fractional,\n label: UiIModelComponents.translate(\"QuantityFormat.fractional\"),\n },\n ]);\n\n const handleOnChange = React.useCallback(\n (newValue: FormatType) => {\n onChange && onChange(newValue);\n },\n [onChange]\n );\n\n return (\n <Select\n options={formatOptions.current}\n value={type}\n onChange={handleOnChange}\n size=\"small\"\n {...otherProps}\n />\n );\n}\n\n/** Properties of [[FormatTypeOptionProps]] component.\n * @alpha\n */\nexport interface FormatTypeOptionProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n}\n\n/** Component to set the Quantity Format type.\n * @alpha\n */\nexport function FormatTypeOption(props: FormatTypeOptionProps) {\n const { formatProps, onChange } = props;\n const handleFormatTypeChange = React.useCallback(\n (newType: FormatType) => {\n const type = formatTypeToString(newType);\n let precision: number | undefined;\n let stationOffsetSize: number | undefined;\n let scientificType: string | undefined;\n switch (\n newType // type must be decimal, fractional, scientific, or station\n ) {\n case FormatType.Scientific:\n precision = DecimalPrecision.Six;\n scientificType = scientificTypeToString(ScientificType.Normalized);\n break;\n case FormatType.Decimal:\n precision = DecimalPrecision.Four;\n break;\n case FormatType.Station:\n precision = DecimalPrecision.Two;\n stationOffsetSize = formatProps.composite?.units[0].name\n .toLocaleLowerCase()\n .endsWith(\"m\")\n ? 3\n : 2;\n break;\n case FormatType.Fractional:\n precision = FractionalPrecision.Eight;\n break;\n }\n const newFormatProps = {\n ...formatProps,\n type,\n precision,\n scientificType,\n stationOffsetSize,\n };\n onChange && onChange(newFormatProps);\n },\n [formatProps, onChange]\n );\n\n const formatType = parseFormatType(formatProps.type, \"format\");\n const label = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.type\")\n );\n\n return (\n <>\n <span className={\"uicore-label.current\"}>{label.current}</span>\n <FormatTypeSelector\n data-testid=\"format-type-selector\"\n type={formatType}\n onChange={handleFormatTypeChange}\n />\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatUnitLabel.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatUnitLabel.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"FormatUnitLabel.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatUnitLabel.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAmDxD;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,WAAW;IACvD,WAAW,EAAE,WAAW,CAAC;IACzB,iBAAiB,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CACnD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAgG1D"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
/** @packageDocumentation
|
|
7
7
|
* @module QuantityFormat
|
|
8
8
|
*/
|
|
@@ -52,7 +52,8 @@ function UomSeparatorSelector(props) {
|
|
|
52
52
|
const separatorOptions = React.useMemo(() => {
|
|
53
53
|
const completeListOfEntries = [];
|
|
54
54
|
// istanbul ignore next (only used if format already has a character that does not match standard options)
|
|
55
|
-
if (undefined ===
|
|
55
|
+
if (undefined ===
|
|
56
|
+
uomDefaultEntries.current.find((option) => option.value === separator)) {
|
|
56
57
|
completeListOfEntries.push({ value: separator, label: separator });
|
|
57
58
|
}
|
|
58
59
|
completeListOfEntries.push(...uomDefaultEntries.current);
|
|
@@ -75,21 +76,27 @@ function FormatUnitLabel(props) {
|
|
|
75
76
|
const setFormatTrait = React.useCallback((trait, setActive) => {
|
|
76
77
|
const traitStr = (0, core_quantity_1.getTraitString)(trait);
|
|
77
78
|
let formatTraits = [traitStr];
|
|
78
|
-
if (setActive) {
|
|
79
|
+
if (setActive) {
|
|
80
|
+
// setting trait
|
|
79
81
|
// istanbul ignore else
|
|
80
82
|
if (formatProps.formatTraits) {
|
|
81
|
-
const traits = Array.isArray(formatProps.formatTraits)
|
|
83
|
+
const traits = Array.isArray(formatProps.formatTraits)
|
|
84
|
+
? formatProps.formatTraits
|
|
85
|
+
: /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
|
|
82
86
|
// istanbul ignore else
|
|
83
87
|
if (!traits.find((traitEntry) => traitStr === traitEntry)) {
|
|
84
88
|
formatTraits = [...traits, traitStr];
|
|
85
89
|
}
|
|
86
90
|
}
|
|
87
91
|
}
|
|
88
|
-
else {
|
|
92
|
+
else {
|
|
93
|
+
// clearing trait
|
|
89
94
|
// istanbul ignore next
|
|
90
95
|
if (!formatProps.formatTraits)
|
|
91
96
|
return;
|
|
92
|
-
const traits = Array.isArray(formatProps.formatTraits)
|
|
97
|
+
const traits = Array.isArray(formatProps.formatTraits)
|
|
98
|
+
? formatProps.formatTraits
|
|
99
|
+
: /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
|
|
93
100
|
formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);
|
|
94
101
|
}
|
|
95
102
|
const newFormatProps = { ...formatProps, formatTraits };
|