@itwin/imodel-components-react 5.3.1 → 5.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -4
- package/lib/imodel-components-react/UiIModelComponents.js +1 -1
- package/lib/imodel-components-react/UiIModelComponents.js.map +1 -1
- package/lib/imodel-components-react/editors/NewWeightEditor.d.ts +10 -0
- package/lib/imodel-components-react/editors/NewWeightEditor.d.ts.map +1 -0
- package/lib/imodel-components-react/editors/NewWeightEditor.js +32 -0
- package/lib/imodel-components-react/editors/NewWeightEditor.js.map +1 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityEditor.d.ts +19 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityEditor.d.ts.map +1 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityEditor.js +34 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityEditor.js.map +1 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityInput.d.ts +15 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityInput.d.ts.map +1 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityInput.js +29 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityInput.js.map +1 -0
- package/lib/imodel-components-react/inputs/new-editors/UseQuantityInfo.d.ts +15 -0
- package/lib/imodel-components-react/inputs/new-editors/UseQuantityInfo.d.ts.map +1 -0
- package/lib/imodel-components-react/inputs/new-editors/UseQuantityInfo.js +47 -0
- package/lib/imodel-components-react/inputs/new-editors/UseQuantityInfo.js.map +1 -0
- package/lib/imodel-components-react/quantityformat/FormatType.d.ts.map +1 -1
- package/lib/imodel-components-react/quantityformat/FormatType.js +2 -0
- package/lib/imodel-components-react/quantityformat/FormatType.js.map +1 -1
- package/lib/imodel-components-react/quantityformat/MiscFormatOptions.d.ts.map +1 -1
- package/lib/imodel-components-react/quantityformat/MiscFormatOptions.js +2 -0
- package/lib/imodel-components-react/quantityformat/MiscFormatOptions.js.map +1 -1
- package/lib/imodel-components-react.d.ts +2 -0
- package/lib/imodel-components-react.d.ts.map +1 -1
- package/lib/imodel-components-react.js +2 -0
- package/lib/imodel-components-react.js.map +1 -1
- package/package.json +26 -27
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAG7B;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU;QAC5B,IAAI,kBAAkB,CAAC,YAAY,EAAE,CAAC;YACpC,MAAM,CAAC,OAAO,CACZ,kBAAkB,CAAC,cAAc,CAAC,oBAAoB,CAAC,EACvD,8CAA8C,CAC/C,CAAC;YACF,OAAO;QACT,CAAC;QAED,MAAM,SAAS,CAAC,YAAY,EAAE,iBAAiB,CAC7C,kBAAkB,CAAC,qBAAqB,CACzC,CAAC;QAEF,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;YAC5B,oEAAoE;YACpE,MAAM,YAAY,GAAG,IAAI,iBAAiB,EAAE,CAAC;YAC7C,MAAM,YAAY,CAAC,UAAU,EAAE,CAAC;YAChC,MAAM,YAAY,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC;QAC9C,CAAC;aAAM,CAAC;YACN,MAAM,YAAY,CAAC,UAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACxD,CAAC;QAED,kBAAkB,CAAC,YAAY,GAAG,IAAI,CAAC;IACzC,CAAC;IAED,gEAAgE;IACzD,MAAM,CAAC,SAAS;QACrB,SAAS,CAAC,YAAY,EAAE,mBAAmB,CACzC,kBAAkB,CAAC,qBAAqB,CACzC,CAAC;QACF,YAAY,CAAC,SAAS,EAAE,CAAC;QACzB,kBAAkB,CAAC,YAAY,GAAG,KAAK,CAAC;IAC1C,CAAC;IAED,4DAA4D;IACrD,MAAM,KAAK,WAAW;QAC3B,OAAO,kBAAkB,CAAC,YAAY,CAAC;IACzC,CAAC;IAED,kDAAkD;IAC3C,MAAM,KAAK,qBAAqB;QACrC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,gBAAgB;IACT,MAAM,KAAK,WAAW;QAC3B,OAAO,yBAAyB,CAAC;IACnC,CAAC;IAED;;OAEG;IACI,MAAM,CAAC,SAAS,CAAC,GAAsB;QAC5C,IAAI,CAAC,kBAAkB,CAAC,WAAW,IAAI,CAAC,SAAS,CAAC,YAAY,EAAE,CAAC;YAC/D,MAAM,CAAC,QAAQ,CACb,kBAAkB,CAAC,cAAc,CAAC,oBAAoB,CAAC,EACvD,+EAA+E,CAChF,CAAC;YACF,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAC9C,GAAG,kBAAkB,CAAC,qBAAqB,IAAI,GAAG,EAAE,
|
|
1
|
+
{"version":3,"file":"UiIModelComponents.js","sourceRoot":"","sources":["../../src/imodel-components-react/UiIModelComponents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAG7B;;OAEG;IACI,MAAM,CAAC,KAAK,CAAC,UAAU;QAC5B,IAAI,kBAAkB,CAAC,Y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C,oBAAoB,CAAC,EACvD,+EAA+E,CAChF,CAAC;YACF,OAAO,EAAE,CAAC;QACZ,CAAC;QACD,OAAO,SAAS,CAAC,YAAY,CAAC,kBAAkB,CAC9C,GAAG,kBAAkB,CAAC,qBAAqB,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAC7D,CAAC;IACJ,CAAC;IAED,gBAAgB;IACT,MAAM,CAAC,cAAc,CAAC,IAAY;QACvC,OAAO,GAAG,kBAAkB,CAAC,WAAW,IAAI,IAAI,EAAE,CAAC;IACrD,CAAC;;AAzEc,+BAAY,GAAG,KAAK,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 Common\n */\n\nimport { Logger } from \"@itwin/core-bentley\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { UiComponents } from \"@itwin/components-react\";\nimport { EmptyLocalization } from \"@itwin/core-common\";\n\n/**\n * Manages the localization service for the imodel-components-react package.\n * @public\n */\nexport class UiIModelComponents {\n private static _initialized = false;\n\n /**\n * initialize UiIModelComponents.\n */\n public static async initialize(): Promise<void> {\n if (UiIModelComponents._initialized) {\n Logger.logInfo(\n UiIModelComponents.loggerCategory(\"UiIModelComponents\"),\n `UiIModelComponents.initialize already called`\n );\n return;\n }\n\n await IModelApp.localization?.registerNamespace(\n UiIModelComponents.localizationNamespace\n );\n\n if (!IModelApp.localization) {\n // it should only get here in unit test where IModelApp is not setup\n const localization = new EmptyLocalization();\n await localization.initialize();\n await UiComponents.initialize(localization);\n } else {\n await UiComponents.initialize(IModelApp.localization);\n }\n\n UiIModelComponents._initialized = true;\n }\n\n /** Unregisters the UiIModelComponents localization namespace */\n public static terminate() {\n IModelApp.localization?.unregisterNamespace(\n UiIModelComponents.localizationNamespace\n );\n UiComponents.terminate();\n UiIModelComponents._initialized = false;\n }\n\n /** Determines if UiIModelComponents has been initialized */\n public static get initialized(): boolean {\n return UiIModelComponents._initialized;\n }\n\n /** The internationalization service namespace. */\n public static get localizationNamespace(): string {\n return \"UiIModelComponents\";\n }\n\n /** @internal */\n public static get packageName(): string {\n return \"imodel-components-react\";\n }\n\n /** Calls localization.getLocalizedString with the \"UiIModelComponents\" namespace. Do NOT include the namespace in the key.\n * @internal\n */\n public static translate(key: string | string[]): string {\n if (!UiIModelComponents.initialized || !IModelApp.localization) {\n Logger.logError(\n UiIModelComponents.loggerCategory(\"UiIModelComponents\"),\n `translate: IModelApp.localization has not been setup. Returning blank string.`\n );\n return \"\";\n }\n return IModelApp.localization.getLocalizedString(\n `${UiIModelComponents.localizationNamespace}:${String(key)}`\n );\n }\n\n /** @internal */\n public static loggerCategory(name: string): string {\n return `${UiIModelComponents.packageName}.${name}`;\n }\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyEditors
|
|
3
|
+
*/
|
|
4
|
+
import { type EditorSpec } from "@itwin/components-react";
|
|
5
|
+
/**
|
|
6
|
+
* Editor specification for weight editor.
|
|
7
|
+
* @beta
|
|
8
|
+
*/
|
|
9
|
+
export declare const WeightEditorSpec: EditorSpec;
|
|
10
|
+
//# sourceMappingURL=NewWeightEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewWeightEditor.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/editors/NewWeightEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EAGL,KAAK,UAAU,EAGhB,MAAM,yBAAyB,CAAC;AAIjC;;;GAGG;AACH,eAAO,MAAM,gBAAgB,EAAE,UAM7B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module PropertyEditors
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { StandardEditorNames } from "@itwin/appui-abstract";
|
|
10
|
+
import { WeightPickerButton } from "../lineweight/WeightPickerButton.js";
|
|
11
|
+
import { createEditorSpec, ValueUtilities, } from "@itwin/components-react";
|
|
12
|
+
/* v8 ignore start */
|
|
13
|
+
/**
|
|
14
|
+
* Editor specification for weight editor.
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
export const WeightEditorSpec = createEditorSpec({
|
|
18
|
+
isMetadataSupported: (metadata) => metadata.type === "number" &&
|
|
19
|
+
metadata.preferredEditor === StandardEditorNames.WeightPicker,
|
|
20
|
+
isValueSupported: ValueUtilities.isNumeric,
|
|
21
|
+
Editor: WeightEditor,
|
|
22
|
+
});
|
|
23
|
+
function WeightEditor({ value, onChange, commit, }) {
|
|
24
|
+
const currentValue = value ? value : { rawValue: 0, displayValue: "" };
|
|
25
|
+
return (React.createElement(WeightPickerButton, { activeWeight: currentValue.rawValue ?? 0, onLineWeightPick: (newWeight) => {
|
|
26
|
+
const newValue = { rawValue: newWeight, displayValue: "" };
|
|
27
|
+
onChange(newValue);
|
|
28
|
+
commit?.();
|
|
29
|
+
} }));
|
|
30
|
+
}
|
|
31
|
+
/* v8 ignore stop */
|
|
32
|
+
//# sourceMappingURL=NewWeightEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewWeightEditor.js","sourceRoot":"","sources":["../../../src/imodel-components-react/editors/NewWeightEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAEzE,OAAO,EACL,gBAAgB,EAIhB,cAAc,GACf,MAAM,yBAAyB,CAAC;AAEjC,qBAAqB;AAErB;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAe,gBAAgB,CAAC;IAC3D,mBAAmB,EAAE,CAAC,QAAQ,EAA6B,EAAE,CAC3D,QAAQ,CAAC,IAAI,KAAK,QAAQ;QAC1B,QAAQ,CAAC,eAAe,KAAK,mBAAmB,CAAC,YAAY;IAC/D,gBAAgB,EAAE,cAAc,CAAC,SAAS;IAC1C,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,SAAS,YAAY,CAAC,EACpB,KAAK,EACL,QAAQ,EACR,MAAM,GACmC;IACzC,MAAM,YAAY,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IAEvE,OAAO,CACL,oBAAC,kBAAkB,IACjB,YAAY,EAAE,YAAY,CAAC,QAAQ,IAAI,CAAC,EACxC,gBAAgB,EAAE,CAAC,SAAS,EAAE,EAAE;YAC9B,MAAM,QAAQ,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;YAC3D,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnB,MAAM,EAAE,EAAE,CAAC;QACb,CAAC,GACD,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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 PropertyEditors\n */\n\nimport * as React from \"react\";\nimport { StandardEditorNames } from \"@itwin/appui-abstract\";\nimport { WeightPickerButton } from \"../lineweight/WeightPickerButton.js\";\nimport type { ValueMetadata } from \"@itwin/components-react\";\nimport {\n createEditorSpec,\n type EditorProps,\n type EditorSpec,\n type NumericValue,\n ValueUtilities,\n} from \"@itwin/components-react\";\n\n/* v8 ignore start */\n\n/**\n * Editor specification for weight editor.\n * @beta\n */\nexport const WeightEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is ValueMetadata =>\n metadata.type === \"number\" &&\n metadata.preferredEditor === StandardEditorNames.WeightPicker,\n isValueSupported: ValueUtilities.isNumeric,\n Editor: WeightEditor,\n});\n\nfunction WeightEditor({\n value,\n onChange,\n commit,\n}: EditorProps<ValueMetadata, NumericValue>) {\n const currentValue = value ? value : { rawValue: 0, displayValue: \"\" };\n\n return (\n <WeightPickerButton\n activeWeight={currentValue.rawValue ?? 0}\n onLineWeightPick={(newWeight) => {\n const newValue = { rawValue: newWeight, displayValue: \"\" };\n onChange(newValue);\n commit?.();\n }}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** @packageDocumentation
|
|
2
|
+
* @module PropertyEditors
|
|
3
|
+
*/
|
|
4
|
+
import { type QuantityTypeArg } from "@itwin/core-frontend";
|
|
5
|
+
import { type EditorSpec, type ValueMetadata } from "@itwin/components-react";
|
|
6
|
+
/**
|
|
7
|
+
* Editor specification for quantity values based on `IModelApp.quantityFormatter`.
|
|
8
|
+
* @beta
|
|
9
|
+
*/
|
|
10
|
+
export declare const QuantityEditorSpec: EditorSpec;
|
|
11
|
+
/**
|
|
12
|
+
* Metadata for quantity values.
|
|
13
|
+
* @beta
|
|
14
|
+
*/
|
|
15
|
+
export interface QuantityValueMetadata extends ValueMetadata {
|
|
16
|
+
type: "number";
|
|
17
|
+
quantityType: QuantityTypeArg;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=QuantityEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuantityEditor.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/new-editors/QuantityEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAGL,KAAK,UAAU,EAEf,KAAK,aAAa,EAEnB,MAAM,yBAAyB,CAAC;AAKjC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAO/B,CAAC;AAEH;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IAC1D,IAAI,EAAE,QAAQ,CAAC;IACf,YAAY,EAAE,eAAe,CAAC;CAC/B"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
/** @packageDocumentation
|
|
6
|
+
* @module PropertyEditors
|
|
7
|
+
*/
|
|
8
|
+
import * as React from "react";
|
|
9
|
+
import { useQuantityInfo } from "./UseQuantityInfo.js";
|
|
10
|
+
import { createEditorSpec, ValueUtilities, } from "@itwin/components-react";
|
|
11
|
+
import { QuantityInput } from "./QuantityInput.js";
|
|
12
|
+
/* v8 ignore start */
|
|
13
|
+
/**
|
|
14
|
+
* Editor specification for quantity values based on `IModelApp.quantityFormatter`.
|
|
15
|
+
* @beta
|
|
16
|
+
*/
|
|
17
|
+
export const QuantityEditorSpec = createEditorSpec({
|
|
18
|
+
isMetadataSupported: (metadata) => metadata.type === "number" &&
|
|
19
|
+
"quantityType" in metadata &&
|
|
20
|
+
metadata.quantityType !== undefined,
|
|
21
|
+
isValueSupported: ValueUtilities.isNumeric,
|
|
22
|
+
Editor: QuantityEditor,
|
|
23
|
+
});
|
|
24
|
+
function QuantityEditor({ metadata, value, onChange, size, }) {
|
|
25
|
+
const { formatter, parser } = useQuantityInfo({
|
|
26
|
+
type: metadata.quantityType,
|
|
27
|
+
});
|
|
28
|
+
const currentValue = value
|
|
29
|
+
? value
|
|
30
|
+
: { rawValue: undefined, displayValue: "" };
|
|
31
|
+
return (React.createElement(QuantityInput, { value: currentValue, onChange: onChange, size: size, formatter: formatter, parser: parser }));
|
|
32
|
+
}
|
|
33
|
+
/* v8 ignore stop */
|
|
34
|
+
//# sourceMappingURL=QuantityEditor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuantityEditor.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/new-editors/QuantityEditor.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EACL,gBAAgB,EAKhB,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,qBAAqB;AAErB;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAe,gBAAgB,CAAC;IAC7D,mBAAmB,EAAE,CAAC,QAAQ,EAAqC,EAAE,CACnE,QAAQ,CAAC,IAAI,KAAK,QAAQ;QAC1B,cAAc,IAAI,QAAQ;QAC1B,QAAQ,CAAC,YAAY,KAAK,SAAS;IACrC,gBAAgB,EAAE,cAAc,CAAC,SAAS;IAC1C,MAAM,EAAE,cAAc;CACvB,CAAC,CAAC;AAWH,SAAS,cAAc,CAAC,EACtB,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,GAC6C;IACjD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,eAAe,CAAC;QAC5C,IAAI,EAAE,QAAQ,CAAC,YAAY;KAC5B,CAAC,CAAC;IACH,MAAM,YAAY,GAAG,KAAK;QACxB,CAAC,CAAC,KAAK;QACP,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC;IAE9C,OAAO,CACL,oBAAC,aAAa,IACZ,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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 PropertyEditors\n */\n\nimport * as React from \"react\";\nimport { type QuantityTypeArg } from \"@itwin/core-frontend\";\nimport { useQuantityInfo } from \"./UseQuantityInfo.js\";\nimport {\n createEditorSpec,\n type EditorProps,\n type EditorSpec,\n type NumericValue,\n type ValueMetadata,\n ValueUtilities,\n} from \"@itwin/components-react\";\nimport { QuantityInput } from \"./QuantityInput.js\";\n\n/* v8 ignore start */\n\n/**\n * Editor specification for quantity values based on `IModelApp.quantityFormatter`.\n * @beta\n */\nexport const QuantityEditorSpec: EditorSpec = createEditorSpec({\n isMetadataSupported: (metadata): metadata is QuantityValueMetadata =>\n metadata.type === \"number\" &&\n \"quantityType\" in metadata &&\n metadata.quantityType !== undefined,\n isValueSupported: ValueUtilities.isNumeric,\n Editor: QuantityEditor,\n});\n\n/**\n * Metadata for quantity values.\n * @beta\n */\nexport interface QuantityValueMetadata extends ValueMetadata {\n type: \"number\";\n quantityType: QuantityTypeArg;\n}\n\nfunction QuantityEditor({\n metadata,\n value,\n onChange,\n size,\n}: EditorProps<QuantityValueMetadata, NumericValue>) {\n const { formatter, parser } = useQuantityInfo({\n type: metadata.quantityType,\n });\n const currentValue = value\n ? value\n : { rawValue: undefined, displayValue: \"\" };\n\n return (\n <QuantityInput\n value={currentValue}\n onChange={onChange}\n size={size}\n formatter={formatter}\n parser={parser}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { FormattedNumericInput } from "@itwin/components-react";
|
|
3
|
+
import type { FormatterSpec, ParserSpec } from "@itwin/core-quantity";
|
|
4
|
+
type FormattedNumericInputProps = React.ComponentPropsWithoutRef<typeof FormattedNumericInput>;
|
|
5
|
+
interface QuantityInputProps extends Omit<FormattedNumericInputProps, "parseValue" | "formatValue" | "disabled"> {
|
|
6
|
+
formatter?: FormatterSpec;
|
|
7
|
+
parser?: ParserSpec;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A component that wraps `FormattedNumericInput` and takes a formatter and parser for quantity values.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare function QuantityInput({ formatter, parser, ...props }: QuantityInputProps): React.JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=QuantityInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuantityInput.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/new-editors/QuantityInput.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAItE,KAAK,0BAA0B,GAAG,KAAK,CAAC,wBAAwB,CAC9D,OAAO,qBAAqB,CAC7B,CAAC;AAEF,UAAU,kBACR,SAAQ,IAAI,CACV,0BAA0B,EAC1B,YAAY,GAAG,aAAa,GAAG,UAAU,CAC1C;IACD,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,MAAM,EACN,GAAG,KAAK,EACT,EAAE,kBAAkB,qBAgCpB"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import * as React from "react";
|
|
6
|
+
import { FormattedNumericInput } from "@itwin/components-react";
|
|
7
|
+
/**
|
|
8
|
+
* A component that wraps `FormattedNumericInput` and takes a formatter and parser for quantity values.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export function QuantityInput({ formatter, parser, ...props }) {
|
|
12
|
+
const initialValue = React.useRef(props.value);
|
|
13
|
+
const formatValue = React.useCallback((currValue) => {
|
|
14
|
+
if (!formatter) {
|
|
15
|
+
return initialValue.current.displayValue;
|
|
16
|
+
}
|
|
17
|
+
return formatter.applyFormatting(currValue);
|
|
18
|
+
}, [formatter]);
|
|
19
|
+
const parseString = React.useCallback((userInput) => {
|
|
20
|
+
if (!parser) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
const parseResult = parser.parseToQuantityValue(userInput);
|
|
24
|
+
return parseResult.ok ? parseResult.value : undefined;
|
|
25
|
+
}, [parser]);
|
|
26
|
+
return (React.createElement(FormattedNumericInput, { ...props, value: props.value, formatValue: formatValue, parseValue: parseString, disabled: !formatter || !parser }));
|
|
27
|
+
}
|
|
28
|
+
/* v8 ignore stop */
|
|
29
|
+
//# sourceMappingURL=QuantityInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QuantityInput.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/new-editors/QuantityInput.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAkBhE;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,SAAS,EACT,MAAM,EACN,GAAG,KAAK,EACW;IACnB,MAAM,YAAY,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,SAAiB,EAAE,EAAE;QACpB,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,OAAO,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC;QAC3C,CAAC;QACD,OAAO,SAAS,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;IAC9C,CAAC,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,MAAM,WAAW,GAAG,KAAK,CAAC,WAAW,CACnC,CAAC,SAAiB,EAAE,EAAE;QACpB,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,MAAM,WAAW,GAAG,MAAM,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;QAC3D,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACxD,CAAC,EACD,CAAC,MAAM,CAAC,CACT,CAAC;IAEF,OAAO,CACL,oBAAC,qBAAqB,OAChB,KAAK,EACT,KAAK,EAAE,KAAK,CAAC,KAAK,EAClB,WAAW,EAAE,WAAW,EACxB,UAAU,EAAE,WAAW,EACvB,QAAQ,EAAE,CAAC,SAAS,IAAI,CAAC,MAAM,GAC/B,CACH,CAAC;AACJ,CAAC;AAED,oBAAoB","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\nimport * as React from \"react\";\nimport { FormattedNumericInput } from \"@itwin/components-react\";\nimport type { FormatterSpec, ParserSpec } from \"@itwin/core-quantity\";\n\n/* v8 ignore start */\n\ntype FormattedNumericInputProps = React.ComponentPropsWithoutRef<\n typeof FormattedNumericInput\n>;\n\ninterface QuantityInputProps\n extends Omit<\n FormattedNumericInputProps,\n \"parseValue\" | \"formatValue\" | \"disabled\"\n > {\n formatter?: FormatterSpec;\n parser?: ParserSpec;\n}\n\n/**\n * A component that wraps `FormattedNumericInput` and takes a formatter and parser for quantity values.\n * @internal\n */\nexport function QuantityInput({\n formatter,\n parser,\n ...props\n}: QuantityInputProps) {\n const initialValue = React.useRef(props.value);\n const formatValue = React.useCallback(\n (currValue: number) => {\n if (!formatter) {\n return initialValue.current.displayValue;\n }\n return formatter.applyFormatting(currValue);\n },\n [formatter]\n );\n\n const parseString = React.useCallback(\n (userInput: string) => {\n if (!parser) {\n return undefined;\n }\n const parseResult = parser.parseToQuantityValue(userInput);\n return parseResult.ok ? parseResult.value : undefined;\n },\n [parser]\n );\n\n return (\n <FormattedNumericInput\n {...props}\n value={props.value}\n formatValue={formatValue}\n parseValue={parseString}\n disabled={!formatter || !parser}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { QuantityTypeArg } from "@itwin/core-frontend";
|
|
2
|
+
import type { FormatterSpec, ParserSpec } from "@itwin/core-quantity";
|
|
3
|
+
interface UseQuantityInfoProps {
|
|
4
|
+
type: QuantityTypeArg | undefined;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Hook that finds the formatter and parser in `IModelApp.quantityFormatter` for a given quantity type.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare function useQuantityInfo({ type }: UseQuantityInfoProps): {
|
|
11
|
+
formatter: FormatterSpec | undefined;
|
|
12
|
+
parser: ParserSpec | undefined;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=UseQuantityInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseQuantityInfo.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/new-editors/UseQuantityInfo.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAKtE,UAAU,oBAAoB;IAC5B,IAAI,EAAE,eAAe,GAAG,SAAS,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,oBAAoB;;;EAiD7D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { IModelApp } from "@itwin/core-frontend";
|
|
6
|
+
import * as React from "react";
|
|
7
|
+
/**
|
|
8
|
+
* Hook that finds the formatter and parser in `IModelApp.quantityFormatter` for a given quantity type.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export function useQuantityInfo({ type }) {
|
|
12
|
+
const [{ formatter, parser }, setState] = React.useState(() => ({
|
|
13
|
+
formatter: undefined,
|
|
14
|
+
parser: undefined,
|
|
15
|
+
}));
|
|
16
|
+
React.useEffect(() => {
|
|
17
|
+
if (type === undefined) {
|
|
18
|
+
setState({
|
|
19
|
+
formatter: undefined,
|
|
20
|
+
parser: undefined,
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const loadFormatterParser = () => {
|
|
25
|
+
const formatterSpec = IModelApp.quantityFormatter.findFormatterSpecByQuantityType(type);
|
|
26
|
+
const parserSpec = IModelApp.quantityFormatter.findParserSpecByQuantityType(type);
|
|
27
|
+
setState({ formatter: formatterSpec, parser: parserSpec });
|
|
28
|
+
};
|
|
29
|
+
loadFormatterParser();
|
|
30
|
+
const removeListeners = [
|
|
31
|
+
IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(loadFormatterParser),
|
|
32
|
+
IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(({ quantityType }) => {
|
|
33
|
+
if (quantityType === type) {
|
|
34
|
+
loadFormatterParser();
|
|
35
|
+
}
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
return () => {
|
|
39
|
+
removeListeners.forEach((remove) => {
|
|
40
|
+
remove();
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
}, [type]);
|
|
44
|
+
return { formatter, parser };
|
|
45
|
+
}
|
|
46
|
+
/* v8 ignore stop */
|
|
47
|
+
//# sourceMappingURL=UseQuantityInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseQuantityInfo.js","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/new-editors/UseQuantityInfo.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAQ/B;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,EAAE,IAAI,EAAwB;IAC5D,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAGrD,GAAG,EAAE,CAAC,CAAC;QACR,SAAS,EAAE,SAAS;QACpB,MAAM,EAAE,SAAS;KAClB,CAAC,CAAC,CAAC;IAEJ,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,QAAQ,CAAC;gBACP,SAAS,EAAE,SAAS;gBACpB,MAAM,EAAE,SAAS;aAClB,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,MAAM,mBAAmB,GAAG,GAAG,EAAE;YAC/B,MAAM,aAAa,GACjB,SAAS,CAAC,iBAAiB,CAAC,+BAA+B,CAAC,IAAI,CAAC,CAAC;YACpE,MAAM,UAAU,GACd,SAAS,CAAC,iBAAiB,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC;YAEjE,QAAQ,CAAC,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;QAC7D,CAAC,CAAC;QAEF,mBAAmB,EAAE,CAAC;QACtB,MAAM,eAAe,GAAG;YACtB,SAAS,CAAC,iBAAiB,CAAC,mCAAmC,CAAC,WAAW,CACzE,mBAAmB,CACpB;YACD,SAAS,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,WAAW,CAC9D,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;gBACnB,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;oBAC1B,mBAAmB,EAAE,CAAC;gBACxB,CAAC;YACH,CAAC,CACF;SACF,CAAC;QAEF,OAAO,GAAG,EAAE;YACV,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACjC,MAAM,EAAE,CAAC;YACX,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC;AAED,oBAAoB","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\nimport type { QuantityTypeArg } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { FormatterSpec, ParserSpec } from \"@itwin/core-quantity\";\nimport * as React from \"react\";\n\n/* v8 ignore start */\n\ninterface UseQuantityInfoProps {\n type: QuantityTypeArg | undefined;\n}\n\n/**\n * Hook that finds the formatter and parser in `IModelApp.quantityFormatter` for a given quantity type.\n * @internal\n */\nexport function useQuantityInfo({ type }: UseQuantityInfoProps) {\n const [{ formatter, parser }, setState] = React.useState<{\n formatter: FormatterSpec | undefined;\n parser: ParserSpec | undefined;\n }>(() => ({\n formatter: undefined,\n parser: undefined,\n }));\n\n React.useEffect(() => {\n if (type === undefined) {\n setState({\n formatter: undefined,\n parser: undefined,\n });\n return;\n }\n\n const loadFormatterParser = () => {\n const formatterSpec =\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(type);\n const parserSpec =\n IModelApp.quantityFormatter.findParserSpecByQuantityType(type);\n\n setState({ formatter: formatterSpec, parser: parserSpec });\n };\n\n loadFormatterParser();\n const removeListeners = [\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(\n loadFormatterParser\n ),\n IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(\n ({ quantityType }) => {\n if (quantityType === type) {\n loadFormatterParser();\n }\n }\n ),\n ];\n\n return () => {\n removeListeners.forEach((remove) => {\n remove();\n });\n };\n }, [type]);\n\n return { formatter, parser };\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatType.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAkExD;;;GAGG;AAEH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C;AAED;;GAEG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"FormatType.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/quantityformat/FormatType.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAkExD;;;GAGG;AAEH,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;CAC1C;AAED;;GAEG;AAEH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBA0D5D"}
|
|
@@ -46,6 +46,7 @@ export function FormatTypeOption(props) {
|
|
|
46
46
|
const { formatProps, onChange } = props;
|
|
47
47
|
const { translate } = useTranslation();
|
|
48
48
|
const handleFormatTypeChange = React.useCallback((newType) => {
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
49
50
|
const type = formatTypeToString(newType);
|
|
50
51
|
let precision;
|
|
51
52
|
let stationOffsetSize;
|
|
@@ -54,6 +55,7 @@ export function FormatTypeOption(props) {
|
|
|
54
55
|
) {
|
|
55
56
|
case FormatType.Scientific:
|
|
56
57
|
precision = DecimalPrecision.Six;
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
57
59
|
scientificType = scientificTypeToString(ScientificType.Normalized);
|
|
58
60
|
break;
|
|
59
61
|
case FormatType.Decimal:
|
|
@@ -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;AAG/B,OAAO,EACL,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,sBAAsB,GACvB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MA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nC;QACP,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 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\";\nimport { useTranslation } from \"../useTranslation.js\";\n\n/** Properties of [[FormatTypeSelector]] component.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\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 { translate } = useTranslation();\n const formatOptions = React.useRef<SelectOption<FormatType>[]>([\n {\n value: FormatType.Decimal,\n label: translate(\"QuantityFormat.decimal\"),\n },\n {\n value: FormatType.Scientific,\n label: translate(\"QuantityFormat.scientific\"),\n },\n {\n value: FormatType.Station,\n label: translate(\"QuantityFormat.station\"),\n },\n {\n value: FormatType.Fractional,\n label: 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 [[FormatTypeOption]] component.\n * @alpha\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof FormatTypeOption>`\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\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 */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function FormatTypeOption(props: FormatTypeOptionProps) {\n const { formatProps, onChange } = props;\n const { translate } = useTranslation();\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 return (\n <>\n <span className={\"uicore-label.current\"}>\n {translate(\"QuantityFormat.labels.type\")}\n </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;AAG/B,OAAO,EACL,gBAAgB,EAChB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AEF,MAAM,UAAU,GAAG,eAAe,CAAC,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/D,OAAO,CACL;QACE,8BAAM,SAAS,EAAE,sBAAsB,IACpC,SAAS,CAAC,4BAA4B,CAAC,CACnC;QACP,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 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\";\nimport { useTranslation } from \"../useTranslation.js\";\n\n/** Properties of [[FormatTypeSelector]] component.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\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 { translate } = useTranslation();\n const formatOptions = React.useRef<SelectOption<FormatType>[]>([\n {\n value: FormatType.Decimal,\n label: translate(\"QuantityFormat.decimal\"),\n },\n {\n value: FormatType.Scientific,\n label: translate(\"QuantityFormat.scientific\"),\n },\n {\n value: FormatType.Station,\n label: translate(\"QuantityFormat.station\"),\n },\n {\n value: FormatType.Fractional,\n label: 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 [[FormatTypeOption]] component.\n * @alpha\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof FormatTypeOption>`\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\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 */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function FormatTypeOption(props: FormatTypeOptionProps) {\n const { formatProps, onChange } = props;\n const { translate } = useTranslation();\n const handleFormatTypeChange = React.useCallback(\n (newType: FormatType) => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\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 // eslint-disable-next-line @typescript-eslint/no-deprecated\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 return (\n <>\n <span className={\"uicore-label.current\"}>\n {translate(\"QuantityFormat.labels.type\")}\n </span>\n <FormatTypeSelector\n data-testid=\"format-type-selector\"\n type={formatType}\n onChange={handleFormatTypeChange}\n />\n </>\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MiscFormatOptions.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/quantityformat/MiscFormatOptions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,sBAAsB,CAAC;AAqBxE;;;GAGG;AAEH,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;GAEG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,
|
|
1
|
+
{"version":3,"file":"MiscFormatOptions.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/quantityformat/MiscFormatOptions.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAkB,MAAM,sBAAsB,CAAC;AAqBxE;;;GAGG;AAEH,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAC;IACzC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC3C,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED;;GAEG;AAEH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,qBAqW9D"}
|
|
@@ -31,6 +31,7 @@ export function MiscFormatOptions(props) {
|
|
|
31
31
|
return Format.isFormatTraitSetInProps(formatProps, trait);
|
|
32
32
|
}, [formatProps]);
|
|
33
33
|
const handleShowSignChange = React.useCallback((option) => {
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
34
35
|
const newShowSignOption = showSignOptionToString(option);
|
|
35
36
|
const newFormatProps = {
|
|
36
37
|
...formatProps,
|
|
@@ -102,6 +103,7 @@ export function MiscFormatOptions(props) {
|
|
|
102
103
|
const handleScientificTypeChange = React.useCallback((type) => {
|
|
103
104
|
const newFormatProps = {
|
|
104
105
|
...formatProps,
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
105
107
|
scientificType: scientificTypeToString(type),
|
|
106
108
|
};
|
|
107
109
|
handleSetFormatProps(newFormatProps);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MiscFormatOptions.js","sourceRoot":"","sources":["../../../src/imodel-components-react/quantityformat/MiscFormatOptions.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EACL,MAAM,EACN,YAAY,EACZ,UAAU,EACV,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,cAAc,EACd,sBAAsB,EACtB,sBAAsB,GACvB,MAAM,sB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9C;YAEF,8BACE,SAAS,EAAE,UAAU,CACnB,cAAc,EACd,UAAU,KAAK,UAAU,CAAC,UAAU,IAAI,iBAAiB,CAC1D,IAEA,SAAS,CAAC,2CAA2C,CAAC,CAClD;YACP,oBAAC,sBAAsB,mBACT,0BAA0B,EACtC,IAAI,EACF,WAAW,CAAC,cAAc;oBAC1B,WAAW,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC;oBACnC,CAAC,CAAC,mBAAmB,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC;oBAC3D,CAAC,CAAC,cAAc,CAAC,UAAU,EAE/B,QAAQ,EAAE,UAAU,KAAK,UAAU,CAAC,UAAU,EAC9C,QAAQ,EAAE,0BAA0B,GACpC;YAED,KAAK,CAAC,QAAQ;YAEd,uBAAuB,IAAI,WAAW,IAAI,CACzC,2BACE,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,qCAAqC,EAChD,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,CAAC,IAEV,SAAS,CAAC,iCAAiC,CAAC,CAC3C,CACL,CACA,CACJ,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 classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport type { FormatProps, ShowSignOption } from \"@itwin/core-quantity\";\nimport {\n Format,\n FormatTraits,\n FormatType,\n getTraitString,\n parseFormatType,\n parseScientificType,\n parseShowSignOption,\n ScientificType,\n scientificTypeToString,\n showSignOptionToString,\n} from \"@itwin/core-quantity\";\nimport { SignOptionSelector } from \"./misc/SignOption.js\";\nimport { ThousandsSeparator } from \"./misc/ThousandsSeparator.js\";\nimport { DecimalSeparatorSelector } from \"./misc/DecimalSeparator.js\";\nimport { ScientificTypeSelector } from \"./misc/ScientificType.js\";\nimport { StationSeparatorSelector } from \"./misc/StationSeparatorSelector.js\";\nimport { StationSizeSelector } from \"./misc/StationSizeSelector.js\";\nimport { useTranslation } from \"../useTranslation.js\";\n\n/** Properties of [[MiscFormatOptions]] component.\n * @alpha\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof MiscFormatOptions>`\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface MiscFormatOptionsProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n enableMinimumProperties?: boolean;\n showOptions: boolean;\n onShowHideOptions: (show: boolean) => void;\n children?: React.ReactNode;\n}\n\n/** Component use to set miscellaneous properties is a Formatted Quantity.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function MiscFormatOptions(props: MiscFormatOptionsProps) {\n const {\n formatProps,\n onChange,\n showOptions,\n onShowHideOptions,\n enableMinimumProperties,\n } = props;\n const { translate } = useTranslation();\n\n const handleSetFormatProps = React.useCallback(\n (newFormatProps: FormatProps) => {\n onChange && onChange(newFormatProps);\n },\n [onChange]\n );\n\n const isFormatTraitSet = React.useCallback(\n (trait: FormatTraits) => {\n return Format.isFormatTraitSetInProps(formatProps, trait);\n },\n [formatProps]\n );\n\n const handleShowSignChange = React.useCallback(\n (option: ShowSignOption) => {\n const newShowSignOption = showSignOptionToString(option);\n const newFormatProps = {\n ...formatProps,\n showSignOption: newShowSignOption,\n };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\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 if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : formatProps.formatTraits.split(/,|;|\\|/);\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\n formatTraits = [...traits, traitStr];\n }\n }\n } else {\n // clearing trait\n if (!formatProps.formatTraits) return;\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : 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 handleShowTrailingZeroesChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleKeepDecimalPointChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleKeepSingleZeroChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleZeroEmptyChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleUseFractionDashChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.FractionDash, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleDecimalSeparatorChange = React.useCallback(\n (decimalSeparator: string) => {\n let thousandSeparator = formatProps.thousandSeparator;\n // make sure 1000 and decimal separator do not match\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\n switch (decimalSeparator) {\n case \".\":\n thousandSeparator = \",\";\n break;\n case \",\":\n thousandSeparator = \".\";\n break;\n }\n }\n const newFormatProps = {\n ...formatProps,\n thousandSeparator,\n decimalSeparator,\n };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, isFormatTraitSet, handleSetFormatProps]\n );\n\n const handleScientificTypeChange = React.useCallback(\n (type: ScientificType) => {\n const newFormatProps = {\n ...formatProps,\n scientificType: scientificTypeToString(type),\n };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n const handleFormatChange = React.useCallback(\n (newFormatProps: FormatProps) => {\n handleSetFormatProps(newFormatProps);\n },\n [handleSetFormatProps]\n );\n\n const formatType = React.useMemo(\n () => parseFormatType(formatProps.type, \"format\"),\n [formatProps.type]\n );\n const showSignOption = React.useMemo(\n () =>\n parseShowSignOption(\n formatProps.showSignOption ?? \"onlyNegative\",\n \"format\"\n ),\n [formatProps.showSignOption]\n );\n\n const handleToggleButtonClick = React.useCallback(() => {\n onShowHideOptions(!showOptions);\n }, [onShowHideOptions, showOptions]);\n\n const handleKeyUpOnLink = React.useCallback(\n (e: React.KeyboardEvent<HTMLAnchorElement>) => {\n if (e.key === Key.Enter.valueOf() || e.key === \" \") {\n onShowHideOptions(!showOptions);\n e.preventDefault();\n }\n },\n [onShowHideOptions, showOptions]\n );\n\n const handleStationSeparatorChange = React.useCallback(\n (value: string) => {\n const newFormatProps = { ...formatProps, stationSeparator: value };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n const handleStationOffsetChange = React.useCallback(\n (value: number) => {\n const newFormatProps = { ...formatProps, stationOffsetSize: value };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n return (\n <>\n {enableMinimumProperties && !showOptions && (\n <a // eslint-disable-line jsx-a11y/anchor-is-valid\n onClick={handleToggleButtonClick}\n onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"}\n role=\"link\"\n tabIndex={0}\n >\n {translate(\"QuantityFormat.labels.moreLabel\")}\n </a>\n )}\n {(!enableMinimumProperties || showOptions) && (\n <>\n <span className={\"uicore-label\"}>\n {translate(\"QuantityFormat.labels.signOptionLabel\")}\n </span>\n <SignOptionSelector\n data-testid=\"sign-option-selector\"\n signOption={showSignOption}\n onChange={handleShowSignChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType !== FormatType.Station && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.stationOffsetLabel\")}\n </span>\n <StationSizeSelector\n data-testid=\"station-size-selector\"\n value={formatProps.stationOffsetSize ?? 2}\n disabled={formatType !== FormatType.Station}\n onChange={handleStationOffsetChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType !== FormatType.Station && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.stationSeparatorLabel\")}\n </span>\n <StationSeparatorSelector\n data-testid=\"station-separator-selector\"\n separator={\n undefined !== formatProps.stationSeparator\n ? formatProps.stationSeparator\n : \"+\"\n }\n disabled={formatType !== FormatType.Station}\n onChange={handleStationSeparatorChange}\n />\n\n <ThousandsSeparator\n formatProps={formatProps}\n onChange={handleFormatChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType === FormatType.Fractional && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.decimalSeparatorLabel\")}\n </span>\n <DecimalSeparatorSelector\n data-testid=\"decimal-separator-selector\"\n separator={formatProps.decimalSeparator ?? \".\"}\n onChange={handleDecimalSeparatorChange}\n disabled={formatType === FormatType.Fractional}\n />\n\n <span className={\"uicore-label\"}>\n {translate(\"QuantityFormat.labels.showTrailZerosLabel\")}\n </span>\n <Checkbox\n data-testid=\"show-trail-zeros\"\n checked={isFormatTraitSet(FormatTraits.TrailZeroes)}\n onChange={handleShowTrailingZeroesChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType === FormatType.Fractional && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.keepDecimalPointLabel\")}\n </span>\n <Checkbox\n data-testid=\"keep-decimal-point\"\n checked={isFormatTraitSet(FormatTraits.KeepDecimalPoint)}\n onChange={handleKeepDecimalPointChange}\n />\n\n <span className={\"uicore-label\"}>\n {translate(\"QuantityFormat.labels.keepSingleZeroLabel\")}\n </span>\n <Checkbox\n data-testid=\"keep-single-zero\"\n checked={isFormatTraitSet(FormatTraits.KeepSingleZero)}\n onChange={handleKeepSingleZeroChange}\n />\n\n <span className={\"uicore-label\"}>\n {translate(\"QuantityFormat.labels.zeroEmptyLabel\")}\n </span>\n <Checkbox\n data-testid=\"zero-empty\"\n checked={isFormatTraitSet(FormatTraits.ZeroEmpty)}\n onChange={handleZeroEmptyChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType !== FormatType.Fractional && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.fractionDashLabel\")}\n </span>\n <Checkbox\n data-testid=\"fraction-dash\"\n checked={isFormatTraitSet(FormatTraits.FractionDash)}\n onChange={handleUseFractionDashChange}\n disabled={formatType !== FormatType.Fractional}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType !== FormatType.Scientific && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.scientificTypeLabel\")}\n </span>\n <ScientificTypeSelector\n data-testid=\"scientific-type-selector\"\n type={\n formatProps.scientificType &&\n formatProps.scientificType.length > 0\n ? parseScientificType(formatProps.scientificType, \"custom\")\n : ScientificType.Normalized\n }\n disabled={formatType !== FormatType.Scientific}\n onChange={handleScientificTypeChange}\n />\n\n {props.children}\n\n {enableMinimumProperties && showOptions && (\n <a // eslint-disable-line jsx-a11y/anchor-is-valid\n onClick={handleToggleButtonClick}\n onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"}\n role=\"link\"\n tabIndex={0}\n >\n {translate(\"QuantityFormat.labels.lessLabel\")}\n </a>\n )}\n </>\n )}\n </>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"MiscFormatOptions.js","sourceRoot":"","sources":["../../../src/imodel-components-react/quantityformat/MiscFormatOptions.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG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AC,YAAY,CAAC,SAAS,CAAC,EACjD,QAAQ,EAAE,qBAAqB,GAC/B;YAEF,8BACE,SAAS,EAAE,UAAU,CACnB,cAAc,EACd,UAAU,KAAK,UAAU,CAAC,UAAU,IAAI,iBAAiB,CAC1D,IAEA,SAAS,CAAC,yCAAyC,CAAC,CAChD;YACP,oBAAC,QAAQ,mBACK,eAAe,EAC3B,OAAO,EAAE,gBAAgB,CAAC,YAAY,CAAC,YAAY,CAAC,EACpD,QAAQ,EAAE,2BAA2B,EACrC,QAAQ,EAAE,UAAU,KAAK,UAAU,CAAC,UAAU,GAC9C;YAEF,8BACE,SAAS,EAAE,UAAU,CACnB,cAAc,EACd,UAAU,KAAK,UAAU,CAAC,UAAU,IAAI,iBAAiB,CAC1D,IAEA,SAAS,CAAC,2CAA2C,CAAC,CAClD;YACP,oBAAC,sBAAsB,mBACT,0BAA0B,EACtC,IAAI,EACF,WAAW,CAAC,cAAc;oBAC1B,WAAW,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC;oBACnC,CAAC,CAAC,mBAAmB,CAAC,WAAW,CAAC,cAAc,EAAE,QAAQ,CAAC;oBAC3D,CAAC,CAAC,cAAc,CAAC,UAAU,EAE/B,QAAQ,EAAE,UAAU,KAAK,UAAU,CAAC,UAAU,EAC9C,QAAQ,EAAE,0BAA0B,GACpC;YAED,KAAK,CAAC,QAAQ;YAEd,uBAAuB,IAAI,WAAW,IAAI,CACzC,2BACE,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,iBAAiB,EAC1B,SAAS,EAAE,qCAAqC,EAChD,IAAI,EAAC,MAAM,EACX,QAAQ,EAAE,CAAC,IAEV,SAAS,CAAC,iCAAiC,CAAC,CAC3C,CACL,CACA,CACJ,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 classnames from \"classnames\";\nimport * as React from \"react\";\nimport { Key } from \"ts-key-enum\";\nimport type { CommonProps } from \"@itwin/core-react\";\nimport { Checkbox } from \"@itwin/itwinui-react\";\nimport type { FormatProps, ShowSignOption } from \"@itwin/core-quantity\";\nimport {\n Format,\n FormatTraits,\n FormatType,\n getTraitString,\n parseFormatType,\n parseScientificType,\n parseShowSignOption,\n ScientificType,\n scientificTypeToString,\n showSignOptionToString,\n} from \"@itwin/core-quantity\";\nimport { SignOptionSelector } from \"./misc/SignOption.js\";\nimport { ThousandsSeparator } from \"./misc/ThousandsSeparator.js\";\nimport { DecimalSeparatorSelector } from \"./misc/DecimalSeparator.js\";\nimport { ScientificTypeSelector } from \"./misc/ScientificType.js\";\nimport { StationSeparatorSelector } from \"./misc/StationSeparatorSelector.js\";\nimport { StationSizeSelector } from \"./misc/StationSizeSelector.js\";\nimport { useTranslation } from \"../useTranslation.js\";\n\n/** Properties of [[MiscFormatOptions]] component.\n * @alpha\n * @deprecated in 4.17.0. Use `React.ComponentProps<typeof MiscFormatOptions>`\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport interface MiscFormatOptionsProps extends CommonProps {\n formatProps: FormatProps;\n onChange?: (format: FormatProps) => void;\n enableMinimumProperties?: boolean;\n showOptions: boolean;\n onShowHideOptions: (show: boolean) => void;\n children?: React.ReactNode;\n}\n\n/** Component use to set miscellaneous properties is a Formatted Quantity.\n * @alpha\n */\n// eslint-disable-next-line @typescript-eslint/no-deprecated\nexport function MiscFormatOptions(props: MiscFormatOptionsProps) {\n const {\n formatProps,\n onChange,\n showOptions,\n onShowHideOptions,\n enableMinimumProperties,\n } = props;\n const { translate } = useTranslation();\n\n const handleSetFormatProps = React.useCallback(\n (newFormatProps: FormatProps) => {\n onChange && onChange(newFormatProps);\n },\n [onChange]\n );\n\n const isFormatTraitSet = React.useCallback(\n (trait: FormatTraits) => {\n return Format.isFormatTraitSetInProps(formatProps, trait);\n },\n [formatProps]\n );\n\n const handleShowSignChange = React.useCallback(\n (option: ShowSignOption) => {\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n const newShowSignOption = showSignOptionToString(option);\n const newFormatProps = {\n ...formatProps,\n showSignOption: newShowSignOption,\n };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\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 if (formatProps.formatTraits) {\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : formatProps.formatTraits.split(/,|;|\\|/);\n if (!traits.find((traitEntry) => traitStr === traitEntry)) {\n formatTraits = [...traits, traitStr];\n }\n }\n } else {\n // clearing trait\n if (!formatProps.formatTraits) return;\n const traits = Array.isArray(formatProps.formatTraits)\n ? formatProps.formatTraits\n : 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 handleShowTrailingZeroesChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.TrailZeroes, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleKeepDecimalPointChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepDecimalPoint, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleKeepSingleZeroChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.KeepSingleZero, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleZeroEmptyChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.ZeroEmpty, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleUseFractionDashChange = React.useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n setFormatTrait(FormatTraits.FractionDash, e.target.checked);\n },\n [setFormatTrait]\n );\n\n const handleDecimalSeparatorChange = React.useCallback(\n (decimalSeparator: string) => {\n let thousandSeparator = formatProps.thousandSeparator;\n // make sure 1000 and decimal separator do not match\n if (isFormatTraitSet(FormatTraits.Use1000Separator)) {\n switch (decimalSeparator) {\n case \".\":\n thousandSeparator = \",\";\n break;\n case \",\":\n thousandSeparator = \".\";\n break;\n }\n }\n const newFormatProps = {\n ...formatProps,\n thousandSeparator,\n decimalSeparator,\n };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, isFormatTraitSet, handleSetFormatProps]\n );\n\n const handleScientificTypeChange = React.useCallback(\n (type: ScientificType) => {\n const newFormatProps = {\n ...formatProps,\n // eslint-disable-next-line @typescript-eslint/no-deprecated\n scientificType: scientificTypeToString(type),\n };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n const handleFormatChange = React.useCallback(\n (newFormatProps: FormatProps) => {\n handleSetFormatProps(newFormatProps);\n },\n [handleSetFormatProps]\n );\n\n const formatType = React.useMemo(\n () => parseFormatType(formatProps.type, \"format\"),\n [formatProps.type]\n );\n const showSignOption = React.useMemo(\n () =>\n parseShowSignOption(\n formatProps.showSignOption ?? \"onlyNegative\",\n \"format\"\n ),\n [formatProps.showSignOption]\n );\n\n const handleToggleButtonClick = React.useCallback(() => {\n onShowHideOptions(!showOptions);\n }, [onShowHideOptions, showOptions]);\n\n const handleKeyUpOnLink = React.useCallback(\n (e: React.KeyboardEvent<HTMLAnchorElement>) => {\n if (e.key === Key.Enter.valueOf() || e.key === \" \") {\n onShowHideOptions(!showOptions);\n e.preventDefault();\n }\n },\n [onShowHideOptions, showOptions]\n );\n\n const handleStationSeparatorChange = React.useCallback(\n (value: string) => {\n const newFormatProps = { ...formatProps, stationSeparator: value };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n const handleStationOffsetChange = React.useCallback(\n (value: number) => {\n const newFormatProps = { ...formatProps, stationOffsetSize: value };\n handleSetFormatProps(newFormatProps);\n },\n [formatProps, handleSetFormatProps]\n );\n\n return (\n <>\n {enableMinimumProperties && !showOptions && (\n <a // eslint-disable-line jsx-a11y/anchor-is-valid\n onClick={handleToggleButtonClick}\n onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"}\n role=\"link\"\n tabIndex={0}\n >\n {translate(\"QuantityFormat.labels.moreLabel\")}\n </a>\n )}\n {(!enableMinimumProperties || showOptions) && (\n <>\n <span className={\"uicore-label\"}>\n {translate(\"QuantityFormat.labels.signOptionLabel\")}\n </span>\n <SignOptionSelector\n data-testid=\"sign-option-selector\"\n signOption={showSignOption}\n onChange={handleShowSignChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType !== FormatType.Station && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.stationOffsetLabel\")}\n </span>\n <StationSizeSelector\n data-testid=\"station-size-selector\"\n value={formatProps.stationOffsetSize ?? 2}\n disabled={formatType !== FormatType.Station}\n onChange={handleStationOffsetChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType !== FormatType.Station && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.stationSeparatorLabel\")}\n </span>\n <StationSeparatorSelector\n data-testid=\"station-separator-selector\"\n separator={\n undefined !== formatProps.stationSeparator\n ? formatProps.stationSeparator\n : \"+\"\n }\n disabled={formatType !== FormatType.Station}\n onChange={handleStationSeparatorChange}\n />\n\n <ThousandsSeparator\n formatProps={formatProps}\n onChange={handleFormatChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType === FormatType.Fractional && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.decimalSeparatorLabel\")}\n </span>\n <DecimalSeparatorSelector\n data-testid=\"decimal-separator-selector\"\n separator={formatProps.decimalSeparator ?? \".\"}\n onChange={handleDecimalSeparatorChange}\n disabled={formatType === FormatType.Fractional}\n />\n\n <span className={\"uicore-label\"}>\n {translate(\"QuantityFormat.labels.showTrailZerosLabel\")}\n </span>\n <Checkbox\n data-testid=\"show-trail-zeros\"\n checked={isFormatTraitSet(FormatTraits.TrailZeroes)}\n onChange={handleShowTrailingZeroesChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType === FormatType.Fractional && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.keepDecimalPointLabel\")}\n </span>\n <Checkbox\n data-testid=\"keep-decimal-point\"\n checked={isFormatTraitSet(FormatTraits.KeepDecimalPoint)}\n onChange={handleKeepDecimalPointChange}\n />\n\n <span className={\"uicore-label\"}>\n {translate(\"QuantityFormat.labels.keepSingleZeroLabel\")}\n </span>\n <Checkbox\n data-testid=\"keep-single-zero\"\n checked={isFormatTraitSet(FormatTraits.KeepSingleZero)}\n onChange={handleKeepSingleZeroChange}\n />\n\n <span className={\"uicore-label\"}>\n {translate(\"QuantityFormat.labels.zeroEmptyLabel\")}\n </span>\n <Checkbox\n data-testid=\"zero-empty\"\n checked={isFormatTraitSet(FormatTraits.ZeroEmpty)}\n onChange={handleZeroEmptyChange}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType !== FormatType.Fractional && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.fractionDashLabel\")}\n </span>\n <Checkbox\n data-testid=\"fraction-dash\"\n checked={isFormatTraitSet(FormatTraits.FractionDash)}\n onChange={handleUseFractionDashChange}\n disabled={formatType !== FormatType.Fractional}\n />\n\n <span\n className={classnames(\n \"uicore-label\",\n formatType !== FormatType.Scientific && \"uicore-disabled\"\n )}\n >\n {translate(\"QuantityFormat.labels.scientificTypeLabel\")}\n </span>\n <ScientificTypeSelector\n data-testid=\"scientific-type-selector\"\n type={\n formatProps.scientificType &&\n formatProps.scientificType.length > 0\n ? parseScientificType(formatProps.scientificType, \"custom\")\n : ScientificType.Normalized\n }\n disabled={formatType !== FormatType.Scientific}\n onChange={handleScientificTypeChange}\n />\n\n {props.children}\n\n {enableMinimumProperties && showOptions && (\n <a // eslint-disable-line jsx-a11y/anchor-is-valid\n onClick={handleToggleButtonClick}\n onKeyUp={handleKeyUpOnLink}\n className={\"components-quantityFormat-more-less\"}\n role=\"link\"\n tabIndex={0}\n >\n {translate(\"QuantityFormat.labels.lessLabel\")}\n </a>\n )}\n </>\n )}\n </>\n );\n}\n"]}
|
|
@@ -8,8 +8,10 @@ export { SaturationPicker, SaturationPickerProps, } from "./imodel-components-re
|
|
|
8
8
|
export { ColorSwatch, ColorSwatchProps, } from "./imodel-components-react/color/Swatch.js";
|
|
9
9
|
export { ColorEditor, ColorPropertyEditor, } from "./imodel-components-react/editors/ColorEditor.js";
|
|
10
10
|
export { WeightEditor, WeightPropertyEditor, } from "./imodel-components-react/editors/WeightEditor.js";
|
|
11
|
+
export { WeightEditorSpec } from "./imodel-components-react/editors/NewWeightEditor.js";
|
|
11
12
|
export { QuantityInput, QuantityProps, } from "./imodel-components-react/inputs/QuantityInput.js";
|
|
12
13
|
export { QuantityNumberInput, QuantityNumberInputProps, StepFunctionProp, } from "./imodel-components-react/inputs/QuantityNumberInput.js";
|
|
14
|
+
export { QuantityEditorSpec } from "./imodel-components-react/inputs/new-editors/QuantityEditor.js";
|
|
13
15
|
export { LineWeightSwatch, LineWeightSwatchProps, } from "./imodel-components-react/lineweight/Swatch.js";
|
|
14
16
|
export { WeightPickerButton, WeightPickerProps, } from "./imodel-components-react/lineweight/WeightPickerButton.js";
|
|
15
17
|
export { Cube, CubeProps, Face, } from "./imodel-components-react/navigationaids/Cube.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imodel-components-react.d.ts","sourceRoot":"","sources":["../src/imodel-components-react.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAErF,OAAO,EACL,WAAW,EACX,gBAAgB,GACjB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,SAAS,EACT,cAAc,GACf,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,WAAW,EACX,gBAAgB,GACjB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,WAAW,EACX,mBAAmB,GACpB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,oBAAoB,GACrB,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"imodel-components-react.d.ts","sourceRoot":"","sources":["../src/imodel-components-react.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAErF,OAAO,EACL,WAAW,EACX,gBAAgB,GACjB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,SAAS,EACT,cAAc,GACf,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,WAAW,EACX,gBAAgB,GACjB,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,WAAW,EACX,mBAAmB,GACpB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,YAA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AChB,6BAA6B,EAC7B,iBAAiB,EACjB,4BAA4B,EAC5B,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,EACvB,qBAAqB,EACrB,aAAa,GACd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,gEAAgE,CAAC;AAC1G,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AAEpG,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,aAAa,GACd,MAAM,yDAAyD,CAAC;AACjE,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,0BAA0B,EAC1B,8BAA8B,EAC9B,2BAA2B,EAC3B,+BAA+B,EAC/B,6BAA6B,EAC7B,iCAAiC,EACjC,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,2BAA2B,GAC5B,MAAM,+DAA+D,CAAC;AAEvE,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAsB3E;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -13,8 +13,10 @@ export { SaturationPicker, } from "./imodel-components-react/color/SaturationPic
|
|
|
13
13
|
export { ColorSwatch, } from "./imodel-components-react/color/Swatch.js";
|
|
14
14
|
export { ColorEditor, ColorPropertyEditor, } from "./imodel-components-react/editors/ColorEditor.js";
|
|
15
15
|
export { WeightEditor, WeightPropertyEditor, } from "./imodel-components-react/editors/WeightEditor.js";
|
|
16
|
+
export { WeightEditorSpec } from "./imodel-components-react/editors/NewWeightEditor.js";
|
|
16
17
|
export { QuantityInput, } from "./imodel-components-react/inputs/QuantityInput.js";
|
|
17
18
|
export { QuantityNumberInput, } from "./imodel-components-react/inputs/QuantityNumberInput.js";
|
|
19
|
+
export { QuantityEditorSpec } from "./imodel-components-react/inputs/new-editors/QuantityEditor.js";
|
|
18
20
|
export { LineWeightSwatch, } from "./imodel-components-react/lineweight/Swatch.js";
|
|
19
21
|
export { WeightPickerButton, } from "./imodel-components-react/lineweight/WeightPickerButton.js";
|
|
20
22
|
export { Cube, Face, } from "./imodel-components-react/navigationaids/Cube.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"imodel-components-react.js","sourceRoot":"","sources":["../src/imodel-components-react.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAErF,OAAO,EACL,WAAW,GAEZ,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,iBAAiB,GAElB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,iBAAiB,GAElB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,EACL,gBAAgB,GAEjB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,SAAS,GAEV,MAAM,8CAA8C,CAAC;AACtD,OAAO,EACL,gBAAgB,GAEjB,MAAM,qDAAqD,CAAC;AAC7D,OAAO,EACL,WAAW,GAEZ,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EACL,WAAW,EACX,mBAAmB,GACpB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,YAAY,EACZ,oBAAoB,GACrB,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"imodel-components-react.js","sourceRoot":"","sources":["../src/imodel-components-react.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG,qDAAqD;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iDAAiD,CAAC;AAErF,OAAO,EACL,WAAW,GAEZ,MAAM,gDA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;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG","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/* eslint-disable @typescript-eslint/no-deprecated */\n\nexport { UiIModelComponents } from \"./imodel-components-react/UiIModelComponents.js\";\n\nexport {\n AlphaSlider,\n AlphaSliderProps,\n} from \"./imodel-components-react/color/AlphaSlider.js\";\nexport {\n ColorPickerButton,\n ColorPickerProps,\n} from \"./imodel-components-react/color/ColorPickerButton.js\";\nexport {\n ColorPickerDialog,\n ColorPickerDialogProps,\n} from \"./imodel-components-react/color/ColorPickerDialog.js\";\nexport {\n ColorPickerPopup,\n ColorPickerPopupProps,\n} from \"./imodel-components-react/color/ColorPickerPopup.js\";\nexport {\n HueSlider,\n HueSliderProps,\n} from \"./imodel-components-react/color/HueSlider.js\";\nexport {\n SaturationPicker,\n SaturationPickerProps,\n} from \"./imodel-components-react/color/SaturationPicker.js\";\nexport {\n ColorSwatch,\n ColorSwatchProps,\n} from \"./imodel-components-react/color/Swatch.js\";\n\nexport {\n ColorEditor,\n ColorPropertyEditor,\n} from \"./imodel-components-react/editors/ColorEditor.js\";\nexport {\n WeightEditor,\n WeightPropertyEditor,\n} from \"./imodel-components-react/editors/WeightEditor.js\";\nexport { WeightEditorSpec } from \"./imodel-components-react/editors/NewWeightEditor.js\";\n\nexport {\n QuantityInput,\n QuantityProps,\n} from \"./imodel-components-react/inputs/QuantityInput.js\";\nexport {\n QuantityNumberInput,\n QuantityNumberInputProps,\n StepFunctionProp,\n} from \"./imodel-components-react/inputs/QuantityNumberInput.js\";\nexport { QuantityEditorSpec } from \"./imodel-components-react/inputs/new-editors/QuantityEditor.js\";\n\nexport {\n LineWeightSwatch,\n LineWeightSwatchProps,\n} from \"./imodel-components-react/lineweight/Swatch.js\";\nexport {\n WeightPickerButton,\n WeightPickerProps,\n} from \"./imodel-components-react/lineweight/WeightPickerButton.js\";\n\nexport {\n Cube,\n CubeProps,\n Face,\n} from \"./imodel-components-react/navigationaids/Cube.js\";\nexport {\n CubeNavigationAid,\n CubeNavigationAidProps,\n CubeNavigationHitBoxX,\n CubeNavigationHitBoxY,\n CubeNavigationHitBoxZ,\n} from \"./imodel-components-react/navigationaids/CubeNavigationAid.js\";\nexport {\n DrawingNavigationAid,\n DrawingNavigationAidProps,\n} from \"./imodel-components-react/navigationaids/DrawingNavigationAid.js\";\n\nexport {\n FormatPanel,\n FormatPanelProps,\n} from \"./imodel-components-react/quantityformat/FormatPanel.js\";\nexport {\n FormatPrecision,\n FormatPrecisionProps,\n} from \"./imodel-components-react/quantityformat/FormatPrecision.js\";\nexport {\n FormatSample,\n FormatSampleProps,\n} from \"./imodel-components-react/quantityformat/FormatSample.js\";\nexport {\n FormatTypeOption,\n FormatTypeOptionProps,\n} from \"./imodel-components-react/quantityformat/FormatType.js\";\nexport {\n FormatUnitLabel,\n FormatUnitLabelProps,\n} from \"./imodel-components-react/quantityformat/FormatUnitLabel.js\";\nexport {\n FormatUnits,\n FormatUnitsProps,\n} from \"./imodel-components-react/quantityformat/FormatUnits.js\";\nexport {\n MiscFormatOptions,\n MiscFormatOptionsProps,\n} from \"./imodel-components-react/quantityformat/MiscFormatOptions.js\";\nexport {\n QuantityFormatPanel,\n QuantityFormatPanelProps,\n} from \"./imodel-components-react/quantityformat/QuantityFormatPanel.js\";\n\nexport {\n AnimationFractionChangeHandler,\n PlaybackSettings,\n PlaybackSettingsChangeHandler,\n SolarDataProvider,\n SolarPlaybackProgressHandler,\n TimelineDataProvider,\n TimelineDateDisplay,\n TimelinePausePlayAction,\n TimelinePausePlayArgs,\n TimelineScale,\n} from \"./imodel-components-react/timeline/interfaces.js\";\nexport { BaseTimelineDataProvider } from \"./imodel-components-react/timeline/BaseTimelineDataProvider.js\";\nexport {\n TimelineComponent,\n TimelineComponentProps,\n TimelineDateMarkerProps,\n TimelineMenuItemOption,\n TimelineMenuItemProps,\n} from \"./imodel-components-react/timeline/TimelineComponent.js\";\nexport { SolarTimeline } from \"./imodel-components-react/timeline/SolarTimeline.js\";\nexport { BaseSolarDataProvider } from \"./imodel-components-react/timeline/BaseSolarDataProvider.js\";\n\nexport {\n ViewStateProp,\n ViewportComponent,\n ViewportProps,\n} from \"./imodel-components-react/viewport/ViewportComponent.js\";\nexport {\n ViewportComponentEvents,\n CubeRotationChangeEvent,\n CubeRotationChangeEventArgs,\n DrawingViewportChangeEvent,\n DrawingViewportChangeEventArgs,\n StandardRotationChangeEvent,\n StandardRotationChangeEventArgs,\n ViewClassFullNameChangedEvent,\n ViewClassFullNameChangedEventArgs,\n ViewIdChangedEvent,\n ViewIdChangedEventArgs,\n ViewRotationChangeEvent,\n ViewRotationChangeEventArgs,\n} from \"./imodel-components-react/viewport/ViewportComponentEvents.js\";\n\nexport { ToolUtilities } from \"./imodel-components-react/ToolUtilities.js\";\n\n// #region \"SideEffects\"\n\nimport { StandardEditorNames, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { PropertyEditorManager } from \"@itwin/components-react\";\nimport { ColorPropertyEditor } from \"./imodel-components-react/editors/ColorEditor.js\";\nimport { WeightPropertyEditor } from \"./imodel-components-react/editors/WeightEditor.js\";\n\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n ColorPropertyEditor,\n StandardEditorNames.ColorPicker\n);\nPropertyEditorManager.registerEditor(\n StandardTypeNames.Number,\n WeightPropertyEditor,\n StandardEditorNames.WeightPicker\n);\n\n// #endregion \"SideEffects\"\n\n/** @docs-package-description\n * The imodel-components-react package contains React components that depend on the core-frontend, core-common or core-quantity packages.\n * The components pertain to Color, Cube, LineWeight, Navigation Aids, Quantity Inputs, Timeline and Viewport.\n */\n/**\n * @docs-group-description Color\n * Classes and components for working with and picking a Color.\n */\n/**\n * @docs-group-description Common\n * Common classes used across various UI components.\n */\n/**\n * @docs-group-description Cube\n * Component for 3D Cube.\n */\n/**\n * @docs-group-description Inputs\n * Input Components that format and parse input for IModelApps.\n */\n/**\n * @docs-group-description LineWeight\n * Classes and components for working with and picking a Line Weight.\n */\n/**\n * @docs-group-description NavigationAids\n * Classes and components for working with Navigation Aids.\n */\n/**\n * @docs-group-description PropertyEditors\n * Classes and components for working with Property Editors.\n */\n/**\n * @docs-group-description QuantityFormat\n * Classes and components for working with a Quantity Formats.\n */\n/**\n * @docs-group-description Timeline\n * Classes and components that provide a timeline\n */\n/**\n * @docs-group-description Viewport\n * Classes and components for working with a Viewport.\n */\n"]}
|