@itwin/imodel-components-react 4.7.2 → 4.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. package/CHANGELOG.md +3 -3
  2. package/lib/cjs/imodel-components-react/UiIModelComponents.js +4 -2
  3. package/lib/cjs/imodel-components-react/UiIModelComponents.js.map +1 -1
  4. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js +1 -1
  5. package/lib/cjs/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  6. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  7. package/lib/cjs/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  8. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js +10 -5
  9. package/lib/cjs/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  10. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  11. package/lib/cjs/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  12. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js +2 -1
  13. package/lib/cjs/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  14. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js +2 -2
  15. package/lib/cjs/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  16. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js +2 -3
  17. package/lib/cjs/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  18. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js +2 -1
  19. package/lib/cjs/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  20. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js +10 -6
  21. package/lib/cjs/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  22. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js +7 -3
  23. package/lib/cjs/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  24. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +2 -1
  25. package/lib/cjs/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  26. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js +2 -2
  27. package/lib/cjs/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  28. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js +9 -7
  29. package/lib/cjs/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  30. package/lib/esm/imodel-components-react/UiIModelComponents.js +4 -2
  31. package/lib/esm/imodel-components-react/UiIModelComponents.js.map +1 -1
  32. package/lib/esm/imodel-components-react/color/ColorPickerButton.js +1 -1
  33. package/lib/esm/imodel-components-react/color/ColorPickerButton.js.map +1 -1
  34. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js +1 -1
  35. package/lib/esm/imodel-components-react/inputs/QuantityNumberInput.js.map +1 -1
  36. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js +10 -5
  37. package/lib/esm/imodel-components-react/navigationaids/CubeNavigationAid.js.map +1 -1
  38. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js +1 -1
  39. package/lib/esm/imodel-components-react/quantityformat/FormatPanel.js.map +1 -1
  40. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js +2 -1
  41. package/lib/esm/imodel-components-react/quantityformat/FormatPrecision.js.map +1 -1
  42. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js +2 -2
  43. package/lib/esm/imodel-components-react/quantityformat/FormatSample.js.map +1 -1
  44. package/lib/esm/imodel-components-react/quantityformat/FormatType.js +2 -3
  45. package/lib/esm/imodel-components-react/quantityformat/FormatType.js.map +1 -1
  46. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js +2 -1
  47. package/lib/esm/imodel-components-react/quantityformat/FormatUnitLabel.js.map +1 -1
  48. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js +10 -6
  49. package/lib/esm/imodel-components-react/quantityformat/FormatUnits.js.map +1 -1
  50. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js +7 -3
  51. package/lib/esm/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
  52. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js +2 -1
  53. package/lib/esm/imodel-components-react/quantityformat/misc/ThousandsSeparator.js.map +1 -1
  54. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js +2 -2
  55. package/lib/esm/imodel-components-react/timeline/TimelineComponent.js.map +1 -1
  56. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js +9 -7
  57. package/lib/esm/imodel-components-react/viewport/ViewportComponent.js.map +1 -1
  58. package/package.json +5 -5
