@itwin/presentation-hierarchies-react 1.2.0 → 1.4.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 +80 -0
- package/README.md +16 -12
- package/lib/cjs/presentation-hierarchies-react/UseTree.d.ts +4 -1
- package/lib/cjs/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies-react/UseTree.js +31 -14
- package/lib/cjs/presentation-hierarchies-react/UseTree.js.map +1 -1
- package/lib/cjs/presentation-hierarchies-react/internal/DisposePolyfill.d.ts +1 -0
- package/lib/cjs/presentation-hierarchies-react/internal/DisposePolyfill.d.ts.map +1 -0
- package/lib/cjs/presentation-hierarchies-react/internal/DisposePolyfill.js +11 -0
- package/lib/cjs/presentation-hierarchies-react/internal/DisposePolyfill.js.map +1 -0
- package/lib/cjs/presentation-hierarchies-react/internal/TreeActions.d.ts +4 -2
- package/lib/cjs/presentation-hierarchies-react/internal/TreeActions.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies-react/internal/TreeActions.js +10 -9
- package/lib/cjs/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
- package/lib/cjs/presentation-hierarchies-react/internal/TreeLoader.d.ts +1 -0
- package/lib/cjs/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies-react/internal/TreeLoader.js +19 -6
- package/lib/cjs/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
- package/lib/cjs/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +2 -2
- package/lib/cjs/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies-react/internal/UseUnifiedSelection.js +4 -4
- package/lib/cjs/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
- package/lib/cjs/presentation-hierarchies-react/internal/Utils.d.ts +15 -0
- package/lib/cjs/presentation-hierarchies-react/internal/Utils.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies-react/internal/Utils.js +19 -0
- package/lib/cjs/presentation-hierarchies-react/internal/Utils.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +4 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.js +31 -14
- package/lib/esm/presentation-hierarchies-react/UseTree.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts +2 -0
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js +11 -0
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +4 -2
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +10 -9
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +1 -0
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +19 -6
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +2 -2
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +4 -4
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts +15 -0
- package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js +18 -0
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +1 -1
- package/package.json +4 -4
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import "./DisposePolyfill.js";
|
|
5
6
|
import { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
6
7
|
/** @internal */
|
|
7
8
|
export function createNodeId(node) {
|
|
@@ -37,4 +38,21 @@ export function sameNodes(lhs, rhs) {
|
|
|
37
38
|
}
|
|
38
39
|
/** @internal */
|
|
39
40
|
export const MAX_LIMIT_OVERRIDE = 10000;
|
|
41
|
+
/**
|
|
42
|
+
* A helper that disposes the given object, if it's disposable.
|
|
43
|
+
*
|
|
44
|
+
* The first option is to dispose using the deprecated `dispose` method if it exists on the object.
|
|
45
|
+
* If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is
|
|
46
|
+
* considered as non-disposable and nothing is done with it.
|
|
47
|
+
*
|
|
48
|
+
* @internal
|
|
49
|
+
*/
|
|
50
|
+
export function safeDispose(disposable) {
|
|
51
|
+
if ("dispose" in disposable) {
|
|
52
|
+
disposable.dispose();
|
|
53
|
+
}
|
|
54
|
+
else if (Symbol.dispose in disposable) {
|
|
55
|
+
disposable[Symbol.dispose]();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
40
58
|
//# sourceMappingURL=Utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/internal/Utils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAiB,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAElF,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAC,IAA+C;IAC1E,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,gBAAgB,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AAC;AAED,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,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\nimport { HierarchyNode, HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\n/** @internal */\nexport function createNodeId(node: Pick<HierarchyNode, \"key\" | \"parentKeys\">) {\n return [...node.parentKeys.map(serializeNodeKey), serializeNodeKey(node.key)].join(\";\");\n}\n\nfunction serializeNodeKey(key: HierarchyNodeKey): string {\n return convertObjectValuesToString(key);\n}\n\nfunction convertObjectValuesToString(obj: object): string {\n return Object.entries(obj)\n .map(([, value]) => {\n if (typeof value === \"object\") {\n return convertObjectValuesToString(value);\n }\n return String(value);\n })\n .join(\",\");\n}\n\n/** @internal */\nexport function sameNodes(lhs: HierarchyNode, rhs: HierarchyNode): boolean {\n if (HierarchyNodeKey.compare(lhs.key, rhs.key) !== 0) {\n return false;\n }\n\n if (lhs.parentKeys.length !== rhs.parentKeys.length) {\n return false;\n }\n\n for (let i = lhs.parentKeys.length - 1; i >= 0; --i) {\n if (HierarchyNodeKey.compare(lhs.parentKeys[i], rhs.parentKeys[i]) !== 0) {\n return false;\n }\n }\n return true;\n}\n\n/** @internal */\nexport const MAX_LIMIT_OVERRIDE = 10000;\n"]}
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/internal/Utils.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,sBAAsB,CAAC;AAC9B,OAAO,EAAiB,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAElF,gBAAgB;AAChB,MAAM,UAAU,YAAY,CAAC,IAA+C;IAC1E,OAAO,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,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AM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,UAAU,WAAW,CAAC,UAA2E;IACrG,IAAI,SAAS,IAAI,UAAU,EAAE,CAAC;QAC5B,UAAU,CAAC,OAAO,EAAE,CAAC;IACvB,CAAC;SAAM,IAAI,MAAM,CAAC,OAAO,IAAI,UAAU,EAAE,CAAC;QACxC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,CAAC;AACH,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 \"./DisposePolyfill.js\";\nimport { HierarchyNode, HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\n/** @internal */\nexport function createNodeId(node: Pick<HierarchyNode, \"key\" | \"parentKeys\">) {\n return [...node.parentKeys.map(serializeNodeKey), serializeNodeKey(node.key)].join(\";\");\n}\n\nfunction serializeNodeKey(key: HierarchyNodeKey): string {\n return convertObjectValuesToString(key);\n}\n\nfunction convertObjectValuesToString(obj: object): string {\n return Object.entries(obj)\n .map(([, value]) => {\n if (typeof value === \"object\") {\n return convertObjectValuesToString(value);\n }\n return String(value);\n })\n .join(\",\");\n}\n\n/** @internal */\nexport function sameNodes(lhs: HierarchyNode, rhs: HierarchyNode): boolean {\n if (HierarchyNodeKey.compare(lhs.key, rhs.key) !== 0) {\n return false;\n }\n\n if (lhs.parentKeys.length !== rhs.parentKeys.length) {\n return false;\n }\n\n for (let i = lhs.parentKeys.length - 1; i >= 0; --i) {\n if (HierarchyNodeKey.compare(lhs.parentKeys[i], rhs.parentKeys[i]) !== 0) {\n return false;\n }\n }\n return true;\n}\n\n/** @internal */\nexport const MAX_LIMIT_OVERRIDE = 10000;\n\n/**\n * A helper that disposes the given object, if it's disposable.\n *\n * The first option is to dispose using the deprecated `dispose` method if it exists on the object.\n * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is\n * considered as non-disposable and nothing is done with it.\n *\n * @internal\n */\nexport function safeDispose(disposable: {} | { [Symbol.dispose]: () => void } | { dispose: () => void }) {\n if (\"dispose\" in disposable) {\n disposable.dispose();\n } else if (Symbol.dispose in disposable) {\n disposable[Symbol.dispose]();\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-hierarchies-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "React components based on `@itwin/presentation-hierarchies`",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -46,9 +46,9 @@
|
|
|
46
46
|
"immer": "^10.1.1",
|
|
47
47
|
"react-error-boundary": "^4.0.13",
|
|
48
48
|
"rxjs": "^7.8.1",
|
|
49
|
-
"@itwin/presentation-hierarchies": "^1.
|
|
49
|
+
"@itwin/presentation-hierarchies": "^1.4.1",
|
|
50
50
|
"@itwin/presentation-shared": "^1.2.0",
|
|
51
|
-
"@itwin/unified-selection": "^1.1
|
|
51
|
+
"@itwin/unified-selection": "^1.2.1"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"@itwin/itwinui-react": "^3.0.0",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@itwin/build-tools": "^4.10.1",
|
|
65
|
-
"@itwin/itwinui-react": "^3.16.
|
|
65
|
+
"@itwin/itwinui-react": "^3.16.2",
|
|
66
66
|
"@testing-library/dom": "^10.3.2",
|
|
67
67
|
"@testing-library/react": "^16.0.0",
|
|
68
68
|
"@testing-library/user-event": "^14.5.2",
|