@itwin/imodel-components-react 3.7.3 → 3.7.5
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 +11 -1
- package/lib/cjs/imodel-components-react/UiIModelComponents.d.ts +28 -28
- package/lib/cjs/imodel-components-react/UiIModelComponents.js +79 -79
- package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.d.ts +36 -36
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js +186 -186
- package/lib/cjs/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/AlphaSlider.scss +63 -63
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +107 -107
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerButton.scss +91 -91
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js +74 -74
- package/lib/cjs/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js +145 -145
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPanel.scss +93 -93
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js +137 -137
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/ColorPickerPopup.scss +64 -64
- package/lib/cjs/imodel-components-react/color/HueSlider.d.ts +22 -22
- package/lib/cjs/imodel-components-react/color/HueSlider.js +199 -199
- package/lib/cjs/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/HueSlider.scss +61 -61
- package/lib/cjs/imodel-components-react/color/SaturationPicker.d.ts +20 -20
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js +213 -213
- package/lib/cjs/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/SaturationPicker.scss +35 -35
- package/lib/cjs/imodel-components-react/color/Swatch.d.ts +22 -22
- package/lib/cjs/imodel-components-react/color/Swatch.js +60 -60
- package/lib/cjs/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/cjs/imodel-components-react/color/Swatch.scss +23 -23
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js +23 -23
- package/lib/cjs/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
- package/lib/cjs/imodel-components-react/editors/ColorEditor.d.ts +44 -44
- package/lib/cjs/imodel-components-react/editors/ColorEditor.js +151 -151
- 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 +47 -47
- package/lib/cjs/imodel-components-react/editors/WeightEditor.js +160 -160
- 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 +25 -25
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.js +96 -96
- package/lib/cjs/imodel-components-react/inputs/QuantityInput.js.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +265 -265
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
- package/lib/cjs/imodel-components-react/lineweight/Swatch.d.ts +33 -33
- package/lib/cjs/imodel-components-react/lineweight/Swatch.js +85 -85
- 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 +60 -60
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js +159 -159
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
- package/lib/cjs/imodel-components-react/navigationaids/Cube.d.ts +45 -45
- package/lib/cjs/imodel-components-react/navigationaids/Cube.js +127 -127
- 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 +175 -175
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +647 -647
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js +647 -647
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/cjs/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +99 -99
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +53 -53
- package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +83 -83
- package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +86 -86
- package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +109 -109
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +133 -133
- package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +184 -184
- package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js +154 -154
- package/lib/cjs/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js +59 -59
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js +47 -47
- package/lib/cjs/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js +54 -54
- package/lib/cjs/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js +48 -48
- package/lib/cjs/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js +50 -50
- package/lib/cjs/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +58 -58
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js +47 -47
- package/lib/cjs/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js +56 -56
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +95 -95
- package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js +119 -119
- package/lib/cjs/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js +143 -143
- package/lib/cjs/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js +69 -69
- package/lib/cjs/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js +81 -81
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/InlineEdit.scss +26 -26
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js +91 -91
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/PlayerButton.scss +25 -25
- package/lib/cjs/imodel-components-react/timeline/Scrubber.d.ts +54 -54
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js +191 -191
- package/lib/cjs/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/Scrubber.scss +106 -106
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js +424 -424
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SolarTimeline.scss +357 -357
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js +54 -54
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
- package/lib/cjs/imodel-components-react/timeline/Timeline.scss +164 -164
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +387 -387
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/timeline/TimelineComponent.scss +185 -185
- package/lib/cjs/imodel-components-react/timeline/interfaces.d.ts +174 -174
- package/lib/cjs/imodel-components-react/timeline/interfaces.js +45 -45
- package/lib/cjs/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +274 -274
- package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js +105 -105
- package/lib/cjs/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/cjs/imodel-components-react.d.ts +82 -82
- package/lib/cjs/imodel-components-react.js +101 -101
- package/lib/cjs/imodel-components-react.js.map +1 -1
- package/lib/esm/imodel-components-react/UiIModelComponents.d.ts +28 -28
- package/lib/esm/imodel-components-react/UiIModelComponents.js +75 -75
- package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.d.ts +36 -36
- package/lib/esm/imodel-components-react/color/AlphaSlider.js +160 -160
- package/lib/esm/imodel-components-react/color/AlphaSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/AlphaSlider.scss +63 -63
- package/lib/esm/imodel-components-react/color/ColorPickerButton.d.ts +37 -37
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js +82 -82
- package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerButton.scss +91 -91
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.d.ts +23 -23
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.js +51 -51
- package/lib/esm/imodel-components-react/color/ColorPickerDialog.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.d.ts +21 -21
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.js +122 -122
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPanel.scss +93 -93
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.d.ts +44 -44
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js +112 -112
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.js.map +1 -1
- package/lib/esm/imodel-components-react/color/ColorPickerPopup.scss +64 -64
- package/lib/esm/imodel-components-react/color/HueSlider.d.ts +22 -22
- package/lib/esm/imodel-components-react/color/HueSlider.js +173 -173
- package/lib/esm/imodel-components-react/color/HueSlider.js.map +1 -1
- package/lib/esm/imodel-components-react/color/HueSlider.scss +61 -61
- package/lib/esm/imodel-components-react/color/SaturationPicker.d.ts +20 -20
- package/lib/esm/imodel-components-react/color/SaturationPicker.js +187 -187
- package/lib/esm/imodel-components-react/color/SaturationPicker.js.map +1 -1
- package/lib/esm/imodel-components-react/color/SaturationPicker.scss +35 -35
- package/lib/esm/imodel-components-react/color/Swatch.d.ts +22 -22
- package/lib/esm/imodel-components-react/color/Swatch.js +34 -34
- package/lib/esm/imodel-components-react/color/Swatch.js.map +1 -1
- package/lib/esm/imodel-components-react/color/Swatch.scss +23 -23
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.d.ts +6 -6
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js +19 -19
- package/lib/esm/imodel-components-react/color/getCSSColorFromDef.js.map +1 -1
- package/lib/esm/imodel-components-react/editors/ColorEditor.d.ts +44 -44
- package/lib/esm/imodel-components-react/editors/ColorEditor.js +124 -124
- 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 +47 -47
- package/lib/esm/imodel-components-react/editors/WeightEditor.js +133 -133
- 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 +25 -25
- package/lib/esm/imodel-components-react/inputs/QuantityInput.js +70 -70
- package/lib/esm/imodel-components-react/inputs/QuantityInput.js.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.d.ts +44 -44
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +240 -240
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
- package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.scss +107 -107
- package/lib/esm/imodel-components-react/lineweight/Swatch.d.ts +33 -33
- package/lib/esm/imodel-components-react/lineweight/Swatch.js +59 -59
- 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 +60 -60
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js +133 -133
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/lineweight/WeightPickerButton.scss +52 -52
- package/lib/esm/imodel-components-react/navigationaids/Cube.d.ts +45 -45
- package/lib/esm/imodel-components-react/navigationaids/Cube.js +100 -100
- 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 +175 -175
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +619 -619
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.scss +180 -180
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.d.ts +145 -145
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js +620 -620
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.js.map +1 -1
- package/lib/esm/imodel-components-react/navigationaids/DrawingNavigationAid.scss +133 -133
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.d.ts +26 -26
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +76 -76
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatPanel.scss +64 -64
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +30 -30
- package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.d.ts +18 -18
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +60 -60
- package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatType.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js +63 -63
- package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +83 -83
- package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.d.ts +19 -19
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +110 -110
- package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.d.ts +21 -21
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +158 -158
- package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.d.ts +22 -22
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js +131 -131
- package/lib/esm/imodel-components-react/quantityformat/QuantityFormatPanel.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js +36 -36
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js +24 -24
- package/lib/esm/imodel-components-react/quantityformat/misc/DecimalSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.d.ts +16 -16
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js +31 -31
- package/lib/esm/imodel-components-react/quantityformat/misc/FractionPrecision.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.d.ts +18 -18
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js +25 -25
- package/lib/esm/imodel-components-react/quantityformat/misc/ScientificType.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js +27 -27
- package/lib/esm/imodel-components-react/quantityformat/misc/SignOption.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js +35 -35
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSeparatorSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js +24 -24
- package/lib/esm/imodel-components-react/quantityformat/misc/StationSizeSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js +33 -33
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSelector.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.d.ts +17 -17
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +69 -69
- package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
- package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.d.ts +23 -23
- package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js +96 -96
- package/lib/esm/imodel-components-react/quantityformat/misc/UnitDescr.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.d.ts +52 -52
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js +139 -139
- package/lib/esm/imodel-components-react/timeline/BaseSolarDataProvider.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.d.ts +31 -31
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js +65 -65
- package/lib/esm/imodel-components-react/timeline/BaseTimelineDataProvider.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.d.ts +27 -27
- package/lib/esm/imodel-components-react/timeline/InlineEdit.js +55 -55
- package/lib/esm/imodel-components-react/timeline/InlineEdit.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/InlineEdit.scss +26 -26
- package/lib/esm/imodel-components-react/timeline/PlayerButton.d.ts +33 -33
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js +64 -64
- package/lib/esm/imodel-components-react/timeline/PlayerButton.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/PlayerButton.scss +25 -25
- package/lib/esm/imodel-components-react/timeline/Scrubber.d.ts +54 -54
- package/lib/esm/imodel-components-react/timeline/Scrubber.js +164 -164
- package/lib/esm/imodel-components-react/timeline/Scrubber.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/Scrubber.scss +106 -106
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.d.ts +77 -77
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js +398 -398
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SolarTimeline.scss +357 -357
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.d.ts +15 -15
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js +28 -28
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/SpeedTimeline.scss +39 -39
- package/lib/esm/imodel-components-react/timeline/Timeline.scss +164 -164
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.d.ts +133 -133
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +361 -361
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/timeline/TimelineComponent.scss +185 -185
- package/lib/esm/imodel-components-react/timeline/interfaces.d.ts +174 -174
- package/lib/esm/imodel-components-react/timeline/interfaces.js +42 -42
- package/lib/esm/imodel-components-react/timeline/interfaces.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.d.ts +42 -42
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +251 -251
- package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.d.ts +106 -106
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js +95 -95
- package/lib/esm/imodel-components-react/viewport/ViewportComponentEvents.js.map +1 -1
- package/lib/esm/imodel-components-react.d.ts +82 -82
- package/lib/esm/imodel-components-react.js +87 -87
- package/lib/esm/imodel-components-react.js.map +1 -1
- package/lib/public/locales/en/UiIModelComponents.json +139 -139
- package/package.json +19 -19
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatUnits.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatUnits.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAG/B,wDAA6C;AAC7C,gDAA6C;AAC7C,8DAA2D;AAY3D;;GAEG;AACH,SAAgB,WAAW,CAAC,KAAuB;;IACjD,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAC/E,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAc,aAAa,CAAC,CAAC;IAClE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEpE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,gBAAgB,CAAC,OAAO,KAAK,aAAa,EAAE;YAC9C,gBAAgB,CAAC,OAAO,GAAG,aAAa,CAAC;YACzC,cAAc,CAAC,aAAa,CAAC,CAAC;SAC/B;IACH,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAqB,EAAE,EAAE;QACvE,cAAc,CAAC,QAAQ,CAAC,CAAC;QACzB,aAAa,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC3C,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEpB,MAAM,qBAAqB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,QAAgB,EAAE,KAAa,EAAE,EAAE;QAClF,uBAAuB;QACvB,IAAI,WAAW,CAAC,SAAS,IAAI,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,M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AE,IAAI,EAAC,OAAO,GAAG,CACxJ,CAEJ,CACJ,CAAC;AACJ,CAAC;AA1GD,kCA0GC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UnitDescr } from \"./misc/UnitDescr\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties of [[FormatUnits]] component.\n * @alpha\n */\nexport interface FormatUnitsProps extends CommonProps {\n initialFormat: FormatProps;\n persistenceUnit?: UnitProps;\n unitsProvider: UnitsProvider;\n onUnitsChange?: (format: FormatProps) => void;\n}\n\n/** Component to show/edit Units used for Quantity Formatting.\n * @alpha\n */\nexport function FormatUnits(props: FormatUnitsProps) {\n const { initialFormat, persistenceUnit, unitsProvider, onUnitsChange } = props;\n const initialFormatRef = React.useRef<FormatProps>(initialFormat);\n const [formatProps, setFormatProps] = React.useState(initialFormat);\n\n React.useEffect(() => {\n if (initialFormatRef.current !== initialFormat) {\n initialFormatRef.current = initialFormat;\n setFormatProps(initialFormat);\n }\n }, [initialFormat]);\n\n const handleSetFormatProps = React.useCallback((newProps: FormatProps) => {\n setFormatProps(newProps);\n onUnitsChange && onUnitsChange(newProps);\n }, [onUnitsChange]);\n\n const handleUnitLabelChange = React.useCallback((newLabel: string, index: number) => {\n // istanbul ignore else\n if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {\n const units = formatProps.composite.units.map((entry, ndx) => {\n // istanbul ignore else\n if (index === ndx)\n return { name: entry.name, label: newLabel };\n else\n return entry;\n });\n\n const composite = { ...formatProps.composite, units };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n }\n }, [formatProps, handleSetFormatProps]);\n\n const handleUnitChange = React.useCallback((newUnit: string, index: number) => {\n const unitParts = newUnit.split(/:/);\n if (unitParts[0] === \"REMOVEUNIT\") {\n // istanbul ignore else\n if (formatProps.composite && formatProps.composite.units.length > 1) {\n const units = [...formatProps.composite.units];\n units.pop();\n const composite = { ...formatProps.composite, units };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n }\n } else if (unitParts[0] === \"ADDSUBUNIT\") {\n const units = formatProps.composite && formatProps.composite.units.length ?\n [...formatProps.composite.units, { name: unitParts[1], label: unitParts[2] }] :\n /* istanbul ignore next*/[{ name: unitParts[1], label: unitParts[2] }];\n const composite = { ...formatProps.composite, units };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n } else {\n // istanbul ignore else\n if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {\n const units = formatProps.composite.units.map((entry, ndx) => {\n // istanbul ignore else\n if (index === ndx)\n return { name: unitParts[0], label: unitParts[1] };\n else\n return entry;\n });\n const composite = { ...formatProps.composite, units };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n } else if (!formatProps.composite) {\n const composite = { units: [{ name: unitParts[0], label: unitParts[1] }] };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n }\n }\n }, [formatProps, handleSetFormatProps]);\n\n const handleOnSpacerChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (formatProps.composite) {\n const spacerValue = e.target.value.length ? e.target.value[0] : /* istanbul ignore next */ \"\"; // spacer can only be empty or a single character\n const composite = { ...formatProps.composite, spacer: spacerValue };\n const newFormatProps = { ...formatProps, composite };\n handleSetFormatProps(newFormatProps);\n }\n }, [formatProps, handleSetFormatProps]);\n\n const compositeSpacer = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.compositeSpacer\"));\n\n return (\n <>\n {(formatProps.composite?.units)\n ?\n formatProps.composite.units.map((value, index) => <UnitDescr key={value.name} name={value.name}\n label={value.label ?? \"\"} parentUnitName={index > 0 ? formatProps.composite!.units[index - 1].name :\n undefined} unitsProvider={unitsProvider} index={index} onUnitChange={handleUnitChange} onLabelChange={handleUnitLabelChange}\n readonly={index < (formatProps.composite!.units.length - 1)} />)\n :\n persistenceUnit && <UnitDescr key={persistenceUnit.name} name={persistenceUnit.name}\n label={persistenceUnit.label} unitsProvider={unitsProvider} index={0} onUnitChange={handleUnitChange} onLabelChange={handleUnitLabelChange} />\n }\n\n {(formatProps.composite?.units && formatProps.composite.units.length > 1) &&\n <>\n <span key={\"composite-spacer-label\"} className={\"uicore-label\"}>{compositeSpacer.current}</span>\n <Input key={\"composite-spacer\"} data-testid=\"composite-spacer\" value={formatProps.composite.spacer ?? \"\"} onChange={handleOnSpacerChange} size=\"small\" />\n </>\n }\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"FormatUnits.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatUnits.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;AAEH,6CAA+B;AAG/B,wDAA6C;AAC7C,gDAA6C;AAC7C,8DAA2D;AAY3D;;GAEG;AACH,SAAgB,WAAW,CAAC,KAAuB;;IACjD,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,EAAE,GAAG,KAAK,CAAC;IAC/E,MAAM,gBAAgB,GAAG,KAAK,CAAC,MAAM,CAAc,aAAa,CAAC,CAAC;IAClE,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;IAEpE,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,gBAAgB,CAAC,OAAO,KAAK,aAAa,EAAE;YAC9C,gBAAgB,CAAC,OAAO,GAAG,aAAa,CAAC;YACzC,cAAc,CAAC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EAAE,KAAK,EAAE,CAAC,EAAE,YAAY,EAAE,gBAAgB,EAAE,aAAa,EAAE,qBAAqB,GAAI;QAGjJ,CAAC,CAAA,MAAA,WAAW,CAAC,SAAS,0CAAE,KAAK,KAAI,WAAW,CAAC,SAAS,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;YACvE;gBACE,8BAAM,GAAG,EAAE,wBAAwB,EAAE,SAAS,EAAE,cAAc,IAAG,eAAe,CAAC,OAAO,CAAQ;gBAChG,oBAAC,qBAAK,IAAC,GAAG,EAAE,kBAAkB,iBAAc,kBAAkB,EAAC,KAAK,EAAE,MAAA,WAAW,CAAC,SAAS,CAAC,MAAM,mCAAI,EAAE,EAAE,QAAQ,EAAE,oBAAoB,EAAE,IAAI,EAAC,OAAO,GAAG,CACxJ,CAEJ,CACJ,CAAC;AACJ,CAAC;AA1GD,kCA0GC","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport * as React from \"react\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { FormatProps, UnitProps, UnitsProvider } from \"@itwin/core-quantity\";\r\nimport { Input } from \"@itwin/itwinui-react\";\r\nimport { UnitDescr } from \"./misc/UnitDescr\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\n\r\n/** Properties of [[FormatUnits]] component.\r\n * @alpha\r\n */\r\nexport interface FormatUnitsProps extends CommonProps {\r\n initialFormat: FormatProps;\r\n persistenceUnit?: UnitProps;\r\n unitsProvider: UnitsProvider;\r\n onUnitsChange?: (format: FormatProps) => void;\r\n}\r\n\r\n/** Component to show/edit Units used for Quantity Formatting.\r\n * @alpha\r\n */\r\nexport function FormatUnits(props: FormatUnitsProps) {\r\n const { initialFormat, persistenceUnit, unitsProvider, onUnitsChange } = props;\r\n const initialFormatRef = React.useRef<FormatProps>(initialFormat);\r\n const [formatProps, setFormatProps] = React.useState(initialFormat);\r\n\r\n React.useEffect(() => {\r\n if (initialFormatRef.current !== initialFormat) {\r\n initialFormatRef.current = initialFormat;\r\n setFormatProps(initialFormat);\r\n }\r\n }, [initialFormat]);\r\n\r\n const handleSetFormatProps = React.useCallback((newProps: FormatProps) => {\r\n setFormatProps(newProps);\r\n onUnitsChange && onUnitsChange(newProps);\r\n }, [onUnitsChange]);\r\n\r\n const handleUnitLabelChange = React.useCallback((newLabel: string, index: number) => {\r\n // istanbul ignore else\r\n if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {\r\n const units = formatProps.composite.units.map((entry, ndx) => {\r\n // istanbul ignore else\r\n if (index === ndx)\r\n return { name: entry.name, label: newLabel };\r\n else\r\n return entry;\r\n });\r\n\r\n const composite = { ...formatProps.composite, units };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n }\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleUnitChange = React.useCallback((newUnit: string, index: number) => {\r\n const unitParts = newUnit.split(/:/);\r\n if (unitParts[0] === \"REMOVEUNIT\") {\r\n // istanbul ignore else\r\n if (formatProps.composite && formatProps.composite.units.length > 1) {\r\n const units = [...formatProps.composite.units];\r\n units.pop();\r\n const composite = { ...formatProps.composite, units };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n }\r\n } else if (unitParts[0] === \"ADDSUBUNIT\") {\r\n const units = formatProps.composite && formatProps.composite.units.length ?\r\n [...formatProps.composite.units, { name: unitParts[1], label: unitParts[2] }] :\r\n /* istanbul ignore next*/[{ name: unitParts[1], label: unitParts[2] }];\r\n const composite = { ...formatProps.composite, units };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n } else {\r\n // istanbul ignore else\r\n if (formatProps.composite && formatProps.composite.units.length > index && index >= 0) {\r\n const units = formatProps.composite.units.map((entry, ndx) => {\r\n // istanbul ignore else\r\n if (index === ndx)\r\n return { name: unitParts[0], label: unitParts[1] };\r\n else\r\n return entry;\r\n });\r\n const composite = { ...formatProps.composite, units };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n } else if (!formatProps.composite) {\r\n const composite = { units: [{ name: unitParts[0], label: unitParts[1] }] };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n }\r\n }\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleOnSpacerChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n // istanbul ignore else\r\n if (formatProps.composite) {\r\n const spacerValue = e.target.value.length ? e.target.value[0] : /* istanbul ignore next */ \"\"; // spacer can only be empty or a single character\r\n const composite = { ...formatProps.composite, spacer: spacerValue };\r\n const newFormatProps = { ...formatProps, composite };\r\n handleSetFormatProps(newFormatProps);\r\n }\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const compositeSpacer = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.compositeSpacer\"));\r\n\r\n return (\r\n <>\r\n {(formatProps.composite?.units)\r\n ?\r\n formatProps.composite.units.map((value, index) => <UnitDescr key={value.name} name={value.name}\r\n label={value.label ?? \"\"} parentUnitName={index > 0 ? formatProps.composite!.units[index - 1].name :\r\n undefined} unitsProvider={unitsProvider} index={index} onUnitChange={handleUnitChange} onLabelChange={handleUnitLabelChange}\r\n readonly={index < (formatProps.composite!.units.length - 1)} />)\r\n :\r\n persistenceUnit && <UnitDescr key={persistenceUnit.name} name={persistenceUnit.name}\r\n label={persistenceUnit.label} unitsProvider={unitsProvider} index={0} onUnitChange={handleUnitChange} onLabelChange={handleUnitLabelChange} />\r\n }\r\n\r\n {(formatProps.composite?.units && formatProps.composite.units.length > 1) &&\r\n <>\r\n <span key={\"composite-spacer-label\"} className={\"uicore-label\"}>{compositeSpacer.current}</span>\r\n <Input key={\"composite-spacer\"} data-testid=\"composite-spacer\" value={formatProps.composite.spacer ?? \"\"} onChange={handleOnSpacerChange} size=\"small\" />\r\n </>\r\n }\r\n </>\r\n );\r\n}\r\n"]}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/** @packageDocumentation
|
|
2
|
-
* @module QuantityFormat
|
|
3
|
-
*/
|
|
4
|
-
import * as React from "react";
|
|
5
|
-
import { CommonProps } from "@itwin/core-react";
|
|
6
|
-
import { FormatProps } from "@itwin/core-quantity";
|
|
7
|
-
/** Properties of [[MiscFormatOptions]] component.
|
|
8
|
-
* @alpha
|
|
9
|
-
*/
|
|
10
|
-
export interface MiscFormatOptionsProps extends CommonProps {
|
|
11
|
-
formatProps: FormatProps;
|
|
12
|
-
onChange?: (format: FormatProps) => void;
|
|
13
|
-
enableMinimumProperties?: boolean;
|
|
14
|
-
showOptions: boolean;
|
|
15
|
-
onShowHideOptions: (show: boolean) => void;
|
|
16
|
-
children?: React.ReactNode;
|
|
17
|
-
}
|
|
18
|
-
/** Component use to set miscellaneous properties is a Formatted Quantity.
|
|
19
|
-
* @alpha
|
|
20
|
-
*/
|
|
21
|
-
export declare function MiscFormatOptions(props: MiscFormatOptionsProps): JSX.Element;
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module QuantityFormat
|
|
3
|
+
*/
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { CommonProps } from "@itwin/core-react";
|
|
6
|
+
import { FormatProps } from "@itwin/core-quantity";
|
|
7
|
+
/** Properties of [[MiscFormatOptions]] component.
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
export interface MiscFormatOptionsProps extends CommonProps {
|
|
11
|
+
formatProps: FormatProps;
|
|
12
|
+
onChange?: (format: FormatProps) => void;
|
|
13
|
+
enableMinimumProperties?: boolean;
|
|
14
|
+
showOptions: boolean;
|
|
15
|
+
onShowHideOptions: (show: boolean) => void;
|
|
16
|
+
children?: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/** Component use to set miscellaneous properties is a Formatted Quantity.
|
|
19
|
+
* @alpha
|
|
20
|
+
*/
|
|
21
|
+
export declare function MiscFormatOptions(props: MiscFormatOptionsProps): JSX.Element;
|
|
22
22
|
//# sourceMappingURL=MiscFormatOptions.d.ts.map
|
|
@@ -1,185 +1,185 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
/** @packageDocumentation
|
|
7
|
-
* @module QuantityFormat
|
|
8
|
-
*/
|
|
9
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
-
}) : (function(o, m, k, k2) {
|
|
13
|
-
if (k2 === undefined) k2 = k;
|
|
14
|
-
o[k2] = m[k];
|
|
15
|
-
}));
|
|
16
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
-
}) : function(o, v) {
|
|
19
|
-
o["default"] = v;
|
|
20
|
-
});
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
-
if (mod && mod.__esModule) return mod;
|
|
23
|
-
var result = {};
|
|
24
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
-
__setModuleDefault(result, mod);
|
|
26
|
-
return result;
|
|
27
|
-
};
|
|
28
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
-
};
|
|
31
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.MiscFormatOptions = void 0;
|
|
33
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
34
|
-
const React = __importStar(require("react"));
|
|
35
|
-
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
36
|
-
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
37
|
-
const core_quantity_1 = require("@itwin/core-quantity");
|
|
38
|
-
const SignOption_1 = require("./misc/SignOption");
|
|
39
|
-
const ThousandsSeparator_1 = require("./misc/ThousandsSeparator");
|
|
40
|
-
const DecimalSeparator_1 = require("./misc/DecimalSeparator");
|
|
41
|
-
const ScientificType_1 = require("./misc/ScientificType");
|
|
42
|
-
const StationSeparatorSelector_1 = require("./misc/StationSeparatorSelector");
|
|
43
|
-
const StationSizeSelector_1 = require("./misc/StationSizeSelector");
|
|
44
|
-
const UiIModelComponents_1 = require("../UiIModelComponents");
|
|
45
|
-
/** Component use to set miscellaneous properties is a Formatted Quantity.
|
|
46
|
-
* @alpha
|
|
47
|
-
*/
|
|
48
|
-
function MiscFormatOptions(props) {
|
|
49
|
-
var _a, _b;
|
|
50
|
-
const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;
|
|
51
|
-
const handleSetFormatProps = React.useCallback((newFormatProps) => {
|
|
52
|
-
onChange && onChange(newFormatProps);
|
|
53
|
-
}, [onChange]);
|
|
54
|
-
const isFormatTraitSet = React.useCallback((trait) => {
|
|
55
|
-
return core_quantity_1.Format.isFormatTraitSetInProps(formatProps, trait);
|
|
56
|
-
}, [formatProps]);
|
|
57
|
-
const handleShowSignChange = React.useCallback((option) => {
|
|
58
|
-
const newShowSignOption = (0, core_quantity_1.showSignOptionToString)(option);
|
|
59
|
-
const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };
|
|
60
|
-
handleSetFormatProps(newFormatProps);
|
|
61
|
-
}, [formatProps, handleSetFormatProps]);
|
|
62
|
-
const setFormatTrait = React.useCallback((trait, setActive) => {
|
|
63
|
-
const traitStr = (0, core_quantity_1.getTraitString)(trait);
|
|
64
|
-
let formatTraits = [traitStr];
|
|
65
|
-
if (setActive) { // setting trait
|
|
66
|
-
// istanbul ignore else
|
|
67
|
-
if (formatProps.formatTraits) {
|
|
68
|
-
const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
|
|
69
|
-
// istanbul ignore else
|
|
70
|
-
if (!traits.find((traitEntry) => traitStr === traitEntry)) {
|
|
71
|
-
formatTraits = [...traits, traitStr];
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
else { // clearing trait
|
|
76
|
-
// istanbul ignore next
|
|
77
|
-
if (!formatProps.formatTraits)
|
|
78
|
-
return;
|
|
79
|
-
const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
|
|
80
|
-
formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);
|
|
81
|
-
}
|
|
82
|
-
const newFormatProps = { ...formatProps, formatTraits };
|
|
83
|
-
handleSetFormatProps(newFormatProps);
|
|
84
|
-
}, [formatProps, handleSetFormatProps]);
|
|
85
|
-
const handleShowTrailingZeroesChange = React.useCallback((e) => {
|
|
86
|
-
setFormatTrait(core_quantity_1.FormatTraits.TrailZeroes, e.target.checked);
|
|
87
|
-
}, [setFormatTrait]);
|
|
88
|
-
const handleKeepDecimalPointChange = React.useCallback((e) => {
|
|
89
|
-
setFormatTrait(core_quantity_1.FormatTraits.KeepDecimalPoint, e.target.checked);
|
|
90
|
-
}, [setFormatTrait]);
|
|
91
|
-
const handleKeepSingleZeroChange = React.useCallback((e) => {
|
|
92
|
-
setFormatTrait(core_quantity_1.FormatTraits.KeepSingleZero, e.target.checked);
|
|
93
|
-
}, [setFormatTrait]);
|
|
94
|
-
const handleZeroEmptyChange = React.useCallback((e) => {
|
|
95
|
-
setFormatTrait(core_quantity_1.FormatTraits.ZeroEmpty, e.target.checked);
|
|
96
|
-
}, [setFormatTrait]);
|
|
97
|
-
const handleUseFractionDashChange = React.useCallback((e) => {
|
|
98
|
-
setFormatTrait(core_quantity_1.FormatTraits.FractionDash, e.target.checked);
|
|
99
|
-
}, [setFormatTrait]);
|
|
100
|
-
const handleDecimalSeparatorChange = React.useCallback((decimalSeparator) => {
|
|
101
|
-
let thousandSeparator = formatProps.thousandSeparator;
|
|
102
|
-
// make sure 1000 and decimal separator do not match
|
|
103
|
-
// istanbul ignore else
|
|
104
|
-
if (isFormatTraitSet(core_quantity_1.FormatTraits.Use1000Separator)) {
|
|
105
|
-
switch (decimalSeparator) {
|
|
106
|
-
case ".":
|
|
107
|
-
thousandSeparator = ",";
|
|
108
|
-
break;
|
|
109
|
-
case ",":
|
|
110
|
-
thousandSeparator = ".";
|
|
111
|
-
break;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };
|
|
115
|
-
handleSetFormatProps(newFormatProps);
|
|
116
|
-
}, [formatProps, isFormatTraitSet, handleSetFormatProps]);
|
|
117
|
-
const handleScientificTypeChange = React.useCallback((type) => {
|
|
118
|
-
const newFormatProps = { ...formatProps, scientificType: (0, core_quantity_1.scientificTypeToString)(type) };
|
|
119
|
-
handleSetFormatProps(newFormatProps);
|
|
120
|
-
}, [formatProps, handleSetFormatProps]);
|
|
121
|
-
const handleFormatChange = React.useCallback((newFormatProps) => {
|
|
122
|
-
handleSetFormatProps(newFormatProps);
|
|
123
|
-
}, [handleSetFormatProps]);
|
|
124
|
-
const formatType = React.useMemo(() => (0, core_quantity_1.parseFormatType)(formatProps.type, "format"), [formatProps.type]);
|
|
125
|
-
const showSignOption = React.useMemo(() => { var _a; return (0, core_quantity_1.parseShowSignOption)((_a = formatProps.showSignOption) !== null && _a !== void 0 ? _a : "onlyNegative", "format"); }, [formatProps.showSignOption]);
|
|
126
|
-
const handleToggleButtonClick = React.useCallback(() => {
|
|
127
|
-
onShowHideOptions(!showOptions);
|
|
128
|
-
}, [onShowHideOptions, showOptions]);
|
|
129
|
-
const handleKeyUpOnLink = React.useCallback((e) => {
|
|
130
|
-
// istanbul ignore else
|
|
131
|
-
if (e.key === appui_abstract_1.SpecialKey.Enter || e.key === appui_abstract_1.SpecialKey.Space) {
|
|
132
|
-
onShowHideOptions(!showOptions);
|
|
133
|
-
e.preventDefault();
|
|
134
|
-
}
|
|
135
|
-
}, [onShowHideOptions, showOptions]);
|
|
136
|
-
const handleStationSeparatorChange = React.useCallback((value) => {
|
|
137
|
-
const newFormatProps = { ...formatProps, stationSeparator: value };
|
|
138
|
-
handleSetFormatProps(newFormatProps);
|
|
139
|
-
}, [formatProps, handleSetFormatProps]);
|
|
140
|
-
const handleStationOffsetChange = React.useCallback((value) => {
|
|
141
|
-
const newFormatProps = { ...formatProps, stationOffsetSize: value };
|
|
142
|
-
handleSetFormatProps(newFormatProps);
|
|
143
|
-
}, [formatProps, handleSetFormatProps]);
|
|
144
|
-
const signOptionLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.signOptionLabel"));
|
|
145
|
-
const stationOffsetLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.stationOffsetLabel"));
|
|
146
|
-
const stationSeparatorLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.stationSeparatorLabel"));
|
|
147
|
-
const decimalSeparatorLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.decimalSeparatorLabel"));
|
|
148
|
-
const showTrailZerosLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.showTrailZerosLabel"));
|
|
149
|
-
const keepSingleZeroLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.keepSingleZeroLabel"));
|
|
150
|
-
const zeroEmptyLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.zeroEmptyLabel"));
|
|
151
|
-
const moreLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.moreLabel"));
|
|
152
|
-
const lessLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.lessLabel"));
|
|
153
|
-
const keepDecimalPointLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.keepDecimalPointLabel"));
|
|
154
|
-
const fractionDashLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.fractionDashLabel"));
|
|
155
|
-
const scientificTypeLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.scientificTypeLabel"));
|
|
156
|
-
return (React.createElement(React.Fragment, null,
|
|
157
|
-
enableMinimumProperties && !showOptions && React.createElement("a", { onClick: handleToggleButtonClick, onKeyUp: handleKeyUpOnLink, className: "components-quantityFormat-more-less", role: "link", "data-testid": "quantityFormat-more", tabIndex: 0 }, moreLabel.current),
|
|
158
|
-
(!enableMinimumProperties || showOptions) &&
|
|
159
|
-
React.createElement(React.Fragment, null,
|
|
160
|
-
React.createElement("span", { className: "uicore-label" }, signOptionLabel.current),
|
|
161
|
-
React.createElement(SignOption_1.SignOptionSelector, { "data-testid": "sign-option-selector", signOption: showSignOption, onChange: handleShowSignChange }),
|
|
162
|
-
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType !== core_quantity_1.FormatType.Station && "uicore-disabled") }, stationOffsetLabel.current),
|
|
163
|
-
React.createElement(StationSizeSelector_1.StationSizeSelector, { "data-testid": "station-size-selector", value: ((_a = formatProps.stationOffsetSize) !== null && _a !== void 0 ? _a : 2), disabled: formatType !== core_quantity_1.FormatType.Station, onChange: handleStationOffsetChange }),
|
|
164
|
-
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType !== core_quantity_1.FormatType.Station && "uicore-disabled") }, stationSeparatorLabel.current),
|
|
165
|
-
React.createElement(StationSeparatorSelector_1.StationSeparatorSelector, { "data-testid": "station-separator-selector", separator: (undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : "+"), disabled: formatType !== core_quantity_1.FormatType.Station, onChange: handleStationSeparatorChange }),
|
|
166
|
-
React.createElement(ThousandsSeparator_1.ThousandsSeparator, { formatProps: formatProps, onChange: handleFormatChange }),
|
|
167
|
-
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType === core_quantity_1.FormatType.Fractional && "uicore-disabled") }, decimalSeparatorLabel.current),
|
|
168
|
-
React.createElement(DecimalSeparator_1.DecimalSeparatorSelector, { "data-testid": "decimal-separator-selector", separator: (_b = formatProps.decimalSeparator) !== null && _b !== void 0 ? _b : ".", onChange: handleDecimalSeparatorChange, disabled: formatType === core_quantity_1.FormatType.Fractional }),
|
|
169
|
-
React.createElement("span", { className: "uicore-label" }, showTrailZerosLabel.current),
|
|
170
|
-
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "show-trail-zeros", checked: isFormatTraitSet(core_quantity_1.FormatTraits.TrailZeroes), onChange: handleShowTrailingZeroesChange }),
|
|
171
|
-
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType === core_quantity_1.FormatType.Fractional && "uicore-disabled") }, keepDecimalPointLabel.current),
|
|
172
|
-
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "keep-decimal-point", checked: isFormatTraitSet(core_quantity_1.FormatTraits.KeepDecimalPoint), onChange: handleKeepDecimalPointChange }),
|
|
173
|
-
React.createElement("span", { className: "uicore-label" }, keepSingleZeroLabel.current),
|
|
174
|
-
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "keep-single-zero", checked: isFormatTraitSet(core_quantity_1.FormatTraits.KeepSingleZero), onChange: handleKeepSingleZeroChange }),
|
|
175
|
-
React.createElement("span", { className: "uicore-label" }, zeroEmptyLabel.current),
|
|
176
|
-
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "zero-empty", checked: isFormatTraitSet(core_quantity_1.FormatTraits.ZeroEmpty), onChange: handleZeroEmptyChange }),
|
|
177
|
-
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType !== core_quantity_1.FormatType.Fractional && "uicore-disabled") }, fractionDashLabel.current),
|
|
178
|
-
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "fraction-dash", checked: isFormatTraitSet(core_quantity_1.FormatTraits.FractionDash), onChange: handleUseFractionDashChange, disabled: formatType !== core_quantity_1.FormatType.Fractional }),
|
|
179
|
-
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType !== core_quantity_1.FormatType.Scientific && "uicore-disabled") }, scientificTypeLabel.current),
|
|
180
|
-
React.createElement(ScientificType_1.ScientificTypeSelector, { "data-testid": "scientific-type-selector", type: (formatProps.scientificType && formatProps.scientificType.length > 0) ? (0, core_quantity_1.parseScientificType)(formatProps.scientificType, "custom") : core_quantity_1.ScientificType.Normalized, disabled: formatType !== core_quantity_1.FormatType.Scientific, onChange: handleScientificTypeChange }),
|
|
181
|
-
props.children,
|
|
182
|
-
enableMinimumProperties && showOptions && React.createElement("a", { onClick: handleToggleButtonClick, onKeyUp: handleKeyUpOnLink, className: "components-quantityFormat-more-less", role: "link", "data-testid": "quantityFormat-less", tabIndex: 0 }, lessLabel.current))));
|
|
183
|
-
}
|
|
184
|
-
exports.MiscFormatOptions = MiscFormatOptions;
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
/** @packageDocumentation
|
|
7
|
+
* @module QuantityFormat
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
22
|
+
if (mod && mod.__esModule) return mod;
|
|
23
|
+
var result = {};
|
|
24
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
25
|
+
__setModuleDefault(result, mod);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
29
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
|
+
};
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.MiscFormatOptions = void 0;
|
|
33
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
34
|
+
const React = __importStar(require("react"));
|
|
35
|
+
const appui_abstract_1 = require("@itwin/appui-abstract");
|
|
36
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
37
|
+
const core_quantity_1 = require("@itwin/core-quantity");
|
|
38
|
+
const SignOption_1 = require("./misc/SignOption");
|
|
39
|
+
const ThousandsSeparator_1 = require("./misc/ThousandsSeparator");
|
|
40
|
+
const DecimalSeparator_1 = require("./misc/DecimalSeparator");
|
|
41
|
+
const ScientificType_1 = require("./misc/ScientificType");
|
|
42
|
+
const StationSeparatorSelector_1 = require("./misc/StationSeparatorSelector");
|
|
43
|
+
const StationSizeSelector_1 = require("./misc/StationSizeSelector");
|
|
44
|
+
const UiIModelComponents_1 = require("../UiIModelComponents");
|
|
45
|
+
/** Component use to set miscellaneous properties is a Formatted Quantity.
|
|
46
|
+
* @alpha
|
|
47
|
+
*/
|
|
48
|
+
function MiscFormatOptions(props) {
|
|
49
|
+
var _a, _b;
|
|
50
|
+
const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;
|
|
51
|
+
const handleSetFormatProps = React.useCallback((newFormatProps) => {
|
|
52
|
+
onChange && onChange(newFormatProps);
|
|
53
|
+
}, [onChange]);
|
|
54
|
+
const isFormatTraitSet = React.useCallback((trait) => {
|
|
55
|
+
return core_quantity_1.Format.isFormatTraitSetInProps(formatProps, trait);
|
|
56
|
+
}, [formatProps]);
|
|
57
|
+
const handleShowSignChange = React.useCallback((option) => {
|
|
58
|
+
const newShowSignOption = (0, core_quantity_1.showSignOptionToString)(option);
|
|
59
|
+
const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };
|
|
60
|
+
handleSetFormatProps(newFormatProps);
|
|
61
|
+
}, [formatProps, handleSetFormatProps]);
|
|
62
|
+
const setFormatTrait = React.useCallback((trait, setActive) => {
|
|
63
|
+
const traitStr = (0, core_quantity_1.getTraitString)(trait);
|
|
64
|
+
let formatTraits = [traitStr];
|
|
65
|
+
if (setActive) { // setting trait
|
|
66
|
+
// istanbul ignore else
|
|
67
|
+
if (formatProps.formatTraits) {
|
|
68
|
+
const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
|
|
69
|
+
// istanbul ignore else
|
|
70
|
+
if (!traits.find((traitEntry) => traitStr === traitEntry)) {
|
|
71
|
+
formatTraits = [...traits, traitStr];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else { // clearing trait
|
|
76
|
+
// istanbul ignore next
|
|
77
|
+
if (!formatProps.formatTraits)
|
|
78
|
+
return;
|
|
79
|
+
const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\|/);
|
|
80
|
+
formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);
|
|
81
|
+
}
|
|
82
|
+
const newFormatProps = { ...formatProps, formatTraits };
|
|
83
|
+
handleSetFormatProps(newFormatProps);
|
|
84
|
+
}, [formatProps, handleSetFormatProps]);
|
|
85
|
+
const handleShowTrailingZeroesChange = React.useCallback((e) => {
|
|
86
|
+
setFormatTrait(core_quantity_1.FormatTraits.TrailZeroes, e.target.checked);
|
|
87
|
+
}, [setFormatTrait]);
|
|
88
|
+
const handleKeepDecimalPointChange = React.useCallback((e) => {
|
|
89
|
+
setFormatTrait(core_quantity_1.FormatTraits.KeepDecimalPoint, e.target.checked);
|
|
90
|
+
}, [setFormatTrait]);
|
|
91
|
+
const handleKeepSingleZeroChange = React.useCallback((e) => {
|
|
92
|
+
setFormatTrait(core_quantity_1.FormatTraits.KeepSingleZero, e.target.checked);
|
|
93
|
+
}, [setFormatTrait]);
|
|
94
|
+
const handleZeroEmptyChange = React.useCallback((e) => {
|
|
95
|
+
setFormatTrait(core_quantity_1.FormatTraits.ZeroEmpty, e.target.checked);
|
|
96
|
+
}, [setFormatTrait]);
|
|
97
|
+
const handleUseFractionDashChange = React.useCallback((e) => {
|
|
98
|
+
setFormatTrait(core_quantity_1.FormatTraits.FractionDash, e.target.checked);
|
|
99
|
+
}, [setFormatTrait]);
|
|
100
|
+
const handleDecimalSeparatorChange = React.useCallback((decimalSeparator) => {
|
|
101
|
+
let thousandSeparator = formatProps.thousandSeparator;
|
|
102
|
+
// make sure 1000 and decimal separator do not match
|
|
103
|
+
// istanbul ignore else
|
|
104
|
+
if (isFormatTraitSet(core_quantity_1.FormatTraits.Use1000Separator)) {
|
|
105
|
+
switch (decimalSeparator) {
|
|
106
|
+
case ".":
|
|
107
|
+
thousandSeparator = ",";
|
|
108
|
+
break;
|
|
109
|
+
case ",":
|
|
110
|
+
thousandSeparator = ".";
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };
|
|
115
|
+
handleSetFormatProps(newFormatProps);
|
|
116
|
+
}, [formatProps, isFormatTraitSet, handleSetFormatProps]);
|
|
117
|
+
const handleScientificTypeChange = React.useCallback((type) => {
|
|
118
|
+
const newFormatProps = { ...formatProps, scientificType: (0, core_quantity_1.scientificTypeToString)(type) };
|
|
119
|
+
handleSetFormatProps(newFormatProps);
|
|
120
|
+
}, [formatProps, handleSetFormatProps]);
|
|
121
|
+
const handleFormatChange = React.useCallback((newFormatProps) => {
|
|
122
|
+
handleSetFormatProps(newFormatProps);
|
|
123
|
+
}, [handleSetFormatProps]);
|
|
124
|
+
const formatType = React.useMemo(() => (0, core_quantity_1.parseFormatType)(formatProps.type, "format"), [formatProps.type]);
|
|
125
|
+
const showSignOption = React.useMemo(() => { var _a; return (0, core_quantity_1.parseShowSignOption)((_a = formatProps.showSignOption) !== null && _a !== void 0 ? _a : "onlyNegative", "format"); }, [formatProps.showSignOption]);
|
|
126
|
+
const handleToggleButtonClick = React.useCallback(() => {
|
|
127
|
+
onShowHideOptions(!showOptions);
|
|
128
|
+
}, [onShowHideOptions, showOptions]);
|
|
129
|
+
const handleKeyUpOnLink = React.useCallback((e) => {
|
|
130
|
+
// istanbul ignore else
|
|
131
|
+
if (e.key === appui_abstract_1.SpecialKey.Enter || e.key === appui_abstract_1.SpecialKey.Space) {
|
|
132
|
+
onShowHideOptions(!showOptions);
|
|
133
|
+
e.preventDefault();
|
|
134
|
+
}
|
|
135
|
+
}, [onShowHideOptions, showOptions]);
|
|
136
|
+
const handleStationSeparatorChange = React.useCallback((value) => {
|
|
137
|
+
const newFormatProps = { ...formatProps, stationSeparator: value };
|
|
138
|
+
handleSetFormatProps(newFormatProps);
|
|
139
|
+
}, [formatProps, handleSetFormatProps]);
|
|
140
|
+
const handleStationOffsetChange = React.useCallback((value) => {
|
|
141
|
+
const newFormatProps = { ...formatProps, stationOffsetSize: value };
|
|
142
|
+
handleSetFormatProps(newFormatProps);
|
|
143
|
+
}, [formatProps, handleSetFormatProps]);
|
|
144
|
+
const signOptionLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.signOptionLabel"));
|
|
145
|
+
const stationOffsetLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.stationOffsetLabel"));
|
|
146
|
+
const stationSeparatorLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.stationSeparatorLabel"));
|
|
147
|
+
const decimalSeparatorLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.decimalSeparatorLabel"));
|
|
148
|
+
const showTrailZerosLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.showTrailZerosLabel"));
|
|
149
|
+
const keepSingleZeroLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.keepSingleZeroLabel"));
|
|
150
|
+
const zeroEmptyLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.zeroEmptyLabel"));
|
|
151
|
+
const moreLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.moreLabel"));
|
|
152
|
+
const lessLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.lessLabel"));
|
|
153
|
+
const keepDecimalPointLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.keepDecimalPointLabel"));
|
|
154
|
+
const fractionDashLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.fractionDashLabel"));
|
|
155
|
+
const scientificTypeLabel = React.useRef(UiIModelComponents_1.UiIModelComponents.translate("QuantityFormat.labels.scientificTypeLabel"));
|
|
156
|
+
return (React.createElement(React.Fragment, null,
|
|
157
|
+
enableMinimumProperties && !showOptions && React.createElement("a", { onClick: handleToggleButtonClick, onKeyUp: handleKeyUpOnLink, className: "components-quantityFormat-more-less", role: "link", "data-testid": "quantityFormat-more", tabIndex: 0 }, moreLabel.current),
|
|
158
|
+
(!enableMinimumProperties || showOptions) &&
|
|
159
|
+
React.createElement(React.Fragment, null,
|
|
160
|
+
React.createElement("span", { className: "uicore-label" }, signOptionLabel.current),
|
|
161
|
+
React.createElement(SignOption_1.SignOptionSelector, { "data-testid": "sign-option-selector", signOption: showSignOption, onChange: handleShowSignChange }),
|
|
162
|
+
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType !== core_quantity_1.FormatType.Station && "uicore-disabled") }, stationOffsetLabel.current),
|
|
163
|
+
React.createElement(StationSizeSelector_1.StationSizeSelector, { "data-testid": "station-size-selector", value: ((_a = formatProps.stationOffsetSize) !== null && _a !== void 0 ? _a : 2), disabled: formatType !== core_quantity_1.FormatType.Station, onChange: handleStationOffsetChange }),
|
|
164
|
+
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType !== core_quantity_1.FormatType.Station && "uicore-disabled") }, stationSeparatorLabel.current),
|
|
165
|
+
React.createElement(StationSeparatorSelector_1.StationSeparatorSelector, { "data-testid": "station-separator-selector", separator: (undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : "+"), disabled: formatType !== core_quantity_1.FormatType.Station, onChange: handleStationSeparatorChange }),
|
|
166
|
+
React.createElement(ThousandsSeparator_1.ThousandsSeparator, { formatProps: formatProps, onChange: handleFormatChange }),
|
|
167
|
+
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType === core_quantity_1.FormatType.Fractional && "uicore-disabled") }, decimalSeparatorLabel.current),
|
|
168
|
+
React.createElement(DecimalSeparator_1.DecimalSeparatorSelector, { "data-testid": "decimal-separator-selector", separator: (_b = formatProps.decimalSeparator) !== null && _b !== void 0 ? _b : ".", onChange: handleDecimalSeparatorChange, disabled: formatType === core_quantity_1.FormatType.Fractional }),
|
|
169
|
+
React.createElement("span", { className: "uicore-label" }, showTrailZerosLabel.current),
|
|
170
|
+
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "show-trail-zeros", checked: isFormatTraitSet(core_quantity_1.FormatTraits.TrailZeroes), onChange: handleShowTrailingZeroesChange }),
|
|
171
|
+
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType === core_quantity_1.FormatType.Fractional && "uicore-disabled") }, keepDecimalPointLabel.current),
|
|
172
|
+
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "keep-decimal-point", checked: isFormatTraitSet(core_quantity_1.FormatTraits.KeepDecimalPoint), onChange: handleKeepDecimalPointChange }),
|
|
173
|
+
React.createElement("span", { className: "uicore-label" }, keepSingleZeroLabel.current),
|
|
174
|
+
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "keep-single-zero", checked: isFormatTraitSet(core_quantity_1.FormatTraits.KeepSingleZero), onChange: handleKeepSingleZeroChange }),
|
|
175
|
+
React.createElement("span", { className: "uicore-label" }, zeroEmptyLabel.current),
|
|
176
|
+
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "zero-empty", checked: isFormatTraitSet(core_quantity_1.FormatTraits.ZeroEmpty), onChange: handleZeroEmptyChange }),
|
|
177
|
+
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType !== core_quantity_1.FormatType.Fractional && "uicore-disabled") }, fractionDashLabel.current),
|
|
178
|
+
React.createElement(itwinui_react_1.Checkbox, { "data-testid": "fraction-dash", checked: isFormatTraitSet(core_quantity_1.FormatTraits.FractionDash), onChange: handleUseFractionDashChange, disabled: formatType !== core_quantity_1.FormatType.Fractional }),
|
|
179
|
+
React.createElement("span", { className: (0, classnames_1.default)("uicore-label", formatType !== core_quantity_1.FormatType.Scientific && "uicore-disabled") }, scientificTypeLabel.current),
|
|
180
|
+
React.createElement(ScientificType_1.ScientificTypeSelector, { "data-testid": "scientific-type-selector", type: (formatProps.scientificType && formatProps.scientificType.length > 0) ? (0, core_quantity_1.parseScientificType)(formatProps.scientificType, "custom") : core_quantity_1.ScientificType.Normalized, disabled: formatType !== core_quantity_1.FormatType.Scientific, onChange: handleScientificTypeChange }),
|
|
181
|
+
props.children,
|
|
182
|
+
enableMinimumProperties && showOptions && React.createElement("a", { onClick: handleToggleButtonClick, onKeyUp: handleKeyUpOnLink, className: "components-quantityFormat-more-less", role: "link", "data-testid": "quantityFormat-less", tabIndex: 0 }, lessLabel.current))));
|
|
183
|
+
}
|
|
184
|
+
exports.MiscFormatOptions = MiscFormatOptions;
|
|
185
185
|
//# sourceMappingURL=MiscFormatOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MiscFormatOptions.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/MiscFormatOptions.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAAoC;AACpC,6CAA+B;AAC/B,0DAAmD;AAEnD,wDAAgD;AAChD,wDAE8B;AAC9B,kDAAuD;AACvD,kEAA+D;AAC/D,8DAAmE;AACnE,0DAA+D;AAC/D,8EAA2E;AAC3E,oEAAiE;AACjE,8DAA2D;AAc3D;;GAEG;AACH,SAAgB,iBAAiB,CAAC,KAA6B;;IAC7D,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,GAAG,KAAK,CAAC;IAEjG,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,cAA2B,EAAE,EAAE;QAC7E,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAmB,EAAE,EAAE;QACjE,OAAO,sBAAM,CAAC,uBAAuB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,MAAsB,EAAE,EAAE;QACxE,MAAM,iBAAiB,GAAG,I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AAQ,EAAE,qBAAqB,GAAI;gBAEzH,8BAAM,SAAS,EAAE,IAAA,oBAAU,EAAC,cAAc,EAAE,UAAU,KAAK,0BAAU,CAAC,UAAU,IAAI,iBAAiB,CAAC,IAAG,iBAAiB,CAAC,OAAO,CAAQ;gBAC1I,oBAAC,wBAAQ,mBAAa,eAAe,EAAC,OAAO,EAAE,gBAAgB,CAAC,4BAAY,CAAC,YAAY,CAAC,EAAE,QAAQ,EAAE,2BAA2B,EAAE,QAAQ,EAAE,UAAU,KAAK,0BAAU,CAAC,UAAU,GAAI;gBAErL,8BAAM,SAAS,EAAE,IAAA,oBAAU,EAAC,cAAc,EAAE,UAAU,KAAK,0BAAU,CAAC,UAAU,IAAI,iBAAiB,CAAC,IAAG,mBAAmB,CAAC,OAAO,CAAQ;gBAC5I,oBAAC,uCAAsB,mBAAa,0BAA0B,EAAC,IAAI,EAAE,CAAC,WAAW,CAAC,cAAc,IAAI,WAAW,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,mCAAmB,EAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,8BAAc,CAAC,UAAU,EAChO,QAAQ,EAAE,UAAU,KAAK,0BAAU,CAAC,UAAU,EAAE,QAAQ,EAAE,0BAA0B,GAAI;gBAEzF,KAAK,CAAC,QAAQ;gBAGb,uBAAuB,IAAI,WAAW,IAAI,2BAAG,OAAO,EAAE,uBAAuB,EAAE,OAAO,EAAE,iBAAiB,EACvG,SAAS,EAAE,qCAAqC,EAAE,IAAI,EAAC,MAAM,iBAAa,qBAAqB,EAAC,QAAQ,EAAE,CAAC,IAAG,SAAS,CAAC,OAAO,CAAK,CACvI,CAEJ,CACJ,CAAC;AACJ,CAAC;AAjLD,8CAiLC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport { SpecialKey } from \"@itwin/appui-abstract\";\nimport { CommonProps } from \"@itwin/core-react\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport { Format, FormatProps, FormatTraits, FormatType, getTraitString, parseFormatType, parseScientificType,\n parseShowSignOption, ScientificType, scientificTypeToString, ShowSignOption, showSignOptionToString,\n} from \"@itwin/core-quantity\";\nimport { SignOptionSelector } from \"./misc/SignOption\";\nimport { ThousandsSeparator } from \"./misc/ThousandsSeparator\";\nimport { DecimalSeparatorSelector } from \"./misc/DecimalSeparator\";\nimport { ScientificTypeSelector } from \"./misc/ScientificType\";\nimport { StationSeparatorSelector } from \"./misc/StationSeparatorSelector\";\nimport { StationSizeSelector } from \"./misc/StationSizeSelector\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties of [[MiscFormatOptions]] component.\n * @alpha\n */\nexport interface MiscFormatOptionsProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n enableMinimumProperties?: boolean;\n showOptions: boolean;\n onShowHideOptions: (show: boolean) => void;\n children?: React.ReactNode;\n}\n\n/** Component use to set miscellaneous properties is a Formatted Quantity.\n * @alpha\n */\nexport function MiscFormatOptions(props: MiscFormatOptionsProps) {\n const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;\n\n const handleSetFormatProps = React.useCallback((newFormatProps: FormatProps) => {\n onChange && onChange(newFormatProps);\n }, [onChange]);\n\n const isFormatTraitSet = React.useCallback((trait: FormatTraits) => {\n return Format.isFormatTraitSetInProps(formatProps, trait);\n }, [formatProps]);\n\n const handleShowSignChange = React.useCallback((option: ShowSignOption) => {\n const newShowSignOption = showSignOptionToString(option);\n const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const setFormatTrait = React.useCallback((trait: FormatTraits, setActive: boolean) => {\n const traitStr = getTraitString(trait);\n let formatTraits: string[] = [traitStr];\n if (setActive) {// setting trait\n // istanbul ignore else\n if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n // istanbul ignore else\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\n formatTraits = [...traits, traitStr];\n }\n }\n } else {// clearing trait\n // istanbul ignore next\n if (!formatProps.formatTraits)\n return;\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\n }\n const newFormatProps = { ...formatProps, formatTraits };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleShowTrailingZeroesChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);\n }, [setFormatTrait]);\n\n const handleKeepDecimalPointChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);\n }, [setFormatTrait]);\n\n const handleKeepSingleZeroChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);\n }, [setFormatTrait]);\n\n const handleZeroEmptyChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);\n }, [setFormatTrait]);\n\n const handleUseFractionDashChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.FractionDash, e.target.checked);\n }, [setFormatTrait]);\n\n const handleDecimalSeparatorChange = React.useCallback((decimalSeparator: string) => {\n let thousandSeparator = formatProps.thousandSeparator;\n // make sure 1000 and decimal separator do not match\n // istanbul ignore else\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\n switch (decimalSeparator) {\n case \".\":\n thousandSeparator = \",\";\n break;\n case \",\":\n thousandSeparator = \".\";\n break;\n }\n }\n const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, isFormatTraitSet, handleSetFormatProps]);\n\n const handleScientificTypeChange = React.useCallback((type: ScientificType) => {\n const newFormatProps = { ...formatProps, scientificType: scientificTypeToString(type) };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleFormatChange = React.useCallback((newFormatProps: FormatProps) => {\n handleSetFormatProps(newFormatProps);\n }, [handleSetFormatProps]);\n\n const formatType = React.useMemo(() => parseFormatType(formatProps.type, \"format\"), [formatProps.type]);\n const showSignOption = React.useMemo(() => parseShowSignOption(formatProps.showSignOption ?? \"onlyNegative\", \"format\"), [formatProps.showSignOption]);\n\n const handleToggleButtonClick = React.useCallback(() => {\n onShowHideOptions(!showOptions);\n }, [onShowHideOptions, showOptions]);\n\n const handleKeyUpOnLink = React.useCallback((e: React.KeyboardEvent<HTMLAnchorElement>) => {\n // istanbul ignore else\n if (e.key === SpecialKey.Enter || e.key === SpecialKey.Space) {\n onShowHideOptions(!showOptions);\n e.preventDefault();\n }\n }, [onShowHideOptions, showOptions]);\n\n const handleStationSeparatorChange = React.useCallback((value: string) => {\n const newFormatProps = { ...formatProps, stationSeparator: value };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const handleStationOffsetChange = React.useCallback((value: number) => {\n const newFormatProps = { ...formatProps, stationOffsetSize: value };\n handleSetFormatProps(newFormatProps);\n }, [formatProps, handleSetFormatProps]);\n\n const signOptionLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.signOptionLabel\"));\n const stationOffsetLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationOffsetLabel\"));\n const stationSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationSeparatorLabel\"));\n const decimalSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.decimalSeparatorLabel\"));\n const showTrailZerosLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.showTrailZerosLabel\"));\n const keepSingleZeroLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepSingleZeroLabel\"));\n const zeroEmptyLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.zeroEmptyLabel\"));\n const moreLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.moreLabel\"));\n const lessLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.lessLabel\"));\n const keepDecimalPointLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepDecimalPointLabel\"));\n const fractionDashLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.fractionDashLabel\"));\n const scientificTypeLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.scientificTypeLabel\"));\n\n return (\n <>\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\n enableMinimumProperties && !showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-more\" tabIndex={0} >{moreLabel.current}</a>}\n {\n (!enableMinimumProperties || showOptions) &&\n <>\n <span className={\"uicore-label\"}>{signOptionLabel.current}</span>\n <SignOptionSelector data-testid=\"sign-option-selector\" signOption={showSignOption} onChange={handleShowSignChange} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationOffsetLabel.current}</span>\n <StationSizeSelector data-testid=\"station-size-selector\" value={(formatProps.stationOffsetSize ?? 2)}\n disabled={formatType !== FormatType.Station} onChange={handleStationOffsetChange} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationSeparatorLabel.current}</span>\n <StationSeparatorSelector data-testid=\"station-separator-selector\" separator={(undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : \"+\")}\n disabled={formatType !== FormatType.Station} onChange={handleStationSeparatorChange} />\n\n <ThousandsSeparator formatProps={formatProps} onChange={handleFormatChange} />\n\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{decimalSeparatorLabel.current}</span>\n <DecimalSeparatorSelector data-testid=\"decimal-separator-selector\" separator={formatProps.decimalSeparator ?? \".\"} onChange={handleDecimalSeparatorChange} disabled={formatType === FormatType.Fractional} />\n\n <span className={\"uicore-label\"}>{showTrailZerosLabel.current}</span>\n <Checkbox data-testid=\"show-trail-zeros\" checked={isFormatTraitSet(FormatTraits.TrailZeroes)} onChange={handleShowTrailingZeroesChange} />\n\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{keepDecimalPointLabel.current}</span>\n <Checkbox data-testid=\"keep-decimal-point\" checked={isFormatTraitSet(FormatTraits.KeepDecimalPoint)} onChange={handleKeepDecimalPointChange} />\n\n <span className={\"uicore-label\"}>{keepSingleZeroLabel.current}</span>\n <Checkbox data-testid=\"keep-single-zero\" checked={isFormatTraitSet(FormatTraits.KeepSingleZero)} onChange={handleKeepSingleZeroChange} />\n\n <span className={\"uicore-label\"}>{zeroEmptyLabel.current}</span>\n <Checkbox data-testid=\"zero-empty\" checked={isFormatTraitSet(FormatTraits.ZeroEmpty)} onChange={handleZeroEmptyChange} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Fractional && \"uicore-disabled\")}>{fractionDashLabel.current}</span>\n <Checkbox data-testid=\"fraction-dash\" checked={isFormatTraitSet(FormatTraits.FractionDash)} onChange={handleUseFractionDashChange} disabled={formatType !== FormatType.Fractional} />\n\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Scientific && \"uicore-disabled\")}>{scientificTypeLabel.current}</span>\n <ScientificTypeSelector data-testid=\"scientific-type-selector\" type={(formatProps.scientificType && formatProps.scientificType.length > 0) ? parseScientificType(formatProps.scientificType, \"custom\") : ScientificType.Normalized}\n disabled={formatType !== FormatType.Scientific} onChange={handleScientificTypeChange} />\n\n {props.children}\n\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\n enableMinimumProperties && showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-less\" tabIndex={0}>{lessLabel.current}</a>}\n </>\n }\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MiscFormatOptions.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/MiscFormatOptions.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,4DAAoC;AACpC,6CAA+B;AAC/B,0DAAmD;AAEnD,wDAAgD;AAChD,wDAE8B;AAC9B,kDAAuD;AACvD,kEAA+D;AAC/D,8DAAmE;AACnE,0DAA+D;AAC/D,8EAA2E;AAC3E,oEAAiE;AACjE,8DAA2D;AAc3D;;GAEG;AACH,SAAgB,iBAAiB,CAAC,KAA6B;;IAC7D,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,GAAG,KAAK,CAAC;IAEjG,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,cAA2B,EAAE,EAAE;QAC7E,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEf,MAAM,gBAAgB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,KAAmB,EAAE,EAAE;QACjE,OAAO,sBAAM,CAAC,uBAAuB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC;IAC5D,CAAC,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC;IAElB,MAAM,oBAAoB,GAAG,KAAK,CAAC,WAAW,CA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porated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\n/** @packageDocumentation\r\n * @module QuantityFormat\r\n */\r\n\r\nimport classnames from \"classnames\";\r\nimport * as React from \"react\";\r\nimport { SpecialKey } from \"@itwin/appui-abstract\";\r\nimport { CommonProps } from \"@itwin/core-react\";\r\nimport { Checkbox } from \"@itwin/itwinui-react\";\r\nimport { Format, FormatProps, FormatTraits, FormatType, getTraitString, parseFormatType, parseScientificType,\r\n parseShowSignOption, ScientificType, scientificTypeToString, ShowSignOption, showSignOptionToString,\r\n} from \"@itwin/core-quantity\";\r\nimport { SignOptionSelector } from \"./misc/SignOption\";\r\nimport { ThousandsSeparator } from \"./misc/ThousandsSeparator\";\r\nimport { DecimalSeparatorSelector } from \"./misc/DecimalSeparator\";\r\nimport { ScientificTypeSelector } from \"./misc/ScientificType\";\r\nimport { StationSeparatorSelector } from \"./misc/StationSeparatorSelector\";\r\nimport { StationSizeSelector } from \"./misc/StationSizeSelector\";\r\nimport { UiIModelComponents } from \"../UiIModelComponents\";\r\n\r\n/** Properties of [[MiscFormatOptions]] component.\r\n * @alpha\r\n */\r\nexport interface MiscFormatOptionsProps extends CommonProps {\r\n formatProps: FormatProps;\r\n onChange?: (format: FormatProps) => void;\r\n enableMinimumProperties?: boolean;\r\n showOptions: boolean;\r\n onShowHideOptions: (show: boolean) => void;\r\n children?: React.ReactNode;\r\n}\r\n\r\n/** Component use to set miscellaneous properties is a Formatted Quantity.\r\n * @alpha\r\n */\r\nexport function MiscFormatOptions(props: MiscFormatOptionsProps) {\r\n const { formatProps, onChange, showOptions, onShowHideOptions, enableMinimumProperties } = props;\r\n\r\n const handleSetFormatProps = React.useCallback((newFormatProps: FormatProps) => {\r\n onChange && onChange(newFormatProps);\r\n }, [onChange]);\r\n\r\n const isFormatTraitSet = React.useCallback((trait: FormatTraits) => {\r\n return Format.isFormatTraitSetInProps(formatProps, trait);\r\n }, [formatProps]);\r\n\r\n const handleShowSignChange = React.useCallback((option: ShowSignOption) => {\r\n const newShowSignOption = showSignOptionToString(option);\r\n const newFormatProps = { ...formatProps, showSignOption: newShowSignOption };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const setFormatTrait = React.useCallback((trait: FormatTraits, setActive: boolean) => {\r\n const traitStr = getTraitString(trait);\r\n let formatTraits: string[] = [traitStr];\r\n if (setActive) {// setting trait\r\n // istanbul ignore else\r\n if (formatProps.formatTraits) {\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n // istanbul ignore else\r\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\r\n formatTraits = [...traits, traitStr];\r\n }\r\n }\r\n } else {// clearing trait\r\n // istanbul ignore next\r\n if (!formatProps.formatTraits)\r\n return;\r\n const traits = Array.isArray(formatProps.formatTraits) ? formatProps.formatTraits : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\r\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\r\n }\r\n const newFormatProps = { ...formatProps, formatTraits };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleShowTrailingZeroesChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleKeepDecimalPointChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleKeepSingleZeroChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleZeroEmptyChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleUseFractionDashChange = React.useCallback((e: React.ChangeEvent<HTMLInputElement>) => {\r\n setFormatTrait(FormatTraits.FractionDash, e.target.checked);\r\n }, [setFormatTrait]);\r\n\r\n const handleDecimalSeparatorChange = React.useCallback((decimalSeparator: string) => {\r\n let thousandSeparator = formatProps.thousandSeparator;\r\n // make sure 1000 and decimal separator do not match\r\n // istanbul ignore else\r\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\r\n switch (decimalSeparator) {\r\n case \".\":\r\n thousandSeparator = \",\";\r\n break;\r\n case \",\":\r\n thousandSeparator = \".\";\r\n break;\r\n }\r\n }\r\n const newFormatProps = { ...formatProps, thousandSeparator, decimalSeparator };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, isFormatTraitSet, handleSetFormatProps]);\r\n\r\n const handleScientificTypeChange = React.useCallback((type: ScientificType) => {\r\n const newFormatProps = { ...formatProps, scientificType: scientificTypeToString(type) };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleFormatChange = React.useCallback((newFormatProps: FormatProps) => {\r\n handleSetFormatProps(newFormatProps);\r\n }, [handleSetFormatProps]);\r\n\r\n const formatType = React.useMemo(() => parseFormatType(formatProps.type, \"format\"), [formatProps.type]);\r\n const showSignOption = React.useMemo(() => parseShowSignOption(formatProps.showSignOption ?? \"onlyNegative\", \"format\"), [formatProps.showSignOption]);\r\n\r\n const handleToggleButtonClick = React.useCallback(() => {\r\n onShowHideOptions(!showOptions);\r\n }, [onShowHideOptions, showOptions]);\r\n\r\n const handleKeyUpOnLink = React.useCallback((e: React.KeyboardEvent<HTMLAnchorElement>) => {\r\n // istanbul ignore else\r\n if (e.key === SpecialKey.Enter || e.key === SpecialKey.Space) {\r\n onShowHideOptions(!showOptions);\r\n e.preventDefault();\r\n }\r\n }, [onShowHideOptions, showOptions]);\r\n\r\n const handleStationSeparatorChange = React.useCallback((value: string) => {\r\n const newFormatProps = { ...formatProps, stationSeparator: value };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const handleStationOffsetChange = React.useCallback((value: number) => {\r\n const newFormatProps = { ...formatProps, stationOffsetSize: value };\r\n handleSetFormatProps(newFormatProps);\r\n }, [formatProps, handleSetFormatProps]);\r\n\r\n const signOptionLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.signOptionLabel\"));\r\n const stationOffsetLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationOffsetLabel\"));\r\n const stationSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.stationSeparatorLabel\"));\r\n const decimalSeparatorLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.decimalSeparatorLabel\"));\r\n const showTrailZerosLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.showTrailZerosLabel\"));\r\n const keepSingleZeroLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepSingleZeroLabel\"));\r\n const zeroEmptyLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.zeroEmptyLabel\"));\r\n const moreLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.moreLabel\"));\r\n const lessLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.lessLabel\"));\r\n const keepDecimalPointLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.keepDecimalPointLabel\"));\r\n const fractionDashLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.fractionDashLabel\"));\r\n const scientificTypeLabel = React.useRef(UiIModelComponents.translate(\"QuantityFormat.labels.scientificTypeLabel\"));\r\n\r\n return (\r\n <>\r\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\r\n enableMinimumProperties && !showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\r\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-more\" tabIndex={0} >{moreLabel.current}</a>}\r\n {\r\n (!enableMinimumProperties || showOptions) &&\r\n <>\r\n <span className={\"uicore-label\"}>{signOptionLabel.current}</span>\r\n <SignOptionSelector data-testid=\"sign-option-selector\" signOption={showSignOption} onChange={handleShowSignChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationOffsetLabel.current}</span>\r\n <StationSizeSelector data-testid=\"station-size-selector\" value={(formatProps.stationOffsetSize ?? 2)}\r\n disabled={formatType !== FormatType.Station} onChange={handleStationOffsetChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Station && \"uicore-disabled\")}>{stationSeparatorLabel.current}</span>\r\n <StationSeparatorSelector data-testid=\"station-separator-selector\" separator={(undefined !== formatProps.stationSeparator ? formatProps.stationSeparator : \"+\")}\r\n disabled={formatType !== FormatType.Station} onChange={handleStationSeparatorChange} />\r\n\r\n <ThousandsSeparator formatProps={formatProps} onChange={handleFormatChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{decimalSeparatorLabel.current}</span>\r\n <DecimalSeparatorSelector data-testid=\"decimal-separator-selector\" separator={formatProps.decimalSeparator ?? \".\"} onChange={handleDecimalSeparatorChange} disabled={formatType === FormatType.Fractional} />\r\n\r\n <span className={\"uicore-label\"}>{showTrailZerosLabel.current}</span>\r\n <Checkbox data-testid=\"show-trail-zeros\" checked={isFormatTraitSet(FormatTraits.TrailZeroes)} onChange={handleShowTrailingZeroesChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType === FormatType.Fractional && \"uicore-disabled\")}>{keepDecimalPointLabel.current}</span>\r\n <Checkbox data-testid=\"keep-decimal-point\" checked={isFormatTraitSet(FormatTraits.KeepDecimalPoint)} onChange={handleKeepDecimalPointChange} />\r\n\r\n <span className={\"uicore-label\"}>{keepSingleZeroLabel.current}</span>\r\n <Checkbox data-testid=\"keep-single-zero\" checked={isFormatTraitSet(FormatTraits.KeepSingleZero)} onChange={handleKeepSingleZeroChange} />\r\n\r\n <span className={\"uicore-label\"}>{zeroEmptyLabel.current}</span>\r\n <Checkbox data-testid=\"zero-empty\" checked={isFormatTraitSet(FormatTraits.ZeroEmpty)} onChange={handleZeroEmptyChange} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Fractional && \"uicore-disabled\")}>{fractionDashLabel.current}</span>\r\n <Checkbox data-testid=\"fraction-dash\" checked={isFormatTraitSet(FormatTraits.FractionDash)} onChange={handleUseFractionDashChange} disabled={formatType !== FormatType.Fractional} />\r\n\r\n <span className={classnames(\"uicore-label\", formatType !== FormatType.Scientific && \"uicore-disabled\")}>{scientificTypeLabel.current}</span>\r\n <ScientificTypeSelector data-testid=\"scientific-type-selector\" type={(formatProps.scientificType && formatProps.scientificType.length > 0) ? parseScientificType(formatProps.scientificType, \"custom\") : ScientificType.Normalized}\r\n disabled={formatType !== FormatType.Scientific} onChange={handleScientificTypeChange} />\r\n\r\n {props.children}\r\n\r\n { // eslint-disable-next-line jsx-a11y/anchor-is-valid\r\n enableMinimumProperties && showOptions && <a onClick={handleToggleButtonClick} onKeyUp={handleKeyUpOnLink}\r\n className={\"components-quantityFormat-more-less\"} role=\"link\" data-testid=\"quantityFormat-less\" tabIndex={0}>{lessLabel.current}</a>}\r\n </>\r\n }\r\n </>\r\n );\r\n}\r\n"]}
|