@@ -1 +1 @@
1
- {"version":3,"file":"CubeNavigationAid.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/navigationaids/CubeNavigationAid.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,4BAA4B,CAAC;AAEpC,cAAc;AACd,MAAM,CAAN,IA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,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,SAAS;IACvB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,WAAW;IAC3B,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,WAAW;IAC3B,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,YAAY;CAC9B,CAAC;AAUF,MAAM,aAAc,SAAQ,KAAK,CAAC,SAAuB;IAAzD;;QAwBU,iBAAY,GAAG,CAAC,KAAuB,EAAE,EAAE;YACjD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YACnC,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC;IA5BiB,MAAM;QACpB,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC3E,MAAM,OAAO,GAAG,UAAU,CACxB,cAAc,EACd,MAAM,EACN,YAAY,CAAC,WAAW,CAAC,EACzB,OAAO,IAAI,cAAc,CAC1B,CAAC;QAEF,OAAO;QACL,iEAAiE;QACjE,6BACE,SAAS,EAAE,OAAO,EAClB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,KAAK,KACR,KAAK,EACT,OAAO,EAAE,IAAI,CAAC,YAAY;YAE1B,oBAAC,IAAI,IAAC,QAAQ,EAAE,eAAe,CAAC,WAAW,CAAC,GAAI;YAAC,GAAG,CAChD,CACP,CAAC;IACJ,CAAC;CAMF","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 NavigationAids\n */\n\nimport \"./CubeNavigationAid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { XYAndZ } from \"@itwin/core-geometry\";\nimport {\n Angle,\n AxisIndex,\n AxisOrder,\n Geometry,\n Matrix3d,\n Point2d,\n Vector2d,\n Vector3d,\n} from \"@itwin/core-geometry\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { CommonProps, IconSpec } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport type { ViewRotationChangeEventArgs } from \"../viewport/ViewportComponentEvents\";\nimport { ViewportComponentEvents } from \"../viewport/ViewportComponentEvents\";\nimport { Cube, Face } from \"./Cube\";\nimport {\n SvgCaretDown,\n SvgCaretLeft,\n SvgCaretRight,\n SvgCaretUp,\n} from \"@itwin/itwinui-icons-react\";\n\n/** @public */\nexport enum CubeNavigationHitBoxX {\n None = 0,\n Right = 1,\n Left = -1,\n}\n\n/** @public */\nexport enum CubeNavigationHitBoxY {\n None = 0,\n Back = 1,\n Front = -1,\n}\n\n/** @public */\nexport enum CubeNavigationHitBoxZ {\n None = 0,\n Top = 1,\n Bottom = -1,\n}\n\ninterface CubeNavigationRotationMap {\n up: Face;\n down: Face;\n left: Face;\n right: Face;\n}\n\nconst cubeNavigationFaceLocs: { [key: string]: Vector3d } = {\n [Face.Left]: Vector3d.create(\n CubeNavigationHitBoxX.Left,\n CubeNavigationHitBoxY.None,\n CubeNavigationHitBoxZ.None\n ),\n [Face.Right]: Vector3d.create(\n CubeNavigationHitBoxX.Right,\n CubeNavigationHitBoxY.None,\n CubeNavigationHitBoxZ.None\n ),\n [Face.Back]: Vector3d.create(\n CubeNavigationHitBoxX.None,\n CubeNavigationHitBoxY.Back,\n CubeNavigationHitBoxZ.None\n ),\n [Face.Front]: Vector3d.create(\n CubeNavigationHitBoxX.None,\n CubeNavigationHitBoxY.Front,\n CubeNavigationHitBoxZ.None\n ),\n [Face.Bottom]: Vector3d.create(\n CubeNavigationHitBoxX.None,\n CubeNavigationHitBoxY.None,\n CubeNavigationHitBoxZ.Bottom\n ),\n [Face.Top]: Vector3d.create(\n CubeNavigationHitBoxX.None,\n CubeNavigationHitBoxY.None,\n CubeNavigationHitBoxZ.Top\n ),\n};\n\nconst cubeNavigationFaceRotations: { [key: string]: Matrix3d } = {\n [Face.Left]: Matrix3d.createRowValues(0, -1, 0, 0, 0, 1, -1, 0, 0),\n [Face.Right]: Matrix3d.createRowValues(0, 1, 0, 0, 0, 1, 1, 0, 0),\n [Face.Back]: Matrix3d.createRowValues(-1, 0, 0, 0, 0, 1, 0, 1, 0),\n [Face.Front]: Matrix3d.createRowValues(1, 0, 0, 0, 0, 1, 0, -1, 0),\n [Face.Bottom]: Matrix3d.createRowValues(1, 0, 0, 0, -1, 0, 0, 0, -1),\n [Face.Top]: Matrix3d.createRowValues(1, 0, 0, 0, 1, 0, 0, 0, 1),\n};\n\n// data relating Up/Down/Left/Right directions relative to every surface\nconst cubeNavigationRoutes: { [key: string]: CubeNavigationRotationMap } = {\n [Face.Front]: {\n up: Face.Top,\n down: Face.Bottom,\n left: Face.Left,\n right: Face.Right,\n },\n [Face.Back]: {\n up: Face.Top,\n down: Face.Bottom,\n left: Face.Right,\n right: Face.Left,\n },\n [Face.Top]: {\n up: Face.Back,\n down: Face.Front,\n left: Face.Left,\n right: Face.Right,\n },\n [Face.Bottom]: {\n up: Face.Front,\n down: Face.Back,\n left: Face.Left,\n right: Face.Right,\n },\n [Face.Right]: {\n up: Face.Top,\n down: Face.Bottom,\n left: Face.Front,\n right: Face.Back,\n },\n [Face.Left]: {\n up: Face.Top,\n down: Face.Bottom,\n left: Face.Back,\n right: Face.Front,\n },\n};\n\n/** The default tolerance (1.0e-6) is appropriate if very dirty viewing operations are expected. */\nconst DEFAULT_TOLERANCE = 1.0e-6;\n\n/** @internal */\nexport enum CubeHover {\n None = 0,\n Hover,\n Active,\n}\n\n/** Properties for the [[CubeNavigationAid]] component\n * @public\n */\nexport interface CubeNavigationAidProps extends CommonProps {\n iModelConnection: IModelConnection;\n viewport?: Viewport;\n\n // used only in testing\n\n /** @internal */\n onAnimationEnd?: () => void;\n /** @internal */\n animationTime?: number;\n favorHeadsUpRotation?: boolean;\n}\n\n/** @public */\ninterface CubeNavigationAidState {\n dragging: boolean;\n startRotMatrix: Matrix3d;\n endRotMatrix: Matrix3d;\n animation: number;\n hoverMap: { [key: string]: CubeHover };\n face: Face;\n}\n\n/** Cube Navigation Aid Component\n * @public\n */\nexport class CubeNavigationAid extends React.Component<\n CubeNavigationAidProps,\n CubeNavigationAidState\n> {\n private _start: Vector2d = Vector2d.createZero();\n /** @internal */\n public override readonly state: Readonly<CubeNavigationAidState> = {\n dragging: false,\n startRotMatrix: Matrix3d.createIdentity(),\n endRotMatrix: Matrix3d.createIdentity(),\n animation: 1,\n hoverMap: {},\n face: Face.Top,\n };\n\n private _lastTime: number | undefined;\n private _animationFrame: any;\n private _mounted: boolean = false;\n private _labels: { [key: string]: string } = {\n [Face.Right]: UiIModelComponents.translate(\"cube.right\"),\n [Face.Left]: UiIModelComponents.translate(\"cube.left\"),\n [Face.Back]: UiIModelComponents.translate(\"cube.back\"),\n [Face.Front]: UiIModelComponents.translate(\"cube.front\"),\n [Face.Top]: UiIModelComponents.translate(\"cube.top\"),\n [Face.Bottom]: UiIModelComponents.translate(\"cube.bottom\"),\n };\n\n /** @internal */\n public override componentDidMount() {\n this._mounted = true;\n ViewportComponentEvents.onViewRotationChangeEvent.addListener(\n this._handleViewRotationChangeEvent\n );\n\n // set initial rotation\n if (this.props.viewport) {\n const newMatrix = this.props.viewport.view.getRotation().clone();\n this.setState({\n startRotMatrix: newMatrix,\n endRotMatrix: newMatrix,\n animation: 1,\n });\n }\n }\n\n /** @internal */\n public override componentWillUnmount() {\n ViewportComponentEvents.onViewRotationChangeEvent.removeListener(\n this._handleViewRotationChangeEvent\n );\n clearTimeout(this._animationFrame);\n this._mounted = false;\n }\n\n // Synchronize with rotation coming from the Viewport\n private _handleViewRotationChangeEvent = (\n args: ViewRotationChangeEventArgs\n ) => {\n const { animation, dragging, endRotMatrix } = this.state;\n // istanbul ignore else\n if (this.props.viewport === args.viewport && animation >= 1 && !dragging) {\n const newMatrix = this.props.viewport.view.getRotation().clone();\n if (!endRotMatrix.isAlmostEqual(newMatrix)) {\n this.setState({\n startRotMatrix: newMatrix,\n endRotMatrix: newMatrix,\n animation: 1,\n face: Face.None,\n });\n }\n }\n };\n\n private _animation = () => {\n const t = Date.now();\n const delta = this._lastTime ? t - this._lastTime : 16;\n this._lastTime = t;\n if (this.state.animation !== 1) {\n const animation = Math.min(\n 1,\n this.state.animation +\n delta /\n (1000 *\n (this.props.animationTime || /* istanbul ignore next */ 0.4))\n );\n\n // istanbul ignore next\n if (this._mounted) {\n this.setState({ animation }, () => {\n this._animationFrame = setTimeout(this._animation, 16.667);\n });\n }\n } else {\n this._lastTime = undefined;\n this._animationEnd();\n }\n };\n\n private _animationEnd = () => {\n ViewportComponentEvents.setCubeMatrix(\n this.state.endRotMatrix,\n this.state.face,\n true\n );\n const startRotMatrix = this.state.endRotMatrix.clone();\n // istanbul ignore next\n if (this._mounted) {\n this.setState({ startRotMatrix }, () => {\n // istanbul ignore else\n if (this.props.onAnimationEnd) this.props.onAnimationEnd();\n });\n }\n };\n\n private static _animationFn = (t: number) =>\n t < 0.5 ? 2 * t ** 2 : -1 + (4 - 2 * t) * t;\n\n private static _isMatrixFace = (matrix: Matrix3d): boolean => {\n let sum = 0;\n for (const coff of matrix.coffs) {\n if (Geometry.isAlmostEqualNumber(Math.abs(coff), 1)) sum++;\n }\n // Assuming matrix is a proper rotation matrix:\n // if matrix viewing a face, there will be a total of 3 values either almost -1, or almost 1.\n return sum === 3;\n };\n\n public override render(): React.ReactNode {\n const { animation, startRotMatrix, endRotMatrix } = this.state;\n const visible =\n CubeNavigationAid._isMatrixFace(endRotMatrix) && animation === 1.0;\n const rotMatrix = CubeNavigationAid._interpolateRotMatrix(\n startRotMatrix,\n animation,\n endRotMatrix\n );\n if (rotMatrix !== startRotMatrix && rotMatrix !== endRotMatrix)\n ViewportComponentEvents.setCubeMatrix(rotMatrix, Face.None);\n\n const faces: { [key: string]: React.ReactNode } = {};\n for (const key in this._labels) {\n // istanbul ignore else\n if (this._labels.hasOwnProperty(key)) {\n const f = key as Face;\n const label = this._labels[f];\n faces[f] = (\n <NavCubeFace\n face={f}\n label={label}\n hoverMap={this.state.hoverMap}\n onFaceCellClick={this._handleFaceCellClick}\n onFaceCellHoverChange={this._handleCellHoverChange}\n />\n );\n }\n }\n\n const cubeClassNames = classnames(\n \"nav-cube\",\n this.state.dragging && \"cube-dragging\"\n );\n\n const upTitle = this.getArrowTitle(Pointer.Up);\n const downTitle = this.getArrowTitle(Pointer.Down);\n const leftTitle = this.getArrowTitle(Pointer.Left);\n const rightTitle = this.getArrowTitle(Pointer.Right);\n\n return (\n <div\n className={classnames(\n \"components-cube-container\",\n this.props.className\n )}\n style={this.props.style}\n data-testid=\"components-cube-navigation-aid\"\n onMouseDown={this._handleBoxMouseDown}\n onTouchStart={this._handleBoxTouchStart}\n role=\"presentation\"\n >\n <div className={\"cube-element-container\"}>\n <Cube\n className={cubeClassNames}\n rotMatrix={rotMatrix}\n faces={faces}\n />\n </div>\n <PointerButton\n data-testid=\"cube-pointer-button-up\"\n visible={visible}\n pointerType={Pointer.Up}\n onArrowClick={this._onArrowClick}\n title={upTitle}\n />\n <PointerButton\n data-testid=\"cube-pointer-button-down\"\n visible={visible}\n pointerType={Pointer.Down}\n onArrowClick={this._onArrowClick}\n title={downTitle}\n />\n <PointerButton\n data-testid=\"cube-pointer-button-left\"\n visible={visible}\n pointerType={Pointer.Left}\n onArrowClick={this._onArrowClick}\n title={leftTitle}\n />\n <PointerButton\n data-testid=\"cube-pointer-button-right\"\n visible={visible}\n pointerType={Pointer.Right}\n onArrowClick={this._onArrowClick}\n title={rightTitle}\n />\n </div>\n );\n }\n\n private _handleCellHoverChange = (vect: Vector3d, state: CubeHover) => {\n if (this._isInteractionLocked()) {\n this.props.onAnimationEnd?.();\n return;\n }\n const hoverMap = this.state.hoverMap;\n hoverMap[`${vect.x}-${vect.y}-${vect.z}`] = state;\n this.setState({ hoverMap });\n };\n\n private _isInteractionLocked = () => {\n // Locked by markup\n if (\n undefined !== this.props.viewport &&\n this.props.viewport === IModelApp.toolAdmin.markupView\n ) {\n return true;\n }\n return false;\n };\n\n private static _getMatrixFace = (rotMatrix: Matrix3d): Face => {\n if (!CubeNavigationAid._isMatrixFace(rotMatrix)) {\n return Face.None;\n }\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Top].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Top].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Top].coffs[8]\n )\n return Face.Top;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] ===\n cubeNavigationFaceRotations[Face.Bottom].coffs[6] &&\n rotMatrix.coffs[7] ===\n cubeNavigationFaceRotations[Face.Bottom].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Bottom].coffs[8]\n )\n return Face.Bottom;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Left].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Left].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Left].coffs[8]\n )\n return Face.Left;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Right].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Right].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Right].coffs[8]\n )\n return Face.Right;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Back].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Back].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Back].coffs[8]\n )\n return Face.Back;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Front].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Front].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Front].coffs[8]\n )\n return Face.Front;\n\n return Face.None;\n };\n\n private static _interpolateRotMatrix = (\n start: Matrix3d,\n anim: number,\n end: Matrix3d\n ): Matrix3d => {\n if (anim === 0) return start;\n if (anim === 1 || start.isAlmostEqual(end)) return end;\n const startInverse = start.transpose();\n const diff = end.multiplyMatrixMatrix(startInverse);\n const angleAxis = diff.getAxisAndAngleOfRotation();\n // istanbul ignore else\n if (angleAxis.ok) {\n const angle = Angle.createRadians(\n angleAxis.angle.radians * CubeNavigationAid._animationFn(anim)\n );\n const newDiff = Matrix3d.createRotationAroundVector(\n angleAxis.axis,\n angle\n );\n // istanbul ignore else\n if (newDiff) {\n const newMatrix = newDiff.multiplyMatrixMatrix(start);\n return newMatrix;\n }\n }\n // istanbul ignore next\n return end;\n };\n\n private static correctSmallNumber(value: number, tolerance: number): number {\n return Math.abs(value) < tolerance ? 0 : value;\n }\n\n /**\n * Snap coordinates of a vector to zero and to each other so that the vector prefers to be\n * * perpendicular to a face of the unit cube.\n * * or pass through a nearby vertex or edge of the unit cube.\n * @param zVector existing z vector.\n * @param tolerance tolerance to determine if a z vector component is close to zero or 1.\n */\n private static snapVectorToCubeFeatures(\n zVector: XYAndZ,\n tolerance: number\n ): Vector3d {\n const x = CubeNavigationAid.correctSmallNumber(zVector.x, tolerance);\n let y = CubeNavigationAid.correctSmallNumber(zVector.y, tolerance);\n let z = CubeNavigationAid.correctSmallNumber(zVector.z, tolerance);\n\n const xx = x === -0 ? Math.abs(x) : x;\n const yy = y === -0 ? Math.abs(y) : y;\n const zz = z === -0 ? Math.abs(z) : z;\n\n // adjust any adjacent pair of near equal values to the first.\n // istanbul ignore next\n if (Geometry.isSameCoordinate(xx, yy, tolerance)) {\n y = Geometry.split3WaySign(y, -xx, xx, xx);\n }\n if (Geometry.isSameCoordinate(yy, zz, tolerance)) {\n z = Geometry.split3WaySign(z, -yy, yy, yy);\n }\n if (Geometry.isSameCoordinate(xx, zz, tolerance)) {\n z = Geometry.split3WaySign(z, -xx, xx, xx);\n }\n return Vector3d.create(x, y, z);\n }\n\n /**\n * Adjust a worldToView matrix to favor both\n * * direct view at faces, edges, and corners of a view cube.\n * * heads up\n * @param worldToView candidate matrix\n * @param tolerance tolerance for cleaning up fuzz. The default (1.0e-6) is appropriate if very dirty viewing operations are expected.\n * @param result optional result.\n */\n private static snapWorldToViewMatrixToCubeFeatures(\n worldToView: Matrix3d,\n tolerance: number,\n result?: Matrix3d,\n favorHeadsUpRotation?: boolean\n ): Matrix3d {\n const oldZ = worldToView.rowZ();\n const newZ = CubeNavigationAid.snapVectorToCubeFeatures(oldZ, tolerance);\n const headsUp = !!favorHeadsUpRotation;\n // If newZ is true up or down, it will have true 0 for x and y.\n // special case this to take x direction from the input.\n // This methodology results in always \"righting\" the face when rotation from an upside-down cube.\n // The behavior was made opt-in in response to https://github.com/iTwin/appui/issues/259\n // istanbul ignore next\n if (!headsUp || (newZ.x === 0.0 && newZ.y === 0)) {\n const perpVector = worldToView.rowX();\n result = Matrix3d.createRigidFromColumns(\n newZ,\n perpVector,\n AxisOrder.ZXY,\n result\n )!;\n } else {\n result = Matrix3d.createRigidViewAxesZTowardsEye(\n newZ.x,\n newZ.y,\n newZ.z,\n result\n );\n }\n // istanbul ignore else\n if (result) result.transposeInPlace();\n return result;\n }\n\n private getArrowRotationAndFace(arrow: Pointer): {\n newRotation: Matrix3d;\n face: Face;\n } {\n const localRotationAxis = Vector3d.create(0, 0, 0);\n switch (arrow) {\n case Pointer.Up:\n localRotationAxis.x = -1.0;\n break;\n case Pointer.Down:\n localRotationAxis.x = 1.0;\n break;\n case Pointer.Left:\n localRotationAxis.y = -1.0;\n break;\n default:\n localRotationAxis.y = 1.0;\n break;\n }\n const localRotation = Matrix3d.createRotationAroundVector(\n localRotationAxis,\n Angle.createDegrees(-90)\n )!;\n const newRotation = localRotation.multiplyMatrixMatrix(\n this.state.endRotMatrix\n );\n CubeNavigationAid.snapWorldToViewMatrixToCubeFeatures(\n newRotation,\n DEFAULT_TOLERANCE,\n newRotation,\n this.props.favorHeadsUpRotation\n );\n const face = CubeNavigationAid._getMatrixFace(newRotation);\n return { newRotation, face };\n }\n\n private _onArrowClick = (arrow: Pointer) => {\n if (this._isInteractionLocked()) {\n // istanbul ignore next\n this.props.onAnimationEnd?.();\n return;\n }\n const { newRotation, face } = this.getArrowRotationAndFace(arrow);\n this._animateRotation(newRotation, face);\n };\n\n private getArrowTitle(arrow: Pointer) {\n const { face } = this.getArrowRotationAndFace(arrow);\n return this._labels[face];\n }\n\n private _lastClientXY: Vector2d = Vector2d.createZero();\n private _processDrag(mousePos: Vector2d) {\n // istanbul ignore else\n if (!this._start.isAlmostEqual(mousePos)) {\n const movement = mousePos.minus(this._lastClientXY);\n const diff = movement.scale(0.05);\n\n const yaw = Angle.createRadians(diff.x);\n const pitch = Angle.createRadians(diff.y);\n\n const matX = Matrix3d.createRotationAroundAxisIndex(AxisIndex.X, pitch);\n const matZ = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, yaw);\n\n const mat = matX\n .multiplyMatrixMatrix(this.state.startRotMatrix)\n .multiplyMatrixMatrix(matZ);\n this._setRotation(mat, CubeNavigationAid._getMatrixFace(mat));\n if (!this.state.dragging) this.setState({ dragging: true });\n }\n this._lastClientXY = mousePos;\n }\n\n private _handleBoxMouseDown = (event: any) => {\n if (this._isInteractionLocked()) {\n this.props.onAnimationEnd?.();\n return;\n }\n event.preventDefault();\n // only start listening after drag is confirmed. Ie. the 3D box is clicked.\n window.addEventListener(\"mousemove\", this._onMouseMove, false);\n window.addEventListener(\"mouseup\", this._onMouseUp, false);\n this._lastClientXY = Vector2d.create(event.clientX, event.clientY);\n this._start = this._lastClientXY;\n };\n\n private _onMouseMove = (event: MouseEvent) => {\n const mousePos = Vector2d.create(event.clientX, event.clientY);\n this._processDrag(mousePos);\n };\n\n private _onMouseUp = () => {\n if (this.state.dragging) {\n this.setState({ dragging: false });\n ViewportComponentEvents.setCubeMatrix(\n this.state.endRotMatrix,\n CubeNavigationAid._getMatrixFace(this.state.endRotMatrix),\n true\n );\n }\n\n // remove so event only triggers after this.onMouseStartDrag\n window.removeEventListener(\"mousemove\", this._onMouseMove);\n window.removeEventListener(\"mouseup\", this._onMouseUp);\n };\n\n // istanbul ignore next - unable to test touch\n private _handleBoxTouchStart = (event: any) => {\n if (this._isInteractionLocked()) {\n this.props.onAnimationEnd?.();\n return;\n }\n if (1 !== event.targetTouches.length) return;\n window.addEventListener(\"touchmove\", this._onTouchMove, false);\n window.addEventListener(\"touchend\", this._onTouchEnd, false);\n this._lastClientXY = Vector2d.create(\n event.targetTouches[0].clientX,\n event.targetTouches[0].clientY\n );\n this._start = this._lastClientXY;\n };\n\n // istanbul ignore next - unable to test touch\n private _onTouchMove = (event: TouchEvent) => {\n if (1 !== event.targetTouches.length) return;\n const mousePos = Vector2d.create(\n event.targetTouches[0].clientX,\n event.targetTouches[0].clientY\n );\n this._processDrag(mousePos);\n };\n\n // istanbul ignore next - unable to test touch\n private _onTouchEnd = (event: TouchEvent) => {\n if (0 !== event.targetTouches.length) return;\n\n if (this.state.dragging) {\n this.setState({ dragging: false });\n ViewportComponentEvents.setCubeMatrix(\n this.state.endRotMatrix,\n CubeNavigationAid._getMatrixFace(this.state.endRotMatrix),\n true\n );\n }\n\n window.removeEventListener(\"touchmove\", this._onTouchMove);\n window.removeEventListener(\"touchend\", this._onTouchEnd);\n };\n\n private _handleFaceCellClick = (pos: Vector3d, face: Face) => {\n if (this._isInteractionLocked()) {\n this.props.onAnimationEnd?.();\n return;\n }\n const { endRotMatrix } = this.state;\n let rotMatrix = Matrix3d.createRigidViewAxesZTowardsEye(\n pos.x,\n pos.y,\n pos.z\n ).inverse();\n // istanbul ignore else\n if (rotMatrix) {\n // if isMatrixFace and user is clicking on top/bottom, the current matrix face must be top or bottom\n if (\n !CubeNavigationAid._isMatrixFace(endRotMatrix) &&\n (face === Face.Top || face === Face.Bottom)\n ) {\n const angleAxis = endRotMatrix.getAxisAndAngleOfRotation();\n // istanbul ignore else\n if (angleAxis.ok) {\n const xAx = endRotMatrix.columnX();\n const a = Math.atan2(xAx.y, xAx.x);\n const r = (Math.round((a * 2) / Math.PI) * Math.PI) / 2; // round to quarter turn intervals\n const rot = Matrix3d.createRotationAroundAxisIndex(\n AxisIndex.Z,\n Angle.createRadians(r)\n );\n rotMatrix = rot.multiplyMatrixMatrix(rotMatrix);\n }\n }\n this._animateRotation(rotMatrix, face);\n }\n window.removeEventListener(\"mousemove\", this._onMouseMove);\n };\n\n private _animateRotation = (endRotMatrix: Matrix3d, face: Face) => {\n if (this.state.endRotMatrix.isAlmostEqual(endRotMatrix)) return;\n // set animation variables, let css transitions animate it.\n this._animationFrame = setTimeout(this._animation, 16.667);\n this.setState((prevState) => ({\n startRotMatrix: prevState.endRotMatrix,\n endRotMatrix,\n animation: 0,\n face,\n }));\n };\n\n private _setRotation = (endRotMatrix: Matrix3d, face: Face) => {\n ViewportComponentEvents.setCubeMatrix(endRotMatrix, face);\n // set variables, with animTime at 0 to prevent animation.\n this.setState({\n startRotMatrix: endRotMatrix,\n endRotMatrix,\n animation: 1,\n face,\n });\n };\n}\n\n/** @internal */\nexport interface NavCubeFaceProps\n extends React.AllHTMLAttributes<HTMLDivElement> {\n face: Face;\n label: string;\n hoverMap: { [key: string]: CubeHover };\n onFaceCellClick: (vector: Vector3d, face: Face) => void;\n onFaceCellHoverChange: (vector: Vector3d, state: CubeHover) => void;\n}\n\n/** @internal */\nexport class NavCubeFace extends React.Component<NavCubeFaceProps> {\n private includeCell(vector: Vector3d): boolean {\n const { x, y, z } = vector;\n const omittedCell =\n (y === 0 && x !== 0 && z !== 0) ||\n (y !== 0 && x === 0 && z !== 0) ||\n (y !== 0 && x !== 0 && z === 0);\n return !omittedCell;\n }\n public override render(): React.ReactNode {\n const { face, hoverMap, onFaceCellClick, onFaceCellHoverChange, label } =\n this.props;\n return (\n <div className=\"nav-cube-face\" data-testid=\"nav-cube-face\">\n {[-1, 0, 1].map((y: number) => {\n return (\n <FaceRow key={y} center={y === 0}>\n {[-1, 0, 1].map((x: number) => {\n const vector = NavCubeFace.faceCellToPos(face, x, y);\n if (this.includeCell(vector)) {\n // return a fully functional cell\n return (\n <FaceCell\n key={x}\n onFaceCellHoverChange={onFaceCellHoverChange}\n onFaceCellClick={onFaceCellClick}\n hoverMap={hoverMap}\n vector={vector}\n face={face}\n center={x === 0}\n >\n {x === 0 && y === 0 && label}\n </FaceCell>\n );\n } else {\n // return a placeholder cell\n return (\n <FaceCell\n key={x}\n vector={vector}\n face={face}\n center={x === 0}\n />\n );\n }\n })}\n </FaceRow>\n );\n })}\n </div>\n );\n }\n public static faceCellToPos = (face: Face, x: number, y: number) => {\n const faceVect = cubeNavigationFaceLocs[face];\n const route = cubeNavigationRoutes[face];\n\n const faceX = x < 0 ? route.left : x > 0 ? route.right : Face.None;\n const xVect =\n faceX !== Face.None\n ? cubeNavigationFaceLocs[faceX]\n : Vector3d.createZero();\n\n const faceY = y < 0 ? route.up : y > 0 ? route.down : Face.None;\n const yVect =\n faceY !== Face.None\n ? cubeNavigationFaceLocs[faceY]\n : Vector3d.createZero();\n\n return faceVect.plus(xVect).plus(yVect);\n };\n}\n\ninterface FaceRowProps extends React.AllHTMLAttributes<HTMLDivElement> {\n center?: boolean;\n}\n\nclass FaceRow extends React.Component<FaceRowProps> {\n public override render(): React.ReactNode {\n const { center, children, ...props } = this.props;\n const classNames = classnames(\"face-row\", center && \"cube-center\");\n return (\n <div className={classNames} {...props}>\n {children}\n </div>\n );\n }\n}\n\n/** @internal */\nexport interface FaceCellProps extends React.AllHTMLAttributes<HTMLDivElement> {\n center?: boolean;\n onFaceCellClick?: (vector: Vector3d, face: Face) => void;\n onFaceCellHoverChange?: (vector: Vector3d, state: CubeHover) => void;\n hoverMap?: { [key: string]: CubeHover };\n vector: Vector3d;\n face: Face;\n}\n\n/** @internal */\nexport class FaceCell extends React.Component<FaceCellProps> {\n private _startMouse: Point2d | undefined;\n public override render(): React.ReactNode {\n const {\n center,\n children,\n onFaceCellClick,\n onFaceCellHoverChange,\n hoverMap,\n face,\n vector,\n ...props\n } = this.props;\n const { x, y, z } = vector;\n const n = `${x}-${y}-${z}`;\n const hover = hoverMap && hoverMap[n] === CubeHover.Hover;\n const active = hoverMap && hoverMap[n] === CubeHover.Active;\n const classNames = classnames(\n \"face-cell\",\n center && \"cube-center\",\n hover && \"cube-hover\",\n active && \"cube-active\"\n );\n\n return (\n <div // eslint-disable-line jsx-a11y/mouse-events-have-key-events\n onMouseDown={this._handleMouseDown}\n onMouseUp={this._handleMouseUp}\n onMouseOver={this._handleMouseOver}\n onMouseOut={this._handleMouseOut}\n onTouchStart={this._handleTouchStart}\n onTouchEnd={this._handleTouchEnd}\n data-testid={`nav-cube-face-cell-${face}-${n}`}\n className={classNames}\n role=\"presentation\"\n {...props}\n >\n {children}\n </div>\n );\n }\n private _handleMouseOver = () => {\n const { vector } = this.props;\n this.props.onFaceCellHoverChange &&\n this.props.onFaceCellHoverChange(vector, CubeHover.Hover);\n };\n private _handleMouseOut = () => {\n const { vector } = this.props;\n this.props.onFaceCellHoverChange &&\n this.props.onFaceCellHoverChange(vector, CubeHover.None);\n };\n private _handleMouseDown = (event: React.MouseEvent) => {\n const { clientX, clientY } = event;\n this.handlePointerDown(clientX, clientY);\n };\n private _handleMouseUp = (event: React.MouseEvent) => {\n const { clientX, clientY } = event;\n this.handlePointerUp(clientX, clientY);\n };\n\n private _handleTouchStart = (event: React.TouchEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.targetTouches.length === 1 &&\n this.handlePointerDown(\n event.targetTouches[0].clientX,\n event.targetTouches[0].clientY\n );\n };\n\n private _handleTouchEnd = (event: React.TouchEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.changedTouches.length === 1 &&\n this.handlePointerUp(\n event.changedTouches[0].clientX,\n event.changedTouches[0].clientY\n );\n };\n\n private handlePointerDown(x: number, y: number) {\n const { vector } = this.props;\n this._startMouse = Point2d.create(x, y);\n this.props.onFaceCellHoverChange &&\n this.props.onFaceCellHoverChange(vector, CubeHover.Active);\n }\n\n private handlePointerUp(x: number, y: number) {\n const { vector, face } = this.props;\n this.props.onFaceCellHoverChange &&\n this.props.onFaceCellHoverChange(vector, CubeHover.None);\n const mouse = Point2d.create(x, y);\n if (this._startMouse && this._startMouse.isAlmostEqual(mouse)) {\n const isFace =\n Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z) === 1;\n this.props.onFaceCellClick &&\n this.props.onFaceCellClick(vector, isFace ? face : Face.None);\n }\n }\n}\n\nenum Pointer {\n None = 0,\n Up,\n Down,\n Left,\n Right,\n}\n\nconst pointerIconSpec: { [key: number]: IconSpec } = {\n [Pointer.Up]: <SvgCaretDown />,\n [Pointer.Down]: <SvgCaretUp />,\n [Pointer.Left]: <SvgCaretRight />,\n [Pointer.Right]: <SvgCaretLeft />,\n};\n\nconst pointerClass: { [key: number]: string } = {\n [Pointer.Up]: \"cube-up\",\n [Pointer.Down]: \"cube-down\",\n [Pointer.Left]: \"cube-left\",\n [Pointer.Right]: \"cube-right\",\n};\n\ninterface PointerProps extends React.AllHTMLAttributes<HTMLDivElement> {\n visible: boolean;\n pointerType: Pointer;\n onArrowClick(pointer: Pointer): void;\n title: string;\n [\"data-testid\"]?: string;\n}\n\nclass PointerButton extends React.Component<PointerProps> {\n public override render(): React.ReactNode {\n const { visible, pointerType, onArrowClick, title, ...props } = this.props;\n const classes = classnames(\n \"cube-pointer\",\n \"icon\",\n pointerClass[pointerType],\n visible && \"cube-visible\"\n );\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div\n className={classes}\n role=\"button\"\n tabIndex={-1}\n title={title}\n {...props}\n onClick={this._handleClick}\n >\n <Icon iconSpec={pointerIconSpec[pointerType]} />{\" \"}\n </div>\n );\n }\n private _handleClick = (event: React.MouseEvent) => {\n const { pointerType } = this.props;\n event.preventDefault();\n this.props.onArrowClick(pointerType);\n };\n}\n"]}
1
+ {"version":3,"file":"CubeNavigationAid.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/navigationaids/CubeNavigationAid.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,0BAA0B,CAAC;AAClC,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EACL,KAAK,EACL,SAAS,EACT,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,uBAAuB,EAAE,MAAM,qCAAqC,CAAC;AAC9E,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,UAAU,GACX,MAAM,4BAA4B,CAAC;AAEpC,cAAc;AACd,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,iEAAQ,CAAA;IACR,mEAAS,CAAA;IACT,kEAAS,CAAA;AACX,CAAC,EAJW,qBAAqB,KAArB,qBAAqB,QAIhC;AAED,cAAc;AACd,MAAM,CAAN,IAAY,qBAIX;AAJD,WAAY,qBAAqB;IAC/B,iEAAQ,CAAA;IACR,iEAAQ,CAAA;IACR,oEAAU,CAAA;AACZ,CAAC,EAJW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AK,CAAC,SAAuB;IAAzD;;QAwBU,iBAAY,GAAG,CAAC,KAAuB,EAAE,EAAE;YACjD,MAAM,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YACnC,KAAK,CAAC,cAAc,EAAE,CAAC;YACvB,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC;QACvC,CAAC,CAAC;IACJ,CAAC;IA5BiB,MAAM;QACpB,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;QAC3E,MAAM,OAAO,GAAG,UAAU,CACxB,cAAc,EACd,MAAM,EACN,YAAY,CAAC,WAAW,CAAC,EACzB,OAAO,IAAI,cAAc,CAC1B,CAAC;QAEF,OAAO;QACL,iEAAiE;QACjE,6BACE,SAAS,EAAE,OAAO,EAClB,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,CAAC,CAAC,EACZ,KAAK,EAAE,KAAK,KACR,KAAK,EACT,OAAO,EAAE,IAAI,CAAC,YAAY;YAE1B,oBAAC,IAAI,IAAC,QAAQ,EAAE,eAAe,CAAC,WAAW,CAAC,GAAI;YAAC,GAAG,CAChD,CACP,CAAC;IACJ,CAAC;CAMF","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 NavigationAids\n */\n\nimport \"./CubeNavigationAid.scss\";\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { XYAndZ } from \"@itwin/core-geometry\";\nimport {\n Angle,\n AxisIndex,\n AxisOrder,\n Geometry,\n Matrix3d,\n Point2d,\n Vector2d,\n Vector3d,\n} from \"@itwin/core-geometry\";\nimport type { IModelConnection, Viewport } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { CommonProps, IconSpec } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport type { ViewRotationChangeEventArgs } from \"../viewport/ViewportComponentEvents\";\nimport { ViewportComponentEvents } from \"../viewport/ViewportComponentEvents\";\nimport { Cube, Face } from \"./Cube\";\nimport {\n SvgCaretDown,\n SvgCaretLeft,\n SvgCaretRight,\n SvgCaretUp,\n} from \"@itwin/itwinui-icons-react\";\n\n/** @public */\nexport enum CubeNavigationHitBoxX {\n None = 0,\n Right = 1,\n Left = -1,\n}\n\n/** @public */\nexport enum CubeNavigationHitBoxY {\n None = 0,\n Back = 1,\n Front = -1,\n}\n\n/** @public */\nexport enum CubeNavigationHitBoxZ {\n None = 0,\n Top = 1,\n Bottom = -1,\n}\n\ninterface CubeNavigationRotationMap {\n up: Face;\n down: Face;\n left: Face;\n right: Face;\n}\n\nconst cubeNavigationFaceLocs: { [key: string]: Vector3d } = {\n [Face.Left]: Vector3d.create(\n CubeNavigationHitBoxX.Left,\n CubeNavigationHitBoxY.None,\n CubeNavigationHitBoxZ.None\n ),\n [Face.Right]: Vector3d.create(\n CubeNavigationHitBoxX.Right,\n CubeNavigationHitBoxY.None,\n CubeNavigationHitBoxZ.None\n ),\n [Face.Back]: Vector3d.create(\n CubeNavigationHitBoxX.None,\n CubeNavigationHitBoxY.Back,\n CubeNavigationHitBoxZ.None\n ),\n [Face.Front]: Vector3d.create(\n CubeNavigationHitBoxX.None,\n CubeNavigationHitBoxY.Front,\n CubeNavigationHitBoxZ.None\n ),\n [Face.Bottom]: Vector3d.create(\n CubeNavigationHitBoxX.None,\n CubeNavigationHitBoxY.None,\n CubeNavigationHitBoxZ.Bottom\n ),\n [Face.Top]: Vector3d.create(\n CubeNavigationHitBoxX.None,\n CubeNavigationHitBoxY.None,\n CubeNavigationHitBoxZ.Top\n ),\n};\n\nconst cubeNavigationFaceRotations: { [key: string]: Matrix3d } = {\n [Face.Left]: Matrix3d.createRowValues(0, -1, 0, 0, 0, 1, -1, 0, 0),\n [Face.Right]: Matrix3d.createRowValues(0, 1, 0, 0, 0, 1, 1, 0, 0),\n [Face.Back]: Matrix3d.createRowValues(-1, 0, 0, 0, 0, 1, 0, 1, 0),\n [Face.Front]: Matrix3d.createRowValues(1, 0, 0, 0, 0, 1, 0, -1, 0),\n [Face.Bottom]: Matrix3d.createRowValues(1, 0, 0, 0, -1, 0, 0, 0, -1),\n [Face.Top]: Matrix3d.createRowValues(1, 0, 0, 0, 1, 0, 0, 0, 1),\n};\n\n// data relating Up/Down/Left/Right directions relative to every surface\nconst cubeNavigationRoutes: { [key: string]: CubeNavigationRotationMap } = {\n [Face.Front]: {\n up: Face.Top,\n down: Face.Bottom,\n left: Face.Left,\n right: Face.Right,\n },\n [Face.Back]: {\n up: Face.Top,\n down: Face.Bottom,\n left: Face.Right,\n right: Face.Left,\n },\n [Face.Top]: {\n up: Face.Back,\n down: Face.Front,\n left: Face.Left,\n right: Face.Right,\n },\n [Face.Bottom]: {\n up: Face.Front,\n down: Face.Back,\n left: Face.Left,\n right: Face.Right,\n },\n [Face.Right]: {\n up: Face.Top,\n down: Face.Bottom,\n left: Face.Front,\n right: Face.Back,\n },\n [Face.Left]: {\n up: Face.Top,\n down: Face.Bottom,\n left: Face.Back,\n right: Face.Front,\n },\n};\n\n/** The default tolerance (1.0e-6) is appropriate if very dirty viewing operations are expected. */\nconst DEFAULT_TOLERANCE = 1.0e-6;\n\n/** @internal */\nexport enum CubeHover {\n None = 0,\n Hover,\n Active,\n}\n\n/** Properties for the [[CubeNavigationAid]] component\n * @public\n */\nexport interface CubeNavigationAidProps extends CommonProps {\n iModelConnection: IModelConnection;\n viewport?: Viewport;\n\n // used only in testing\n\n /** @internal */\n onAnimationEnd?: () => void;\n /** @internal */\n animationTime?: number;\n favorHeadsUpRotation?: boolean;\n}\n\n/** @public */\ninterface CubeNavigationAidState {\n dragging: boolean;\n startRotMatrix: Matrix3d;\n endRotMatrix: Matrix3d;\n animation: number;\n hoverMap: { [key: string]: CubeHover };\n face: Face;\n}\n\n/** Cube Navigation Aid Component\n * @public\n */\nexport class CubeNavigationAid extends React.Component<\n CubeNavigationAidProps,\n CubeNavigationAidState\n> {\n private _start: Vector2d = Vector2d.createZero();\n /** @internal */\n public override readonly state: Readonly<CubeNavigationAidState> = {\n dragging: false,\n startRotMatrix: Matrix3d.createIdentity(),\n endRotMatrix: Matrix3d.createIdentity(),\n animation: 1,\n hoverMap: {},\n face: Face.Top,\n };\n\n private _lastTime: number | undefined;\n private _animationFrame: any;\n private _mounted: boolean = false;\n private _labels: { [key: string]: string } = {\n [Face.Right]: UiIModelComponents.translate(\"cube.right\"),\n [Face.Left]: UiIModelComponents.translate(\"cube.left\"),\n [Face.Back]: UiIModelComponents.translate(\"cube.back\"),\n [Face.Front]: UiIModelComponents.translate(\"cube.front\"),\n [Face.Top]: UiIModelComponents.translate(\"cube.top\"),\n [Face.Bottom]: UiIModelComponents.translate(\"cube.bottom\"),\n };\n\n /** @internal */\n public override componentDidMount() {\n this._mounted = true;\n ViewportComponentEvents.onViewRotationChangeEvent.addListener(\n this._handleViewRotationChangeEvent\n );\n\n // set initial rotation\n if (this.props.viewport) {\n const newMatrix = this.props.viewport.view.getRotation().clone();\n this.setState({\n startRotMatrix: newMatrix,\n endRotMatrix: newMatrix,\n animation: 1,\n });\n }\n }\n\n /** @internal */\n public override componentWillUnmount() {\n ViewportComponentEvents.onViewRotationChangeEvent.removeListener(\n this._handleViewRotationChangeEvent\n );\n clearTimeout(this._animationFrame);\n this._mounted = false;\n }\n\n // Synchronize with rotation coming from the Viewport\n private _handleViewRotationChangeEvent = (\n args: ViewRotationChangeEventArgs\n ) => {\n const { animation, dragging, endRotMatrix } = this.state;\n // istanbul ignore else\n if (this.props.viewport === args.viewport && animation >= 1 && !dragging) {\n const newMatrix = this.props.viewport.view.getRotation().clone();\n if (!endRotMatrix.isAlmostEqual(newMatrix)) {\n this.setState({\n startRotMatrix: newMatrix,\n endRotMatrix: newMatrix,\n animation: 1,\n face: Face.None,\n });\n }\n }\n };\n\n private _animation = () => {\n const t = Date.now();\n const delta = this._lastTime ? t - this._lastTime : 16;\n this._lastTime = t;\n if (this.state.animation !== 1) {\n const animation = Math.min(\n 1,\n this.state.animation +\n delta /\n (1000 *\n (this.props.animationTime || /* istanbul ignore next */ 0.4))\n );\n\n // istanbul ignore next\n if (this._mounted) {\n this.setState({ animation }, () => {\n this._animationFrame = setTimeout(this._animation, 16.667);\n });\n }\n } else {\n this._lastTime = undefined;\n this._animationEnd();\n }\n };\n\n private _animationEnd = () => {\n ViewportComponentEvents.setCubeMatrix(\n this.state.endRotMatrix,\n this.state.face,\n true\n );\n const startRotMatrix = this.state.endRotMatrix.clone();\n // istanbul ignore next\n if (this._mounted) {\n this.setState({ startRotMatrix }, () => {\n // istanbul ignore else\n if (this.props.onAnimationEnd) this.props.onAnimationEnd();\n });\n }\n };\n\n private static _animationFn = (t: number) =>\n t < 0.5 ? 2 * t ** 2 : -1 + (4 - 2 * t) * t;\n\n private static _isMatrixFace = (matrix: Matrix3d): boolean => {\n let sum = 0;\n for (const coff of matrix.coffs) {\n if (Geometry.isAlmostEqualNumber(Math.abs(coff), 1)) sum++;\n }\n // Assuming matrix is a proper rotation matrix:\n // if matrix viewing a face, there will be a total of 3 values either almost -1, or almost 1.\n return sum === 3;\n };\n\n public override render(): React.ReactNode {\n const { animation, startRotMatrix, endRotMatrix } = this.state;\n const visible =\n CubeNavigationAid._isMatrixFace(endRotMatrix) && animation === 1.0;\n const rotMatrix = CubeNavigationAid._interpolateRotMatrix(\n startRotMatrix,\n animation,\n endRotMatrix\n );\n if (rotMatrix !== startRotMatrix && rotMatrix !== endRotMatrix)\n ViewportComponentEvents.setCubeMatrix(rotMatrix, Face.None);\n\n const faces: { [key: string]: React.ReactNode } = {};\n for (const key in this._labels) {\n // istanbul ignore else\n if (this._labels.hasOwnProperty(key)) {\n const f = key as Face;\n const label = this._labels[f];\n faces[f] = (\n <NavCubeFace\n face={f}\n label={label}\n hoverMap={this.state.hoverMap}\n onFaceCellClick={this._handleFaceCellClick}\n onFaceCellHoverChange={this._handleCellHoverChange}\n />\n );\n }\n }\n\n const cubeClassNames = classnames(\n \"nav-cube\",\n this.state.dragging && \"cube-dragging\"\n );\n\n const upTitle = this.getArrowTitle(Pointer.Up);\n const downTitle = this.getArrowTitle(Pointer.Down);\n const leftTitle = this.getArrowTitle(Pointer.Left);\n const rightTitle = this.getArrowTitle(Pointer.Right);\n\n return (\n <div\n className={classnames(\n \"components-cube-container\",\n this.props.className\n )}\n style={this.props.style}\n data-testid=\"components-cube-navigation-aid\"\n onMouseDown={this._handleBoxMouseDown}\n onTouchStart={this._handleBoxTouchStart}\n role=\"presentation\"\n >\n <div className={\"cube-element-container\"}>\n <Cube\n className={cubeClassNames}\n rotMatrix={rotMatrix}\n faces={faces}\n />\n </div>\n <PointerButton\n data-testid=\"cube-pointer-button-up\"\n visible={visible}\n pointerType={Pointer.Up}\n onArrowClick={this._onArrowClick}\n title={upTitle}\n />\n <PointerButton\n data-testid=\"cube-pointer-button-down\"\n visible={visible}\n pointerType={Pointer.Down}\n onArrowClick={this._onArrowClick}\n title={downTitle}\n />\n <PointerButton\n data-testid=\"cube-pointer-button-left\"\n visible={visible}\n pointerType={Pointer.Left}\n onArrowClick={this._onArrowClick}\n title={leftTitle}\n />\n <PointerButton\n data-testid=\"cube-pointer-button-right\"\n visible={visible}\n pointerType={Pointer.Right}\n onArrowClick={this._onArrowClick}\n title={rightTitle}\n />\n </div>\n );\n }\n\n private _handleCellHoverChange = (vect: Vector3d, state: CubeHover) => {\n if (this._isInteractionLocked()) {\n this.props.onAnimationEnd?.();\n return;\n }\n const hoverMap = this.state.hoverMap;\n hoverMap[`${vect.x}-${vect.y}-${vect.z}`] = state;\n this.setState({ hoverMap });\n };\n\n private _isInteractionLocked = () => {\n // Locked by markup\n if (\n undefined !== this.props.viewport &&\n this.props.viewport === IModelApp.toolAdmin.markupView\n ) {\n return true;\n }\n return false;\n };\n\n private static _getMatrixFace = (rotMatrix: Matrix3d): Face => {\n if (!CubeNavigationAid._isMatrixFace(rotMatrix)) {\n return Face.None;\n }\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Top].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Top].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Top].coffs[8]\n )\n return Face.Top;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] ===\n cubeNavigationFaceRotations[Face.Bottom].coffs[6] &&\n rotMatrix.coffs[7] ===\n cubeNavigationFaceRotations[Face.Bottom].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Bottom].coffs[8]\n )\n return Face.Bottom;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Left].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Left].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Left].coffs[8]\n )\n return Face.Left;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Right].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Right].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Right].coffs[8]\n )\n return Face.Right;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Back].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Back].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Back].coffs[8]\n )\n return Face.Back;\n\n // istanbul ignore else\n if (\n rotMatrix.coffs[6] === cubeNavigationFaceRotations[Face.Front].coffs[6] &&\n rotMatrix.coffs[7] === cubeNavigationFaceRotations[Face.Front].coffs[7] &&\n rotMatrix.coffs[8] === cubeNavigationFaceRotations[Face.Front].coffs[8]\n )\n return Face.Front;\n\n return Face.None;\n };\n\n private static _interpolateRotMatrix = (\n start: Matrix3d,\n anim: number,\n end: Matrix3d\n ): Matrix3d => {\n if (anim === 0) return start;\n if (anim === 1 || start.isAlmostEqual(end)) return end;\n const startInverse = start.transpose();\n const diff = end.multiplyMatrixMatrix(startInverse);\n const angleAxis = diff.getAxisAndAngleOfRotation();\n // istanbul ignore else\n if (angleAxis.ok) {\n const angle = Angle.createRadians(\n angleAxis.angle.radians * CubeNavigationAid._animationFn(anim)\n );\n const newDiff = Matrix3d.createRotationAroundVector(\n angleAxis.axis,\n angle\n );\n // istanbul ignore else\n if (newDiff) {\n const newMatrix = newDiff.multiplyMatrixMatrix(start);\n return newMatrix;\n }\n }\n // istanbul ignore next\n return end;\n };\n\n private static correctSmallNumber(value: number, tolerance: number): number {\n return Math.abs(value) < tolerance ? 0 : value;\n }\n\n /**\n * Snap coordinates of a vector to zero and to each other so that the vector prefers to be\n * * perpendicular to a face of the unit cube.\n * * or pass through a nearby vertex or edge of the unit cube.\n * @param zVector existing z vector.\n * @param tolerance tolerance to determine if a z vector component is close to zero or 1.\n */\n private static snapVectorToCubeFeatures(\n zVector: XYAndZ,\n tolerance: number\n ): Vector3d {\n const x = CubeNavigationAid.correctSmallNumber(zVector.x, tolerance);\n let y = CubeNavigationAid.correctSmallNumber(zVector.y, tolerance);\n let z = CubeNavigationAid.correctSmallNumber(zVector.z, tolerance);\n\n const xx = x === -0 ? Math.abs(x) : x;\n const yy = y === -0 ? Math.abs(y) : y;\n const zz = z === -0 ? Math.abs(z) : z;\n\n // adjust any adjacent pair of near equal values to the first.\n // istanbul ignore next\n if (Geometry.isSameCoordinate(xx, yy, tolerance)) {\n y = Geometry.split3WaySign(y, -xx, xx, xx);\n }\n if (Geometry.isSameCoordinate(yy, zz, tolerance)) {\n z = Geometry.split3WaySign(z, -yy, yy, yy);\n }\n if (Geometry.isSameCoordinate(xx, zz, tolerance)) {\n z = Geometry.split3WaySign(z, -xx, xx, xx);\n }\n return Vector3d.create(x, y, z);\n }\n\n /**\n * Adjust a worldToView matrix to favor both\n * * direct view at faces, edges, and corners of a view cube.\n * * heads up\n * @param worldToView candidate matrix\n * @param tolerance tolerance for cleaning up fuzz. The default (1.0e-6) is appropriate if very dirty viewing operations are expected.\n * @param result optional result.\n */\n private static snapWorldToViewMatrixToCubeFeatures(\n worldToView: Matrix3d,\n tolerance: number,\n result?: Matrix3d,\n favorHeadsUpRotation?: boolean\n ): Matrix3d {\n const oldZ = worldToView.rowZ();\n const newZ = CubeNavigationAid.snapVectorToCubeFeatures(oldZ, tolerance);\n const headsUp = !!favorHeadsUpRotation;\n // If newZ is true up or down, it will have true 0 for x and y.\n // special case this to take x direction from the input.\n // This methodology results in always \"righting\" the face when rotation from an upside-down cube.\n // The behavior was made opt-in in response to https://github.com/iTwin/appui/issues/259\n // istanbul ignore next\n if (!headsUp || (newZ.x === 0.0 && newZ.y === 0)) {\n const perpVector = worldToView.rowX();\n result = Matrix3d.createRigidFromColumns(\n newZ,\n perpVector,\n AxisOrder.ZXY,\n result\n )!;\n } else {\n result = Matrix3d.createRigidViewAxesZTowardsEye(\n newZ.x,\n newZ.y,\n newZ.z,\n result\n );\n }\n // istanbul ignore else\n if (result) result.transposeInPlace();\n return result;\n }\n\n private getArrowRotationAndFace(arrow: Pointer): {\n newRotation: Matrix3d;\n face: Face;\n } {\n const localRotationAxis = Vector3d.create(0, 0, 0);\n switch (arrow) {\n case Pointer.Up:\n localRotationAxis.x = -1.0;\n break;\n case Pointer.Down:\n localRotationAxis.x = 1.0;\n break;\n case Pointer.Left:\n localRotationAxis.y = -1.0;\n break;\n default:\n localRotationAxis.y = 1.0;\n break;\n }\n const localRotation = Matrix3d.createRotationAroundVector(\n localRotationAxis,\n Angle.createDegrees(-90)\n )!;\n const newRotation = localRotation.multiplyMatrixMatrix(\n this.state.endRotMatrix\n );\n CubeNavigationAid.snapWorldToViewMatrixToCubeFeatures(\n newRotation,\n DEFAULT_TOLERANCE,\n newRotation,\n this.props.favorHeadsUpRotation\n );\n const face = CubeNavigationAid._getMatrixFace(newRotation);\n return { newRotation, face };\n }\n\n private _onArrowClick = (arrow: Pointer) => {\n if (this._isInteractionLocked()) {\n // istanbul ignore next\n this.props.onAnimationEnd?.();\n return;\n }\n const { newRotation, face } = this.getArrowRotationAndFace(arrow);\n this._animateRotation(newRotation, face);\n };\n\n private getArrowTitle(arrow: Pointer) {\n const { face } = this.getArrowRotationAndFace(arrow);\n return this._labels[face];\n }\n\n private _lastClientXY: Vector2d = Vector2d.createZero();\n private _processDrag(mousePos: Vector2d) {\n // istanbul ignore else\n if (!this._start.isAlmostEqual(mousePos)) {\n const movement = mousePos.minus(this._lastClientXY);\n const diff = movement.scale(0.05);\n\n const yaw = Angle.createRadians(diff.x);\n const pitch = Angle.createRadians(diff.y);\n\n const matX = Matrix3d.createRotationAroundAxisIndex(AxisIndex.X, pitch);\n const matZ = Matrix3d.createRotationAroundAxisIndex(AxisIndex.Z, yaw);\n\n const mat = matX\n .multiplyMatrixMatrix(this.state.startRotMatrix)\n .multiplyMatrixMatrix(matZ);\n this._setRotation(mat, CubeNavigationAid._getMatrixFace(mat));\n if (!this.state.dragging) this.setState({ dragging: true });\n }\n this._lastClientXY = mousePos;\n }\n\n private _handleBoxMouseDown = (event: any) => {\n if (this._isInteractionLocked()) {\n this.props.onAnimationEnd?.();\n return;\n }\n event.preventDefault();\n // only start listening after drag is confirmed. Ie. the 3D box is clicked.\n window.addEventListener(\"mousemove\", this._onMouseMove, false);\n window.addEventListener(\"mouseup\", this._onMouseUp, false);\n this._lastClientXY = Vector2d.create(event.clientX, event.clientY);\n this._start = this._lastClientXY;\n };\n\n private _onMouseMove = (event: MouseEvent) => {\n const mousePos = Vector2d.create(event.clientX, event.clientY);\n this._processDrag(mousePos);\n };\n\n private _onMouseUp = () => {\n if (this.state.dragging) {\n this.setState({ dragging: false });\n ViewportComponentEvents.setCubeMatrix(\n this.state.endRotMatrix,\n CubeNavigationAid._getMatrixFace(this.state.endRotMatrix),\n true\n );\n }\n\n // remove so event only triggers after this.onMouseStartDrag\n window.removeEventListener(\"mousemove\", this._onMouseMove);\n window.removeEventListener(\"mouseup\", this._onMouseUp);\n };\n\n // istanbul ignore next - unable to test touch\n private _handleBoxTouchStart = (event: any) => {\n if (this._isInteractionLocked()) {\n this.props.onAnimationEnd?.();\n return;\n }\n if (1 !== event.targetTouches.length) return;\n window.addEventListener(\"touchmove\", this._onTouchMove, false);\n window.addEventListener(\"touchend\", this._onTouchEnd, false);\n this._lastClientXY = Vector2d.create(\n event.targetTouches[0].clientX,\n event.targetTouches[0].clientY\n );\n this._start = this._lastClientXY;\n };\n\n // istanbul ignore next - unable to test touch\n private _onTouchMove = (event: TouchEvent) => {\n if (1 !== event.targetTouches.length) return;\n const mousePos = Vector2d.create(\n event.targetTouches[0].clientX,\n event.targetTouches[0].clientY\n );\n this._processDrag(mousePos);\n };\n\n // istanbul ignore next - unable to test touch\n private _onTouchEnd = (event: TouchEvent) => {\n if (0 !== event.targetTouches.length) return;\n\n if (this.state.dragging) {\n this.setState({ dragging: false });\n ViewportComponentEvents.setCubeMatrix(\n this.state.endRotMatrix,\n CubeNavigationAid._getMatrixFace(this.state.endRotMatrix),\n true\n );\n }\n\n window.removeEventListener(\"touchmove\", this._onTouchMove);\n window.removeEventListener(\"touchend\", this._onTouchEnd);\n };\n\n private _handleFaceCellClick = (pos: Vector3d, face: Face) => {\n if (this._isInteractionLocked()) {\n this.props.onAnimationEnd?.();\n return;\n }\n const { endRotMatrix } = this.state;\n let rotMatrix = Matrix3d.createRigidViewAxesZTowardsEye(\n pos.x,\n pos.y,\n pos.z\n ).inverse();\n // istanbul ignore else\n if (rotMatrix) {\n // if isMatrixFace and user is clicking on top/bottom, the current matrix face must be top or bottom\n if (\n !CubeNavigationAid._isMatrixFace(endRotMatrix) &&\n (face === Face.Top || face === Face.Bottom)\n ) {\n const angleAxis = endRotMatrix.getAxisAndAngleOfRotation();\n // istanbul ignore else\n if (angleAxis.ok) {\n const xAx = endRotMatrix.columnX();\n const a = Math.atan2(xAx.y, xAx.x);\n const r = (Math.round((a * 2) / Math.PI) * Math.PI) / 2; // round to quarter turn intervals\n const rot = Matrix3d.createRotationAroundAxisIndex(\n AxisIndex.Z,\n Angle.createRadians(r)\n );\n rotMatrix = rot.multiplyMatrixMatrix(rotMatrix);\n }\n }\n this._animateRotation(rotMatrix, face);\n }\n window.removeEventListener(\"mousemove\", this._onMouseMove);\n };\n\n private _animateRotation = (endRotMatrix: Matrix3d, face: Face) => {\n if (this.state.endRotMatrix.isAlmostEqual(endRotMatrix)) return;\n // set animation variables, let css transitions animate it.\n this._animationFrame = setTimeout(this._animation, 16.667);\n this.setState((prevState) => ({\n startRotMatrix: prevState.endRotMatrix,\n endRotMatrix,\n animation: 0,\n face,\n }));\n };\n\n private _setRotation = (endRotMatrix: Matrix3d, face: Face) => {\n ViewportComponentEvents.setCubeMatrix(endRotMatrix, face);\n // set variables, with animTime at 0 to prevent animation.\n this.setState({\n startRotMatrix: endRotMatrix,\n endRotMatrix,\n animation: 1,\n face,\n });\n };\n}\n\n/** @internal */\nexport interface NavCubeFaceProps\n extends React.AllHTMLAttributes<HTMLDivElement> {\n face: Face;\n label: string;\n hoverMap: { [key: string]: CubeHover };\n onFaceCellClick: (vector: Vector3d, face: Face) => void;\n onFaceCellHoverChange: (vector: Vector3d, state: CubeHover) => void;\n}\n\n/** @internal */\nexport class NavCubeFace extends React.Component<NavCubeFaceProps> {\n private includeCell(vector: Vector3d): boolean {\n const { x, y, z } = vector;\n const omittedCell =\n (y === 0 && x !== 0 && z !== 0) ||\n (y !== 0 && x === 0 && z !== 0) ||\n (y !== 0 && x !== 0 && z === 0);\n return !omittedCell;\n }\n public override render(): React.ReactNode {\n const { face, hoverMap, onFaceCellClick, onFaceCellHoverChange, label } =\n this.props;\n return (\n <div className=\"nav-cube-face\" data-testid=\"nav-cube-face\">\n {[-1, 0, 1].map((y: number) => {\n return (\n <FaceRow key={y} center={y === 0}>\n {[-1, 0, 1].map((x: number) => {\n const vector = NavCubeFace.faceCellToPos(face, x, y);\n if (this.includeCell(vector)) {\n // return a fully functional cell\n return (\n <FaceCell\n key={x}\n onFaceCellHoverChange={onFaceCellHoverChange}\n onFaceCellClick={onFaceCellClick}\n hoverMap={hoverMap}\n vector={vector}\n face={face}\n center={x === 0}\n >\n {x === 0 && y === 0 && label}\n </FaceCell>\n );\n } else {\n // return a placeholder cell\n return (\n <FaceCell\n key={x}\n vector={vector}\n face={face}\n center={x === 0}\n />\n );\n }\n })}\n </FaceRow>\n );\n })}\n </div>\n );\n }\n public static faceCellToPos = (face: Face, x: number, y: number) => {\n const faceVect = cubeNavigationFaceLocs[face];\n const route = cubeNavigationRoutes[face];\n\n const faceX = x < 0 ? route.left : x > 0 ? route.right : Face.None;\n const xVect =\n faceX !== Face.None\n ? cubeNavigationFaceLocs[faceX]\n : Vector3d.createZero();\n\n const faceY = y < 0 ? route.up : y > 0 ? route.down : Face.None;\n const yVect =\n faceY !== Face.None\n ? cubeNavigationFaceLocs[faceY]\n : Vector3d.createZero();\n\n return faceVect.plus(xVect).plus(yVect);\n };\n}\n\ninterface FaceRowProps extends React.AllHTMLAttributes<HTMLDivElement> {\n center?: boolean;\n}\n\nclass FaceRow extends React.Component<FaceRowProps> {\n public override render(): React.ReactNode {\n const { center, children, ...props } = this.props;\n const classNames = classnames(\"face-row\", center && \"cube-center\");\n return (\n <div className={classNames} {...props}>\n {children}\n </div>\n );\n }\n}\n\n/** @internal */\nexport interface FaceCellProps extends React.AllHTMLAttributes<HTMLDivElement> {\n center?: boolean;\n onFaceCellClick?: (vector: Vector3d, face: Face) => void;\n onFaceCellHoverChange?: (vector: Vector3d, state: CubeHover) => void;\n hoverMap?: { [key: string]: CubeHover };\n vector: Vector3d;\n face: Face;\n}\n\n/** @internal */\nexport class FaceCell extends React.Component<FaceCellProps> {\n private _startMouse: Point2d | undefined;\n public override render(): React.ReactNode {\n const {\n center,\n children,\n onFaceCellClick,\n onFaceCellHoverChange,\n hoverMap,\n face,\n vector,\n ...props\n } = this.props;\n const { x, y, z } = vector;\n const n = `${x}-${y}-${z}`;\n const hover = hoverMap && hoverMap[n] === CubeHover.Hover;\n const active = hoverMap && hoverMap[n] === CubeHover.Active;\n const classNames = classnames(\n \"face-cell\",\n center && \"cube-center\",\n hover && \"cube-hover\",\n active && \"cube-active\"\n );\n\n return (\n <div // eslint-disable-line jsx-a11y/mouse-events-have-key-events\n onMouseDown={this._handleMouseDown}\n onMouseUp={this._handleMouseUp}\n onMouseOver={this._handleMouseOver}\n onMouseOut={this._handleMouseOut}\n onTouchStart={this._handleTouchStart}\n onTouchEnd={this._handleTouchEnd}\n data-testid={`nav-cube-face-cell-${face}-${n}`}\n className={classNames}\n role=\"presentation\"\n {...props}\n >\n {children}\n </div>\n );\n }\n private _handleMouseOver = () => {\n const { vector } = this.props;\n this.props.onFaceCellHoverChange &&\n this.props.onFaceCellHoverChange(vector, CubeHover.Hover);\n };\n private _handleMouseOut = () => {\n const { vector } = this.props;\n this.props.onFaceCellHoverChange &&\n this.props.onFaceCellHoverChange(vector, CubeHover.None);\n };\n private _handleMouseDown = (event: React.MouseEvent) => {\n const { clientX, clientY } = event;\n this.handlePointerDown(clientX, clientY);\n };\n private _handleMouseUp = (event: React.MouseEvent) => {\n const { clientX, clientY } = event;\n this.handlePointerUp(clientX, clientY);\n };\n\n private _handleTouchStart = (event: React.TouchEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.targetTouches.length === 1 &&\n this.handlePointerDown(\n event.targetTouches[0].clientX,\n event.targetTouches[0].clientY\n );\n };\n\n private _handleTouchEnd = (event: React.TouchEvent<HTMLDivElement>) => {\n event.preventDefault();\n event.changedTouches.length === 1 &&\n this.handlePointerUp(\n event.changedTouches[0].clientX,\n event.changedTouches[0].clientY\n );\n };\n\n private handlePointerDown(x: number, y: number) {\n const { vector } = this.props;\n this._startMouse = Point2d.create(x, y);\n this.props.onFaceCellHoverChange &&\n this.props.onFaceCellHoverChange(vector, CubeHover.Active);\n }\n\n private handlePointerUp(x: number, y: number) {\n const { vector, face } = this.props;\n this.props.onFaceCellHoverChange &&\n this.props.onFaceCellHoverChange(vector, CubeHover.None);\n const mouse = Point2d.create(x, y);\n if (this._startMouse && this._startMouse.isAlmostEqual(mouse)) {\n const isFace =\n Math.abs(vector.x) + Math.abs(vector.y) + Math.abs(vector.z) === 1;\n this.props.onFaceCellClick &&\n this.props.onFaceCellClick(vector, isFace ? face : Face.None);\n }\n }\n}\n\nenum Pointer {\n None = 0,\n Up,\n Down,\n Left,\n Right,\n}\n\nconst pointerIconSpec: { [key: number]: IconSpec } = {\n [Pointer.Up]: <SvgCaretDown />,\n [Pointer.Down]: <SvgCaretUp />,\n [Pointer.Left]: <SvgCaretRight />,\n [Pointer.Right]: <SvgCaretLeft />,\n};\n\nconst pointerClass: { [key: number]: string } = {\n [Pointer.Up]: \"cube-up\",\n [Pointer.Down]: \"cube-down\",\n [Pointer.Left]: \"cube-left\",\n [Pointer.Right]: \"cube-right\",\n};\n\ninterface PointerProps extends React.AllHTMLAttributes<HTMLDivElement> {\n visible: boolean;\n pointerType: Pointer;\n onArrowClick(pointer: Pointer): void;\n title: string;\n [\"data-testid\"]?: string;\n}\n\nclass PointerButton extends React.Component<PointerProps> {\n public override render(): React.ReactNode {\n const { visible, pointerType, onArrowClick, title, ...props } = this.props;\n const classes = classnames(\n \"cube-pointer\",\n \"icon\",\n pointerClass[pointerType],\n visible && \"cube-visible\"\n );\n\n return (\n // eslint-disable-next-line jsx-a11y/click-events-have-key-events\n <div\n className={classes}\n role=\"button\"\n tabIndex={-1}\n title={title}\n {...props}\n onClick={this._handleClick}\n >\n <Icon iconSpec={pointerIconSpec[pointerType]} />{\" \"}\n </div>\n );\n }\n private _handleClick = (event: React.MouseEvent) => {\n const { pointerType } = this.props;\n event.preventDefault();\n this.props.onArrowClick(pointerType);\n };\n}\n"]}
@@ -72,7 +72,7 @@ export function FormatPanel(props) {
72
72
  }, []);
