@itwin/imodel-components-react 4.10.0-dev.1 → 4.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +1 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.js +6 -6
- package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +2 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js +12 -8
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +2 -0
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +5 -2
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +2 -0
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +2 -0
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +5 -5
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +2 -0
- package/lib/cjs/imodel-components-react/color/HueSlider.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/HueSlider.js +12 -9
- package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +2 -0
- package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js +12 -11
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/Swatch.d.ts +2 -0
- package/lib/cjs/imodel-components-react/color/Swatch.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/color/Swatch.js +2 -0
- package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/ColorEditor.js +3 -2
- package/lib/cjs/imodel-components-react/editors/ColorEditor.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/editors/WeightEditor.js.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +5 -4
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +5 -5
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +3 -3
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +10 -5
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +3 -3
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +5 -4
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +7 -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 +10 -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 -14
- 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 +13 -9
- 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 +22 -29
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.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 +18 -17
- 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 +7 -6
- 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 +14 -13
- 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 +7 -6
- 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 +9 -8
- 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 +23 -22
- 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 +7 -6
- 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 +15 -14
- 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 +6 -6
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +2 -2
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayButton.d.ts +12 -0
- package/lib/cjs/imodel-components-react/timeline/PlayButton.d.ts.map +1 -0
- package/lib/cjs/imodel-components-react/timeline/PlayButton.js +50 -0
- package/lib/cjs/imodel-components-react/timeline/PlayButton.js.map +1 -0
- package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +0 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js +1 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +2 -20
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +111 -202
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +25 -333
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +33 -67
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +226 -330
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +27 -140
- package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +2 -2
- package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/cjs/imodel-components-react/useTranslation.d.ts +10 -0
- package/lib/cjs/imodel-components-react/useTranslation.d.ts.map +1 -0
- package/lib/cjs/imodel-components-react/useTranslation.js +20 -0
- package/lib/cjs/imodel-components-react/useTranslation.js.map +1 -0
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +13 -8
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react.d.ts +0 -1
- package/lib/cjs/imodel-components-react.d.ts.map +1 -1
- package/lib/cjs/imodel-components-react.js +0 -1
- package/lib/cjs/imodel-components-react.js.map +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.js +6 -6
- package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +2 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.js +12 -8
- package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +2 -0
- package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js +5 -2
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +2 -0
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +2 -0
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +5 -5
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/esm/imodel-components-react/color/HueSlider.d.ts +2 -0
- package/lib/esm/imodel-components-react/color/HueSlider.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/HueSlider.js +12 -9
- package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +2 -0
- package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/SaturationPicker.js +12 -11
- package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/esm/imodel-components-react/color/Swatch.d.ts +2 -0
- package/lib/esm/imodel-components-react/color/Swatch.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/color/Swatch.js +2 -0
- package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/ColorEditor.js +3 -2
- package/lib/esm/imodel-components-react/editors/ColorEditor.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/WeightEditor.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/editors/WeightEditor.js.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityInput.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityInput.js +5 -4
- package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +5 -5
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +3 -3
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +10 -5
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +3 -3
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +5 -4
- 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 +7 -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 +10 -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 -14
- 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 +13 -9
- 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 +22 -29
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.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 +18 -17
- 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 +7 -6
- 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 +14 -13
- 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 +7 -6
- 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 +9 -8
- 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 +23 -22
- 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 +7 -6
- 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 +15 -14
- 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 +6 -6
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.js +2 -2
- package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayButton.d.ts +12 -0
- package/lib/esm/imodel-components-react/timeline/PlayButton.d.ts.map +1 -0
- package/lib/esm/imodel-components-react/timeline/PlayButton.js +23 -0
- package/lib/esm/imodel-components-react/timeline/PlayButton.js.map +1 -0
- package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +0 -1
- package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/Scrubber.js +1 -1
- package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +2 -20
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +112 -203
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +25 -333
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +33 -67
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +228 -329
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +27 -140
- package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +2 -2
- package/lib/esm/imodel-components-react/timeline/interfaces.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/esm/imodel-components-react/useTranslation.d.ts +10 -0
- package/lib/esm/imodel-components-react/useTranslation.d.ts.map +1 -0
- package/lib/esm/imodel-components-react/useTranslation.js +16 -0
- package/lib/esm/imodel-components-react/useTranslation.js.map +1 -0
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +13 -8
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/esm/imodel-components-react.d.ts +0 -1
- package/lib/esm/imodel-components-react.d.ts.map +1 -1
- package/lib/esm/imodel-components-react.js +0 -1
- package/lib/esm/imodel-components-react.js.map +1 -1
- package/lib/public/locales/en/UiIModelComponents.json +14 -3
- package/package.json +20 -20
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +0 -34
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts.map +0 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +0 -100
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +0 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +0 -28
- package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +0 -34
- package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts.map +0 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js +0 -69
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +0 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +0 -28
|
@@ -1,361 +1,260 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module Timeline
|
|
7
|
+
*/
|
|
8
|
+
import "./TimelineComponent.scss";
|
|
7
9
|
import * as React from "react";
|
|
8
|
-
import {
|
|
10
|
+
import { UiAdmin } from "@itwin/appui-abstract";
|
|
11
|
+
import { toDateString, toTimeString } from "@itwin/components-react";
|
|
12
|
+
import { SvgCheckmark, SvgMoreVertical } from "@itwin/itwinui-icons-react";
|
|
13
|
+
import { DropdownMenu, IconButton, MenuDivider, MenuItem, } from "@itwin/itwinui-react";
|
|
9
14
|
import { InlineEdit } from "./InlineEdit";
|
|
10
15
|
import { TimelinePausePlayAction } from "./interfaces";
|
|
11
|
-
import { PlayButton
|
|
16
|
+
import { PlayButton } from "./PlayButton";
|
|
12
17
|
import { Scrubber } from "./Scrubber";
|
|
13
|
-
import "
|
|
14
|
-
// cspell:ignore millisec
|
|
18
|
+
import { useTranslation } from "../useTranslation";
|
|
15
19
|
const slowSpeed = 60 * 1000;
|
|
16
20
|
const mediumSpeed = 20 * 1000;
|
|
17
21
|
const fastSpeed = 10 * 1000;
|
|
18
|
-
/**
|
|
19
|
-
* [[TimelineComponent]] is used to playback timeline data
|
|
22
|
+
/** [[TimelineComponent]] is used to playback timeline data
|
|
20
23
|
* @public
|
|
21
24
|
*/
|
|
22
|
-
export
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
25
|
+
export function TimelineComponent(props) {
|
|
26
|
+
var _a, _b, _c, _d;
|
|
27
|
+
const { appMenuItemOption = "replace", startDate, endDate, showDuration, timeZoneOffset, dateFormatOptions, timeFormatOptions, includeRepeat = true, onSettingsChange, onChange, onPlayPause, } = props;
|
|
28
|
+
const [isPlaying, setIsPlaying] = React.useState(!!props.isPlaying);
|
|
29
|
+
const [currentDuration, setCurrentDuration] = React.useState((_a = props.initialDuration) !== null && _a !== void 0 ? _a : 0);
|
|
30
|
+
const [totalDuration, setTotalDuration] = React.useState(props.totalDuration);
|
|
31
|
+
const [repeat, setRepeat] = React.useState((_b = props.repeat) !== null && _b !== void 0 ? _b : false);
|
|
32
|
+
const playOrReplay = React.useCallback(() => {
|
|
33
|
+
if (isPlaying)
|
|
34
|
+
return;
|
|
35
|
+
if (currentDuration >= totalDuration) {
|
|
36
|
+
setCurrentDuration(0);
|
|
37
|
+
}
|
|
38
|
+
setIsPlaying(true);
|
|
39
|
+
onPlayPause === null || onPlayPause === void 0 ? void 0 : onPlayPause(true);
|
|
40
|
+
}, [isPlaying, onPlayPause, currentDuration, totalDuration]);
|
|
41
|
+
const pause = React.useCallback(() => {
|
|
42
|
+
if (!isPlaying)
|
|
43
|
+
return;
|
|
44
|
+
setIsPlaying(false);
|
|
45
|
+
onPlayPause === null || onPlayPause === void 0 ? void 0 : onPlayPause(false);
|
|
46
|
+
}, [isPlaying, onPlayPause]);
|
|
47
|
+
const updateTotalDuration = (newTotalDuration) => {
|
|
48
|
+
if (newTotalDuration === totalDuration)
|
|
49
|
+
return;
|
|
50
|
+
const fraction = currentDuration / totalDuration;
|
|
51
|
+
const newCurrentDuration = fraction * newTotalDuration;
|
|
52
|
+
setTotalDuration(newTotalDuration);
|
|
53
|
+
setCurrentDuration(newCurrentDuration);
|
|
54
|
+
onSettingsChange === null || onSettingsChange === void 0 ? void 0 : onSettingsChange({ duration: newTotalDuration });
|
|
55
|
+
};
|
|
56
|
+
const updateDuration = (newDuration, currentTotalDuration = totalDuration) => {
|
|
57
|
+
newDuration = Math.max(newDuration, 0);
|
|
58
|
+
newDuration = Math.min(newDuration, currentTotalDuration);
|
|
59
|
+
if (newDuration === currentDuration)
|
|
60
|
+
return;
|
|
61
|
+
setCurrentDuration(newDuration);
|
|
62
|
+
const fraction = newDuration / currentTotalDuration;
|
|
63
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(fraction);
|
|
64
|
+
};
|
|
65
|
+
const updateRepeat = (newRepeat) => {
|
|
66
|
+
if (newRepeat === repeat)
|
|
67
|
+
return;
|
|
68
|
+
setRepeat(newRepeat);
|
|
69
|
+
onSettingsChange === null || onSettingsChange === void 0 ? void 0 : onSettingsChange({ loop: newRepeat });
|
|
70
|
+
};
|
|
71
|
+
const [prevTotalDuration, setPrevTotalDuration] = React.useState(props.totalDuration);
|
|
72
|
+
if (prevTotalDuration !== props.totalDuration) {
|
|
73
|
+
setPrevTotalDuration(props.totalDuration);
|
|
74
|
+
updateTotalDuration(props.totalDuration);
|
|
75
|
+
}
|
|
76
|
+
const [prevInitialDuration, setPrevInitialDuration] = React.useState(props.initialDuration);
|
|
77
|
+
if (prevInitialDuration !== props.initialDuration) {
|
|
78
|
+
setPrevInitialDuration(props.initialDuration);
|
|
79
|
+
updateDuration((_c = props.initialDuration) !== null && _c !== void 0 ? _c : 0, props.totalDuration);
|
|
80
|
+
}
|
|
81
|
+
const [prevRepeat, setPrevRepeat] = React.useState(props.repeat);
|
|
82
|
+
if (prevRepeat !== props.repeat) {
|
|
83
|
+
setPrevRepeat(props.repeat);
|
|
84
|
+
updateRepeat((_d = props.repeat) !== null && _d !== void 0 ? _d : repeat);
|
|
85
|
+
}
|
|
86
|
+
React.useEffect(() => {
|
|
87
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
88
|
+
if (!props.componentId)
|
|
89
|
+
return;
|
|
90
|
+
return UiAdmin.onGenericUiEvent.addListener((args) => {
|
|
43
91
|
const timelineArgs = args;
|
|
44
|
-
// istanbul ignore else
|
|
45
92
|
if (!timelineArgs ||
|
|
46
|
-
|
|
93
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
94
|
+
props.componentId !== timelineArgs.uiComponentId ||
|
|
47
95
|
timelineArgs.timelineAction === undefined)
|
|
48
96
|
return;
|
|
49
|
-
let startPlaying;
|
|
50
97
|
switch (timelineArgs.timelineAction) {
|
|
51
98
|
case TimelinePausePlayAction.Play:
|
|
52
|
-
|
|
99
|
+
playOrReplay();
|
|
53
100
|
break;
|
|
54
101
|
case TimelinePausePlayAction.Pause:
|
|
55
|
-
|
|
102
|
+
pause();
|
|
56
103
|
break;
|
|
57
104
|
case TimelinePausePlayAction.Toggle:
|
|
58
|
-
|
|
105
|
+
if (isPlaying) {
|
|
106
|
+
pause();
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
playOrReplay();
|
|
110
|
+
}
|
|
59
111
|
break;
|
|
60
|
-
// istanbul ignore next
|
|
61
|
-
default:
|
|
62
|
-
return; // throw error?
|
|
63
|
-
}
|
|
64
|
-
if (startPlaying)
|
|
65
|
-
this._onPlay();
|
|
66
|
-
else
|
|
67
|
-
this._onPause();
|
|
68
|
-
};
|
|
69
|
-
// user clicked backward button
|
|
70
|
-
this._onBackward = () => {
|
|
71
|
-
// istanbul ignore else
|
|
72
|
-
if (this.props.onJump)
|
|
73
|
-
this.props.onJump(false);
|
|
74
|
-
};
|
|
75
|
-
// user clicked forward button
|
|
76
|
-
this._onForward = () => {
|
|
77
|
-
// istanbul ignore else
|
|
78
|
-
if (this.props.onJump)
|
|
79
|
-
this.props.onJump(true);
|
|
80
|
-
};
|
|
81
|
-
// user clicked play button
|
|
82
|
-
this._onPlay = () => {
|
|
83
|
-
// istanbul ignore if
|
|
84
|
-
if (this.state.isPlaying)
|
|
85
|
-
return;
|
|
86
|
-
// timeline was complete, restart from the beginning
|
|
87
|
-
if (this.state.currentDuration >= this.state.totalDuration) {
|
|
88
|
-
this._replay();
|
|
89
|
-
}
|
|
90
|
-
else
|
|
91
|
-
this._play();
|
|
92
|
-
// istanbul ignore else
|
|
93
|
-
if (this.props.onPlayPause)
|
|
94
|
-
this.props.onPlayPause(true);
|
|
95
|
-
};
|
|
96
|
-
// user clicked pause button
|
|
97
|
-
this._onPause = () => {
|
|
98
|
-
// istanbul ignore if
|
|
99
|
-
if (!this.state.isPlaying)
|
|
100
|
-
return;
|
|
101
|
-
// stop requesting frames
|
|
102
|
-
window.cancelAnimationFrame(this._requestFrame);
|
|
103
|
-
// stop playing
|
|
104
|
-
this.setState({ isPlaying: false });
|
|
105
|
-
// istanbul ignore else
|
|
106
|
-
if (this.props.onPlayPause)
|
|
107
|
-
this.props.onPlayPause(false);
|
|
108
|
-
};
|
|
109
|
-
// user clicked on timeline rail or dragged scrubber handle
|
|
110
|
-
this._onTimelineChange = (values) => {
|
|
111
|
-
const currentDuration = values[0];
|
|
112
|
-
this._setDuration(currentDuration);
|
|
113
|
-
};
|
|
114
|
-
// set the current duration, which will call the OnChange callback
|
|
115
|
-
this._setDuration = (currentDuration, updatedTotal) => {
|
|
116
|
-
const actualDuration = Math.min(updatedTotal ?? this.state.totalDuration, Math.max(currentDuration, 0));
|
|
117
|
-
this._timeLastCycle = new Date().getTime();
|
|
118
|
-
// istanbul ignore else
|
|
119
|
-
if (!this._unmounted)
|
|
120
|
-
this.setState({ currentDuration: actualDuration });
|
|
121
|
-
// istanbul ignore else
|
|
122
|
-
if (this.props.onChange) {
|
|
123
|
-
const fraction = actualDuration / (updatedTotal ?? this.state.totalDuration);
|
|
124
|
-
this.props.onChange(fraction);
|
|
125
112
|
}
|
|
126
|
-
};
|
|
127
|
-
//
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
const millisecondsElapsed = currentTime - this._timeLastCycle;
|
|
136
|
-
const duration = this.state.currentDuration + millisecondsElapsed;
|
|
137
|
-
this._setDuration(duration);
|
|
138
|
-
// stop the animation!
|
|
139
|
-
if (duration >= this.state.totalDuration) {
|
|
140
|
-
window.cancelAnimationFrame(this._requestFrame);
|
|
141
|
-
this.setState({ isPlaying: false });
|
|
142
|
-
if (this.state.repeat)
|
|
143
|
-
this._replay();
|
|
144
|
-
else {
|
|
145
|
-
// istanbul ignore else
|
|
146
|
-
if (this.props.onPlayPause)
|
|
147
|
-
this.props.onPlayPause(false);
|
|
148
|
-
}
|
|
113
|
+
});
|
|
114
|
+
// eslint-disable-next-line deprecation/deprecation
|
|
115
|
+
}, [isPlaying, pause, playOrReplay, props.componentId]);
|
|
116
|
+
useAnimation(({ delta }) => {
|
|
117
|
+
const duration = currentDuration + delta;
|
|
118
|
+
updateDuration(duration);
|
|
119
|
+
if (duration >= totalDuration) {
|
|
120
|
+
if (repeat) {
|
|
121
|
+
setCurrentDuration(0);
|
|
149
122
|
return;
|
|
150
123
|
}
|
|
151
|
-
|
|
152
|
-
this._requestFrame = window.requestAnimationFrame(this._updateAnimation);
|
|
153
|
-
};
|
|
154
|
-
this._replay = () => {
|
|
155
|
-
// timeline was complete, restart from the beginning
|
|
156
|
-
this.setState({ currentDuration: 0 }, () => this._play());
|
|
157
|
-
};
|
|
158
|
-
// user changed the total duration
|
|
159
|
-
this._onTotalDurationChange = (value) => {
|
|
160
|
-
// NOTE: we should reset the current duration to 0
|
|
161
|
-
const milliseconds = this._getMilliseconds(value);
|
|
162
|
-
this._onSetTotalDuration(milliseconds);
|
|
163
|
-
};
|
|
164
|
-
this._changeRepeatSetting = (newValue) => {
|
|
165
|
-
// istanbul ignore else
|
|
166
|
-
if (newValue !== undefined) {
|
|
167
|
-
this.setState(() => ({ repeat: newValue }), () => {
|
|
168
|
-
// istanbul ignore else
|
|
169
|
-
if (this.props.onSettingsChange) {
|
|
170
|
-
this.props.onSettingsChange({ loop: this.state.repeat });
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
this._onRepeatChanged = () => {
|
|
176
|
-
this.setState((prevState) => ({ repeat: !prevState.repeat }), () => {
|
|
177
|
-
// istanbul ignore else
|
|
178
|
-
if (this.props.onSettingsChange) {
|
|
179
|
-
this.props.onSettingsChange({ loop: this.state.repeat });
|
|
180
|
-
}
|
|
181
|
-
});
|
|
182
|
-
};
|
|
183
|
-
this._currentDate = () => {
|
|
184
|
-
const fraction = this.state.currentDuration / this.state.totalDuration;
|
|
185
|
-
if (this.props.endDate && this.props.startDate) {
|
|
186
|
-
const timeElapsed = (this.props.endDate.getTime() - this.props.startDate.getTime()) *
|
|
187
|
-
fraction;
|
|
188
|
-
return new Date(this.props.startDate.getTime() + timeElapsed);
|
|
189
|
-
}
|
|
190
|
-
return new Date();
|
|
191
|
-
};
|
|
192
|
-
this._onSetTotalDuration = (milliseconds) => {
|
|
193
|
-
this.setState({ totalDuration: milliseconds }, () => {
|
|
194
|
-
// istanbul ignore else
|
|
195
|
-
if (this.props.onSettingsChange) {
|
|
196
|
-
this.props.onSettingsChange({ duration: milliseconds });
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
this._renderSettings = () => {
|
|
201
|
-
const createMenuItemNodes = (close) => {
|
|
202
|
-
const { totalDuration } = this.state;
|
|
203
|
-
let contextMenuItems = [];
|
|
204
|
-
if (!this.props.appMenuItems) {
|
|
205
|
-
contextMenuItems = this._standardTimelineMenuItems;
|
|
206
|
-
}
|
|
207
|
-
else {
|
|
208
|
-
if (this.props.appMenuItemOption === "append") {
|
|
209
|
-
contextMenuItems = this._standardTimelineMenuItems.concat(this.props.appMenuItems);
|
|
210
|
-
}
|
|
211
|
-
else if (this.props.appMenuItemOption === "prefix") {
|
|
212
|
-
contextMenuItems = this.props.appMenuItems.concat(this._standardTimelineMenuItems);
|
|
213
|
-
}
|
|
214
|
-
else {
|
|
215
|
-
contextMenuItems = this.props.appMenuItems;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
const itemNodes = [];
|
|
219
|
-
let keyIndex = 0;
|
|
220
|
-
if (this.state.includeRepeat) {
|
|
221
|
-
const checked = this.state.repeat;
|
|
222
|
-
const icon = checked ? (React.createElement("span", { className: "icon" },
|
|
223
|
-
React.createElement(Icon, { iconSpec: React.createElement(SvgCheckmark, null) }),
|
|
224
|
-
" ")) : (React.createElement("span", null));
|
|
225
|
-
itemNodes.push(React.createElement(MenuItem, { key: ++keyIndex, onClick: () => {
|
|
226
|
-
this._onRepeatChanged();
|
|
227
|
-
close();
|
|
228
|
-
}, startIcon: icon }, this._repeatLabel));
|
|
229
|
-
itemNodes.push(React.createElement(MenuDivider, { key: ++keyIndex }));
|
|
230
|
-
}
|
|
231
|
-
contextMenuItems.forEach((item, index) => {
|
|
232
|
-
itemNodes.push(this._createMenuItemNode(item, index + keyIndex + 1, totalDuration, close));
|
|
233
|
-
});
|
|
234
|
-
return itemNodes;
|
|
235
|
-
};
|
|
236
|
-
return (React.createElement(DropdownMenu, { menuItems: createMenuItemNodes, placement: "top-start" },
|
|
237
|
-
React.createElement("span", { "data-testid": "timeline-settings", className: "timeline-settings icon", role: "button", tabIndex: -1, title: UiComponents.translate("button.label.settings") },
|
|
238
|
-
React.createElement(Icon, { iconSpec: React.createElement(SvgMoreVertical, null) }))));
|
|
239
|
-
};
|
|
240
|
-
this.state = {
|
|
241
|
-
isPlaying: false,
|
|
242
|
-
minimized: true,
|
|
243
|
-
currentDuration: props.initialDuration
|
|
244
|
-
? props.initialDuration
|
|
245
|
-
: /* istanbul ignore next */ 0,
|
|
246
|
-
totalDuration: this.props.totalDuration,
|
|
247
|
-
repeat: this.props.repeat ? true : false,
|
|
248
|
-
includeRepeat: this.props.includeRepeat || this.props.includeRepeat === undefined
|
|
249
|
-
? true
|
|
250
|
-
: false,
|
|
251
|
-
};
|
|
252
|
-
this._repeatLabel = UiIModelComponents.translate("timeline.repeat");
|
|
253
|
-
// istanbul ignore else
|
|
254
|
-
if (this.props.componentId) {
|
|
255
|
-
// can't handle an event if we have no id
|
|
256
|
-
this._removeListener = UiAdmin.onGenericUiEvent.addListener(this._handleTimelinePausePlayEvent);
|
|
124
|
+
pause();
|
|
257
125
|
}
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
if (
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
126
|
+
}, isPlaying);
|
|
127
|
+
React.useEffect(() => {
|
|
128
|
+
if (props.isPlaying)
|
|
129
|
+
playOrReplay();
|
|
130
|
+
if (props.isPlaying === false)
|
|
131
|
+
pause();
|
|
132
|
+
}, [props.isPlaying, playOrReplay, pause]);
|
|
133
|
+
const onTimelineChange = (values) => {
|
|
134
|
+
const newDuration = values[0];
|
|
135
|
+
updateDuration(newDuration);
|
|
136
|
+
};
|
|
137
|
+
const currentDurationStr = toDisplayTime(currentDuration);
|
|
138
|
+
const totalDurationStr = toDisplayTime(totalDuration);
|
|
139
|
+
const hasDates = !!startDate && !!endDate;
|
|
140
|
+
return (React.createElement("div", { "data-testid": "timeline-component", className: "timeline-component" },
|
|
141
|
+
React.createElement(PlayButton, { isPlaying: isPlaying, onPlay: playOrReplay, onPause: pause }),
|
|
142
|
+
React.createElement("div", { className: "time-container" },
|
|
143
|
+
hasDates && (React.createElement("span", { "data-testid": "test-start-date", className: "timeline-date" }, toDateString(startDate, timeZoneOffset, dateFormatOptions))),
|
|
144
|
+
hasDates && !showDuration && (React.createElement("span", { "data-testid": "test-start-time", className: "timeline-time" }, toTimeString(startDate, timeZoneOffset, timeFormatOptions))),
|
|
145
|
+
showDuration && (React.createElement("span", { className: "timeline-duration-time" }, currentDurationStr))),
|
|
146
|
+
React.createElement(Scrubber, { className: "slider", currentDuration: currentDuration, totalDuration: totalDuration, startDate: startDate, endDate: endDate, isPlaying: isPlaying, showTime: !showDuration, onChange: onTimelineChange, onUpdate: onTimelineChange, timeZoneOffset: props.timeZoneOffset, markDate: props.markDate }),
|
|
147
|
+
React.createElement("div", { className: "time-container" },
|
|
148
|
+
hasDates && (React.createElement("span", { "data-testid": "test-end-date", className: "timeline-date" }, toDateString(endDate, timeZoneOffset))),
|
|
149
|
+
hasDates && !showDuration && (React.createElement("span", { className: "timeline-time" }, toTimeString(endDate, timeZoneOffset, timeFormatOptions))),
|
|
150
|
+
showDuration && (React.createElement(InlineEdit, { className: "timeline-duration-time", defaultValue: totalDurationStr, onChange: (value) => {
|
|
151
|
+
const newTotalDuration = timeToMs(value);
|
|
152
|
+
updateTotalDuration(newTotalDuration);
|
|
153
|
+
} }))),
|
|
154
|
+
React.createElement(SettingsMenu, { appMenuItems: props.appMenuItems, appMenuItemOption: appMenuItemOption, includeRepeat: includeRepeat, repeat: repeat, totalDuration: totalDuration, onRepeatClick: () => {
|
|
155
|
+
updateRepeat(!repeat);
|
|
156
|
+
}, onTotalDurationChange: (newTotalDuration) => {
|
|
157
|
+
updateTotalDuration(newTotalDuration);
|
|
158
|
+
} })));
|
|
159
|
+
}
|
|
160
|
+
function SettingsMenu({ appMenuItems, appMenuItemOption, includeRepeat, repeat, totalDuration, onRepeatClick, onTotalDurationChange, }) {
|
|
161
|
+
const { translate } = useTranslation();
|
|
162
|
+
const menuItems = React.useMemo(() => {
|
|
163
|
+
const standardItems = [
|
|
164
|
+
{
|
|
165
|
+
label: translate("timeline.slow"),
|
|
166
|
+
timelineDuration: slowSpeed,
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
label: translate("timeline.medium"),
|
|
170
|
+
timelineDuration: mediumSpeed,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
label: translate("timeline.fast"),
|
|
174
|
+
timelineDuration: fastSpeed,
|
|
175
|
+
},
|
|
176
|
+
];
|
|
177
|
+
if (!appMenuItems) {
|
|
178
|
+
return standardItems;
|
|
285
179
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
this._changeRepeatSetting(this.props.repeat);
|
|
180
|
+
if (appMenuItemOption === "append") {
|
|
181
|
+
return [...standardItems, ...appMenuItems];
|
|
289
182
|
}
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
this._onSetTotalDuration(this.props.totalDuration);
|
|
183
|
+
if (appMenuItemOption === "prefix") {
|
|
184
|
+
return [...appMenuItems, ...standardItems];
|
|
293
185
|
}
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
186
|
+
// Replace
|
|
187
|
+
return appMenuItems;
|
|
188
|
+
}, [appMenuItemOption, appMenuItems, translate]);
|
|
189
|
+
return (React.createElement(DropdownMenu, { menuItems: (close) => {
|
|
190
|
+
return [
|
|
191
|
+
...(includeRepeat
|
|
192
|
+
? [
|
|
193
|
+
React.createElement(MenuItem, { key: "repeat", onClick: () => {
|
|
194
|
+
onRepeatClick();
|
|
195
|
+
close();
|
|
196
|
+
}, startIcon: repeat ? React.createElement(SvgCheckmark, null) : React.createElement(React.Fragment, null) }, translate("timeline.repeat")),
|
|
197
|
+
React.createElement(MenuDivider, { key: "divider" }),
|
|
198
|
+
]
|
|
199
|
+
: []),
|
|
200
|
+
...menuItems.map((item, index) => {
|
|
201
|
+
const checked = totalDuration === item.timelineDuration;
|
|
202
|
+
return (React.createElement(MenuItem, { key: index, startIcon: checked ? React.createElement(SvgCheckmark, null) : React.createElement(React.Fragment, null), onClick: () => {
|
|
203
|
+
onTotalDurationChange(item.timelineDuration);
|
|
204
|
+
close();
|
|
205
|
+
} }, item.label));
|
|
206
|
+
}),
|
|
207
|
+
];
|
|
208
|
+
}, placement: "top-start" },
|
|
209
|
+
React.createElement(IconButton, { "data-testid": "timeline-settings", label: translate("button.label.settings"), styleType: "borderless" },
|
|
210
|
+
React.createElement(SvgMoreVertical, null))));
|
|
211
|
+
}
|
|
212
|
+
function useAnimation(onAnimate, playing = true) {
|
|
213
|
+
const onAnimateRef = React.useRef(onAnimate);
|
|
214
|
+
onAnimateRef.current = onAnimate;
|
|
215
|
+
const lastTimeRef = React.useRef();
|
|
216
|
+
React.useEffect(() => {
|
|
217
|
+
if (!playing)
|
|
218
|
+
return;
|
|
219
|
+
let handle = 0;
|
|
220
|
+
let didCancel = false;
|
|
221
|
+
const animate = (time) => {
|
|
222
|
+
if (lastTimeRef.current === undefined) {
|
|
223
|
+
lastTimeRef.current = time;
|
|
224
|
+
}
|
|
225
|
+
const delta = time - lastTimeRef.current;
|
|
226
|
+
lastTimeRef.current = time;
|
|
227
|
+
onAnimateRef.current({
|
|
228
|
+
delta,
|
|
229
|
+
});
|
|
230
|
+
if (didCancel)
|
|
231
|
+
return;
|
|
232
|
+
handle = window.requestAnimationFrame(animate);
|
|
306
233
|
};
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
else {
|
|
319
|
-
return Number(time) * 1000;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
_createMenuItemNode(item, index, currentTimelineDuration, close) {
|
|
323
|
-
const label = item.label;
|
|
324
|
-
const checked = currentTimelineDuration === item.timelineDuration;
|
|
325
|
-
const icon = checked ? (React.createElement("span", { className: "icon" },
|
|
326
|
-
React.createElement(Icon, { iconSpec: React.createElement(SvgCheckmark, null) }),
|
|
327
|
-
" ")) : (React.createElement("span", null));
|
|
328
|
-
return (React.createElement(MenuItem, { key: index, startIcon: icon, onClick: () => {
|
|
329
|
-
this._onSetTotalDuration(item.timelineDuration);
|
|
330
|
-
close();
|
|
331
|
-
} }, label));
|
|
234
|
+
handle = window.requestAnimationFrame(animate);
|
|
235
|
+
return () => {
|
|
236
|
+
didCancel = true;
|
|
237
|
+
lastTimeRef.current = undefined;
|
|
238
|
+
window.cancelAnimationFrame(handle);
|
|
239
|
+
};
|
|
240
|
+
}, [playing]);
|
|
241
|
+
}
|
|
242
|
+
function timeToMs(time) {
|
|
243
|
+
if (time.indexOf(":") !== -1) {
|
|
244
|
+
return ((Number(time.split(":")[0]) * 60 + Number(time.split(":")[1])) * 1000);
|
|
332
245
|
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
const { currentDuration, totalDuration, minimized } = this.state;
|
|
336
|
-
const currentDate = this._currentDate();
|
|
337
|
-
const durationString = this._displayTime(currentDuration);
|
|
338
|
-
const totalDurationString = this._displayTime(totalDuration);
|
|
339
|
-
const hasDates = !!startDate && !!endDate;
|
|
340
|
-
return (React.createElement("div", { "data-testid": "timeline-component", className: classnames("timeline-component", !!minimized && "minimized", hasDates && "has-dates") },
|
|
341
|
-
React.createElement("div", { className: "header" },
|
|
342
|
-
React.createElement(PlayButton, { className: "play-button", isPlaying: this.state.isPlaying, onPlay: this._onPlay, onPause: this._onPause, "data-testid": "timeline-play" }),
|
|
343
|
-
React.createElement(PlayerButton, { className: "play-backward", icon: React.createElement(SvgCaretLeft, null), onClick: this._onBackward, title: UiIModelComponents.translate("timeline.backward") }),
|
|
344
|
-
React.createElement(PlayerButton, { className: "play-button-step", icon: React.createElement(SvgPlayCircular, null), isPlaying: this.state.isPlaying, onPlay: this._onPlay, onPause: this._onPause, title: UiIModelComponents.translate("timeline.step") }),
|
|
345
|
-
React.createElement(PlayerButton, { className: "play-forward", icon: React.createElement(SvgCaretRight, null), onClick: this._onForward, title: UiIModelComponents.translate("timeline.backward") }),
|
|
346
|
-
React.createElement("span", { className: "current-date" }, toDateString(currentDate, timeZoneOffset, dateFormatOptions))),
|
|
347
|
-
React.createElement("div", { className: "scrubber" },
|
|
348
|
-
React.createElement(PlayButton, { className: "play-button", isPlaying: this.state.isPlaying, onPlay: this._onPlay, onPause: this._onPause }),
|
|
349
|
-
React.createElement("div", { className: "start-time-container" },
|
|
350
|
-
hasDates && (React.createElement("span", { "data-testid": "test-start-date", className: "start-date" }, toDateString(startDate, timeZoneOffset, dateFormatOptions))),
|
|
351
|
-
hasDates && !showDuration && (React.createElement("span", { "data-testid": "test-start-time", className: "start-time" }, toTimeString(startDate, timeZoneOffset, timeFormatOptions))),
|
|
352
|
-
showDuration && (React.createElement("span", { className: "duration-start-time" }, durationString))),
|
|
353
|
-
React.createElement(Scrubber, { className: "slider", currentDuration: this.state.currentDuration, totalDuration: totalDuration, startDate: startDate, endDate: endDate, isPlaying: this.state.isPlaying, inMiniMode: !!minimized, showTime: !showDuration, onChange: this._onTimelineChange, onUpdate: this._onTimelineChange, timeZoneOffset: this.props.timeZoneOffset, markDate: this.props.markDate }),
|
|
354
|
-
React.createElement("div", { className: "end-time-container" },
|
|
355
|
-
hasDates && (React.createElement("span", { className: "end-date" }, toDateString(endDate, timeZoneOffset))),
|
|
356
|
-
hasDates && !showDuration && (React.createElement("span", { className: "end-time" }, toTimeString(endDate, timeZoneOffset, timeFormatOptions))),
|
|
357
|
-
showDuration && (React.createElement(InlineEdit, { className: "duration-end-time", defaultValue: totalDurationString, onChange: this._onTotalDurationChange }))),
|
|
358
|
-
minimized && this._renderSettings())));
|
|
246
|
+
else {
|
|
247
|
+
return Number(time) * 1000;
|
|
359
248
|
}
|
|
360
249
|
}
|
|
250
|
+
function toDisplayTime(ms) {
|
|
251
|
+
const addZero = (i) => {
|
|
252
|
+
return i < 10 ? `0${i}` : i;
|
|
253
|
+
};
|
|
254
|
+
const date = new Date(ms);
|
|
255
|
+
// const hours = date.getUTCHours();
|
|
256
|
+
const minutes = date.getUTCMinutes();
|
|
257
|
+
const seconds = date.getUTCSeconds();
|
|
258
|
+
return `${addZero(minutes)}:${addZero(seconds)}`;
|
|
259
|
+
}
|
|
361
260
|
//# sourceMappingURL=TimelineComponent.js.map
|