@itwin/imodel-components-react 5.33.0 → 5.33.2
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
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Change Log - @itwin/imodel-components-react
|
|
2
2
|
|
|
3
|
+
## 5.33.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [e95016c]
|
|
8
|
+
- @itwin/components-react@5.33.2
|
|
9
|
+
- @itwin/core-react@5.33.2
|
|
10
|
+
|
|
11
|
+
## 5.33.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- b98b9c3: Quantity editor now strips the `TrailZeroes` and `KeepDecimalPoint` format traits while editing, so the editable value is no longer padded with trailing zeros or a dangling decimal point.
|
|
16
|
+
- @itwin/components-react@5.33.1
|
|
17
|
+
- @itwin/core-react@5.33.1
|
|
18
|
+
|
|
3
19
|
## 5.33.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -1 +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;
|
|
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;AAKtE;;;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,CA2DA"}
|
|
@@ -42,6 +42,7 @@ export async function getFormatterParserSpec({ imodel, type, }) {
|
|
|
42
42
|
precision: parseFormatType(formatProps.type, "") === FormatType.Decimal
|
|
43
43
|
? 12
|
|
44
44
|
: formatProps.precision,
|
|
45
|
+
formatTraits: getHighPrecisionFormatTraits(formatProps.formatTraits),
|
|
45
46
|
},
|
|
46
47
|
persistenceUnitName,
|
|
47
48
|
});
|
|
@@ -59,4 +60,19 @@ export async function getFormatterParserSpec({ imodel, type, }) {
|
|
|
59
60
|
parserSpec,
|
|
60
61
|
};
|
|
61
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Returns the format traits to use for the high precision formatter, removing
|
|
65
|
+
* `TrailZeroes` and `KeepDecimalPoint` so that the editable value is not padded
|
|
66
|
+
* with trailing zeros or a dangling decimal point.
|
|
67
|
+
*/
|
|
68
|
+
function getHighPrecisionFormatTraits(formatTraits) {
|
|
69
|
+
if (!formatTraits) {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
const traits = Array.isArray(formatTraits)
|
|
73
|
+
? formatTraits
|
|
74
|
+
: formatTraits.split(/,|;|\|/);
|
|
75
|
+
const excluded = ["trailzeroes", "keepdecimalpoint"];
|
|
76
|
+
return traits.filter((trait) => !excluded.includes(trait.trim().toLowerCase()));
|
|
77
|
+
}
|
|
62
78
|
//# sourceMappingURL=KoqUtilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"KoqUtilities.js","sourceRoot":"","sources":["../../src/imodel-components-react/KoqUtilities.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,O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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 type { FormatProps } 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 formatTraits: getHighPrecisionFormatTraits(formatProps.formatTraits),\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\n/**\n * Returns the format traits to use for the high precision formatter, removing\n * `TrailZeroes` and `KeepDecimalPoint` so that the editable value is not padded\n * with trailing zeros or a dangling decimal point.\n */\nfunction getHighPrecisionFormatTraits(\n formatTraits: FormatProps[\"formatTraits\"]\n): string[] | undefined {\n if (!formatTraits) {\n return undefined;\n }\n const traits = Array.isArray(formatTraits)\n ? formatTraits\n : formatTraits.split(/,|;|\\|/);\n const excluded = [\"trailzeroes\", \"keepdecimalpoint\"];\n return traits.filter(\n (trait) => !excluded.includes(trait.trim().toLowerCase())\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/imodel-components-react",
|
|
3
|
-
"version": "5.33.
|
|
3
|
+
"version": "5.33.2",
|
|
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.33.
|
|
48
|
-
"@itwin/core-react": "5.33.
|
|
47
|
+
"@itwin/components-react": "5.33.2",
|
|
48
|
+
"@itwin/core-react": "5.33.2"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@itwin/appui-abstract": "^5.8.1",
|
|
@@ -82,9 +82,9 @@
|
|
|
82
82
|
"typemoq": "^2.1.0",
|
|
83
83
|
"typescript": "~5.6.3",
|
|
84
84
|
"upath": "^2.0.1",
|
|
85
|
-
"vitest": "^
|
|
86
|
-
"@itwin/components-react": "5.33.
|
|
87
|
-
"@itwin/core-react": "5.33.
|
|
85
|
+
"vitest": "^4.1.10",
|
|
86
|
+
"@itwin/components-react": "5.33.2",
|
|
87
|
+
"@itwin/core-react": "5.33.2"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@itwin/itwinui-icons-react": "^2.11.0",
|