73
73
  return (React.createElement("div", { className: "components-quantityFormat-panel" },
74
74
  showSample && (React.createElement(FormatSample, { formatSpec: formatSpec, initialMagnitude: initialMagnitude })),
75
- React.createElement(FormatUnits, { unitsProvider: unitsProvider, persistenceUnit: formatSpec?.persistenceUnit, initialFormat: formatProps, onUnitsChange: handleFormatChange }),
75
+ React.createElement(FormatUnits, { unitsProvider: unitsProvider, persistenceUnit: formatSpec === null || formatSpec === void 0 ? void 0 : formatSpec.persistenceUnit, initialFormat: formatProps, onUnitsChange: handleFormatChange }),
76
76
  React.createElement(FormatUnitLabel, { formatProps: formatProps, onUnitLabelChange: handleFormatChange }),
77
77
  React.createElement(FormatTypeOption, { formatProps: formatProps, onChange: handleFormatChange }),
78
78
  React.createElement(FormatPrecision, { formatProps: formatProps, onChange: handleFormatChange }),
@@ -1 +1 @@
1
- {"version":3,"file":"FormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPanel.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AA6BxD,KAAK,UAAU,kBAAkB,CAC/B,WAAwB,EACxB,eAA0B,EAC1B,aAA4B;IAE5B,MAAM,YAAY,GAAG,MAAM,MAAM,CAAC,cAAc,CAC9C,QAA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kBAAkB,GACjC;QACF,oBAAC,eAAe,IACd,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,kBAAkB,GACrC;QACF,oBAAC,gBAAgB,IACf,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,kBAAkB,GAC5B;QACF,oBAAC,eAAe,IACd,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,kBAAkB,GAC5B;QACD,KAAK,CAAC,sBAAsB;YAC3B,KAAK,CAAC,sBAAsB,CAAC,WAAW,EAAE,kBAAkB,CAAC;QAC/D,oBAAC,iBAAiB,IAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,kBAAkB,EAC5B,uBAAuB,EAAE,uBAAuB,EAChD,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,IAEnC,KAAK,CAAC,wBAAwB;YAC7B,KAAK,CAAC,wBAAwB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAC/C,CAChB,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport \"./FormatPanel.scss\";\nimport * as React from \"react\";\nimport type {\n FormatProps,\n UnitProps,\n UnitsProvider,\n} from \"@itwin/core-quantity\";\nimport { Format, FormatterSpec } from \"@itwin/core-quantity\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { FormatPrecision } from \"./FormatPrecision\";\nimport { FormatSample } from \"./FormatSample\";\nimport { FormatTypeOption } from \"./FormatType\";\nimport { FormatUnitLabel } from \"./FormatUnitLabel\";\nimport { FormatUnits } from \"./FormatUnits\";\nimport { MiscFormatOptions } from \"./MiscFormatOptions\";\n\n/** Properties of [[FormatPanel]] component.\n * @alpha\n */\nexport interface FormatPanelProps extends CommonProps {\n initialFormat: FormatProps;\n unitsProvider: UnitsProvider;\n persistenceUnit: Promise<UnitProps> | UnitProps;\n showSample?: boolean;\n initialMagnitude?: number;\n // if true a only primary format properties are initially displayed and a \"More/Less\" link is added.\n enableMinimumProperties?: boolean;\n onFormatChange?: (format: FormatProps) => void;\n provideFormatSpec?: (\n formatProps: FormatProps,\n persistenceUnit: UnitProps,\n unitsProvider: UnitsProvider\n ) => Promise<FormatterSpec>;\n providePrimaryChildren?: (\n formatProps: FormatProps,\n fireFormatChange: (newProps: FormatProps) => void\n ) => React.ReactNode;\n provideSecondaryChildren?: (\n formatProps: FormatProps,\n fireFormatChange: (newProps: FormatProps) => void\n ) => React.ReactNode;\n}\n\nasync function generateFormatSpec(\n formatProps: FormatProps,\n persistenceUnit: UnitProps,\n unitsProvider: UnitsProvider\n) {\n const actualFormat = await Format.createFromJSON(\n \"custom\",\n unitsProvider,\n formatProps\n );\n return FormatterSpec.create(\n actualFormat.name,\n actualFormat,\n unitsProvider,\n persistenceUnit\n );\n}\n\n/** Component to show/edit Quantity Format.\n * @alpha\n */\nexport function FormatPanel(props: FormatPanelProps) {\n const [formatSpec, setFormatSpec] = React.useState<FormatterSpec>();\n const {\n initialFormat,\n showSample,\n initialMagnitude,\n unitsProvider,\n persistenceUnit,\n onFormatChange,\n provideFormatSpec,\n enableMinimumProperties,\n } = props;\n const [formatProps, setFormatProps] = React.useState(initialFormat);\n const [showOptions, setShowOptions] = React.useState(false);\n\n React.useEffect(() => {\n setFormatProps(initialFormat);\n setFormatSpec(undefined); // this will trigger the new spec to be created in the useEffect hook\n }, [initialFormat]);\n\n const handleUserFormatChanges = React.useCallback(\n (newProps: FormatProps) => {\n setFormatProps(newProps);\n setFormatSpec(undefined); // this will trigger the new spec to be created in the useEffect hook\n onFormatChange && onFormatChange(newProps);\n },\n [onFormatChange]\n );\n\n const isMounted = React.useRef(false);\n\n // runs returned function only when component is unmounted.\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n React.useEffect(() => {\n async function fetchFormatSpec() {\n const pu = await persistenceUnit;\n let newFormatSpec: FormatterSpec;\n if (provideFormatSpec) {\n newFormatSpec = await provideFormatSpec(formatProps, pu, unitsProvider);\n } else {\n newFormatSpec = await generateFormatSpec(\n formatProps,\n pu,\n unitsProvider\n );\n }\n isMounted.current && setFormatSpec(newFormatSpec);\n }\n if (!formatSpec) void fetchFormatSpec();\n }, [\n formatProps,\n formatSpec,\n persistenceUnit,\n provideFormatSpec,\n unitsProvider,\n ]);\n\n const handleFormatChange = React.useCallback(\n (newFormatProps: FormatProps) => {\n handleUserFormatChanges(newFormatProps);\n },\n [handleUserFormatChanges]\n );\n\n const handleShowOptions = React.useCallback((show: boolean) => {\n setShowOptions(show);\n }, []);\n\n return (\n <div className=\"components-quantityFormat-panel\">\n {showSample && (\n <FormatSample\n formatSpec={formatSpec}\n initialMagnitude={initialMagnitude}\n />\n )}\n <FormatUnits\n unitsProvider={unitsProvider}\n persistenceUnit={formatSpec?.persistenceUnit}\n initialFormat={formatProps}\n onUnitsChange={handleFormatChange}\n />\n <FormatUnitLabel\n formatProps={formatProps}\n onUnitLabelChange={handleFormatChange}\n />\n <FormatTypeOption\n formatProps={formatProps}\n onChange={handleFormatChange}\n />\n <FormatPrecision\n formatProps={formatProps}\n onChange={handleFormatChange}\n />\n {props.providePrimaryChildren &&\n props.providePrimaryChildren(formatProps, handleFormatChange)}\n <MiscFormatOptions\n formatProps={formatProps}\n onChange={handleFormatChange}\n enableMinimumProperties={enableMinimumProperties}\n showOptions={showOptions}\n onShowHideOptions={handleShowOptions}\n >\n {props.provideSecondaryChildren &&\n props.provideSecondaryChildren(formatProps, handleFormatChange)}\n </MiscFormatOptions>\n </div>\n );\n}\n"]}
1
+ {"version":3,"file":"FormatPanel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPanel.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,KAAK,KAAK,MAAM,O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EAAE;QAC9B,uBAAuB,CAAC,cAAc,CAAC,CAAC;IAC1C,CAAC,EACD,CAAC,uBAAuB,CAAC,CAC1B,CAAC;IAEF,MAAM,iBAAiB,GAAG,KAAK,CAAC,WAAW,CAAC,CAAC,IAAa,EAAE,EAAE;QAC5D,cAAc,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC7C,UAAU,IAAI,CACb,oBAAC,YAAY,IACX,UAAU,EAAE,UAAU,EACtB,gBAAgB,EAAE,gBAAgB,GAClC,CACH;QACD,oBAAC,WAAW,IACV,aAAa,EAAE,aAAa,EAC5B,eAAe,EAAE,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,eAAe,EAC5C,aAAa,EAAE,WAAW,EAC1B,aAAa,EAAE,kBAAkB,GACjC;QACF,oBAAC,eAAe,IACd,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,kBAAkB,GACrC;QACF,oBAAC,gBAAgB,IACf,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,kBAAkB,GAC5B;QACF,oBAAC,eAAe,IACd,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,kBAAkB,GAC5B;QACD,KAAK,CAAC,sBAAsB;YAC3B,KAAK,CAAC,sBAAsB,CAAC,WAAW,EAAE,kBAAkB,CAAC;QAC/D,oBAAC,iBAAiB,IAChB,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,kBAAkB,EAC5B,uBAAuB,EAAE,uBAAuB,EAChD,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,IAEnC,KAAK,CAAC,wBAAwB;YAC7B,KAAK,CAAC,wBAAwB,CAAC,WAAW,EAAE,kBAAkB,CAAC,CAC/C,CAChB,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport \"./FormatPanel.scss\";\nimport * as React from \"react\";\nimport type {\n FormatProps,\n UnitProps,\n UnitsProvider,\n} from \"@itwin/core-quantity\";\nimport { Format, FormatterSpec } from \"@itwin/core-quantity\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { FormatPrecision } from \"./FormatPrecision\";\nimport { FormatSample } from \"./FormatSample\";\nimport { FormatTypeOption } from \"./FormatType\";\nimport { FormatUnitLabel } from \"./FormatUnitLabel\";\nimport { FormatUnits } from \"./FormatUnits\";\nimport { MiscFormatOptions } from \"./MiscFormatOptions\";\n\n/** Properties of [[FormatPanel]] component.\n * @alpha\n */\nexport interface FormatPanelProps extends CommonProps {\n initialFormat: FormatProps;\n unitsProvider: UnitsProvider;\n persistenceUnit: Promise<UnitProps> | UnitProps;\n showSample?: boolean;\n initialMagnitude?: number;\n // if true a only primary format properties are initially displayed and a \"More/Less\" link is added.\n enableMinimumProperties?: boolean;\n onFormatChange?: (format: FormatProps) => void;\n provideFormatSpec?: (\n formatProps: FormatProps,\n persistenceUnit: UnitProps,\n unitsProvider: UnitsProvider\n ) => Promise<FormatterSpec>;\n providePrimaryChildren?: (\n formatProps: FormatProps,\n fireFormatChange: (newProps: FormatProps) => void\n ) => React.ReactNode;\n provideSecondaryChildren?: (\n formatProps: FormatProps,\n fireFormatChange: (newProps: FormatProps) => void\n ) => React.ReactNode;\n}\n\nasync function generateFormatSpec(\n formatProps: FormatProps,\n persistenceUnit: UnitProps,\n unitsProvider: UnitsProvider\n) {\n const actualFormat = await Format.createFromJSON(\n \"custom\",\n unitsProvider,\n formatProps\n );\n return FormatterSpec.create(\n actualFormat.name,\n actualFormat,\n unitsProvider,\n persistenceUnit\n );\n}\n\n/** Component to show/edit Quantity Format.\n * @alpha\n */\nexport function FormatPanel(props: FormatPanelProps) {\n const [formatSpec, setFormatSpec] = React.useState<FormatterSpec>();\n const {\n initialFormat,\n showSample,\n initialMagnitude,\n unitsProvider,\n persistenceUnit,\n onFormatChange,\n provideFormatSpec,\n enableMinimumProperties,\n } = props;\n const [formatProps, setFormatProps] = React.useState(initialFormat);\n const [showOptions, setShowOptions] = React.useState(false);\n\n React.useEffect(() => {\n setFormatProps(initialFormat);\n setFormatSpec(undefined); // this will trigger the new spec to be created in the useEffect hook\n }, [initialFormat]);\n\n const handleUserFormatChanges = React.useCallback(\n (newProps: FormatProps) => {\n setFormatProps(newProps);\n setFormatSpec(undefined); // this will trigger the new spec to be created in the useEffect hook\n onFormatChange && onFormatChange(newProps);\n },\n [onFormatChange]\n );\n\n const isMounted = React.useRef(false);\n\n // runs returned function only when component is unmounted.\n React.useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n React.useEffect(() => {\n async function fetchFormatSpec() {\n const pu = await persistenceUnit;\n let newFormatSpec: FormatterSpec;\n if (provideFormatSpec) {\n newFormatSpec = await provideFormatSpec(formatProps, pu, unitsProvider);\n } else {\n newFormatSpec = await generateFormatSpec(\n formatProps,\n pu,\n unitsProvider\n );\n }\n isMounted.current && setFormatSpec(newFormatSpec);\n }\n if (!formatSpec) void fetchFormatSpec();\n }, [\n formatProps,\n formatSpec,\n persistenceUnit,\n provideFormatSpec,\n unitsProvider,\n ]);\n\n const handleFormatChange = React.useCallback(\n (newFormatProps: FormatProps) => {\n handleUserFormatChanges(newFormatProps);\n },\n [handleUserFormatChanges]\n );\n\n const handleShowOptions = React.useCallback((show: boolean) => {\n setShowOptions(show);\n }, []);\n\n return (\n <div className=\"components-quantityFormat-panel\">\n {showSample && (\n <FormatSample\n formatSpec={formatSpec}\n initialMagnitude={initialMagnitude}\n />\n )}\n <FormatUnits\n unitsProvider={unitsProvider}\n persistenceUnit={formatSpec?.persistenceUnit}\n initialFormat={formatProps}\n onUnitsChange={handleFormatChange}\n />\n <FormatUnitLabel\n formatProps={formatProps}\n onUnitLabelChange={handleFormatChange}\n />\n <FormatTypeOption\n formatProps={formatProps}\n onChange={handleFormatChange}\n />\n <FormatPrecision\n formatProps={formatProps}\n onChange={handleFormatChange}\n />\n {props.providePrimaryChildren &&\n props.providePrimaryChildren(formatProps, handleFormatChange)}\n <MiscFormatOptions\n formatProps={formatProps}\n onChange={handleFormatChange}\n enableMinimumProperties={enableMinimumProperties}\n showOptions={showOptions}\n onShowHideOptions={handleShowOptions}\n >\n {props.provideSecondaryChildren &&\n props.provideSecondaryChildren(formatProps, handleFormatChange)}\n </MiscFormatOptions>\n </div>\n );\n}\n"]}
@@ -14,6 +14,7 @@ import { UiIModelComponents } from "../UiIModelComponents";
14
14
  * @alpha
