@itwin/imodel-components-react 5.32.1 → 5.33.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 +13 -0
- package/lib/imodel-components-react/KoqUtilities.d.ts +15 -0
- package/lib/imodel-components-react/KoqUtilities.d.ts.map +1 -0
- package/lib/imodel-components-react/KoqUtilities.js +62 -0
- package/lib/imodel-components-react/KoqUtilities.js.map +1 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityEditor.d.ts.map +1 -1
- package/lib/imodel-components-react/inputs/new-editors/QuantityEditor.js +1 -1
- package/lib/imodel-components-react/inputs/new-editors/QuantityEditor.js.map +1 -1
- package/lib/imodel-components-react/inputs/new-editors/QuantityInput.d.ts +1 -0
- package/lib/imodel-components-react/inputs/new-editors/QuantityInput.d.ts.map +1 -1
- package/lib/imodel-components-react/inputs/new-editors/QuantityInput.js +28 -3
- package/lib/imodel-components-react/inputs/new-editors/QuantityInput.js.map +1 -1
- package/lib/imodel-components-react/inputs/new-editors/UseQuantityInfo.d.ts.map +1 -1
- package/lib/imodel-components-react/inputs/new-editors/UseQuantityInfo.js +9 -62
- package/lib/imodel-components-react/inputs/new-editors/UseQuantityInfo.js.map +1 -1
- package/lib/imodel-components-react/properties/KoqPropertyRenderer.d.ts +19 -0
- package/lib/imodel-components-react/properties/KoqPropertyRenderer.d.ts.map +1 -0
- package/lib/imodel-components-react/properties/KoqPropertyRenderer.js +62 -0
- package/lib/imodel-components-react/properties/KoqPropertyRenderer.js.map +1 -0
- package/lib/imodel-components-react.d.ts +1 -0
- package/lib/imodel-components-react.d.ts.map +1 -1
- package/lib/imodel-components-react.js +5 -1
- package/lib/imodel-components-react.js.map +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Change Log - @itwin/imodel-components-react
|
|
2
2
|
|
|
3
|
+
## 5.33.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- be761cc: Added support for merged values in the new quantity editor. When a value is merged and has no explicit value, it now renders `-- <unit>`.
|
|
8
|
+
- be761cc: Introduced a property value renderer for properties with a kind of quantity. A new `KOQ_RENDERER_NAME` constant is exported; set it on `PropertyRecord.property.renderer.name` to render a property using this renderer.
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [be761cc]
|
|
13
|
+
- @itwin/components-react@5.33.0
|
|
14
|
+
- @itwin/core-react@5.33.0
|
|
15
|
+
|
|
3
16
|
## 5.32.1
|
|
4
17
|
|
|
5
18
|
### Patch Changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { IModelConnection, QuantityTypeArg } from "@itwin/core-frontend";
|
|
2
|
+
import type { FormatterSpec, ParserSpec } from "@itwin/core-quantity";
|
|
3
|
+
/**
|
|
4
|
+
* Finds formatter and parser specs for a given quantity type.
|
|
5
|
+
* @internal
|
|
6
|
+
*/
|
|
7
|
+
export declare function getFormatterParserSpec({ imodel, type, }: {
|
|
8
|
+
imodel: IModelConnection;
|
|
9
|
+
type: QuantityTypeArg;
|
|
10
|
+
}): Promise<{
|
|
11
|
+
formatterSpec: FormatterSpec;
|
|
12
|
+
parserSpec: ParserSpec;
|
|
13
|
+
highPrecisionFormatterSpec: FormatterSpec;
|
|
14
|
+
} | undefined>;
|
|
15
|
+
//# sourceMappingURL=KoqUtilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KoqUtilities.d.ts","sourceRoot":"","sources":["../../src/imodel-components-react/KoqUtilities.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE9E,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAItE;;;GAGG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,MAAM,EACN,IAAI,GACL,EAAE;IACD,MAAM,EAAE,gBAAgB,CAAC;IACzB,IAAI,EAAE,eAAe,CAAC;CACvB,GAAG,OAAO,CACP;IACE,aAAa,EAAE,aAAa,CAAC;IAC7B,UAAU,EAAE,UAAU,CAAC;IACvB,0BAA0B,EAAE,aAAa,CAAC;CAC3C,GACD,SAAS,CACZ,CA0DA"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 { FormatType, parseFormatType } from "@itwin/core-quantity";
|
|
7
|
+
/**
|
|
8
|
+
* Finds formatter and parser specs for a given quantity type.
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
export async function getFormatterParserSpec({ imodel, type, }) {
|
|
12
|
+
// fallback to IModelApp.quantityFormatter:
|
|
13
|
+
// - if `itwinjs-core` v4 is used
|
|
14
|
+
// - don't have an iModelConnection to look up KOQ
|
|
15
|
+
// - old quantity type enum is used instead of KOQ name
|
|
16
|
+
if (!IModelApp.formatsProvider || typeof type !== "string") {
|
|
17
|
+
const quantityFormatterSpec = IModelApp.quantityFormatter.findFormatterSpecByQuantityType(type);
|
|
18
|
+
const quantityParserSpec = IModelApp.quantityFormatter.findParserSpecByQuantityType(type);
|
|
19
|
+
return quantityFormatterSpec && quantityParserSpec
|
|
20
|
+
? {
|
|
21
|
+
highPrecisionFormatterSpec: quantityFormatterSpec,
|
|
22
|
+
formatterSpec: quantityFormatterSpec,
|
|
23
|
+
parserSpec: quantityParserSpec,
|
|
24
|
+
}
|
|
25
|
+
: undefined;
|
|
26
|
+
}
|
|
27
|
+
const koq = await imodel.schemaContext.getSchemaItem(type);
|
|
28
|
+
if (!koq) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
// TODO: `KindOfQuantity` here is used only as a type because we don't have peerDep on `ecschema-metadata`
|
|
32
|
+
// It should be added when dropping `itwinjs-core` v4 support
|
|
33
|
+
const persistenceUnit = await koq.persistenceUnit;
|
|
34
|
+
const formatProps = await IModelApp.formatsProvider.getFormat(type);
|
|
35
|
+
if (!persistenceUnit || !formatProps) {
|
|
36
|
+
return undefined;
|
|
37
|
+
}
|
|
38
|
+
const persistenceUnitName = persistenceUnit.fullName;
|
|
39
|
+
const highPrecisionFormatterSpec = await IModelApp.quantityFormatter.createFormatterSpec({
|
|
40
|
+
formatProps: {
|
|
41
|
+
...formatProps,
|
|
42
|
+
precision: parseFormatType(formatProps.type, "") === FormatType.Decimal
|
|
43
|
+
? 12
|
|
44
|
+
: formatProps.precision,
|
|
45
|
+
},
|
|
46
|
+
persistenceUnitName,
|
|
47
|
+
});
|
|
48
|
+
const formatterSpec = await IModelApp.quantityFormatter.createFormatterSpec({
|
|
49
|
+
formatProps,
|
|
50
|
+
persistenceUnitName,
|
|
51
|
+
});
|
|
52
|
+
const parserSpec = await IModelApp.quantityFormatter.createParserSpec({
|
|
53
|
+
formatProps,
|
|
54
|
+
persistenceUnitName,
|
|
55
|
+
});
|
|
56
|
+
return {
|
|
57
|
+
highPrecisionFormatterSpec,
|
|
58
|
+
formatterSpec,
|
|
59
|
+
parserSpec,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=KoqUtilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KoqUtilities.js","sourceRoot":"","sources":["../../src/imodel-components-react/KoqUtilities.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGnE;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,C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C,CAAC,WAAW,CAAC,SAAS;SAC5B;QACD,mBAAmB;KACpB,CAAC,CAAC;IACL,MAAM,aAAa,GAAG,MAAM,SAAS,CAAC,iBAAiB,CAAC,mBAAmB,CAAC;QAC1E,WAAW;QACX,mBAAmB;KACpB,CAAC,CAAC;IACH,MAAM,UAAU,GAAG,MAAM,SAAS,CAAC,iBAAiB,CAAC,gBAAgB,CAAC;QACpE,WAAW;QACX,mBAAmB;KACpB,CAAC,CAAC;IACH,OAAO;QACL,0BAA0B;QAC1B,aAAa;QACb,UAAU;KACX,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\nimport type { IModelConnection, QuantityTypeArg } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport type { FormatterSpec, ParserSpec } from \"@itwin/core-quantity\";\nimport { FormatType, parseFormatType } from \"@itwin/core-quantity\";\nimport type { KindOfQuantity } from \"@itwin/ecschema-metadata\";\n\n/**\n * Finds formatter and parser specs for a given quantity type.\n * @internal\n */\nexport async function getFormatterParserSpec({\n imodel,\n type,\n}: {\n imodel: IModelConnection;\n type: QuantityTypeArg;\n}): Promise<\n | {\n formatterSpec: FormatterSpec;\n parserSpec: ParserSpec;\n highPrecisionFormatterSpec: FormatterSpec;\n }\n | undefined\n> {\n // fallback to IModelApp.quantityFormatter:\n // - if `itwinjs-core` v4 is used\n // - don't have an iModelConnection to look up KOQ\n // - old quantity type enum is used instead of KOQ name\n if (!IModelApp.formatsProvider || typeof type !== \"string\") {\n const quantityFormatterSpec =\n IModelApp.quantityFormatter.findFormatterSpecByQuantityType(type);\n const quantityParserSpec =\n IModelApp.quantityFormatter.findParserSpecByQuantityType(type);\n\n return quantityFormatterSpec && quantityParserSpec\n ? {\n highPrecisionFormatterSpec: quantityFormatterSpec,\n formatterSpec: quantityFormatterSpec,\n parserSpec: quantityParserSpec,\n }\n : undefined;\n }\n\n const koq = await imodel.schemaContext.getSchemaItem(type);\n if (!koq) {\n return undefined;\n }\n\n // TODO: `KindOfQuantity` here is used only as a type because we don't have peerDep on `ecschema-metadata`\n // It should be added when dropping `itwinjs-core` v4 support\n const persistenceUnit = await (koq as KindOfQuantity).persistenceUnit;\n const formatProps = await IModelApp.formatsProvider.getFormat(type);\n if (!persistenceUnit || !formatProps) {\n return undefined;\n }\n\n const persistenceUnitName = persistenceUnit.fullName;\n const highPrecisionFormatterSpec =\n await IModelApp.quantityFormatter.createFormatterSpec({\n formatProps: {\n ...formatProps,\n precision:\n parseFormatType(formatProps.type, \"\") === FormatType.Decimal\n ? 12\n : formatProps.precision,\n },\n persistenceUnitName,\n });\n const formatterSpec = await IModelApp.quantityFormatter.createFormatterSpec({\n formatProps,\n persistenceUnitName,\n });\n const parserSpec = await IModelApp.quantityFormatter.createParserSpec({\n formatProps,\n persistenceUnitName,\n });\n return {\n highPrecisionFormatterSpec,\n formatterSpec,\n parserSpec,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QuantityEditor.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/new-editors/QuantityEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAE1B,MAAM,yBAAyB,CAAC;AAMjC;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAO/B,CAAC;AAEH;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,GACL,EAAE,WAAW,CAAC,qBAAqB,EAAE,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"QuantityEditor.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/new-editors/QuantityEditor.tsx"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAE1B,MAAM,yBAAyB,CAAC;AAMjC;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,EAAE,UAO/B,CAAC;AAEH;;;GAGG;AACH,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,YAAY,EAAE,eAAe,CAAC;CAC/B;AAED,gBAAgB;AAChB,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,GACL,EAAE,WAAW,CAAC,qBAAqB,EAAE,YAAY,CAAC,qBAyClD"}
|
|
@@ -56,7 +56,7 @@ export function QuantityEditor({ metadata, value, onChange, size, }) {
|
|
|
56
56
|
});
|
|
57
57
|
return;
|
|
58
58
|
};
|
|
59
|
-
return (React.createElement(QuantityInput, { value: currentValue, onChange: handleChange, size: size, formatter: isEditing ? highPrecisionFormatter : defaultFormatter, parser: parser, onBlur: () => setEditing(false), onFocus: () => setEditing(true) }));
|
|
59
|
+
return (React.createElement(QuantityInput, { value: currentValue, onChange: handleChange, size: size, formatter: isEditing ? highPrecisionFormatter : defaultFormatter, parser: parser, onBlur: () => setEditing(false), onFocus: () => setEditing(true), isMerged: metadata.isMerged }));
|
|
60
60
|
}
|
|
61
61
|
/* v8 ignore stop */
|
|
62
62
|
//# sourceMappingURL=QuantityEditor.js.map
|
|
@@ -1 +1 @@
|
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Q,CAAC,WAAW,IAAI;QAC7D,YAAY,EAAE,SAAS;QACvB,YAAY,EAAE,SAAS;KACxB,CAAC;IACF,MAAM,YAAY,GAAG,CAAC,QAAsB,EAAE,EAAE;QAC9C,IAAI,QAAQ,EAAE,QAAQ,KAAK,SAAS,EAAE,CAAC;YACrC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnB,OAAO;QACT,CAAC;QACD,QAAQ,CAAC;YACP,GAAG,QAAQ;YACX,QAAQ,EAAE,uBAAuB,CAAC;gBAChC,KAAK,EAAE,QAAQ,CAAC,QAAQ;gBACxB,GAAG,EAAE,YAAY;gBACjB,GAAG,EAAE,YAAY;aAClB,CAAC;SACH,CAAC,CAAC;QACH,OAAO;IACT,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,IACZ,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,gBAAgB,EAChE,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,
|
|
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,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD,qBAAqB;AAErB;;;;;;;;;GASG;AACH,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,OAAO;IACT,CAAC,CAAC;IAEF,OAAO,CACL,oBAAC,aAAa,IACZ,KAAK,EAAE,YAAY,EACnB,QAAQ,EAAE,YAAY,EACtB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,gBAAgB,EAChE,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,EAC/B,OAAO,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAC/B,QAAQ,EAAE,QAAQ,CAAC,QAAQ,GAC3B,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 NumericValueMetadata,\n ValueUtilities,\n} from \"@itwin/components-react\";\nimport { applyNumericConstraints } from \"@itwin/components-react/internal\";\nimport { QuantityInput } from \"./QuantityInput.js\";\n\n/* v8 ignore start */\n\n/**\n * Editor specification for quantity values based on `IModelApp.quantityFormatter`.\n *\n * **Note:** value provided to `onChange` might have mismatching `displayValue` and `rawValue`.\n * This can happen when input is invalid, some examples:\n * - input is not numeric. input `abc` -> { `displayValue`: \"abc\", `rawValue`: undefined }\n * - input is smaller than property constraints. input: `2 in`, minimumValue is `1 m` -> { `displayValue`: `2 in`, `rawValue`: 1 }\n * - input is larger than property constraints. input: `6 m`, maximumValue is `5 m` -> { `displayValue`: `6 m`, `rawValue`: 5 }\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 NumericValueMetadata {\n quantityType: QuantityTypeArg;\n}\n\n/** @internal */\nexport function QuantityEditor({\n metadata,\n value,\n onChange,\n size,\n}: EditorProps<QuantityValueMetadata, NumericValue>) {\n const { defaultFormatter, highPrecisionFormatter, parser } = useQuantityInfo({\n type: metadata.quantityType,\n });\n const [isEditing, setEditing] = React.useState(false);\n const currentValue = value\n ? value\n : { rawValue: undefined, displayValue: \"\" };\n\n const { minimumValue, maximumValue } = metadata.constraints ?? {\n minimumValue: undefined,\n maximumValue: undefined,\n };\n const handleChange = (newValue: NumericValue) => {\n if (newValue?.rawValue === undefined) {\n onChange(newValue);\n return;\n }\n onChange({\n ...newValue,\n rawValue: applyNumericConstraints({\n value: newValue.rawValue,\n min: minimumValue,\n max: maximumValue,\n }),\n });\n return;\n };\n\n return (\n <QuantityInput\n value={currentValue}\n onChange={handleChange}\n size={size}\n formatter={isEditing ? highPrecisionFormatter : defaultFormatter}\n parser={parser}\n onBlur={() => setEditing(false)}\n onFocus={() => setEditing(true)}\n isMerged={metadata.isMerged}\n />\n );\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -7,6 +7,7 @@ interface QuantityInputProps extends Pick<React.ComponentPropsWithoutRef<typeof
|
|
|
7
7
|
onChange: (value: NumericValue) => void;
|
|
8
8
|
formatter?: FormatterSpec;
|
|
9
9
|
parser?: ParserSpec;
|
|
10
|
+
isMerged?: boolean;
|
|
10
11
|
}
|
|
11
12
|
/**
|
|
12
13
|
* A quantity input that manages its own display state and uses formatter/parser for quantity values.
|
|
@@ -1 +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,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;
|
|
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,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAC7C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAKtE,UAAU,kBACR,SAAQ,IAAI,CACV,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,EAC5C,QAAQ,GAAG,SAAS,GAAG,MAAM,CAC9B;IACD,KAAK,EAAE,YAAY,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,CAAC;IACxC,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,MAAM,CAAC,EAAE,UAAU,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,qBAkBtD"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import { Input } from "@itwin/itwinui-react";
|
|
7
|
+
import { ValueUtilities } from "@itwin/components-react";
|
|
7
8
|
/**
|
|
8
9
|
* A quantity input that manages its own display state and uses formatter/parser for quantity values.
|
|
9
10
|
* @internal
|
|
@@ -12,9 +13,27 @@ export function QuantityInput(props) {
|
|
|
12
13
|
const { formatter, parser, size, onBlur } = props;
|
|
13
14
|
const { inputProps } = useQuantityInput(props);
|
|
14
15
|
const placeholder = formatter?.unitConversions?.[0]?.label;
|
|
15
|
-
|
|
16
|
+
const delayedDisabled = useDelayed({
|
|
17
|
+
initial: false,
|
|
18
|
+
current: !formatter || !parser,
|
|
19
|
+
});
|
|
20
|
+
return (React.createElement(Input, { ...inputProps, placeholder: placeholder, disabled: delayedDisabled, size: size, onBlur: onBlur }));
|
|
16
21
|
}
|
|
17
|
-
function
|
|
22
|
+
function useDelayed({ initial, current }) {
|
|
23
|
+
const [value, setValue] = React.useState(initial);
|
|
24
|
+
React.useEffect(() => {
|
|
25
|
+
if (current === initial) {
|
|
26
|
+
setValue(current);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const timeoutId = setTimeout(() => {
|
|
30
|
+
setValue(current);
|
|
31
|
+
}, 200);
|
|
32
|
+
return () => clearTimeout(timeoutId);
|
|
33
|
+
}, [current, initial]);
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
function useQuantityInput({ value, onChange, formatter, parser, onFocus, isMerged, }) {
|
|
18
37
|
const [state, setState] = React.useState(() => {
|
|
19
38
|
if (value.rawValue !== undefined && formatter) {
|
|
20
39
|
return {
|
|
@@ -38,12 +57,18 @@ function useQuantityInput({ value, onChange, formatter, parser, onFocus, }) {
|
|
|
38
57
|
if (prev.displayValue !== "") {
|
|
39
58
|
return prev;
|
|
40
59
|
}
|
|
60
|
+
if (isMerged) {
|
|
61
|
+
return {
|
|
62
|
+
...prev,
|
|
63
|
+
displayValue: `${ValueUtilities.MERGED_VALUE} ${formatter.unitConversions?.[0]?.label ?? ""}`,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
41
66
|
return {
|
|
42
67
|
...prev,
|
|
43
68
|
displayValue: formatter.unitConversions?.[0]?.label ?? "",
|
|
44
69
|
};
|
|
45
70
|
});
|
|
46
|
-
}, [formatter]);
|
|
71
|
+
}, [formatter, isMerged]);
|
|
47
72
|
const handleChange = (e) => {
|
|
48
73
|
const inputText = e.target.value;
|
|
49
74
|
const unit = formatter?.unitConversions?.[0]?.label;
|
|
@@ -1 +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,KAAK,EAAE,MAAM,sBAAsB,CAAC;
|
|
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,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAgBzD;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAClD,MAAM,EAAE,UAAU,EAAE,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,WAAW,GAAG,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC;IAC3D,MAAM,eAAe,GAAG,UAAU,CAAC;QACjC,OAAO,EAAE,KAAK;QACd,OAAO,EAAE,CAAC,SAAS,IAAI,CAAC,MAAM;KAC/B,CAAC,CAAC;IAEH,OAAO,CACL,oBAAC,KAAK,OACA,UAAU,EACd,WAAW,EAAE,WAAW,EACxB,QAAQ,EAAE,eAAe,EACzB,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACd,CACH,CAAC;AACJ,C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CAAC,CAAC,CAAC;QAEb,MAAM,KAAK,GAAG,CAAC,CAAC,aAAa,CAAC;QAC9B,MAAM,IAAI,GAAG,SAAS,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAAE,CAAC;QAE1D,IAAI,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,KAAK,CAAC,YAAY,KAAK,IAAI,EAAE,CAAC;YAChE,qBAAqB,CAAC,GAAG,EAAE;gBACzB,KAAK,CAAC,iBAAiB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YAChC,CAAC,CAAC,CAAC;YACH,OAAO;QACT,CAAC;QAED,qBAAqB,CAAC,GAAG,EAAE;YACzB,KAAK,CAAC,MAAM,EAAE,CAAC;QACjB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO;QACL,UAAU,EAAE;YACV,KAAK,EAAE,KAAK,CAAC,YAAY;YACzB,QAAQ,EAAE,YAAY;YACtB,OAAO,EAAE,WAAW;SACrB;KACF,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CACjB,SAAiB,EACjB,MAA8B,EAC9B,WAA+B;IAE/B,IAAI,CAAC,MAAM,IAAI,SAAS,KAAK,WAAW,EAAE,CAAC;QACzC,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,oBAAoB,CAAC,SAAS,CAAC,CAAC;IAC3D,OAAO,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACxD,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 { Input } from \"@itwin/itwinui-react\";\nimport type { NumericValue } from \"@itwin/components-react\";\nimport type { FormatterSpec, ParserSpec } from \"@itwin/core-quantity\";\nimport { ValueUtilities } from \"@itwin/components-react\";\n\n/* v8 ignore start */\n\ninterface QuantityInputProps\n extends Pick<\n React.ComponentPropsWithoutRef<typeof Input>,\n \"onBlur\" | \"onFocus\" | \"size\"\n > {\n value: NumericValue;\n onChange: (value: NumericValue) => void;\n formatter?: FormatterSpec;\n parser?: ParserSpec;\n isMerged?: boolean;\n}\n\n/**\n * A quantity input that manages its own display state and uses formatter/parser for quantity values.\n * @internal\n */\nexport function QuantityInput(props: QuantityInputProps) {\n const { formatter, parser, size, onBlur } = props;\n const { inputProps } = useQuantityInput(props);\n const placeholder = formatter?.unitConversions?.[0]?.label;\n const delayedDisabled = useDelayed({\n initial: false,\n current: !formatter || !parser,\n });\n\n return (\n <Input\n {...inputProps}\n placeholder={placeholder}\n disabled={delayedDisabled}\n size={size}\n onBlur={onBlur}\n />\n );\n}\n\nfunction useDelayed<T>({ initial, current }: { initial: T; current: T }) {\n const [value, setValue] = React.useState(initial);\n\n React.useEffect(() => {\n if (current === initial) {\n setValue(current);\n return;\n }\n const timeoutId = setTimeout(() => {\n setValue(current);\n }, 200);\n return () => clearTimeout(timeoutId);\n }, [current, initial]);\n\n return value;\n}\n\nfunction useQuantityInput({\n value,\n onChange,\n formatter,\n parser,\n onFocus,\n isMerged,\n}: QuantityInputProps) {\n const [state, setState] = React.useState<NumericValue>(() => {\n if (value.rawValue !== undefined && formatter) {\n return {\n rawValue: value.rawValue,\n displayValue: formatter.applyFormatting(value.rawValue),\n };\n }\n return value;\n });\n\n React.useLayoutEffect(() => {\n if (!formatter) {\n return;\n }\n setState((prev) => {\n if (prev.rawValue !== undefined) {\n const displayValue = formatter.applyFormatting(prev.rawValue);\n return prev.displayValue === displayValue\n ? prev\n : { ...prev, displayValue };\n }\n\n if (prev.displayValue !== \"\") {\n return prev;\n }\n\n if (isMerged) {\n return {\n ...prev,\n displayValue: `${ValueUtilities.MERGED_VALUE} ${\n formatter.unitConversions?.[0]?.label ?? \"\"\n }`,\n };\n }\n\n return {\n ...prev,\n displayValue: formatter.unitConversions?.[0]?.label ?? \"\",\n };\n });\n }, [formatter, isMerged]);\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const inputText = e.target.value;\n const unit = formatter?.unitConversions?.[0]?.label;\n const rawValue = parseInput(inputText, parser, unit);\n const newValue: NumericValue = { rawValue, displayValue: inputText };\n setState(newValue);\n onChange(newValue);\n };\n\n const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {\n onFocus?.(e);\n\n const input = e.currentTarget;\n const unit = formatter?.unitConversions?.[0]?.label ?? \"\";\n\n if (state.rawValue === undefined && state.displayValue === unit) {\n requestAnimationFrame(() => {\n input.setSelectionRange(0, 0);\n });\n return;\n }\n\n requestAnimationFrame(() => {\n input.select();\n });\n };\n\n return {\n inputProps: {\n value: state.displayValue,\n onChange: handleChange,\n onFocus: handleFocus,\n },\n };\n}\n\nfunction parseInput(\n userInput: string,\n parser: ParserSpec | undefined,\n placeholder: string | undefined\n): number | undefined {\n if (!parser || userInput === placeholder) {\n return undefined;\n }\n const parseResult = parser.parseToQuantityValue(userInput);\n return parseResult.ok ? parseResult.value : undefined;\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseQuantityInfo.d.ts","sourceRoot":"","sources":["../../../../src/imodel-components-react/inputs/new-editors/UseQuantityInfo.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,
|
|
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,EAAE,KAAK,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAO3E,UAAU,oBAAoB;IAC5B,IAAI,EAAE,eAAe,GAAG,SAAS,CAAC;CACnC;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE,oBAAoB;;;;EA4E7D"}
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import { IModelApp } from "@itwin/core-frontend";
|
|
6
|
-
import { FormatType, parseFormatType, } from "@itwin/core-quantity";
|
|
7
6
|
import * as React from "react";
|
|
8
7
|
import { useIModelConnection } from "../../IModelConnectionContext.js";
|
|
8
|
+
import { getFormatterParserSpec } from "../../KoqUtilities.js";
|
|
9
9
|
/**
|
|
10
10
|
* Hook that finds the formatter and parser in `IModelApp.quantityFormatter` for a given quantity type.
|
|
11
11
|
* @internal
|
|
@@ -18,7 +18,7 @@ export function useQuantityInfo({ type }) {
|
|
|
18
18
|
}));
|
|
19
19
|
const imodel = useIModelConnection();
|
|
20
20
|
React.useEffect(() => {
|
|
21
|
-
if (type === undefined) {
|
|
21
|
+
if (type === undefined || !imodel) {
|
|
22
22
|
setState({
|
|
23
23
|
defaultFormatter: undefined,
|
|
24
24
|
highPrecisionFormatter: undefined,
|
|
@@ -28,13 +28,17 @@ export function useQuantityInfo({ type }) {
|
|
|
28
28
|
}
|
|
29
29
|
let disposed = false;
|
|
30
30
|
const loadFormatterParser = async () => {
|
|
31
|
-
const {
|
|
31
|
+
const { formatterSpec, highPrecisionFormatterSpec, parserSpec } = (await getFormatterParserSpec({
|
|
32
32
|
imodel,
|
|
33
33
|
type,
|
|
34
|
-
})
|
|
34
|
+
})) ?? {
|
|
35
|
+
formatterSpec: undefined,
|
|
36
|
+
highPrecisionFormatterSpec: undefined,
|
|
37
|
+
parserSpec: undefined,
|
|
38
|
+
};
|
|
35
39
|
if (!disposed) {
|
|
36
40
|
setState({
|
|
37
|
-
defaultFormatter:
|
|
41
|
+
defaultFormatter: formatterSpec,
|
|
38
42
|
highPrecisionFormatter: highPrecisionFormatterSpec,
|
|
39
43
|
parser: parserSpec,
|
|
40
44
|
});
|
|
@@ -61,62 +65,5 @@ export function useQuantityInfo({ type }) {
|
|
|
61
65
|
}, [imodel, type]);
|
|
62
66
|
return { defaultFormatter, highPrecisionFormatter, parser };
|
|
63
67
|
}
|
|
64
|
-
async function getFormatterParserSpec({ imodel, type, }) {
|
|
65
|
-
// fallback to IModelApp.quantityFormatter:
|
|
66
|
-
// - if `itwinjs-core` v4 is used
|
|
67
|
-
// - don't have an iModelConnection to look up KOQ
|
|
68
|
-
// - old quantity type enum is used instead of KOQ name
|
|
69
|
-
if (!IModelApp.formatsProvider || !imodel || typeof type !== "string") {
|
|
70
|
-
const quantityFormatterSpec = IModelApp.quantityFormatter.findFormatterSpecByQuantityType(type);
|
|
71
|
-
const quantityParserSpec = IModelApp.quantityFormatter.findParserSpecByQuantityType(type);
|
|
72
|
-
return {
|
|
73
|
-
highPrecisionFormatterSpec: quantityFormatterSpec,
|
|
74
|
-
defaultFormatterSpec: quantityFormatterSpec,
|
|
75
|
-
parserSpec: quantityParserSpec,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
const koq = await imodel.schemaContext.getSchemaItem(type);
|
|
79
|
-
if (!koq) {
|
|
80
|
-
return {
|
|
81
|
-
highPrecisionFormatterSpec: undefined,
|
|
82
|
-
defaultFormatterSpec: undefined,
|
|
83
|
-
parser: undefined,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
// TODO: `KindOfQuantity` here is used only as a type because we don't have peerDep on `ecschema-metadata`
|
|
87
|
-
// It should be added when dropping `itwinjs-core` v4 support
|
|
88
|
-
const persistenceUnit = await koq.persistenceUnit;
|
|
89
|
-
const formatProps = await IModelApp.formatsProvider.getFormat(type);
|
|
90
|
-
if (!persistenceUnit || !formatProps) {
|
|
91
|
-
return {
|
|
92
|
-
highPrecisionFormatterSpec: undefined,
|
|
93
|
-
defaultFormatterSpec: undefined,
|
|
94
|
-
parser: undefined,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
const persistenceUnitName = persistenceUnit.fullName;
|
|
98
|
-
const highPrecisionFormatterSpec = await IModelApp.quantityFormatter.createFormatterSpec({
|
|
99
|
-
formatProps: {
|
|
100
|
-
...formatProps,
|
|
101
|
-
precision: parseFormatType(formatProps.type, "") === FormatType.Decimal
|
|
102
|
-
? 12
|
|
103
|
-
: formatProps.precision,
|
|
104
|
-
},
|
|
105
|
-
persistenceUnitName,
|
|
106
|
-
});
|
|
107
|
-
const defaultFormatterSpec = await IModelApp.quantityFormatter.createFormatterSpec({
|
|
108
|
-
formatProps,
|
|
109
|
-
persistenceUnitName,
|
|
110
|
-
});
|
|
111
|
-
const parserSpec = await IModelApp.quantityFormatter.createParserSpec({
|
|
112
|
-
formatProps,
|
|
113
|
-
persistenceUnitName,
|
|
114
|
-
});
|
|
115
|
-
return {
|
|
116
|
-
highPrecisionFormatterSpec,
|
|
117
|
-
defaultFormatterSpec,
|
|
118
|
-
parserSpec,
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
68
|
/* v8 ignore stop */
|
|
122
69
|
//# sourceMappingURL=UseQuantityInfo.js.map
|
|
@@ -1 +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;
|
|
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;AAC/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAQ/D;;;GAGG;A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C,wBAAwB,CAAC,WAAW,CAC9D,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;gBACnB,IAAI,YAAY,KAAK,IAAI,EAAE,CAAC;oBAC1B,KAAK,mBAAmB,EAAE,CAAC;gBAC7B,CAAC;YACH,CAAC,CACF;SACF,CAAC;QACF,IAAI,SAAS,CAAC,eAAe,EAAE,CAAC;YAC9B,eAAe,CAAC,IAAI,CAClB,SAAS,CAAC,eAAe,CAAC,gBAAgB,CAAC,WAAW,CAAC,KAAK,IAAI,EAAE,CAChE,mBAAmB,EAAE,CACtB,CACF,CAAC;QACJ,CAAC;QAED,OAAO,GAAG,EAAE;YACV,QAAQ,GAAG,IAAI,CAAC;YAChB,eAAe,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;gBACjC,MAAM,EAAE,CAAC;YACX,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;IAEnB,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,EAAE,CAAC;AAC9D,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, type ParserSpec } from \"@itwin/core-quantity\";\nimport * as React from \"react\";\nimport { useIModelConnection } from \"../../IModelConnectionContext.js\";\nimport { getFormatterParserSpec } from \"../../KoqUtilities.js\";\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 [{ defaultFormatter, highPrecisionFormatter, parser }, setState] =\n React.useState<{\n defaultFormatter: FormatterSpec | undefined;\n highPrecisionFormatter: FormatterSpec | undefined;\n parser: ParserSpec | undefined;\n }>(() => ({\n defaultFormatter: undefined,\n highPrecisionFormatter: undefined,\n parser: undefined,\n }));\n\n const imodel = useIModelConnection();\n\n React.useEffect(() => {\n if (type === undefined || !imodel) {\n setState({\n defaultFormatter: undefined,\n highPrecisionFormatter: undefined,\n parser: undefined,\n });\n return;\n }\n\n let disposed = false;\n const loadFormatterParser = async () => {\n const { formatterSpec, highPrecisionFormatterSpec, parserSpec } =\n (await getFormatterParserSpec({\n imodel,\n type,\n })) ?? {\n formatterSpec: undefined,\n highPrecisionFormatterSpec: undefined,\n parserSpec: undefined,\n };\n\n if (!disposed) {\n setState({\n defaultFormatter: formatterSpec,\n highPrecisionFormatter: highPrecisionFormatterSpec,\n parser: parserSpec,\n });\n }\n };\n\n void loadFormatterParser();\n\n const removeListeners = [\n IModelApp.quantityFormatter.onActiveFormattingUnitSystemChanged.addListener(\n loadFormatterParser\n ),\n IModelApp.quantityFormatter.onQuantityFormatsChanged.addListener(\n ({ quantityType }) => {\n if (quantityType === type) {\n void loadFormatterParser();\n }\n }\n ),\n ];\n if (IModelApp.formatsProvider) {\n removeListeners.push(\n IModelApp.formatsProvider.onFormatsChanged.addListener(async () =>\n loadFormatterParser()\n )\n );\n }\n\n return () => {\n disposed = true;\n removeListeners.forEach((remove) => {\n remove();\n });\n };\n }, [imodel, type]);\n\n return { defaultFormatter, highPrecisionFormatter, parser };\n}\n\n/* v8 ignore stop */\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { PropertyRecord } from "@itwin/appui-abstract";
|
|
3
|
+
import type { IPropertyValueRenderer, PropertyValueRendererContext } from "@itwin/components-react";
|
|
4
|
+
/**
|
|
5
|
+
* Name of the renderer for properties with kind of quantity.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export declare const KOQ_RENDERER_NAME = "KoqPropertyValueRenderer";
|
|
9
|
+
/**
|
|
10
|
+
* Renderer for properties with kind of quantity.
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export declare class KoqPropertyValueRenderer implements IPropertyValueRenderer {
|
|
14
|
+
/** Checks if the renderer can handle given property */
|
|
15
|
+
canRender(record: PropertyRecord): boolean;
|
|
16
|
+
/** Method that returns a JSX representation of PropertyRecord */
|
|
17
|
+
render(record: PropertyRecord, context?: PropertyValueRendererContext): React.JSX.Element;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=KoqPropertyRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KoqPropertyRenderer.d.ts","sourceRoot":"","sources":["../../../src/imodel-components-react/properties/KoqPropertyRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EACV,sBAAsB,EACtB,4BAA4B,EAC7B,MAAM,yBAAyB,CAAC;AAUjC;;;GAGG;AACH,eAAO,MAAM,iBAAiB,6BAA6B,CAAC;AAE5D;;;GAGG;AACH,qBAAa,wBAAyB,YAAW,sBAAsB;IACrE,uDAAuD;IAChD,SAAS,CAAC,MAAM,EAAE,cAAc;IASvC,iEAAiE;IAC1D,MAAM,CACX,MAAM,EAAE,cAAc,EACtB,OAAO,CAAC,EAAE,4BAA4B;CAIzC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
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 { PropertyValueFormat, StandardTypeNames } from "@itwin/appui-abstract";
|
|
7
|
+
import { assert } from "@itwin/core-bentley";
|
|
8
|
+
import { useIModelConnection } from "../IModelConnectionContext.js";
|
|
9
|
+
import { IModelApp } from "@itwin/core-frontend";
|
|
10
|
+
import { convertRecordToString, PrimitivePropertyValueRendererImpl, } from "@itwin/components-react/internal";
|
|
11
|
+
import { ValueUtilities } from "@itwin/components-react";
|
|
12
|
+
import { getFormatterParserSpec } from "../KoqUtilities.js";
|
|
13
|
+
/**
|
|
14
|
+
* Name of the renderer for properties with kind of quantity.
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export const KOQ_RENDERER_NAME = "KoqPropertyValueRenderer";
|
|
18
|
+
/**
|
|
19
|
+
* Renderer for properties with kind of quantity.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export class KoqPropertyValueRenderer {
|
|
23
|
+
/** Checks if the renderer can handle given property */
|
|
24
|
+
canRender(record) {
|
|
25
|
+
return (record.value.valueFormat === PropertyValueFormat.Primitive &&
|
|
26
|
+
(record.property.typename === StandardTypeNames.Double.valueOf() ||
|
|
27
|
+
record.property.typename === StandardTypeNames.Float.valueOf()) &&
|
|
28
|
+
!!record.property.kindOfQuantityName);
|
|
29
|
+
}
|
|
30
|
+
/** Method that returns a JSX representation of PropertyRecord */
|
|
31
|
+
render(record, context) {
|
|
32
|
+
return React.createElement(KoqRenderer, { record: record, context: context });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function KoqRenderer(props) {
|
|
36
|
+
const { record, context } = props;
|
|
37
|
+
const imodel = useIModelConnection();
|
|
38
|
+
const stringValueCalculator = React.useCallback(async (recordToFormat) => {
|
|
39
|
+
return imodel
|
|
40
|
+
? formatKoqValue(recordToFormat, imodel)
|
|
41
|
+
: convertRecordToString(recordToFormat);
|
|
42
|
+
}, [imodel]);
|
|
43
|
+
return (React.createElement(PrimitivePropertyValueRendererImpl, { record: record, context: context, stringValueCalculator: stringValueCalculator }));
|
|
44
|
+
}
|
|
45
|
+
async function formatKoqValue(record, imodel) {
|
|
46
|
+
const value = record.value;
|
|
47
|
+
const koqName = record.property.kindOfQuantityName;
|
|
48
|
+
assert(value.valueFormat === PropertyValueFormat.Primitive, "PropertyRecord value is not primitive");
|
|
49
|
+
assert(koqName !== undefined, "Kind of quantity name is undefined");
|
|
50
|
+
const { formatterSpec } = (await getFormatterParserSpec({
|
|
51
|
+
imodel,
|
|
52
|
+
type: koqName,
|
|
53
|
+
})) ?? { formatterSpec: undefined };
|
|
54
|
+
if (!formatterSpec) {
|
|
55
|
+
return convertRecordToString(record);
|
|
56
|
+
}
|
|
57
|
+
if (record.isMerged) {
|
|
58
|
+
return `${ValueUtilities.MERGED_VALUE} ${formatterSpec.unitConversions?.[0]?.label ?? ""}`;
|
|
59
|
+
}
|
|
60
|
+
return IModelApp.quantityFormatter.formatQuantity(value.value, formatterSpec);
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=KoqPropertyRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KoqPropertyRenderer.js","sourceRoot":"","sources":["../../../src/imodel-components-react/properties/KoqPropertyRenderer.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAK7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,SAAS,EAAyB,MAAM,sBAAsB,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,kCAAkC,GACnC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AA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AAC,kBAAkB,CAAC;IACnD,MAAM,CACJ,KAAK,CAAC,WAAW,KAAK,mBAAmB,CAAC,SAAS,EACnD,uCAAuC,CACxC,CAAC;IACF,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE,oCAAoC,CAAC,CAAC;IAEpE,MAAM,EAAE,aAAa,EAAE,GAAG,CAAC,MAAM,sBAAsB,CAAC;QACtD,MAAM;QACN,IAAI,EAAE,OAAO;KACd,CAAC,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,CAAC;IAEpC,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,EAAE,CAAC;QACpB,OAAO,GAAG,cAAc,CAAC,YAAY,IACnC,aAAa,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,IAAI,EAC/C,EAAE,CAAC;IACL,CAAC;IAED,OAAO,SAAS,CAAC,iBAAiB,CAAC,cAAc,CAC/C,KAAK,CAAC,KAAe,EACrB,aAAa,CACd,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\nimport * as React from \"react\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport { PropertyValueFormat, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport { assert } from \"@itwin/core-bentley\";\nimport type {\n IPropertyValueRenderer,\n PropertyValueRendererContext,\n} from \"@itwin/components-react\";\nimport { useIModelConnection } from \"../IModelConnectionContext.js\";\nimport { IModelApp, type IModelConnection } from \"@itwin/core-frontend\";\nimport {\n convertRecordToString,\n PrimitivePropertyValueRendererImpl,\n} from \"@itwin/components-react/internal\";\nimport { ValueUtilities } from \"@itwin/components-react\";\nimport { getFormatterParserSpec } from \"../KoqUtilities.js\";\n\n/**\n * Name of the renderer for properties with kind of quantity.\n * @public\n */\nexport const KOQ_RENDERER_NAME = \"KoqPropertyValueRenderer\";\n\n/**\n * Renderer for properties with kind of quantity.\n * @internal\n */\nexport class KoqPropertyValueRenderer implements IPropertyValueRenderer {\n /** Checks if the renderer can handle given property */\n public canRender(record: PropertyRecord) {\n return (\n record.value.valueFormat === PropertyValueFormat.Primitive &&\n (record.property.typename === StandardTypeNames.Double.valueOf() ||\n record.property.typename === StandardTypeNames.Float.valueOf()) &&\n !!record.property.kindOfQuantityName\n );\n }\n\n /** Method that returns a JSX representation of PropertyRecord */\n public render(\n record: PropertyRecord,\n context?: PropertyValueRendererContext\n ) {\n return <KoqRenderer record={record} context={context} />;\n }\n}\n\nfunction KoqRenderer(props: {\n record: PropertyRecord;\n context?: PropertyValueRendererContext;\n}) {\n const { record, context } = props;\n const imodel = useIModelConnection();\n const stringValueCalculator = React.useCallback(\n async (recordToFormat: PropertyRecord) => {\n return imodel\n ? formatKoqValue(recordToFormat, imodel)\n : convertRecordToString(recordToFormat);\n },\n [imodel]\n );\n return (\n <PrimitivePropertyValueRendererImpl\n record={record}\n context={context}\n stringValueCalculator={stringValueCalculator}\n />\n );\n}\n\nasync function formatKoqValue(\n record: PropertyRecord,\n imodel: IModelConnection\n): Promise<string> {\n const value = record.value;\n const koqName = record.property.kindOfQuantityName;\n assert(\n value.valueFormat === PropertyValueFormat.Primitive,\n \"PropertyRecord value is not primitive\"\n );\n assert(koqName !== undefined, \"Kind of quantity name is undefined\");\n\n const { formatterSpec } = (await getFormatterParserSpec({\n imodel,\n type: koqName,\n })) ?? { formatterSpec: undefined };\n\n if (!formatterSpec) {\n return convertRecordToString(record);\n }\n\n if (record.isMerged) {\n return `${ValueUtilities.MERGED_VALUE} ${\n formatterSpec.unitConversions?.[0]?.label ?? \"\"\n }`;\n }\n\n return IModelApp.quantityFormatter.formatQuantity(\n value.value as number,\n formatterSpec\n );\n}\n"]}
|
|
@@ -34,6 +34,7 @@ export { ViewStateProp, ViewportComponent, ViewportProps, } from "./imodel-compo
|
|
|
34
34
|
export { ViewportComponentEvents, CubeRotationChangeEvent, CubeRotationChangeEventArgs, DrawingViewportChangeEvent, DrawingViewportChangeEventArgs, StandardRotationChangeEvent, StandardRotationChangeEventArgs, ViewClassFullNameChangedEvent, ViewClassFullNameChangedEventArgs, ViewIdChangedEvent, ViewIdChangedEventArgs, ViewRotationChangeEvent, ViewRotationChangeEventArgs, } from "./imodel-components-react/viewport/ViewportComponentEvents.js";
|
|
35
35
|
export { ToolUtilities } from "./imodel-components-react/ToolUtilities.js";
|
|
36
36
|
export { IModelConnectionProvider } from "./imodel-components-react/IModelConnectionContext.js";
|
|
37
|
+
export { KOQ_RENDERER_NAME } from "./imodel-components-react/properties/KoqPropertyRenderer.js";
|
|
37
38
|
/** @docs-package-description
|
|
38
39
|
* The imodel-components-react package contains React components that depend on the core-frontend, core-common or core-quantity packages.
|
|
39
40
|
* The components pertain to Color, Cube, LineWeight, Navigation Aids, Quantity Inputs, Timeline and Viewport.
|
|
@@ -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,M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,OAAO,EACL,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,iEAAiE,CAAC;AAEzE,OAAO,EACL,8BAA8B,EAC9B,gBAAgB,EAChB,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;AAE3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,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,sBA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AM,6DAA6D,CAAC;AAgChG;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG"}
|
|
@@ -39,13 +39,17 @@ export { ViewportComponent, } from "./imodel-components-react/viewport/ViewportC
|
|
|
39
39
|
export { ViewportComponentEvents, CubeRotationChangeEvent, DrawingViewportChangeEvent, StandardRotationChangeEvent, ViewClassFullNameChangedEvent, ViewIdChangedEvent, ViewRotationChangeEvent, } from "./imodel-components-react/viewport/ViewportComponentEvents.js";
|
|
40
40
|
export { ToolUtilities } from "./imodel-components-react/ToolUtilities.js";
|
|
41
41
|
export { IModelConnectionProvider } from "./imodel-components-react/IModelConnectionContext.js";
|
|
42
|
+
export { KOQ_RENDERER_NAME } from "./imodel-components-react/properties/KoqPropertyRenderer.js";
|
|
42
43
|
// #region "SideEffects"
|
|
43
44
|
import { StandardEditorNames, StandardTypeNames } from "@itwin/appui-abstract";
|
|
44
|
-
import { PropertyEditorManager } from "@itwin/components-react";
|
|
45
|
+
import { PropertyEditorManager, PropertyValueRendererManager, } from "@itwin/components-react";
|
|
45
46
|
import { ColorPropertyEditor } from "./imodel-components-react/editors/ColorEditor.js";
|
|
46
47
|
import { WeightPropertyEditor } from "./imodel-components-react/editors/WeightEditor.js";
|
|
48
|
+
import { KoqPropertyValueRenderer } from "./imodel-components-react/properties/KoqPropertyRenderer.js";
|
|
49
|
+
import { KOQ_RENDERER_NAME } from "./imodel-components-react/properties/KoqPropertyRenderer.js";
|
|
47
50
|
PropertyEditorManager.registerEditor(StandardTypeNames.Number, ColorPropertyEditor, StandardEditorNames.ColorPicker);
|
|
48
51
|
PropertyEditorManager.registerEditor(StandardTypeNames.Number, WeightPropertyEditor, StandardEditorNames.WeightPicker);
|
|
52
|
+
PropertyValueRendererManager.defaultManager.registerRenderer(KOQ_RENDERER_NAME, new KoqPropertyValueRenderer());
|
|
49
53
|
// #endregion "SideEffects"
|
|
50
54
|
/** @docs-package-description
|
|
51
55
|
* The imodel-components-react package contains React components that depend on the core-frontend, core-common or core-quantity packages.
|
|
@@ -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;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sDAAsD,CAAC;AAExF,OAAO,EACL,aAAa,GAEd,MAAM,mDAAmD,CAAC;AAC3D,OAAO,EACL,mBAAmB,GAGpB,MAAM,yDAAyD,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gEAAgE,CAAC;AAEpG,OAAO,EACL,gBAAgB,GAEjB,MAAM,gDAAgD,CAAC;AACxD,OAAO,EACL,kBAAkB,GAEnB,MAAM,4DAA4D,CAAC;AAEpE,OAAO,EACL,IAAI,EAEJ,IAAI,GACL,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,EACrB,qBAAqB,EACrB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AChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,kDAAkD,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,MAAM,mDAAmD,CAAC;AAEzF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,MAAM,EACxB,mBAAmB,EACnB,mBAAmB,CAAC,WAAW,CAChC,CAAC;AACF,qBAAqB,CAAC,cAAc,CAClC,iBAAiB,CAAC,MAAM,EACxB,oBAAoB,EACpB,mBAAmB,CAAC,YAAY,CACjC,CAAC;AAEF,2BAA2B;AAE3B;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;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\nexport { IModelConnectionProvider } from \"./imodel-components-react/IModelConnectionContext.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"]}
|
|
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,8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iB,EACjB,IAAI,wBAAwB,EAAE,CAC/B,CAAC;AAEF,2BAA2B;AAE3B;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;GAGG;AACH;;;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\nexport { IModelConnectionProvider } from \"./imodel-components-react/IModelConnectionContext.js\";\n\nexport { KOQ_RENDERER_NAME } from \"./imodel-components-react/properties/KoqPropertyRenderer.js\";\n\n// #region \"SideEffects\"\n\nimport { StandardEditorNames, StandardTypeNames } from \"@itwin/appui-abstract\";\nimport {\n PropertyEditorManager,\n PropertyValueRendererManager,\n} from \"@itwin/components-react\";\nimport { ColorPropertyEditor } from \"./imodel-components-react/editors/ColorEditor.js\";\nimport { WeightPropertyEditor } from \"./imodel-components-react/editors/WeightEditor.js\";\nimport { KoqPropertyValueRenderer } from \"./imodel-components-react/properties/KoqPropertyRenderer.js\";\nimport { KOQ_RENDERER_NAME } from \"./imodel-components-react/properties/KoqPropertyRenderer.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\nPropertyValueRendererManager.defaultManager.registerRenderer(\n KOQ_RENDERER_NAME,\n new KoqPropertyValueRenderer()\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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/imodel-components-react",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.33.0",
|
|
4
4
|
"description": "A react component library of iTwin.js UI iModel components",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./lib/imodel-components-react.d.ts",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@itwin/itwinui-react": "^3.15.0",
|
|
45
45
|
"react": "^18.0.0 || ^19.0.0",
|
|
46
46
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
47
|
-
"@itwin/components-react": "5.
|
|
48
|
-
"@itwin/core-react": "5.
|
|
47
|
+
"@itwin/components-react": "5.33.0",
|
|
48
|
+
"@itwin/core-react": "5.33.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@itwin/appui-abstract": "^5.8.1",
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"typescript": "~5.6.3",
|
|
84
84
|
"upath": "^2.0.1",
|
|
85
85
|
"vitest": "^3.2.4",
|
|
86
|
-
"@itwin/components-react": "5.
|
|
87
|
-
"@itwin/core-react": "5.
|
|
86
|
+
"@itwin/components-react": "5.33.0",
|
|
87
|
+
"@itwin/core-react": "5.33.0"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@itwin/itwinui-icons-react": "^2.11.0",
|