@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StationSizeSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSizeSelector.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"StationSizeSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/StationSizeSelector.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAW9C;;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;YACE,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC;SACvE;QACD;YACE,KAAK,EAAE,CAAC;YACR,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,mCAAmC,CAAC;SACzE;KACF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CACtC,CAAC,QAAgB,EAAE,EAAE;QACnB,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,OAAO,CACL,oBAAC,MAAM,IACL,OAAO,EAAE,gBAAgB,CAAC,OAAO,EACjC,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAC,OAAO,KACR,UAAU,GACd,CACH,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 type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } 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 {\n value: 2,\n label: UiIModelComponents.translate(\"QuantityFormat.station_size.two\"),\n },\n {\n value: 3,\n label: UiIModelComponents.translate(\"QuantityFormat.station_size.three\"),\n },\n ]);\n\n const handleOnChange = React.useCallback(\n (newValue: number) => {\n onChange && onChange(newValue);\n },\n [onChange]\n );\n\n return (\n <Select\n options={separatorOptions.current}\n disabled={disabled}\n value={value}\n onChange={handleOnChange}\n size=\"small\"\n {...otherProps}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThousandsSelector.d.ts","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSelector.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKrD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"ThousandsSelector.d.ts","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSelector.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKrD;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,eA+C9D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
5
|
/** @packageDocumentation
|
|
6
6
|
* @module QuantityFormat
|
|
7
7
|
*/
|
|
@@ -14,8 +14,14 @@ import { Select } from "@itwin/itwinui-react";
|
|
|
14
14
|
export function ThousandsSelector(props) {
|
|
15
15
|
const { separator, disabled, onChange, ...otherProps } = props;
|
|
16
16
|
const uomDefaultEntries = React.useRef([
|
|
17
|
-
{
|
|
18
|
-
|
|
17
|
+
{
|
|
18
|
+
value: ",",
|
|
19
|
+
label: UiIModelComponents.translate("QuantityFormat.thousand_separator.comma"),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
value: ".",
|
|
23
|
+
label: UiIModelComponents.translate("QuantityFormat.thousand_separator.point"),
|
|
24
|
+
},
|
|
19
25
|
]);
|
|
20
26
|
const handleOnChange = React.useCallback((newValue) => {
|
|
21
27
|
onChange && onChange(newValue);
|
|
@@ -23,7 +29,8 @@ export function ThousandsSelector(props) {
|
|
|
23
29
|
const separatorOptions = React.useMemo(() => {
|
|
24
30
|
const completeListOfEntries = [];
|
|
25
31
|
// istanbul ignore next (only used if format already has a character that does not match standard options)
|
|
26
|
-
if (undefined ===
|
|
32
|
+
if (undefined ===
|
|
33
|
+
uomDefaultEntries.current.find((option) => option.value === separator)) {
|
|
27
34
|
completeListOfEntries.push({ value: separator, label: separator });
|
|
28
35
|
}
|
|
29
36
|
completeListOfEntries.push(...uomDefaultEntries.current);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThousandsSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSelector.tsx"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"ThousandsSelector.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSelector.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAW9C;;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;YACE,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,kBAAkB,CAAC,SAAS,CACjC,yCAAyC,CAC1C;SACF;QACD;YACE,KAAK,EAAE,GAAG;YACV,KAAK,EAAE,kBAAkB,CAAC,SAAS,CACjC,yCAAyC,CAC1C;SACF;KACF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CACtC,CAAC,QAAgB,EAAE,EAAE;QACnB,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAAC;IAEF,MAAM,gBAAgB,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE;QAC1C,MAAM,qBAAqB,GAA2B,EAAE,CAAC;QACzD,0GAA0G;QAC1G,IACE,SAAS;YACT,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,SAAS,CAAC,EACtE;YACA,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,IACL,OAAO,EAAE,gBAAgB,EACzB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,cAAc,EACxB,IAAI,EAAC,OAAO,KACR,UAAU,GACd,CACH,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 type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } 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 {\n value: \",\",\n label: UiIModelComponents.translate(\n \"QuantityFormat.thousand_separator.comma\"\n ),\n },\n {\n value: \".\",\n label: UiIModelComponents.translate(\n \"QuantityFormat.thousand_separator.point\"\n ),\n },\n ]);\n\n const handleOnChange = React.useCallback(\n (newValue: string) => {\n onChange && onChange(newValue);\n },\n [onChange]\n );\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 (\n undefined ===\n uomDefaultEntries.current.find((option) => option.value === separator)\n ) {\n completeListOfEntries.push({ value: separator, label: separator });\n }\n completeListOfEntries.push(...uomDefaultEntries.current);\n return completeListOfEntries;\n }, [separator]);\n\n return (\n <Select\n options={separatorOptions}\n disabled={disabled}\n value={separator}\n onChange={handleOnChange}\n size=\"small\"\n {...otherProps}\n />\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThousandsSeparator.d.ts","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSeparator.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"ThousandsSeparator.d.ts","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSeparator.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAMxD;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IAC1D,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,eAgHhE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
5
|
/** @packageDocumentation
|
|
6
6
|
* @module QuantityFormat
|
|
7
7
|
*/
|
|
@@ -23,17 +23,23 @@ export function ThousandsSeparator(props) {
|
|
|
23
23
|
const setFormatTrait = React.useCallback((trait, setActive) => {
|
|
24
24
|
const traitStr = getTraitString(trait);
|
|
25
25
|
let formatTraits = [traitStr];
|
|
26
|
-
if (setActive) {
|
|
26
|
+
if (setActive) {
|
|
27
|
+
// setting trait
|
|
27
28
|
// istanbul ignore else
|
|
28
29
|
if (formatProps.formatTraits) {
|
|
29
|
-
const traits = Array.isArray(formatProps.formatTraits)
|
|
30
|
+
const traits = Array.isArray(formatProps.formatTraits)
|
|
31
|
+
? formatProps.formatTraits
|
|
32
|
+
: /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
|
|
30
33
|
formatTraits = [...traits, traitStr];
|
|
31
34
|
}
|
|
32
35
|
}
|
|
33
|
-
else {
|
|
36
|
+
else {
|
|
37
|
+
// clearing trait
|
|
34
38
|
// istanbul ignore else
|
|
35
39
|
if (formatProps.formatTraits) {
|
|
36
|
-
const traits = Array.isArray(formatProps.formatTraits)
|
|
40
|
+
const traits = Array.isArray(formatProps.formatTraits)
|
|
41
|
+
? formatProps.formatTraits
|
|
42
|
+
: /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
|
|
37
43
|
formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);
|
|
38
44
|
}
|
|
39
45
|
}
|
|
@@ -53,10 +59,15 @@ export function ThousandsSeparator(props) {
|
|
|
53
59
|
if (isFormatTraitSet(FormatTraits.Use1000Separator)) {
|
|
54
60
|
if (thousandSeparator === ".")
|
|
55
61
|
decimalSeparator = ",";
|
|
56
|
-
|
|
62
|
+
// thousandSeparator === ","
|
|
63
|
+
else
|
|
57
64
|
decimalSeparator = ".";
|
|
58
65
|
}
|
|
59
|
-
const newFormatProps = {
|
|
66
|
+
const newFormatProps = {
|
|
67
|
+
...formatProps,
|
|
68
|
+
thousandSeparator,
|
|
69
|
+
decimalSeparator,
|
|
70
|
+
};
|
|
60
71
|
handleSetFormatProps(newFormatProps);
|
|
61
72
|
}, [formatProps, isFormatTraitSet, handleSetFormatProps]);
|
|
62
73
|
const useThousandSeparatorLabel = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.useThousandSeparatorLabel"));
|
|
@@ -64,7 +75,7 @@ export function ThousandsSeparator(props) {
|
|
|
64
75
|
return (React.createElement(React.Fragment, null,
|
|
65
76
|
React.createElement("span", { className: "uicore-label" }, useThousandSeparatorLabel.current),
|
|
66
77
|
React.createElement(Checkbox, { "data-testid": "use-thousands-separator", checked: isFormatTraitSet(FormatTraits.Use1000Separator), onChange: handleUseThousandsSeparatorChange }),
|
|
67
|
-
React.createElement("span", { className: classnames("uicore-label", !
|
|
78
|
+
React.createElement("span", { className: classnames("uicore-label", !isFormatTraitSet(FormatTraits.Use1000Separator) && "uicore-disabled") }, thousandSeparatorLabel.current),
|
|
68
79
|
React.createElement(ThousandsSelector, { "data-testid": "thousands-separator-selector", separator: (_a = formatProps.thousandSeparator) !== null && _a !== void 0 ? _a : ",", disabled: !isFormatTraitSet(FormatTraits.Use1000Separator), onChange: handleThousandSeparatorChange })));
|
|
69
80
|
}
|
|
70
81
|
//# 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
|
|
1
|
+
{"version":3,"file":"ThousandsSeparator.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/ThousandsSeparator.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MA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AAC;QACF,oBAAoB,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EACD,CAAC,WAAW,EAAE,gBAAgB,EAAE,oBAAoB,CAAC,CACtD,CAAC;IAEF,MAAM,yBAAyB,GAAG,KAAK,CAAC,MAAM,CAC5C,kBAAkB,CAAC,SAAS,CAC1B,iDAAiD,CAClD,CACF,CAAC;IACF,MAAM,sBAAsB,GAAG,KAAK,CAAC,MAAM,CACzC,kBAAkB,CAAC,SAAS,CAAC,8CAA8C,CAAC,CAC7E,CAAC;IAEF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,cAAc,IAC5B,yBAAyB,CAAC,OAAO,CAC7B;QACP,oBAAC,QAAQ,mBACK,yBAAyB,EACrC,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,gBAAgB,CAAC,EACxD,QAAQ,EAAE,iCAAiC,GAC3C;QACF,8BACE,SAAS,EAAE,UAAU,CACnB,cAAc,EACd,CAAC,gBAAgB,CAAC,YAAY,CAAC,gBAAgB,CAAC,IAAI,iBAAiB,CACtE,IAEA,sBAAsB,CAAC,OAAO,CAC1B;QACP,oBAAC,iBAAiB,mBACJ,8BAA8B,EAC1C,SAAS,EAAE,MAAA,WAAW,CAAC,iBAAiB,mCAAI,GAAG,EAC/C,QAAQ,EAAE,CAAC,gBAAgB,CAAC,YAAY,CAAC,gBAAgB,CAAC,EAC1D,QAAQ,EAAE,6BAA6B,GACvC,CACD,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 type { CommonProps } from \"@itwin/core-react\";\nimport type { FormatProps } from \"@itwin/core-quantity\";\nimport { Format, FormatTraits, getTraitString } from \"@itwin/core-quantity\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { ThousandsSelector } from \"./ThousandsSelector\";\nimport { UiIModelComponents } from \"../../UiIModelComponents\";\n\n/** Properties of [[ThousandsSeparator]] component.\n * @internal\n */\nexport interface ThousandsSeparatorProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n}\n\n/** Component use to set Quantity Format thousand group separator.\n * @internal\n */\nexport function ThousandsSeparator(props: ThousandsSeparatorProps) {\n const { formatProps, onChange } = props;\n\n const handleSetFormatProps = React.useCallback(\n (newProps: FormatProps) => {\n onChange && onChange(newProps);\n },\n [onChange]\n );\n\n const setFormatTrait = React.useCallback(\n (trait: FormatTraits, setActive: boolean) => {\n const traitStr = getTraitString(trait);\n let formatTraits: string[] = [traitStr];\n if (setActive) {\n // setting trait\n // istanbul ignore else\n if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : /* istanbul ignore next */ formatProps.formatTraits.split(\n /,|;|\\|/\n );\n formatTraits = [...traits, traitStr];\n }\n } else {\n // clearing trait\n // istanbul ignore else\n if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : /* istanbul ignore next */ formatProps.formatTraits.split(\n /,|;|\\|/\n );\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\n }\n }\n const newFormatProps = { ...formatProps, formatTraits };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n const handleUseThousandsSeparatorChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.Use1000Separator, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const isFormatTraitSet = React.useCallback(\n (trait: FormatTraits) => {\n return Format.isFormatTraitSetInProps(formatProps, trait);\n },\n [formatProps]\n );\n\n const handleThousandSeparatorChange = React.useCallback(\n (thousandSeparator: string) => {\n let decimalSeparator = formatProps.decimalSeparator;\n // make sure 1000 and decimal separator do not match\n // istanbul ignore else\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\n if (thousandSeparator === \".\") decimalSeparator = \",\";\n // thousandSeparator === \",\"\n else decimalSeparator = \".\";\n }\n const newFormatProps = {\n ...formatProps,\n thousandSeparator,\n decimalSeparator,\n };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, isFormatTraitSet, handleSetFormatProps]\n );\n\n const useThousandSeparatorLabel = React.useRef(\n UiIModelComponents.translate(\n \"QuantityFormat.labels.useThousandSeparatorLabel\"\n )\n );\n const thousandSeparatorLabel = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.thousandSeparatorLabel\")\n );\n\n return (\n <>\n <span className={\"uicore-label\"}>\n {useThousandSeparatorLabel.current}\n </span>\n <Checkbox\n data-testid=\"use-thousands-separator\"\n checked={isFormatTraitSet(FormatTraits.Use1000Separator)}\n onChange={handleUseThousandsSeparatorChange}\n />\n <span\n className={classnames(\n \"uicore-label\",\n !isFormatTraitSet(FormatTraits.Use1000Separator) && \"uicore-disabled\"\n )}\n >\n {thousandSeparatorLabel.current}\n </span>\n <ThousandsSelector\n data-testid=\"thousands-separator-selector\"\n separator={formatProps.thousandSeparator ?? \",\"}\n disabled={!isFormatTraitSet(FormatTraits.Use1000Separator)}\n onChange={handleThousandSeparatorChange}\n />\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnitDescr.d.ts","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/UnitDescr.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;
|
|
1
|
+
{"version":3,"file":"UnitDescr.d.ts","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/UnitDescr.tsx"],"names":[],"mappings":"AAIA;;GAEG;;AAGH,OAAO,KAAK,EAAa,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIrD;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvD;AAgDD;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,eAuH9C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
5
|
/** @packageDocumentation
|
|
6
6
|
* @module QuantityFormat
|
|
7
7
|
*/
|
|
@@ -22,7 +22,9 @@ async function getPossibleUnits(parentUnit, unitsProvider, ensureCompatibleCompo
|
|
|
22
22
|
const conversionPromises = await getUnitConversionData(possibleUnits, parentUnit, unitsProvider);
|
|
23
23
|
const conversionEntries = await Promise.all(conversionPromises);
|
|
24
24
|
// sort the entries so the best potential sub unit will be the first one in the array
|
|
25
|
-
return conversionEntries
|
|
25
|
+
return conversionEntries
|
|
26
|
+
.filter((entry) => entry.unitProps.system === parentUnit.system &&
|
|
27
|
+
entry.conversion.factor < 1)
|
|
26
28
|
.sort((a, b) => b.conversion.factor - a.conversion.factor)
|
|
27
29
|
.map((value) => value.unitProps);
|
|
28
30
|
}
|
|
@@ -38,8 +40,10 @@ function getUnitName(fullUnitName) {
|
|
|
38
40
|
* @internal
|
|
39
41
|
*/
|
|
40
42
|
export function UnitDescr(props) {
|
|
41
|
-
const { name, label, parentUnitName, index, onUnitChange, onLabelChange, readonly, unitsProvider } = props;
|
|
42
|
-
const [unitOptions, setUnitOptions] = React.useState([
|
|
43
|
+
const { name, label, parentUnitName, index, onUnitChange, onLabelChange, readonly, unitsProvider, } = props;
|
|
44
|
+
const [unitOptions, setUnitOptions] = React.useState([
|
|
45
|
+
{ value: name, label: getUnitName(name) },
|
|
46
|
+
]);
|
|
43
47
|
const [currentUnit, setCurrentUnit] = React.useState({ name, label });
|
|
44
48
|
const isMounted = React.useRef(false);
|
|
45
49
|
React.useEffect(() => {
|
|
@@ -62,15 +66,28 @@ export function UnitDescr(props) {
|
|
|
62
66
|
if (potentialSubUnits.length)
|
|
63
67
|
potentialSubUnit = potentialSubUnits[0];
|
|
64
68
|
}
|
|
65
|
-
const options =
|
|
66
|
-
potentialUnits
|
|
67
|
-
|
|
68
|
-
|
|
69
|
+
const options = potentialUnits.length > 0
|
|
70
|
+
? potentialUnits
|
|
71
|
+
.map((unitValue) => {
|
|
72
|
+
return {
|
|
73
|
+
value: `${unitValue.name}:${unitValue.label}`,
|
|
74
|
+
label: getUnitName(unitValue.name),
|
|
75
|
+
};
|
|
76
|
+
})
|
|
77
|
+
.sort((a, b) => a.label.localeCompare(b.label))
|
|
69
78
|
: /* istanbul ignore next */
|
|
70
|
-
[
|
|
79
|
+
[
|
|
80
|
+
{
|
|
81
|
+
value: `${currentUnitProps.name}:${currentUnitProps.label}`,
|
|
82
|
+
label: getUnitName(name),
|
|
83
|
+
},
|
|
84
|
+
];
|
|
71
85
|
if (potentialSubUnit) {
|
|
72
86
|
// construct an entry that will provide the name and label of the unit to add
|
|
73
|
-
options.push({
|
|
87
|
+
options.push({
|
|
88
|
+
value: `ADDSUBUNIT:${potentialSubUnit.name}:${potentialSubUnit.label}`,
|
|
89
|
+
label: "Add sub-unit",
|
|
90
|
+
}); // NEEDSWORK - i18n
|
|
74
91
|
}
|
|
75
92
|
if (index !== 0)
|
|
76
93
|
options.push({ value: "REMOVEUNIT", label: "Remove" }); // NEEDSWORK - i18n
|
|
@@ -81,7 +98,7 @@ export function UnitDescr(props) {
|
|
|
81
98
|
}
|
|
82
99
|
}
|
|
83
100
|
}
|
|
84
|
-
fetchAllowableUnitSelections();
|
|
101
|
+
void fetchAllowableUnitSelections();
|
|
85
102
|
}, [index, label, name, parentUnitName, unitsProvider]);
|
|
86
103
|
const handleOnUnitChange = React.useCallback((newValue) => {
|
|
87
104
|
onUnitChange && onUnitChange(newValue, index);
|
|
@@ -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;AAI/B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,C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BAAc,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 type { UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport type { CommonProps } from \"@itwin/core-react\";\r\nimport type { SelectOption } from \"@itwin/itwinui-react\";\r\nimport { Input, Select } 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
|
+
{"version":3,"file":"UnitDescr.js","sourceRoot":"","sources":["../../../../../src/imodel-components-react/quantityformat/misc/UnitDescr.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAgBrD,KAAK,UAAU,qBAAqB,CAClC,aAA0B,EAC1B,MAAiB,EACjB,aAA4B;IAE5B,MAAM,qBAAqB,GAAG,aAAa,CAAC,GAAG,CAAC,KAAK,EAAE,IAAI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BAE5F,uBAAuB;gBACvB,IAAI,SAAS,CAAC,OAAO,EAAE;oBACrB,cAAc,CAAC,OAAO,CAAC,CAAC;oBACxB,cAAc,CAAC,gBAAgB,CAAC,CAAC;iBAClC;aACF;QACH,CAAC;QACD,KAAK,4BAA4B,EAAE,CAAC;IACtC,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC,CAAC;IAExD,MAAM,kBAAkB,GAAG,KAAK,CAAC,WAAW,CAC1C,CAAC,QAAgB,EAAE,EAAE;QACnB,YAAY,IAAI,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IAChD,CAAC,EACD,CAAC,KAAK,EAAE,YAAY,CAAC,CACtB,CAAC;IAEF,MAAM,mBAAmB,GAAG,KAAK,CAAC,WAAW,CAC3C,CAAC,CAAsC,EAAE,EAAE;QACzC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,aAAa,IAAI,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC,EACD,CAAC,KAAK,EAAE,aAAa,CAAC,CACvB,CAAC;IAEF,OAAO,CACL;QACE,oBAAC,MAAM,IACL,OAAO,EAAE,WAAW,iBACP,QAAQ,WAAW,CAAC,IAAI,EAAE,EACvC,KAAK,EAAE,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,KAAK,EAAE,EACjD,QAAQ,EAAE,kBAAkB,EAC5B,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAC,OAAO,GACZ;QACF,oBAAC,KAAK,mBACS,cAAc,WAAW,CAAC,IAAI,EAAE,EAC7C,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,mBAAmB,EAC7B,IAAI,EAAC,OAAO,GACZ,CACD,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 type { UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Input, Select } 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(\n possibleUnits: UnitProps[],\n toUnit: UnitProps,\n unitsProvider: UnitsProvider\n) {\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(\n parentUnit: UnitProps,\n unitsProvider: UnitsProvider,\n ensureCompatibleComposite: boolean\n) {\n const phenomenon = parentUnit.phenomenon;\n const possibleUnits = await unitsProvider.getUnitsByFamily(phenomenon);\n if (!ensureCompatibleComposite) return possibleUnits;\n\n const conversionPromises = await getUnitConversionData(\n possibleUnits,\n parentUnit,\n unitsProvider\n );\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\n .filter(\n (entry) =>\n entry.unitProps.system === parentUnit.system &&\n entry.conversion.factor < 1\n )\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) 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 {\n name,\n label,\n parentUnitName,\n index,\n onUnitChange,\n onLabelChange,\n readonly,\n unitsProvider,\n } = props;\n const [unitOptions, setUnitOptions] = React.useState<SelectOption<string>[]>([\n { value: name, label: getUnitName(name) },\n ]);\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(\n parentUnitName ? parentUnitName : name\n );\n // istanbul ignore else\n if (parentUnit && currentUnitProps) {\n let potentialSubUnit: UnitProps | undefined;\n const potentialUnits = await getPossibleUnits(\n parentUnit,\n unitsProvider,\n index !== 0\n );\n // istanbul ignore else\n if (index < 3) {\n const potentialSubUnits = await getPossibleUnits(\n currentUnitProps,\n unitsProvider,\n true\n );\n if (potentialSubUnits.length) potentialSubUnit = potentialSubUnits[0];\n }\n\n const options =\n potentialUnits.length > 0\n ? potentialUnits\n .map((unitValue) => {\n return {\n value: `${unitValue.name}:${unitValue.label}`,\n label: getUnitName(unitValue.name),\n };\n })\n .sort((a, b) => a.label.localeCompare(b.label))\n : /* istanbul ignore next */\n [\n {\n value: `${currentUnitProps.name}:${currentUnitProps.label}`,\n label: getUnitName(name),\n },\n ];\n\n if (potentialSubUnit) {\n // construct an entry that will provide the name and label of the unit to add\n options.push({\n value: `ADDSUBUNIT:${potentialSubUnit.name}:${potentialSubUnit.label}`,\n label: \"Add sub-unit\",\n }); // NEEDSWORK - i18n\n }\n\n if (index !== 0) 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 void fetchAllowableUnitSelections();\n }, [index, label, name, parentUnitName, unitsProvider]);\n\n const handleOnUnitChange = React.useCallback(\n (newValue: string) => {\n onUnitChange && onUnitChange(newValue, index);\n },\n [index, onUnitChange]\n );\n\n const handleOnLabelChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n e.preventDefault();\n onLabelChange && onLabelChange(e.target.value, index);\n },\n [index, onLabelChange]\n );\n\n return (\n <>\n <Select\n options={unitOptions}\n data-testid={`unit-${currentUnit.name}`}\n value={`${currentUnit.name}:${currentUnit.label}`}\n onChange={handleOnUnitChange}\n disabled={readonly}\n size=\"small\"\n />\n <Input\n data-testid={`unit-label-${currentUnit.name}`}\n value={label}\n onChange={handleOnLabelChange}\n size=\"small\"\n />\n </>\n );\n}\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,
|
|
1
|
+
{"version":3,"file":"BaseSolarDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseSolarDataProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAEL,YAAY,EAEZ,QAAQ,EACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQtD;;GAEG;AACH,qBAAa,qBAAsB,YAAW,iBAAiB;IAC7D,SAAS,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACzC,SAAS,CAAC,SAAS,EAAE,cAAc,GAAG,SAAS,CAAC;IAChD,SAAS,CAAC,mBAAmB,EAAE,YAAY,CAAC;IAC5C,SAAS,CAAC,YAAY,WAAqC;IAEpD,SAAS,EAAE,MAAM,CAAa;IAC9B,QAAQ,EAAE,MAAM,CAAa;IAC7B,MAAM,SAAM;IACZ,yBAA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,UAAW,IAAI,UAEjC;CACH"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Timeline
|
|
7
7
|
*/
|
|
8
8
|
import { Point3d } from "@itwin/core-geometry";
|
|
9
|
-
import { calculateSunriseOrSunset, Cartographic, ColorByName, ColorDef } from "@itwin/core-common";
|
|
9
|
+
import { calculateSunriseOrSunset, Cartographic, ColorByName, ColorDef, } from "@itwin/core-common";
|
|
10
10
|
const millisecPerMinute = 1000 * 60;
|
|
11
11
|
const millisecPerHour = millisecPerMinute * 60;
|
|
12
12
|
// the interface and class are in alpha state - it may change after usability testing - test coverage not complete
|
|
@@ -63,7 +63,11 @@ export class BaseSolarDataProvider {
|
|
|
63
63
|
if (viewport)
|
|
64
64
|
this.viewId = viewport.view.id;
|
|
65
65
|
// project location
|
|
66
|
-
this._cartographicCenter = Cartographic.fromDegrees({
|
|
66
|
+
this._cartographicCenter = Cartographic.fromDegrees({
|
|
67
|
+
longitude: this.longitude,
|
|
68
|
+
latitude: this.latitude,
|
|
69
|
+
height: 0.0,
|
|
70
|
+
});
|
|
67
71
|
this._projectTimeZoneOffset = this.getZone(this._cartographicCenter);
|
|
68
72
|
this.initializeData(this._projectTimeZoneOffset);
|
|
69
73
|
}
|
|
@@ -105,10 +109,14 @@ export class BaseSolarDataProvider {
|
|
|
105
109
|
getCartographicCenter(iModel) {
|
|
106
110
|
if (iModel.isGeoLocated) {
|
|
107
111
|
const projectExtents = iModel.projectExtents;
|
|
108
|
-
const projectCenter = Point3d.createAdd2Scaled(projectExtents.low, .5, projectExtents.high, .5);
|
|
112
|
+
const projectCenter = Point3d.createAdd2Scaled(projectExtents.low, 0.5, projectExtents.high, 0.5);
|
|
109
113
|
return iModel.spatialToCartographicFromEcef(projectCenter);
|
|
110
114
|
}
|
|
111
|
-
return Cartographic.fromDegrees({
|
|
115
|
+
return Cartographic.fromDegrees({
|
|
116
|
+
longitude: this.longitude,
|
|
117
|
+
latitude: this.latitude,
|
|
118
|
+
height: 0.0,
|
|
119
|
+
});
|
|
112
120
|
}
|
|
113
121
|
set viewport(viewport) {
|
|
114
122
|
this._viewport = viewport;
|
|
@@ -121,7 +129,7 @@ export class BaseSolarDataProvider {
|
|
|
121
129
|
return this._viewport;
|
|
122
130
|
}
|
|
123
131
|
getZone(location) {
|
|
124
|
-
return Math.floor(.5 + location.longitudeDegrees / 15.0);
|
|
132
|
+
return Math.floor(0.5 + location.longitudeDegrees / 15.0);
|
|
125
133
|
}
|
|
126
134
|
get sunrise() {
|
|
127
135
|
return this._projectSunrise;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSolarDataProvider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseSolarDataProvider.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAInG,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAE,CAAC;AACpC,MAAM,eAAe,GAAG,iBAAiB,GAAG,EAAE,CAAC;AAE/C,kHAAkH;AAClH,0BAA0B;AAE1B;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAqBhC,+CAA+C;IACrC,cAAc,CAAC,qBAA6B,EAAE,WAAkB;QACxE,IAAI,CAAC,WAAW;YACd,WAAW,GAAG,IAAI,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AY,EAAE;YACvB,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,CAAC;YAC7C,MAAM,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,cAAc,CAAC,GAAG,EAAE,EAAE,EAAE,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAChG,OAAO,MAAM,CAAC,6BAA6B,CAAC,aAAa,CAAC,CAAC;SAC5D;QACD,OAAO,YAAY,CAAC,WAAW,CAAC,EAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC,CAAC;IACrG,CAAC;IAED,IAAW,QAAQ,CAAC,QAAoC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,QAAQ;YACV,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;;YAE/B,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACrB,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAES,OAAO,CAAC,QAAsB;QACtC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,GAAG,QAAQ,CAAC,gBAAgB,GAAG,IAAI,CAAC,CAAC;IAC3D,CAAC;IAED,IAAW,OAAO;QAChB,OAAO,IAAI,CAAC,eAAe,CAAC;IAC9B,CAAC;IAED,IAAW,SAAS;QAClB,OAAO,IAAI,CAAC,iBAAiB,CAAC;IAChC,CAAC;IAED,IAAW,MAAM;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CAKF","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 Timeline\r\n */\r\n\r\nimport { Point3d } from \"@itwin/core-geometry\";\r\nimport { calculateSunriseOrSunset, Cartographic, ColorByName, ColorDef } from \"@itwin/core-common\";\r\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\r\nimport type { SolarDataProvider } from \"./interfaces\";\r\n\r\nconst millisecPerMinute = 1000 * 60;\r\nconst millisecPerHour = millisecPerMinute * 60;\r\n\r\n// the interface and class are in alpha state - it may change after usability testing - test coverage not complete\r\n/* istanbul ignore file */\r\n\r\n/** Base class that provides solar data for animation control\r\n * @alpha\r\n */\r\nexport class BaseSolarDataProvider implements SolarDataProvider {\r\n protected _projectTimeZoneOffset: number; // used to convert between project time and local time\r\n protected _viewport: ScreenViewport | undefined;\r\n protected _cartographicCenter: Cartographic;\r\n protected _shadowColor = ColorDef.create(ColorByName.gray);\r\n\r\n public longitude: number = -75.17035; // long/lat of Philadelphia\r\n public latitude: number = 39.954927;\r\n public viewId = \"\"; // View Id used to determine sunrise and sunset\r\n public supportsTimelineAnimation = false; // set to true when provider determines animation data is available.\r\n public animationFraction: number = 0; // value from 0.0 to 1.0 that specifies the percentage complete for the animation.\r\n\r\n private _projectDayStartMS = 0;\r\n private _projectSunriseMs = 0;\r\n private _projectSunsetMs = 0;\r\n private _zoneOffsetMs = 0;\r\n private _projectSunrise = new Date();\r\n private _projectSunset = new Date();\r\n private _projectDateTime = new Date();\r\n private _projectDay = new Date();\r\n\r\n // projectTimeZoneOffset = zone offset in hours\r\n protected initializeData(projectTimeZoneOffset: number, initialTime?: Date) {\r\n if (!initialTime)\r\n initialTime = new Date(Date.now()); // users local time\r\n\r\n this._zoneOffsetMs = projectTimeZoneOffset * millisecPerHour;\r\n const year=initialTime.getFullYear();\r\n const month=initialTime.getMonth();\r\n const date=initialTime.getDate();\r\n const hours=initialTime.getHours();\r\n const minutes=initialTime.getMinutes();\r\n const initialUtcMs = Date.UTC(year, month, date, hours, minutes, 0, 0);\r\n const initialProjectMs = initialUtcMs - this._zoneOffsetMs;\r\n this._projectDateTime = new Date (initialProjectMs);\r\n\r\n const utcDayMs = Date.UTC(year, month, date, 0, 0, 0, 0);\r\n const utcDay = new Date(utcDayMs);\r\n this._projectDayStartMS = utcDayMs - this._zoneOffsetMs;\r\n this._projectDay = new Date (this._projectDayStartMS);\r\n this._projectSunrise = calculateSunriseOrSunset(utcDay, this._cartographicCenter, true);\r\n this._projectSunset = calculateSunriseOrSunset(utcDay, this._cartographicCenter, false);\r\n this._projectSunriseMs = this._projectSunrise.getTime();\r\n this._projectSunsetMs = this._projectSunset.getTime();\r\n }\r\n\r\n constructor(viewport?: ScreenViewport, longitude?: number, latitude?: number) {\r\n this._viewport = viewport;\r\n if (longitude)\r\n this.longitude = longitude;\r\n if (latitude)\r\n this.latitude = latitude;\r\n\r\n if (viewport)\r\n this.viewId = viewport.view.id;\r\n\r\n // project location\r\n this._cartographicCenter = Cartographic.fromDegrees({longitude: this.longitude, latitude: this.latitude, height: 0.0});\r\n this._projectTimeZoneOffset = this.getZone(this._cartographicCenter);\r\n\r\n this.initializeData(this._projectTimeZoneOffset);\r\n }\r\n\r\n public get timeZoneOffset(): number {\r\n return this._projectTimeZoneOffset;\r\n }\r\n\r\n public get shadowColor(): ColorDef {\r\n return this._shadowColor;\r\n }\r\n\r\n public set shadowColor(color: ColorDef) {\r\n this._shadowColor = color;\r\n }\r\n\r\n public get shouldShowTimeline() {\r\n return false;\r\n }\r\n\r\n /** Get time at project location */\r\n public get timeOfDay(): Date {\r\n return this._projectDateTime;\r\n }\r\n\r\n /** The date can be in project time or if isProjectDate is false, it is assumed to be users current local time\r\n * which will be adjusted to the same time at project location. */\r\n public setDateAndTime(date: Date, isProjectDate?: boolean) {\r\n let userDay = date;\r\n\r\n // convert date from user date to project location\r\n if (isProjectDate) {\r\n const userOffset = date.getTimezoneOffset() * millisecPerMinute;\r\n userDay = new Date(date.getTime() - userOffset - this._zoneOffsetMs);\r\n }\r\n\r\n this.initializeData(this._projectTimeZoneOffset, userDay);\r\n }\r\n\r\n /** Project Day Start */\r\n public get day(): Date {\r\n return this._projectDay;\r\n }\r\n\r\n /** Project Day Start in milliseconds */\r\n public get dayStartMs(): number {\r\n return this._projectDayStartMS;\r\n }\r\n\r\n public getCartographicCenter(iModel: IModelConnection): Cartographic {\r\n if (iModel.isGeoLocated) {\r\n const projectExtents = iModel.projectExtents;\r\n const projectCenter = Point3d.createAdd2Scaled(projectExtents.low, .5, projectExtents.high, .5);\r\n return iModel.spatialToCartographicFromEcef(projectCenter);\r\n }\r\n return Cartographic.fromDegrees({longitude: this.longitude, latitude: this.latitude, height: 0.0});\r\n }\r\n\r\n public set viewport(viewport: ScreenViewport | undefined) {\r\n this._viewport = viewport;\r\n if (viewport)\r\n this.viewId = viewport.view.id;\r\n else\r\n this.viewId = \"\";\r\n }\r\n\r\n public get viewport(): ScreenViewport | undefined {\r\n return this._viewport;\r\n }\r\n\r\n protected getZone(location: Cartographic) {\r\n return Math.floor(.5 + location.longitudeDegrees / 15.0);\r\n }\r\n\r\n public get sunrise(): Date {\r\n return this._projectSunrise;\r\n }\r\n\r\n public get sunriseMs(): number {\r\n return this._projectSunriseMs;\r\n }\r\n\r\n public get sunset(): Date {\r\n return this._projectSunset;\r\n }\r\n\r\n public get sunsetMs(): number {\r\n return this._projectSunsetMs;\r\n }\r\n\r\n public onTimeChanged = (_time: Date) => {\r\n // to be implemented by derived class\r\n };\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"BaseSolarDataProvider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseSolarDataProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EACL,wBAAwB,EACxB,YAAY,EACZ,WAAW,EACX,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAI5B,MAAM,iBAAiB,GAAG,IAAI,GAAG,EA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cAAc,CAAC;IAC7B,CAAC;IAED,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;CAKF","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Timeline\n */\n\nimport { Point3d } from \"@itwin/core-geometry\";\nimport {\n calculateSunriseOrSunset,\n Cartographic,\n ColorByName,\n ColorDef,\n} from \"@itwin/core-common\";\nimport type { IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport type { SolarDataProvider } from \"./interfaces\";\n\nconst millisecPerMinute = 1000 * 60;\nconst millisecPerHour = millisecPerMinute * 60;\n\n// the interface and class are in alpha state - it may change after usability testing - test coverage not complete\n/* istanbul ignore file */\n\n/** Base class that provides solar data for animation control\n * @alpha\n */\nexport class BaseSolarDataProvider implements SolarDataProvider {\n protected _projectTimeZoneOffset: number; // used to convert between project time and local time\n protected _viewport: ScreenViewport | undefined;\n protected _cartographicCenter: Cartographic;\n protected _shadowColor = ColorDef.create(ColorByName.gray);\n\n public longitude: number = -75.17035; // long/lat of Philadelphia\n public latitude: number = 39.954927;\n public viewId = \"\"; // View Id used to determine sunrise and sunset\n public supportsTimelineAnimation = false; // set to true when provider determines animation data is available.\n public animationFraction: number = 0; // value from 0.0 to 1.0 that specifies the percentage complete for the animation.\n\n private _projectDayStartMS = 0;\n private _projectSunriseMs = 0;\n private _projectSunsetMs = 0;\n private _zoneOffsetMs = 0;\n private _projectSunrise = new Date();\n private _projectSunset = new Date();\n private _projectDateTime = new Date();\n private _projectDay = new Date();\n\n // projectTimeZoneOffset = zone offset in hours\n protected initializeData(projectTimeZoneOffset: number, initialTime?: Date) {\n if (!initialTime) initialTime = new Date(Date.now()); // users local time\n\n this._zoneOffsetMs = projectTimeZoneOffset * millisecPerHour;\n const year = initialTime.getFullYear();\n const month = initialTime.getMonth();\n const date = initialTime.getDate();\n const hours = initialTime.getHours();\n const minutes = initialTime.getMinutes();\n const initialUtcMs = Date.UTC(year, month, date, hours, minutes, 0, 0);\n const initialProjectMs = initialUtcMs - this._zoneOffsetMs;\n this._projectDateTime = new Date(initialProjectMs);\n\n const utcDayMs = Date.UTC(year, month, date, 0, 0, 0, 0);\n const utcDay = new Date(utcDayMs);\n this._projectDayStartMS = utcDayMs - this._zoneOffsetMs;\n this._projectDay = new Date(this._projectDayStartMS);\n this._projectSunrise = calculateSunriseOrSunset(\n utcDay,\n this._cartographicCenter,\n true\n );\n this._projectSunset = calculateSunriseOrSunset(\n utcDay,\n this._cartographicCenter,\n false\n );\n this._projectSunriseMs = this._projectSunrise.getTime();\n this._projectSunsetMs = this._projectSunset.getTime();\n }\n\n constructor(\n viewport?: ScreenViewport,\n longitude?: number,\n latitude?: number\n ) {\n this._viewport = viewport;\n if (longitude) this.longitude = longitude;\n if (latitude) this.latitude = latitude;\n\n if (viewport) this.viewId = viewport.view.id;\n\n // project location\n this._cartographicCenter = Cartographic.fromDegrees({\n longitude: this.longitude,\n latitude: this.latitude,\n height: 0.0,\n });\n this._projectTimeZoneOffset = this.getZone(this._cartographicCenter);\n\n this.initializeData(this._projectTimeZoneOffset);\n }\n\n public get timeZoneOffset(): number {\n return this._projectTimeZoneOffset;\n }\n\n public get shadowColor(): ColorDef {\n return this._shadowColor;\n }\n\n public set shadowColor(color: ColorDef) {\n this._shadowColor = color;\n }\n\n public get shouldShowTimeline() {\n return false;\n }\n\n /** Get time at project location */\n public get timeOfDay(): Date {\n return this._projectDateTime;\n }\n\n /** The date can be in project time or if isProjectDate is false, it is assumed to be users current local time\n * which will be adjusted to the same time at project location. */\n public setDateAndTime(date: Date, isProjectDate?: boolean) {\n let userDay = date;\n\n // convert date from user date to project location\n if (isProjectDate) {\n const userOffset = date.getTimezoneOffset() * millisecPerMinute;\n userDay = new Date(date.getTime() - userOffset - this._zoneOffsetMs);\n }\n\n this.initializeData(this._projectTimeZoneOffset, userDay);\n }\n\n /** Project Day Start */\n public get day(): Date {\n return this._projectDay;\n }\n\n /** Project Day Start in milliseconds */\n public get dayStartMs(): number {\n return this._projectDayStartMS;\n }\n\n public getCartographicCenter(iModel: IModelConnection): Cartographic {\n if (iModel.isGeoLocated) {\n const projectExtents = iModel.projectExtents;\n const projectCenter = Point3d.createAdd2Scaled(\n projectExtents.low,\n 0.5,\n projectExtents.high,\n 0.5\n );\n return iModel.spatialToCartographicFromEcef(projectCenter);\n }\n return Cartographic.fromDegrees({\n longitude: this.longitude,\n latitude: this.latitude,\n height: 0.0,\n });\n }\n\n public set viewport(viewport: ScreenViewport | undefined) {\n this._viewport = viewport;\n if (viewport) this.viewId = viewport.view.id;\n else this.viewId = \"\";\n }\n\n public get viewport(): ScreenViewport | undefined {\n return this._viewport;\n }\n\n protected getZone(location: Cartographic) {\n return Math.floor(0.5 + location.longitudeDegrees / 15.0);\n }\n\n public get sunrise(): Date {\n return this._projectSunrise;\n }\n\n public get sunriseMs(): number {\n return this._projectSunriseMs;\n }\n\n public get sunset(): Date {\n return this._projectSunset;\n }\n\n public get sunsetMs(): number {\n return this._projectSunsetMs;\n }\n\n public onTimeChanged = (_time: Date) => {\n // to be implemented by derived class\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseTimelineDataProvider.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseTimelineDataProvider.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAE3E;;GAEG;AACH,qBAAa,wBAAyB,YAAW,oBAAoB;IACnE,SAAgB,EAAE,8BAA8B;IACzC,KAAK,EAAE,IAAI,GAAG,SAAS,CAAC;IACxB,GAAG,EAAE,IAAI,GAAG,SAAS,CAAC;IACt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}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Timeline
|
|
7
7
|
*/
|
|
@@ -19,11 +19,9 @@ export class BaseTimelineDataProvider {
|
|
|
19
19
|
loop: true,
|
|
20
20
|
};
|
|
21
21
|
// istanbul ignore next
|
|
22
|
-
this.onPlaybackSettingChanged = (_settings) => {
|
|
23
|
-
};
|
|
22
|
+
this.onPlaybackSettingChanged = (_settings) => { };
|
|
24
23
|
// istanbul ignore next
|
|
25
|
-
this.onAnimationFractionChanged = (_animationFraction) => {
|
|
26
|
-
};
|
|
24
|
+
this.onAnimationFractionChanged = (_animationFraction) => { };
|
|
27
25
|
this._viewport = viewport;
|
|
28
26
|
// istanbul ignore if - WIP
|
|
29
27
|
if (viewport)
|
|
@@ -39,7 +37,9 @@ export class BaseTimelineDataProvider {
|
|
|
39
37
|
}
|
|
40
38
|
/** Called to get playback duration */
|
|
41
39
|
get duration() {
|
|
42
|
-
return
|
|
40
|
+
return this.getSettings().duration
|
|
41
|
+
? this.getSettings().duration
|
|
42
|
+
: /* istanbul ignore next */ 20000;
|
|
43
43
|
}
|
|
44
44
|
// istanbul ignore next - WIP
|
|
45
45
|
set viewport(viewport) {
|
|
@@ -54,7 +54,9 @@ export class BaseTimelineDataProvider {
|
|
|
54
54
|
return this._viewport;
|
|
55
55
|
}
|
|
56
56
|
get loop() {
|
|
57
|
-
return
|
|
57
|
+
return undefined === this.getSettings().loop
|
|
58
|
+
? /* istanbul ignore next */ false
|
|
59
|
+
: this.getSettings().loop;
|
|
58
60
|
}
|
|
59
61
|
getSettings() {
|
|
60
62
|
return this._settings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseTimelineDataProvider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseTimelineDataProvider.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"BaseTimelineDataProvider.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/BaseTimelineDataProvider.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAKH;;GAEG;AACH,MAAM,OAAO,wBAAwB;IAUnC,YAAY,QAAyB;QATrB,OAAE,GAAG,0BAA0B,CAAC;QAGzC,WAAM,GAAG,EAAE,CAAC;QAEZ,8BAAyB,GAAG,KAAK,CAAC,CAAC,oEAAoE;QACvG,sBAAiB,GAAW,CAAC,CAAC,CAAC,kFAAkF;QAS9G,cAAS,GAAqB;YACtC,QAAQ,EAAE,EAAE,GAAG,IAAI;YACnB,IAAI,EAAE,IAAI;SACX,CAAC;QA6CF,uBAAuB;QAChB,6BAAwB,GAAG,CAAC,SAA2B,EAAE,EAAE,GAAE,CAAC,CAAC;QAEtE,uBAAuB;QAChB,+BAA0B,GAAG,CAAC,kBAA0B,EAAE,EAAE,GAAE,CAAC,CAAC;QAzDrE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,2BAA2B;QAC3B,IAAI,QAAQ;YAAE,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IAC/C,CAAC;IAOD,uBAAuB;IAChB,KAAK,CAAC,gBAAgB;QAC3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,kDAAkD;IAClD,IAAW,eAAe;QACxB,OAAO,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,iBAAiB,CAAC;IAChD,CAAC;IAED,uCAAuC;IACvC,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,QAAQ;YAChC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,QAAS;YAC9B,CAAC,CAAC,0BAA0B,CAAC,KAAK,CAAC;IACvC,CAAC;IAED,6BAA6B;IAC7B,IAAW,QAAQ,CAAC,QAAoC;QACtD,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;QAC1B,IAAI,QAAQ;YAAE,IAAI,CAAC,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;;YACxC,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;IACxB,CAAC;IAED,6BAA6B;IAC7B,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,SAAS,KAAK,IAAI,CAAC,WAAW,EAAE,CAAC,IAAI;YAC1C,CAAC,CAAC,0BAA0B,CAAC,KAAK;YAClC,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC,IAAK,CAAC;IAC/B,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,cAAc,CAAC,QAA0B;QAC9C,IAAI,CAAC,SAAS,GAAG,EAAE,GAAG,IAAI,CAAC,SAAS,EAAE,GAAG,QAAQ,EAAE,CAAC;IACtD,CAAC;CAOF","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 Timeline\n */\n\nimport type { ScreenViewport } from \"@itwin/core-frontend\";\nimport type { PlaybackSettings, TimelineDataProvider } from \"./interfaces\";\n\n/** Base Timeline Data Provider\n * @alpha\n */\nexport class BaseTimelineDataProvider implements TimelineDataProvider {\n public readonly id = \"TestTimelineDataProvider\";\n public start: Date | undefined;\n public end: Date | undefined;\n public viewId = \"\";\n\n public supportsTimelineAnimation = false; // set to true when provider determines animation data is available.\n public animationFraction: number = 0; // value from 0.0 to 1.0 that specifies the percentage complete for the animation.\n protected _viewport: ScreenViewport | undefined;\n\n constructor(viewport?: ScreenViewport) {\n this._viewport = viewport;\n // istanbul ignore if - WIP\n if (viewport) this.viewId = viewport.view.id;\n }\n\n protected _settings: PlaybackSettings = {\n duration: 20 * 1000,\n loop: true,\n };\n\n // istanbul ignore next\n public async loadTimelineData(): Promise<boolean> {\n return false;\n }\n\n /** Called to get the initial scrubber location */\n public get initialDuration(): number {\n return this.duration * this.animationFraction;\n }\n\n /** Called to get playback duration */\n public get duration(): number {\n return this.getSettings().duration\n ? this.getSettings().duration!\n : /* istanbul ignore next */ 20000;\n }\n\n // istanbul ignore next - WIP\n public set viewport(viewport: ScreenViewport | undefined) {\n this._viewport = viewport;\n if (viewport) this.viewId = viewport.view.id;\n else this.viewId = \"\";\n }\n\n // istanbul ignore next - WIP\n public get viewport(): ScreenViewport | undefined {\n return this._viewport;\n }\n\n public get loop(): boolean {\n return undefined === this.getSettings().loop\n ? /* istanbul ignore next */ false\n : this.getSettings().loop!;\n }\n\n public getSettings(): PlaybackSettings {\n return this._settings;\n }\n\n public updateSettings(settings: PlaybackSettings) {\n this._settings = { ...this._settings, ...settings };\n }\n\n // istanbul ignore next\n public onPlaybackSettingChanged = (_settings: PlaybackSettings) => {};\n\n // istanbul ignore next\n public onAnimationFractionChanged = (_animationFraction: number) => {};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InlineEdit.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/InlineEdit.tsx"],"names":[],"mappings":"AAIA,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,UAAU,eAAgB,SAAQ,WAAW;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"InlineEdit.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/timeline/InlineEdit.tsx"],"names":[],"mappings":"AAIA,OAAO,mBAAmB,CAAC;AAE3B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD,UAAU,eAAgB,SAAQ,WAAW;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,UAAU,eAAe;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK,CAAC,SAAS,CAC7C,eAAe,EACf,eAAe,CAChB;IACC,OAAO,CAAC,SAAS,CAAuC;gBAE5C,KAAK,EAAE,eAAe;IASlC,gBAAgB;IACA,kBAAkB,CAChC,SAAS,EAAE,eAAe,EAC1B,UAAU,EAAE,eAAe;IAU7B,OAAO,CAAC,OAAO,CAEb;IAEF,OAAO,CAAC,QAAQ,CAEd;IAEF,OAAO,CAAC,UAAU,CAYhB;IAEF,OAAO,CAAC,SAAS,CAEf;IAEF,OAAO,CAAC,WAAW;IAKH,MAAM;CAiBvB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
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
|
-
*--------------------------------------------------------------------------------------------*/
|
|
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
5
|
import "./InlineEdit.scss";
|
|
6
6
|
import classnames from "classnames";
|
|
7
7
|
import * as React from "react";
|
|
@@ -34,7 +34,10 @@ export class InlineEdit extends React.Component {
|
|
|
34
34
|
this._onChange = (event) => {
|
|
35
35
|
this.setState({ value: event.target.value });
|
|
36
36
|
};
|
|
37
|
-
this.state = {
|
|
37
|
+
this.state = {
|
|
38
|
+
value: this.props.defaultValue,
|
|
39
|
+
originalValue: this.props.defaultValue,
|
|
40
|
+
};
|
|
38
41
|
}
|
|
39
42
|
/** @internal */
|
|
40
43
|
componentDidUpdate(prevProps, _prevState) {
|