15
15
  */
16
16
  export function FormatPrecision(props) {
17
+ var _a, _b;
17
18
  const { formatProps, onChange } = props;
18
19
  const handlePrecisionChange = React.useCallback((precision) => {
19
20
  const newFormatProps = { ...formatProps, precision };
@@ -23,6 +24,6 @@ export function FormatPrecision(props) {
23
24
  const label = React.useRef(UiIModelComponents.translate("QuantityFormat.labels.precision"));
24
25
  return (React.createElement(React.Fragment, null,
25
26
  React.createElement("span", { className: "uicore-label" }, label.current),
26
- formatType === FormatType.Fractional ? (React.createElement(FractionPrecisionSelector, { "data-testid": "fraction-precision-selector", precision: formatProps.precision ?? 0, onChange: handlePrecisionChange })) : (React.createElement(DecimalPrecisionSelector, { "data-testid": "decimal-precision-selector", precision: formatProps.precision ?? 0, onChange: handlePrecisionChange }))));
27
+ formatType === FormatType.Fractional ? (React.createElement(FractionPrecisionSelector, { "data-testid": "fraction-precision-selector", precision: (_a = formatProps.precision) !== null && _a !== void 0 ? _a : 0, onChange: handlePrecisionChange })) : (React.createElement(DecimalPrecisionSelector, { "data-testid": "decimal-precision-selector", precision: (_b = formatProps.precision) !== null && _b !== void 0 ? _b : 0, onChange: handlePrecisionChange }))));
27
28
  }
28
29
  //# sourceMappingURL=FormatPrecision.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatPrecision.js","sourceRoot":"","sources":["../../../../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AS,IAAI,CAAC,EACrC,QAAQ,EAAE,qBAAqB,GAC/B,CACH,CACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type { FormatProps } from \"@itwin/core-quantity\";\nimport { FormatType, parseFormatType } from \"@itwin/core-quantity\";\nimport { DecimalPrecisionSelector } from \"./misc/DecimalPrecision\";\nimport { FractionPrecisionSelector } from \"./misc/FractionPrecision\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties of [[FormatPrecision]] component.\n * @alpha\n */\nexport interface FormatPrecisionProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n}\n\n/** Component to show/edit Quantity Format Precision.\n * @alpha\n */\nexport function FormatPrecision(props: FormatPrecisionProps) {\n const { formatProps, onChange } = props;\n\n const handlePrecisionChange = React.useCallback(\n (precision: number) => {\n const newFormatProps = { ...formatProps, precision };\n onChange && onChange(newFormatProps);\n },\n [formatProps, onChange]\n );\n\n const formatType = parseFormatType(formatProps.type, \"format\");\n\n const label = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.precision\")\n );\n return (\n <>\n <span className={\"uicore-label\"}>{label.current}</span>\n {formatType === FormatType.Fractional ? (\n <FractionPrecisionSelector\n data-testid=\"fraction-precision-selector\"\n precision={formatProps.precision ?? 0}\n onChange={handlePrecisionChange}\n />\n ) : (\n <DecimalPrecisionSelector\n data-testid=\"decimal-precision-selector\"\n precision={formatProps.precision ?? 0}\n onChange={handlePrecisionChange}\n />\n )}\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"FormatPrecision.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatPrecision.tsx"],"names":[],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Q,EAAE,qBAAqB,GAC/B,CACH,CACA,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type { FormatProps } from \"@itwin/core-quantity\";\nimport { FormatType, parseFormatType } from \"@itwin/core-quantity\";\nimport { DecimalPrecisionSelector } from \"./misc/DecimalPrecision\";\nimport { FractionPrecisionSelector } from \"./misc/FractionPrecision\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\n/** Properties of [[FormatPrecision]] component.\n * @alpha\n */\nexport interface FormatPrecisionProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n}\n\n/** Component to show/edit Quantity Format Precision.\n * @alpha\n */\nexport function FormatPrecision(props: FormatPrecisionProps) {\n const { formatProps, onChange } = props;\n\n const handlePrecisionChange = React.useCallback(\n (precision: number) => {\n const newFormatProps = { ...formatProps, precision };\n onChange && onChange(newFormatProps);\n },\n [formatProps, onChange]\n );\n\n const formatType = parseFormatType(formatProps.type, \"format\");\n\n const label = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.precision\")\n );\n return (\n <>\n <span className={\"uicore-label\"}>{label.current}</span>\n {formatType === FormatType.Fractional ? (\n <FractionPrecisionSelector\n data-testid=\"fraction-precision-selector\"\n precision={formatProps.precision ?? 0}\n onChange={handlePrecisionChange}\n />\n ) : (\n <DecimalPrecisionSelector\n data-testid=\"decimal-precision-selector\"\n precision={formatProps.precision ?? 0}\n onChange={handlePrecisionChange}\n />\n )}\n </>\n );\n}\n"]}
@@ -16,11 +16,11 @@ import { SvgProgressForward } from "@itwin/itwinui-icons-react";
16
16
  */
17
17
  export function FormatSample(props) {
18
18
  const { initialMagnitude, formatSpec, hideLabels } = props;
19
- const initialValue = initialMagnitude ?? 0;
19
+ const initialValue = initialMagnitude !== null && initialMagnitude !== void 0 ? initialMagnitude : 0;
20
20
  const [magnitude, setMagnitude] = React.useState(initialValue);
21
21
  const [sampleValue, setSampleValue] = React.useState(initialValue.toString());
22
22
  React.useEffect(() => {
23
- const value = initialMagnitude ?? 0;
23
+ const value = initialMagnitude !== null && initialMagnitude !== void 0 ? initialMagnitude : 0;
24
24
  setMagnitude(value);
25
25
  setSampleValue(value.toString());
26
26
  }, [initialMagnitude]);
@@ -1 +1 @@
1
- {"version":3,"file":"FormatSample.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatSample.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAWhE;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,YAAY,GAAG,gBAAgB,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC/D,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;IAE9E,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,KAAK,GAAG,gBAAgB,IAAI,CA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AC,KAAK;QAClC,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,cAAc,GAAG,UAAU;QAC/B,CAAC,CAAC,UAAU,CAAC,eAAe,CAAC,SAAS,CAAC;QACvC,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,UAAU,GAAG,KAAK,CAAC,MAAM,CAC7B,kBAAkB,CAAC,SAAS,CAAC,6BAA6B,CAAC,CAC5D,CAAC;IACF,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CACjC,kBAAkB,CAAC,SAAS,CAAC,iCAAiC,CAAC,CAChE,CAAC;IAEF,OAAO,CACL;QACG,CAAC,UAAU,IAAI,CACd,8BAAM,SAAS,EAAE,cAAc,IAAG,UAAU,CAAC,OAAO,CAAQ,CAC7D;QACD,8BAAM,SAAS,EAAC,mBAAmB;YACjC,oBAAC,KAAK,mBACQ,qBAAqB,EACjC,SAAS,EAAE,uCAAuC,EAClD,KAAK,EAAE,WAAW,EAClB,QAAQ,EAAE,mBAAmB,EAC7B,SAAS,EAAE,aAAa,EACxB,MAAM,EAAE,iBAAiB,EACzB,IAAI,EAAC,OAAO,GACZ;YACD,0BAA0B,CACtB;QACN,CAAC,UAAU,IAAI,CACd,8BAAM,SAAS,EAAE,cAAc,IAAG,cAAc,CAAC,OAAO,CAAQ,CACjE;QACD,6CAAkB,kBAAkB;YACjC,UAAU,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,IAAI,CAC1C,oBAAC,IAAI,IAAC,QAAQ,EAAE,oBAAC,kBAAkB,OAAG,GAAI,CAC3C;YACD,6CACc,yBAAyB,EACrC,SAAS,EAAE,mDAAmD,IAE7D,cAAc,CACV,CACF,CACN,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { FormatterSpec } from \"@itwin/core-quantity\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { SvgProgressForward } from \"@itwin/itwinui-icons-react\";\n\n/** Properties of [[FormatSample]] component.\n * @alpha\n */\nexport interface FormatSampleProps extends CommonProps {\n formatSpec?: FormatterSpec;\n initialMagnitude?: number;\n hideLabels?: boolean;\n}\n\n/** Component to show the persistence value and formatted value given a FormatterSpec.\n * @alpha\n */\nexport function FormatSample(props: FormatSampleProps) {\n const { initialMagnitude, formatSpec, hideLabels } = props;\n const initialValue = initialMagnitude ?? 0;\n const [magnitude, setMagnitude] = React.useState(initialValue);\n const [sampleValue, setSampleValue] = React.useState(initialValue.toString());\n\n React.useEffect(() => {\n const value = initialMagnitude ?? 0;\n setMagnitude(value);\n setSampleValue(value.toString());\n }, [initialMagnitude]);\n\n const handleOnValueBlur = React.useCallback(() => {\n let newValue = Number.parseFloat(sampleValue);\n if (Number.isNaN(newValue)) newValue = 0;\n setMagnitude(newValue);\n setSampleValue(newValue.toString());\n }, [sampleValue]);\n\n const handleOnValueChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setSampleValue(event.target.value);\n },\n []\n );\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (e.key === Key.Enter) {\n let newValue = Number.parseFloat(sampleValue);\n if (Number.isNaN(newValue)) newValue = 0;\n setMagnitude(newValue);\n setSampleValue(newValue.toString());\n e.preventDefault();\n }\n },\n [sampleValue]\n );\n\n const activePersistenceUnitLabel = formatSpec\n ? formatSpec.persistenceUnit.label\n : \"\";\n const formattedValue = formatSpec\n ? formatSpec.applyFormatting(magnitude)\n : \"\";\n\n const valueLabel = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.value\")\n );\n const formattedLabel = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.formatted\")\n );\n\n return (\n <>\n {!hideLabels && (\n <span className={\"uicore-label\"}>{valueLabel.current}</span>\n )}\n <span className=\"components-inline\">\n <Input\n data-testid=\"format-sample-input\"\n className={\"components-quantity-persistence-input\"}\n value={sampleValue}\n onChange={handleOnValueChange}\n onKeyDown={handleKeyDown}\n onBlur={handleOnValueBlur}\n size=\"small\"\n />\n {activePersistenceUnitLabel}\n </span>\n {!hideLabels && (\n <span className={\"uicore-label\"}>{formattedLabel.current}</span>\n )}\n <span data-testid=\"progress-forward\">\n {hideLabels && formattedValue.length > 0 && (\n <Icon iconSpec={<SvgProgressForward />} />\n )}\n <span\n data-testid=\"format-sample-formatted\"\n className={\"uicore-label components-quantity-formatted-sample\"}\n >\n {formattedValue}\n </span>\n </span>\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"FormatSample.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatSample.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAGlC,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAWhE;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,KAAwB;IACnD,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IAC3D,MAAM,YAAY,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG,KAAK,CAA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,EACrC,SAAS,EAAE,mDAAmD,IAE7D,cAAc,CACV,CACF,CACN,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { FormatterSpec } from \"@itwin/core-quantity\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Icon } from \"@itwin/core-react\";\nimport { Input } from \"@itwin/itwinui-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport { SvgProgressForward } from \"@itwin/itwinui-icons-react\";\n\n/** Properties of [[FormatSample]] component.\n * @alpha\n */\nexport interface FormatSampleProps extends CommonProps {\n formatSpec?: FormatterSpec;\n initialMagnitude?: number;\n hideLabels?: boolean;\n}\n\n/** Component to show the persistence value and formatted value given a FormatterSpec.\n * @alpha\n */\nexport function FormatSample(props: FormatSampleProps) {\n const { initialMagnitude, formatSpec, hideLabels } = props;\n const initialValue = initialMagnitude ?? 0;\n const [magnitude, setMagnitude] = React.useState(initialValue);\n const [sampleValue, setSampleValue] = React.useState(initialValue.toString());\n\n React.useEffect(() => {\n const value = initialMagnitude ?? 0;\n setMagnitude(value);\n setSampleValue(value.toString());\n }, [initialMagnitude]);\n\n const handleOnValueBlur = React.useCallback(() => {\n let newValue = Number.parseFloat(sampleValue);\n if (Number.isNaN(newValue)) newValue = 0;\n setMagnitude(newValue);\n setSampleValue(newValue.toString());\n }, [sampleValue]);\n\n const handleOnValueChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n setSampleValue(event.target.value);\n },\n []\n );\n\n const handleKeyDown = React.useCallback(\n (e: React.KeyboardEvent<HTMLInputElement>) => {\n // istanbul ignore else\n if (e.key === Key.Enter) {\n let newValue = Number.parseFloat(sampleValue);\n if (Number.isNaN(newValue)) newValue = 0;\n setMagnitude(newValue);\n setSampleValue(newValue.toString());\n e.preventDefault();\n }\n },\n [sampleValue]\n );\n\n const activePersistenceUnitLabel = formatSpec\n ? formatSpec.persistenceUnit.label\n : \"\";\n const formattedValue = formatSpec\n ? formatSpec.applyFormatting(magnitude)\n : \"\";\n\n const valueLabel = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.value\")\n );\n const formattedLabel = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.formatted\")\n );\n\n return (\n <>\n {!hideLabels && (\n <span className={\"uicore-label\"}>{valueLabel.current}</span>\n )}\n <span className=\"components-inline\">\n <Input\n data-testid=\"format-sample-input\"\n className={\"components-quantity-persistence-input\"}\n value={sampleValue}\n onChange={handleOnValueChange}\n onKeyDown={handleKeyDown}\n onBlur={handleOnValueBlur}\n size=\"small\"\n />\n {activePersistenceUnitLabel}\n </span>\n {!hideLabels && (\n <span className={\"uicore-label\"}>{formattedLabel.current}</span>\n )}\n <span data-testid=\"progress-forward\">\n {hideLabels && formattedValue.length > 0 && (\n <Icon iconSpec={<SvgProgressForward />} />\n )}\n <span\n data-testid=\"format-sample-formatted\"\n className={\"uicore-label components-quantity-formatted-sample\"}\n >\n {formattedValue}\n </span>\n </span>\n </>\n );\n}\n"]}
@@ -43,6 +43,7 @@ function FormatTypeSelector(props) {
43
43
  export function FormatTypeOption(props) {
44
44
  const { formatProps, onChange } = props;
45
45
  const handleFormatTypeChange = React.useCallback((newType) => {
46
+ var _a;
46
47
  const type = formatTypeToString(newType);
47
48
  let precision;
48
49
  let stationOffsetSize;
@@ -58,9 +59,7 @@ export function FormatTypeOption(props) {
58
59
  break;
59
60
  case FormatType.Station:
60
61
  precision = DecimalPrecision.Two;
61
- stationOffsetSize = formatProps.composite?.units[0].name
62
- .toLocaleLowerCase()
63
- .endsWith("m")
62
+ stationOffsetSize = ((_a = formatProps.composite) === null || _a === void 0 ? void 0 : _a.units[0].name.toLocaleLowerCase().endsWith("m"))
64
63
  ? 3
65
64
  : 2;
66
65
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"FormatType.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C;;GAEG;AACH,SAAS,kBAAkB,CAAC,KAA8B;IACxD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAA6B;QAC7D;YACE,KAAK,EAAE,UAAU,CAAC,OAAO;YACzB,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC;SAC9D;QACD;YACE,KAAK,EAAE,UAAU,CAAC,UAAU;YAC5B,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,CAAC;SACjE;QACD;YACE,KAAK,EAAE,UAAU,CAAC,OAAO;YACzB,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC;SAC9D;QACD;YACE,KAAK,EAAE,UAAU,CAAC,UAAU;YAC5B,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,CAAC;SACjE;KACF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CACtC,CAAC,QAAoB,EAAE,EAAE;QACvB,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC,EACD,CAAC,QAAQ,CAAC,CACX,CAA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BAAiB;SAClB,CAAC;QACF,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EACD,CAAC,WAAW,EAAE,QAAQ,CAAC,CACxB,CAAC;IAEF,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CACxB,kBAAkB,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAC3D,CAAC;IAEF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,sBAAsB,IAAG,KAAK,CAAC,OAAO,CAAQ;QAC/D,oBAAC,kBAAkB,mBACL,sBAAsB,EAClC,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,sBAAsB,GAChC,CACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport type { FormatProps } from \"@itwin/core-quantity\";\nimport {\n DecimalPrecision,\n FormatType,\n formatTypeToString,\n FractionalPrecision,\n parseFormatType,\n ScientificType,\n scientificTypeToString,\n} from \"@itwin/core-quantity\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } from \"@itwin/itwinui-react\";\n\n/** Properties of [[FormatTypeSelector]] component.\n * @alpha\n */\ninterface FormatTypeSelectorProps extends CommonProps {\n type: FormatType;\n onChange: (value: FormatType) => void;\n}\n\n/** Component to select the format type.\n * @alpha\n */\nfunction FormatTypeSelector(props: FormatTypeSelectorProps) {\n const { type, onChange, ...otherProps } = props;\n const formatOptions = React.useRef<SelectOption<FormatType>[]>([\n {\n value: FormatType.Decimal,\n label: UiIModelComponents.translate(\"QuantityFormat.decimal\"),\n },\n {\n value: FormatType.Scientific,\n label: UiIModelComponents.translate(\"QuantityFormat.scientific\"),\n },\n {\n value: FormatType.Station,\n label: UiIModelComponents.translate(\"QuantityFormat.station\"),\n },\n {\n value: FormatType.Fractional,\n label: UiIModelComponents.translate(\"QuantityFormat.fractional\"),\n },\n ]);\n\n const handleOnChange = React.useCallback(\n (newValue: FormatType) => {\n onChange && onChange(newValue);\n },\n [onChange]\n );\n\n return (\n <Select\n options={formatOptions.current}\n value={type}\n onChange={handleOnChange}\n size=\"small\"\n {...otherProps}\n />\n );\n}\n\n/** Properties of [[FormatTypeOptionProps]] component.\n * @alpha\n */\nexport interface FormatTypeOptionProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n}\n\n/** Component to set the Quantity Format type.\n * @alpha\n */\nexport function FormatTypeOption(props: FormatTypeOptionProps) {\n const { formatProps, onChange } = props;\n const handleFormatTypeChange = React.useCallback(\n (newType: FormatType) => {\n const type = formatTypeToString(newType);\n let precision: number | undefined;\n let stationOffsetSize: number | undefined;\n let scientificType: string | undefined;\n switch (\n newType // type must be decimal, fractional, scientific, or station\n ) {\n case FormatType.Scientific:\n precision = DecimalPrecision.Six;\n scientificType = scientificTypeToString(ScientificType.Normalized);\n break;\n case FormatType.Decimal:\n precision = DecimalPrecision.Four;\n break;\n case FormatType.Station:\n precision = DecimalPrecision.Two;\n stationOffsetSize = formatProps.composite?.units[0].name\n .toLocaleLowerCase()\n .endsWith(\"m\")\n ? 3\n : 2;\n break;\n case FormatType.Fractional:\n precision = FractionalPrecision.Eight;\n break;\n }\n const newFormatProps = {\n ...formatProps,\n type,\n precision,\n scientificType,\n stationOffsetSize,\n };\n onChange && onChange(newFormatProps);\n },\n [formatProps, onChange]\n );\n\n const formatType = parseFormatType(formatProps.type, \"format\");\n const label = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.type\")\n );\n\n return (\n <>\n <span className={\"uicore-label.current\"}>{label.current}</span>\n <FormatTypeSelector\n data-testid=\"format-type-selector\"\n type={formatType}\n onChange={handleFormatTypeChange}\n />\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"FormatType.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAU9C;;GAEG;AACH,SAAS,kBAAkB,CAAC,KAA8B;IACxD,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,UAAU,EAAE,GAAG,KAAK,CAAC;IAChD,MAAM,aAAa,GAAG,KAAK,CAAC,MAAM,CAA6B;QAC7D;YACE,KAAK,EAAE,UAAU,CAAC,OAAO;YACzB,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC;SAC9D;QACD;YACE,KAAK,EAAE,UAAU,CAAC,UAAU;YAC5B,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,CAAC;SACjE;QACD;YACE,KAAK,EAAE,UAAU,CAAC,OAAO;YACzB,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,wBAAwB,CAAC;SAC9D;QACD;YACE,KAAK,EAAE,UAAU,CAAC,UAAU;YAC5B,KAAK,EAAE,kBAAkB,CAAC,SAAS,CAAC,2BAA2B,CAAC;SACjE;KACF,CAAC,CAAC;IAEH,MAAM,cAAc,GAAG,KAAK,CAAC,WAAW,CACtC,CAAC,QAAoB,EAAE,EAAE;QACvB,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC;I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AW;YACd,IAAI;YACJ,SAAS;YACT,cAAc;YACd,iBAAiB;SAClB,CAAC;QACF,QAAQ,IAAI,QAAQ,CAAC,cAAc,CAAC,CAAC;IACvC,CAAC,EACD,CAAC,WAAW,EAAE,QAAQ,CAAC,CACxB,CAAC;IAEF,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/D,MAAM,KAAK,GAAG,KAAK,CAAC,MAAM,CACxB,kBAAkB,CAAC,SAAS,CAAC,4BAA4B,CAAC,CAC3D,CAAC;IAEF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,sBAAsB,IAAG,KAAK,CAAC,OAAO,CAAQ;QAC/D,oBAAC,kBAAkB,mBACL,sBAAsB,EAClC,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,sBAAsB,GAChC,CACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\nimport type { FormatProps } from \"@itwin/core-quantity\";\nimport {\n DecimalPrecision,\n FormatType,\n formatTypeToString,\n FractionalPrecision,\n parseFormatType,\n ScientificType,\n scientificTypeToString,\n} from \"@itwin/core-quantity\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Select } from \"@itwin/itwinui-react\";\n\n/** Properties of [[FormatTypeSelector]] component.\n * @alpha\n */\ninterface FormatTypeSelectorProps extends CommonProps {\n type: FormatType;\n onChange: (value: FormatType) => void;\n}\n\n/** Component to select the format type.\n * @alpha\n */\nfunction FormatTypeSelector(props: FormatTypeSelectorProps) {\n const { type, onChange, ...otherProps } = props;\n const formatOptions = React.useRef<SelectOption<FormatType>[]>([\n {\n value: FormatType.Decimal,\n label: UiIModelComponents.translate(\"QuantityFormat.decimal\"),\n },\n {\n value: FormatType.Scientific,\n label: UiIModelComponents.translate(\"QuantityFormat.scientific\"),\n },\n {\n value: FormatType.Station,\n label: UiIModelComponents.translate(\"QuantityFormat.station\"),\n },\n {\n value: FormatType.Fractional,\n label: UiIModelComponents.translate(\"QuantityFormat.fractional\"),\n },\n ]);\n\n const handleOnChange = React.useCallback(\n (newValue: FormatType) => {\n onChange && onChange(newValue);\n },\n [onChange]\n );\n\n return (\n <Select\n options={formatOptions.current}\n value={type}\n onChange={handleOnChange}\n size=\"small\"\n {...otherProps}\n />\n );\n}\n\n/** Properties of [[FormatTypeOptionProps]] component.\n * @alpha\n */\nexport interface FormatTypeOptionProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n}\n\n/** Component to set the Quantity Format type.\n * @alpha\n */\nexport function FormatTypeOption(props: FormatTypeOptionProps) {\n const { formatProps, onChange } = props;\n const handleFormatTypeChange = React.useCallback(\n (newType: FormatType) => {\n const type = formatTypeToString(newType);\n let precision: number | undefined;\n let stationOffsetSize: number | undefined;\n let scientificType: string | undefined;\n switch (\n newType // type must be decimal, fractional, scientific, or station\n ) {\n case FormatType.Scientific:\n precision = DecimalPrecision.Six;\n scientificType = scientificTypeToString(ScientificType.Normalized);\n break;\n case FormatType.Decimal:\n precision = DecimalPrecision.Four;\n break;\n case FormatType.Station:\n precision = DecimalPrecision.Two;\n stationOffsetSize = formatProps.composite?.units[0].name\n .toLocaleLowerCase()\n .endsWith(\"m\")\n ? 3\n : 2;\n break;\n case FormatType.Fractional:\n precision = FractionalPrecision.Eight;\n break;\n }\n const newFormatProps = {\n ...formatProps,\n type,\n precision,\n scientificType,\n stationOffsetSize,\n };\n onChange && onChange(newFormatProps);\n },\n [formatProps, onChange]\n );\n\n const formatType = parseFormatType(formatProps.type, \"format\");\n const label = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.type\")\n );\n\n return (\n <>\n <span className={\"uicore-label.current\"}>{label.current}</span>\n <FormatTypeSelector\n data-testid=\"format-type-selector\"\n type={formatType}\n onChange={handleFormatTypeChange}\n />\n </>\n );\n}\n"]}
@@ -36,6 +36,7 @@ function UomSeparatorSelector(props) {
36
36
  * @alpha
37
37
  */
38
38
  export function FormatUnitLabel(props) {
39
+ var _a;
39
40
  const { formatProps, onUnitLabelChange } = props;
40
41
  const handleSetFormatProps = React.useCallback((newProps) => {
41
42
  onUnitLabelChange && onUnitLabelChange(newProps);
@@ -85,6 +86,6 @@ export function FormatUnitLabel(props) {
85
86
  React.createElement("span", { className: "uicore-label" }, appendUnitLabel.current),
86
87
  React.createElement(Checkbox, { "data-testid": "show-unit-label-checkbox", checked: isFormatTraitSet(FormatTraits.ShowUnitLabel), onChange: handleShowUnitLabelChange }),
87
88
  React.createElement("span", { className: classnames("uicore-label", !isFormatTraitSet(FormatTraits.ShowUnitLabel) && "uicore-disabled") }, labelSeparator.current),
88
- React.createElement(UomSeparatorSelector, { "data-testid": "uom-separator-select", separator: formatProps.uomSeparator ?? "", onChange: handleUomSeparatorChange, disabled: !isFormatTraitSet(FormatTraits.ShowUnitLabel) })));
89
+ React.createElement(UomSeparatorSelector, { "data-testid": "uom-separator-select", separator: (_a = formatProps.uomSeparator) !== null && _a !== void 0 ? _a : "", onChange: handleUomSeparatorChange, disabled: !isFormatTraitSet(FormatTraits.ShowUnitLabel) })));
89
90
  }
90
91
  //# sourceMappingURL=FormatUnitLabel.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormatUnitLabel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatUnitLabel.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAA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CAAuC,CAAC,CACtE,CAAC;IACF,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CACjC,kBAAkB,CAAC,SAAS,CAAC,sCAAsC,CAAC,CACrE,CAAC;IAEF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,cAAc,IAAG,eAAe,CAAC,OAAO,CAAQ;QACjE,oBAAC,QAAQ,mBACK,0BAA0B,EACtC,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,aAAa,CAAC,EACrD,QAAQ,EAAE,yBAAyB,GACnC;QACF,8BACE,SAAS,EAAE,UAAU,CACnB,cAAc,EACd,CAAC,gBAAgB,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,iBAAiB,CACnE,IAEA,cAAc,CAAC,OAAO,CAClB;QACP,oBAAC,oBAAoB,mBACP,sBAAsB,EAClC,SAAS,EAAE,WAAW,CAAC,YAAY,IAAI,EAAE,EACzC,QAAQ,EAAE,wBAAwB,EAClC,QAAQ,EAAE,CAAC,gBAAgB,CAAC,YAAY,CAAC,aAAa,CAAC,GACvD,CACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type { FormatProps } from \"@itwin/core-quantity\";\nimport { Format, FormatTraits, getTraitString } from \"@itwin/core-quantity\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Checkbox, Select } from \"@itwin/itwinui-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\ninterface UomSeparatorSelectorProps extends CommonProps {\n separator: string;\n disabled?: boolean;\n onChange: (value: string) => void;\n}\n\nfunction UomSeparatorSelector(props: UomSeparatorSelectorProps) {\n const { separator, onChange, ...otherProps } = props;\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\n { value: \"\", label: UiIModelComponents.translate(\"QuantityFormat.none\") },\n { value: \" \", label: UiIModelComponents.translate(\"QuantityFormat.space\") },\n { value: \"-\", label: UiIModelComponents.translate(\"QuantityFormat.dash\") },\n ]);\n\n const handleOnChange = React.useCallback(\n (newValue: string) => {\n onChange && onChange(newValue);\n },\n [onChange]\n );\n\n const separatorOptions = React.useMemo(() => {\n const completeListOfEntries: SelectOption<string>[] = [];\n // istanbul ignore next (only used if format already has a character that does not match standard options)\n if (\n undefined ===\n uomDefaultEntries.current.find((option) => option.value === separator)\n ) {\n completeListOfEntries.push({ value: separator, label: separator });\n }\n completeListOfEntries.push(...uomDefaultEntries.current);\n return completeListOfEntries;\n }, [separator]);\n\n return (\n <Select\n options={separatorOptions}\n value={separator}\n onChange={handleOnChange}\n size=\"small\"\n {...otherProps}\n />\n );\n}\n\n/** Properties of [[FormatUnitLabel]] component.\n * @alpha\n */\nexport interface FormatUnitLabelProps extends CommonProps {\n formatProps: FormatProps;\n onUnitLabelChange?: (format: FormatProps) => void;\n}\n\n/** Component to set the label separator definition in a Quantity Format and if it the label is to be displayed.\n * @alpha\n */\nexport function FormatUnitLabel(props: FormatUnitLabelProps) {\n const { formatProps, onUnitLabelChange } = props;\n\n const handleSetFormatProps = React.useCallback(\n (newProps: FormatProps) => {\n onUnitLabelChange && onUnitLabelChange(newProps);\n },\n [onUnitLabelChange]\n );\n\n const isFormatTraitSet = React.useCallback(\n (trait: FormatTraits) => {\n return Format.isFormatTraitSetInProps(formatProps, trait);\n },\n [formatProps]\n );\n\n const setFormatTrait = React.useCallback(\n (trait: FormatTraits, setActive: boolean) => {\n const traitStr = getTraitString(trait);\n let formatTraits: string[] = [traitStr];\n if (setActive) {\n // setting trait\n // istanbul ignore else\n if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : /* istanbul ignore next */ formatProps.formatTraits.split(\n /,|;|\\|/\n );\n // istanbul ignore else\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\n formatTraits = [...traits, traitStr];\n }\n }\n } else {\n // clearing trait\n // istanbul ignore next\n if (!formatProps.formatTraits) return;\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\n }\n const newFormatProps = { ...formatProps, formatTraits };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n const handleUomSeparatorChange = React.useCallback(\n (newSeparator: string) => {\n const newFormatProps = { ...formatProps, uomSeparator: newSeparator };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n const handleShowUnitLabelChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.ShowUnitLabel, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const appendUnitLabel = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.appendUnitLabel\")\n );\n const labelSeparator = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.labelSeparator\")\n );\n\n return (\n <>\n <span className={\"uicore-label\"}>{appendUnitLabel.current}</span>\n <Checkbox\n data-testid=\"show-unit-label-checkbox\"\n checked={isFormatTraitSet(FormatTraits.ShowUnitLabel)}\n onChange={handleShowUnitLabelChange}\n />\n <span\n className={classnames(\n \"uicore-label\",\n !isFormatTraitSet(FormatTraits.ShowUnitLabel) && \"uicore-disabled\"\n )}\n >\n {labelSeparator.current}\n </span>\n <UomSeparatorSelector\n data-testid=\"uom-separator-select\"\n separator={formatProps.uomSeparator ?? \"\"}\n onChange={handleUomSeparatorChange}\n disabled={!isFormatTraitSet(FormatTraits.ShowUnitLabel)}\n />\n </>\n );\n}\n"]}
1
+ {"version":3,"file":"FormatUnitLabel.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/quantityformat/FormatUnitLabel.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cAAc,CAAC,YAAY,CAAC,aAAa,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC/D,CAAC,EACD,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,MAAM,eAAe,GAAG,KAAK,CAAC,MAAM,CAClC,kBAAkB,CAAC,SAAS,CAAC,uCAAuC,CAAC,CACtE,CAAC;IACF,MAAM,cAAc,GAAG,KAAK,CAAC,MAAM,CACjC,kBAAkB,CAAC,SAAS,CAAC,sCAAsC,CAAC,CACrE,CAAC;IAEF,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,cAAc,IAAG,eAAe,CAAC,OAAO,CAAQ;QACjE,oBAAC,QAAQ,mBACK,0BAA0B,EACtC,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,aAAa,CAAC,EACrD,QAAQ,EAAE,yBAAyB,GACnC;QACF,8BACE,SAAS,EAAE,UAAU,CACnB,cAAc,EACd,CAAC,gBAAgB,CAAC,YAAY,CAAC,aAAa,CAAC,IAAI,iBAAiB,CACnE,IAEA,cAAc,CAAC,OAAO,CAClB;QACP,oBAAC,oBAAoB,mBACP,sBAAsB,EAClC,SAAS,EAAE,MAAA,WAAW,CAAC,YAAY,mCAAI,EAAE,EACzC,QAAQ,EAAE,wBAAwB,EAClC,QAAQ,EAAE,CAAC,gBAAgB,CAAC,YAAY,CAAC,aAAa,CAAC,GACvD,CACD,CACJ,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module QuantityFormat\n */\n\nimport classnames from \"classnames\";\nimport * as React from \"react\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport type { FormatProps } from \"@itwin/core-quantity\";\nimport { Format, FormatTraits, getTraitString } from \"@itwin/core-quantity\";\nimport type { SelectOption } from \"@itwin/itwinui-react\";\nimport { Checkbox, Select } from \"@itwin/itwinui-react\";\nimport { UiIModelComponents } from \"../UiIModelComponents\";\n\ninterface UomSeparatorSelectorProps extends CommonProps {\n separator: string;\n disabled?: boolean;\n onChange: (value: string) => void;\n}\n\nfunction UomSeparatorSelector(props: UomSeparatorSelectorProps) {\n const { separator, onChange, ...otherProps } = props;\n const uomDefaultEntries = React.useRef<SelectOption<string>[]>([\n { value: \"\", label: UiIModelComponents.translate(\"QuantityFormat.none\") },\n { value: \" \", label: UiIModelComponents.translate(\"QuantityFormat.space\") },\n { value: \"-\", label: UiIModelComponents.translate(\"QuantityFormat.dash\") },\n ]);\n\n const handleOnChange = React.useCallback(\n (newValue: string) => {\n onChange && onChange(newValue);\n },\n [onChange]\n );\n\n const separatorOptions = React.useMemo(() => {\n const completeListOfEntries: SelectOption<string>[] = [];\n // istanbul ignore next (only used if format already has a character that does not match standard options)\n if (\n undefined ===\n uomDefaultEntries.current.find((option) => option.value === separator)\n ) {\n completeListOfEntries.push({ value: separator, label: separator });\n }\n completeListOfEntries.push(...uomDefaultEntries.current);\n return completeListOfEntries;\n }, [separator]);\n\n return (\n <Select\n options={separatorOptions}\n value={separator}\n onChange={handleOnChange}\n size=\"small\"\n {...otherProps}\n />\n );\n}\n\n/** Properties of [[FormatUnitLabel]] component.\n * @alpha\n */\nexport interface FormatUnitLabelProps extends CommonProps {\n formatProps: FormatProps;\n onUnitLabelChange?: (format: FormatProps) => void;\n}\n\n/** Component to set the label separator definition in a Quantity Format and if it the label is to be displayed.\n * @alpha\n */\nexport function FormatUnitLabel(props: FormatUnitLabelProps) {\n const { formatProps, onUnitLabelChange } = props;\n\n const handleSetFormatProps = React.useCallback(\n (newProps: FormatProps) => {\n onUnitLabelChange && onUnitLabelChange(newProps);\n },\n [onUnitLabelChange]\n );\n\n const isFormatTraitSet = React.useCallback(\n (trait: FormatTraits) => {\n return Format.isFormatTraitSetInProps(formatProps, trait);\n },\n [formatProps]\n );\n\n const setFormatTrait = React.useCallback(\n (trait: FormatTraits, setActive: boolean) => {\n const traitStr = getTraitString(trait);\n let formatTraits: string[] = [traitStr];\n if (setActive) {\n // setting trait\n // istanbul ignore else\n if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : /* istanbul ignore next */ formatProps.formatTraits.split(\n /,|;|\\|/\n );\n // istanbul ignore else\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\n formatTraits = [...traits, traitStr];\n }\n }\n } else {\n // clearing trait\n // istanbul ignore next\n if (!formatProps.formatTraits) return;\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : /* istanbul ignore next */ formatProps.formatTraits.split(/,|;|\\|/);\n formatTraits = traits.filter((traitEntry) => traitEntry !== traitStr);\n }\n const newFormatProps = { ...formatProps, formatTraits };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n const handleUomSeparatorChange = React.useCallback(\n (newSeparator: string) => {\n const newFormatProps = { ...formatProps, uomSeparator: newSeparator };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n const handleShowUnitLabelChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.ShowUnitLabel, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const appendUnitLabel = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.appendUnitLabel\")\n );\n const labelSeparator = React.useRef(\n UiIModelComponents.translate(\"QuantityFormat.labels.labelSeparator\")\n );\n\n return (\n <>\n <span className={\"uicore-label\"}>{appendUnitLabel.current}</span>\n <Checkbox\n data-testid=\"show-unit-label-checkbox\"\n checked={isFormatTraitSet(FormatTraits.ShowUnitLabel)}\n onChange={handleShowUnitLabelChange}\n />\n <span\n className={classnames(\n \"uicore-label\",\n !isFormatTraitSet(FormatTraits.ShowUnitLabel) && \"uicore-disabled\"\n )}\n >\n {labelSeparator.current}\n </span>\n <UomSeparatorSelector\n data-testid=\"uom-separator-select\"\n separator={formatProps.uomSeparator ?? \"\"}\n onChange={handleUomSeparatorChange}\n disabled={!isFormatTraitSet(FormatTraits.ShowUnitLabel)}\n />\n </>\n );\n}\n"]}