@itwin/presentation-hierarchies-react 2.0.0-alpha.52 → 2.0.0-alpha.54
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 +33 -0
- package/lib/esm/presentation-hierarchies-react/Renderers.d.ts +62 -55
- package/lib/esm/presentation-hierarchies-react/Renderers.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +33 -29
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts +27 -16
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.js +181 -54
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts +12 -6
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js +54 -49
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts +7 -30
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js +116 -74
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +67 -54
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.js +283 -226
- package/lib/esm/presentation-hierarchies-react/UseTree.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/Utils.js +44 -27
- package/lib/esm/presentation-hierarchies-react/Utils.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js +6 -7
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +271 -298
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +91 -82
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts +3 -47
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js +114 -151
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +32 -37
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +128 -101
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js +29 -44
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts +24 -13
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +344 -67
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts +16 -15
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js +78 -60
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +122 -117
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js +59 -38
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +16 -5
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +161 -35
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts +21 -17
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js +84 -31
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +22 -14
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +61 -26
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts +15 -6
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js +75 -25
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts +16 -40
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js +140 -61
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +14 -42
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +489 -121
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +58 -55
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js +412 -181
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react.d.ts +17 -17
- package/lib/esm/presentation-hierarchies-react.js +15 -18
- package/package.json +17 -14
- package/lib/esm/presentation-hierarchies-react/Renderers.js +0 -6
- package/lib/esm/presentation-hierarchies-react/Renderers.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/TreeNode.js +0 -6
- package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/Utils.d.ts +0 -8
- package/lib/esm/presentation-hierarchies-react/Utils.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts +0 -2
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +0 -53
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +0 -62
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts +0 -23
- package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @itwin/presentation-hierarchies-react
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.54
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1198](https://github.com/iTwin/presentation/pull/1198): Change `HierarchyProvider.hierarchyChanged` argument to be required.
|
|
8
|
+
|
|
9
|
+
This simplifies the API for users of `HierarchyProvider`, as they no longer need to check for `undefined` when handling hierarchy changes.
|
|
10
|
+
|
|
11
|
+
For implementors of custom `HierarchyProvider`, this change means that they must always provide an even argument when raising the `hierarchyChanged` event. Since all members of the argument type are optional, it's okay to raise the even with an empty object, e.g.: `this.hierarchyChanged.raiseEvent({})`.
|
|
12
|
+
|
|
13
|
+
- [#1200](https://github.com/iTwin/presentation/pull/1200): Removed unnecessary, always-truthy condition checks.
|
|
14
|
+
- [#1193](https://github.com/iTwin/presentation/pull/1193): Process package output with [React Compiler](https://react.dev/reference/react-compiler/compiling-libraries).
|
|
15
|
+
- Updated dependencies:
|
|
16
|
+
- @itwin/presentation-shared@2.0.0-alpha.7
|
|
17
|
+
- @itwin/presentation-hierarchies@2.0.0-alpha.11
|
|
18
|
+
|
|
19
|
+
## 2.0.0-alpha.53
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- [#1192](https://github.com/iTwin/presentation/pull/1192): Fix situations where expander was rendered for leaf nodes.
|
|
24
|
+
- [#1196](https://github.com/iTwin/presentation/pull/1196): Added accessible name for tree node rename input.
|
|
25
|
+
|
|
3
26
|
## 2.0.0-alpha.52
|
|
4
27
|
|
|
5
28
|
### Patch Changes
|
|
@@ -763,6 +786,16 @@
|
|
|
763
786
|
|
|
764
787
|
- [#847](https://github.com/iTwin/presentation/pull/847): Moving tree rendering components to a new design systems.
|
|
765
788
|
|
|
789
|
+
## 1.9.11
|
|
790
|
+
|
|
791
|
+
### Patch Changes
|
|
792
|
+
|
|
793
|
+
- [#1208](https://github.com/iTwin/presentation/pull/1208): Bump dependencies.
|
|
794
|
+
- Updated dependencies:
|
|
795
|
+
- @itwin/presentation-hierarchies@1.7.9
|
|
796
|
+
- @itwin/presentation-shared@1.2.8
|
|
797
|
+
- @itwin/unified-selection@1.6.6
|
|
798
|
+
|
|
766
799
|
## 1.9.10
|
|
767
800
|
|
|
768
801
|
### Patch Changes
|
|
@@ -1,85 +1,92 @@
|
|
|
1
|
-
import { GenericInstanceFilter, HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
2
|
-
import { InstanceKey } from "@itwin/presentation-shared";
|
|
3
1
|
import { ErrorInfo, TreeNode } from "./TreeNode.js";
|
|
4
2
|
import { SelectionChangeType } from "./UseSelectionHandler.js";
|
|
3
|
+
import { GenericInstanceFilter, HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
4
|
+
import { InstanceKey } from "@itwin/presentation-shared";
|
|
5
|
+
|
|
6
|
+
//#region src/presentation-hierarchies-react/Renderers.d.ts
|
|
5
7
|
/**
|
|
6
8
|
* Type definition used to render tree rendering UI component.
|
|
7
9
|
* @alpha
|
|
8
10
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
type TreeRendererProps = {
|
|
12
|
+
/**
|
|
13
|
+
* Array containing root tree nodes.
|
|
14
|
+
*/
|
|
15
|
+
rootNodes: TreeNode[];
|
|
16
|
+
/**
|
|
17
|
+
* A function that should be called to either expand or collapse the given node.
|
|
18
|
+
*/
|
|
19
|
+
expandNode: (nodeId: string, isExpanded: boolean) => void;
|
|
20
|
+
/**
|
|
21
|
+
* A function that should be called to select nodes in the tree.
|
|
22
|
+
* @param nodeIds Ids of the nodes that are selected.
|
|
23
|
+
* @param changeType Type of change that occurred for the selection.
|
|
24
|
+
*/
|
|
25
|
+
selectNodes: (nodeIds: Array<string>, changeType: SelectionChangeType) => void;
|
|
26
|
+
/**
|
|
27
|
+
* Determines whether a given node is selected.
|
|
28
|
+
*/
|
|
29
|
+
isNodeSelected: (nodeId: string) => boolean;
|
|
26
30
|
} & CommonRendererProps;
|
|
27
31
|
/**
|
|
28
32
|
* Type definition used to render root error handling UI component.
|
|
29
33
|
* @alpha
|
|
30
34
|
*/
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
35
|
+
type RootErrorRendererProps = {
|
|
36
|
+
/**
|
|
37
|
+
* Object containing root error information
|
|
38
|
+
*/
|
|
39
|
+
error: ErrorInfo;
|
|
34
40
|
} & CommonRendererProps;
|
|
35
41
|
/**
|
|
36
42
|
* @alpha
|
|
37
43
|
*/
|
|
38
44
|
interface CommonRendererProps {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
/**
|
|
46
|
+
* A function that should be called to reload the tree.
|
|
47
|
+
*/
|
|
48
|
+
reloadTree: (options?: ReloadTreeOptions) => void;
|
|
49
|
+
/** Returns hierarchy level details for a given node ID. */
|
|
50
|
+
getHierarchyLevelDetails: (nodeId: string | undefined) => HierarchyLevelDetails | undefined;
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
47
53
|
* Options for doing either full or a sub tree reload.
|
|
48
54
|
* @public
|
|
49
55
|
*/
|
|
50
56
|
interface ReloadTreeOptions {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
/** Specifies parent node under which sub tree should be reloaded. */
|
|
58
|
+
parentNodeId: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Specifies how current tree state should be handled:
|
|
61
|
+
* - `keep` - try to keep current tree state (expanded/collapsed nodes, instance filters, etc.).
|
|
62
|
+
* - `discard` - do not try to keep current tree state. Tree model will be update after nodes are reloaded.
|
|
63
|
+
* - `reset` - remove subtree from the model before reloading and reload nodes ignoring cache.
|
|
64
|
+
*
|
|
65
|
+
* Defaults to `"keep"`.
|
|
66
|
+
*/
|
|
67
|
+
state?: "keep" | "discard" | "reset";
|
|
62
68
|
}
|
|
63
69
|
/**
|
|
64
70
|
* A data structure that contains information about a single hierarchy level.
|
|
65
71
|
* @public
|
|
66
72
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
instanceFilter?: GenericInstanceFilter;
|
|
73
|
-
hierarchyLevelSizeLimit?: number | "unbounded";
|
|
74
|
-
}) => AsyncIterableIterator<InstanceKey>;
|
|
75
|
-
/** Get the limit of how many nodes can be loaded in this hierarchy level. */
|
|
76
|
-
sizeLimit?: number | "unbounded";
|
|
77
|
-
/** Set the limit of how many nodes can be loaded in this hierarchy level. */
|
|
78
|
-
setSizeLimit: (value: undefined | number | "unbounded") => void;
|
|
79
|
-
/** Get the active instance filter applied to this hierarchy level. */
|
|
73
|
+
interface HierarchyLevelDetails {
|
|
74
|
+
/** The parent node whose hierarchy level's information is contained in this data structure */
|
|
75
|
+
hierarchyNode: HierarchyNode | undefined;
|
|
76
|
+
/** A function to get instance keys of the hierarchy level. */
|
|
77
|
+
getInstanceKeysIterator: (props?: {
|
|
80
78
|
instanceFilter?: GenericInstanceFilter;
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
hierarchyLevelSizeLimit?: number | "unbounded";
|
|
80
|
+
}) => AsyncIterableIterator<InstanceKey>;
|
|
81
|
+
/** Get the limit of how many nodes can be loaded in this hierarchy level. */
|
|
82
|
+
sizeLimit?: number | "unbounded";
|
|
83
|
+
/** Set the limit of how many nodes can be loaded in this hierarchy level. */
|
|
84
|
+
setSizeLimit: (value: undefined | number | "unbounded") => void;
|
|
85
|
+
/** Get the active instance filter applied to this hierarchy level. */
|
|
86
|
+
instanceFilter?: GenericInstanceFilter;
|
|
87
|
+
/** Set the instance filter to apply to this hierarchy level */
|
|
88
|
+
setInstanceFilter: (filter: GenericInstanceFilter | undefined) => void;
|
|
83
89
|
}
|
|
84
|
-
|
|
90
|
+
//#endregion
|
|
91
|
+
export { HierarchyLevelDetails, RootErrorRendererProps, TreeRendererProps };
|
|
85
92
|
//# sourceMappingURL=Renderers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Renderers.d.ts","
|
|
1
|
+
{"version":3,"file":"Renderers.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/Renderers.ts"],"mappings":";;;;;;;;AAcA;;KAAY,iBAAA;EAIC;;;EAAX,SAAA,EAAW,QAAA;EAeU;;;EAXrB,UAAA,GAAa,MAAA,UAAgB,UAAA;EAA7B;;;;;EAMA,WAAA,GAAc,OAAA,EAAS,KAAA,UAAe,UAAA,EAAY,mBAAA;EAAA;;;EAIlD,cAAA,GAAiB,MAAA;AAAA,IACf,mBAAA;;;AAMJ;;KAAY,sBAAA;EAKW;;;EADrB,KAAA,EAAO,SAAA;AAAA,IACL,mBAAA;;AAAoB;;UAKd,mBAAA;EAMuE;;;EAF/E,UAAA,GAAa,OAAA,GAAU,iBAAA;EAEvB;EAAA,wBAAA,GAA2B,MAAA,yBAA+B,qBAAA;AAAA;;;AAAqB;;UAOvE,iBAAA;EAER;EAAA,YAAA;EAiBe;;;;;;;;EAPf,KAAA;AAAA;;;;;UAOe,qBAAA;EAMI;EAJnB,aAAA,EAAe,aAAA;EAGW;EAA1B,uBAAA,GAA0B,KAAA;IACxB,cAAA,GAAiB,qBAAA;IACjB,uBAAA;EAAA,MACI,qBAAA,CAAsB,WAAA;EAKb;EAFf,SAAA;EAKiB;EAHjB,YAAA,GAAe,KAAA;EAKa;EAF5B,cAAA,GAAiB,qBAAA;EAE4C;EAA7D,iBAAA,GAAoB,MAAA,EAAQ,qBAAA;AAAA"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
2
|
+
|
|
3
|
+
//#region src/presentation-hierarchies-react/TreeNode.d.ts
|
|
2
4
|
/**
|
|
3
5
|
* A type that defines an node in a UI tree component, built with `useTree` hook.
|
|
4
6
|
* @public
|
|
5
7
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
interface TreeNode {
|
|
9
|
+
id: string;
|
|
10
|
+
label: string;
|
|
11
|
+
children: true | Array<TreeNode>;
|
|
12
|
+
isExpanded: boolean;
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
isFilterable: boolean;
|
|
15
|
+
isFiltered: boolean;
|
|
16
|
+
/** UI-agnostic source of this node object. */
|
|
17
|
+
nodeData: HierarchyNode;
|
|
18
|
+
/** Contains error encountered from expanding the node */
|
|
19
|
+
error?: ErrorInfo;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* A type of `ErrorInfo` that is returned,
|
|
@@ -22,9 +24,9 @@ export interface TreeNode {
|
|
|
22
24
|
*
|
|
23
25
|
* @public
|
|
24
26
|
*/
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
interface NoFilterMatchesErrorInfo {
|
|
28
|
+
id: string;
|
|
29
|
+
type: "NoFilterMatches";
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* A type of `ErrorInfo` that is returned, when the
|
|
@@ -33,10 +35,10 @@ export interface NoFilterMatchesErrorInfo {
|
|
|
33
35
|
*
|
|
34
36
|
* @public
|
|
35
37
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
interface ResultSetTooLargeErrorInfo {
|
|
39
|
+
id: string;
|
|
40
|
+
type: "ResultSetTooLarge";
|
|
41
|
+
resultSetSizeLimit: number;
|
|
40
42
|
}
|
|
41
43
|
/**
|
|
42
44
|
* A type of `ErrorInfo` that contains a user-friendly message to be displayed in the UI.
|
|
@@ -45,10 +47,10 @@ export interface ResultSetTooLargeErrorInfo {
|
|
|
45
47
|
*
|
|
46
48
|
* @public
|
|
47
49
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
interface ChildrenLoadErrorInfo {
|
|
51
|
+
id: string;
|
|
52
|
+
type: "ChildrenLoad";
|
|
53
|
+
message: string;
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* A type of `ErrorInfo` that can be used to show/handle generic errors,
|
|
@@ -58,11 +60,11 @@ export interface ChildrenLoadErrorInfo {
|
|
|
58
60
|
*
|
|
59
61
|
* @public
|
|
60
62
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
interface GenericErrorInfo {
|
|
64
|
+
id: string;
|
|
65
|
+
type: "Unknown";
|
|
66
|
+
message: string;
|
|
67
|
+
additionalData?: unknown;
|
|
66
68
|
}
|
|
67
69
|
/**
|
|
68
70
|
* A collection of types that defines an error state for `TreeNode` node in a UI tree component, built
|
|
@@ -70,5 +72,7 @@ export interface GenericErrorInfo {
|
|
|
70
72
|
*
|
|
71
73
|
* @public
|
|
72
74
|
*/
|
|
73
|
-
|
|
75
|
+
type ErrorInfo = GenericErrorInfo | ResultSetTooLargeErrorInfo | NoFilterMatchesErrorInfo | ChildrenLoadErrorInfo;
|
|
76
|
+
//#endregion
|
|
77
|
+
export { ErrorInfo, GenericErrorInfo, ResultSetTooLargeErrorInfo, TreeNode };
|
|
74
78
|
//# sourceMappingURL=TreeNode.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNode.d.ts","
|
|
1
|
+
{"version":3,"file":"TreeNode.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/TreeNode.ts"],"mappings":";;;;;AAWA;;UAAiB,QAAA;EACf,EAAA;EACA,KAAA;EACA,QAAA,SAAiB,KAAA,CAAM,QAAA;EACvB,UAAA;EACA,SAAA;EACA,YAAA;EACA,UAAA;EALA;EAOA,QAAA,EAAU,aAAA;EANO;EAQjB,KAAA,GAAQ,SAAA;AAAA;;;;;;;UASO,wBAAA;EACf,EAAA;EACA,IAAA;AAAA;;;;;AAUF;;;UAAiB,0BAAA;EACf,EAAA;EACA,IAAA;EACA,kBAAA;AAAA;;AAUF;;;;;;UAAiB,qBAAA;EACf,EAAA;EACA,IAAA;EACA,OAAA;AAAA;;;;;;;;;UAWe,gBAAA;EACf,EAAA;EACA,IAAA;EACA,OAAA;EACA,cAAA;AAAA;;;;;;;KASU,SAAA,GAAY,gBAAA,GAAmB,0BAAA,GAA6B,wBAAA,GAA2B,qBAAA"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { createIModelHierarchyProvider, HierarchyDefinition, HierarchySearchPath } from "@itwin/presentation-hierarchies";
|
|
2
|
-
import { Props } from "@itwin/presentation-shared";
|
|
3
1
|
import { UseUnifiedTreeSelectionProps } from "./internal/UseUnifiedSelection.js";
|
|
4
2
|
import { UseTreeProps, UseTreeResult } from "./UseTree.js";
|
|
3
|
+
import { HierarchyDefinition, HierarchySearchPath, createIModelHierarchyProvider } from "@itwin/presentation-hierarchies";
|
|
4
|
+
import { Props } from "@itwin/presentation-shared";
|
|
5
|
+
|
|
6
|
+
//#region src/presentation-hierarchies-react/UseIModelTree.d.ts
|
|
5
7
|
/** @public */
|
|
6
8
|
type IModelHierarchyProviderProps = Props<typeof createIModelHierarchyProvider>;
|
|
7
9
|
/** @public */
|
|
@@ -11,17 +13,25 @@ type IModelAccess = IModelHierarchyProviderProps["imodelAccess"];
|
|
|
11
13
|
* @public
|
|
12
14
|
*/
|
|
13
15
|
type UseIModelTreeProps = Omit<UseTreeProps, "getHierarchyProvider" | "getSearchPaths"> & Pick<IModelHierarchyProviderProps, "localizedStrings" | "imodelAccess" | "imodelChanged"> & {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
/**
|
|
17
|
+
* Provides the hierarchy definition for the tree.
|
|
18
|
+
*/
|
|
19
|
+
getHierarchyDefinition: (props: {
|
|
20
|
+
imodelAccess: IModelAccess;
|
|
21
|
+
}) => HierarchyDefinition;
|
|
22
|
+
/**
|
|
23
|
+
* Provides paths to target nodes.
|
|
24
|
+
*/
|
|
25
|
+
getSearchPaths?: (props: {
|
|
26
|
+
/**
|
|
27
|
+
* Object that provides access to the iModel schema and can run queries against the iModel.
|
|
28
|
+
*/
|
|
29
|
+
imodelAccess: IModelAccess;
|
|
30
|
+
/**
|
|
31
|
+
* Signal indicating that that the request was canceled
|
|
32
|
+
*/
|
|
33
|
+
abortSignal: AbortSignal;
|
|
34
|
+
}) => Promise<HierarchySearchPath[] | undefined>;
|
|
25
35
|
};
|
|
26
36
|
/**
|
|
27
37
|
* A React hook that creates state for a tree component whose displayed hierarchy is based on
|
|
@@ -36,7 +46,7 @@ type UseIModelTreeProps = Omit<UseTreeProps, "getHierarchyProvider" | "getSearch
|
|
|
36
46
|
* @see `useIModelUnifiedSelectionTree`
|
|
37
47
|
* @public
|
|
38
48
|
*/
|
|
39
|
-
|
|
49
|
+
declare function useIModelTree(props: UseIModelTreeProps): UseTreeResult;
|
|
40
50
|
/**
|
|
41
51
|
* A React hook that creates state for a tree component whose displayed hierarchy is based on
|
|
42
52
|
* iModel data and that is integrated with unified selection through the given selection
|
|
@@ -52,6 +62,7 @@ export declare function useIModelTree(props: UseIModelTreeProps): UseTreeResult;
|
|
|
52
62
|
* @see `UnifiedSelectionProvider`
|
|
53
63
|
* @public
|
|
54
64
|
*/
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
declare function useIModelUnifiedSelectionTree(props: UseIModelTreeProps & UseUnifiedTreeSelectionProps): UseTreeResult;
|
|
66
|
+
//#endregion
|
|
67
|
+
export { useIModelTree, useIModelUnifiedSelectionTree };
|
|
57
68
|
//# sourceMappingURL=UseIModelTree.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseIModelTree.d.ts","
|
|
1
|
+
{"version":3,"file":"UseIModelTree.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/UseIModelTree.ts"],"mappings":";;;;;;;KAeK,4BAAA,GAA+B,KAAA,QAAa,6BAAA;;KAG5C,YAAA,GAAe,4BAAA;;;AAH0D;;KASzE,kBAAA,GAAqB,IAAA,CAAK,YAAA,+CAC7B,IAAA,CAAK,4BAAA;EAPa;;AAA4B;EAW5C,sBAAA,GAAyB,KAAA;IAAS,YAAA,EAAc,YAAA;EAAA,MAAmB,mBAAA;EAL7C;;;EAUtB,cAAA,IAAkB,KAAA;IALiD;;;IASjE,YAAA,EAAc,YAAA;IAKV;;;IADJ,WAAA,EAAa,WAAA;EAAA,MACT,OAAA,CAAQ,mBAAA;AAAA;;;;;;;;;;;;;;iBAgBF,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAqB,aAAA;;;AAA1D;;;;;;;;;AAuBA;;;;iBAAgB,6BAAA,CAA8B,KAAA,EAAO,kBAAA,GAAqB,4BAAA,GAA+B,aAAA"}
|
|
@@ -1,62 +1,189 @@
|
|
|
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 { useCallback } from "react";
|
|
6
|
-
import { createIModelHierarchyProvider } from "@itwin/presentation-hierarchies";
|
|
7
1
|
import { useTree, useUnifiedSelectionTree } from "./UseTree.js";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { createIModelHierarchyProvider } from "@itwin/presentation-hierarchies";
|
|
4
|
+
|
|
5
|
+
//#region src/presentation-hierarchies-react/UseIModelTree.ts
|
|
8
6
|
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
* A React hook that creates state for a tree component whose displayed hierarchy is based on
|
|
8
|
+
* iModel data.
|
|
9
|
+
*
|
|
10
|
+
* The hook uses `@itwin/presentation-hierarchies` package to load the hierarchy data and returns a
|
|
11
|
+
* component-agnostic result which may be used to render the hierarchy using any UI framework.
|
|
12
|
+
*
|
|
13
|
+
* See `README.md` for an example
|
|
14
|
+
*
|
|
15
|
+
* @see `useTree`
|
|
16
|
+
* @see `useIModelUnifiedSelectionTree`
|
|
17
|
+
* @public
|
|
18
|
+
*/
|
|
19
|
+
function useIModelTree(props) {
|
|
20
|
+
const $ = c(16);
|
|
21
|
+
let getHierarchyDefinition;
|
|
22
|
+
let getSearchPaths;
|
|
23
|
+
let imodelAccess;
|
|
24
|
+
let imodelChanged;
|
|
25
|
+
let localizedStrings;
|
|
26
|
+
let rest;
|
|
27
|
+
if ($[0] !== props) {
|
|
28
|
+
({imodelAccess, imodelChanged, getHierarchyDefinition, getSearchPaths, localizedStrings, ...rest} = props);
|
|
29
|
+
$[0] = props;
|
|
30
|
+
$[1] = getHierarchyDefinition;
|
|
31
|
+
$[2] = getSearchPaths;
|
|
32
|
+
$[3] = imodelAccess;
|
|
33
|
+
$[4] = imodelChanged;
|
|
34
|
+
$[5] = localizedStrings;
|
|
35
|
+
$[6] = rest;
|
|
36
|
+
} else {
|
|
37
|
+
getHierarchyDefinition = $[1];
|
|
38
|
+
getSearchPaths = $[2];
|
|
39
|
+
imodelAccess = $[3];
|
|
40
|
+
imodelChanged = $[4];
|
|
41
|
+
localizedStrings = $[5];
|
|
42
|
+
rest = $[6];
|
|
43
|
+
}
|
|
44
|
+
let t0;
|
|
45
|
+
if ($[7] !== getHierarchyDefinition || $[8] !== getSearchPaths || $[9] !== imodelAccess || $[10] !== imodelChanged || $[11] !== localizedStrings) {
|
|
46
|
+
t0 = {
|
|
47
|
+
imodelAccess,
|
|
48
|
+
imodelChanged,
|
|
49
|
+
getHierarchyDefinition,
|
|
50
|
+
getSearchPaths,
|
|
51
|
+
localizedStrings
|
|
52
|
+
};
|
|
53
|
+
$[7] = getHierarchyDefinition;
|
|
54
|
+
$[8] = getSearchPaths;
|
|
55
|
+
$[9] = imodelAccess;
|
|
56
|
+
$[10] = imodelChanged;
|
|
57
|
+
$[11] = localizedStrings;
|
|
58
|
+
$[12] = t0;
|
|
59
|
+
} else t0 = $[12];
|
|
60
|
+
const t1 = useIModelTreeProps(t0);
|
|
61
|
+
let t2;
|
|
62
|
+
if ($[13] !== rest || $[14] !== t1) {
|
|
63
|
+
t2 = {
|
|
64
|
+
...rest,
|
|
65
|
+
...t1
|
|
66
|
+
};
|
|
67
|
+
$[13] = rest;
|
|
68
|
+
$[14] = t1;
|
|
69
|
+
$[15] = t2;
|
|
70
|
+
} else t2 = $[15];
|
|
71
|
+
return useTree(t2);
|
|
27
72
|
}
|
|
28
73
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
74
|
+
* A React hook that creates state for a tree component whose displayed hierarchy is based on
|
|
75
|
+
* iModel data and that is integrated with unified selection through the given selection
|
|
76
|
+
* storage (previously the storage was provided through the, now deprecated, `UnifiedSelectionProvider`).
|
|
77
|
+
*
|
|
78
|
+
* The hook uses `@itwin/presentation-hierarchies` package to load the hierarchy data and returns a
|
|
79
|
+
* component-agnostic result which may be used to render the hierarchy using any UI framework.
|
|
80
|
+
*
|
|
81
|
+
* See `README.md` for an example
|
|
82
|
+
*
|
|
83
|
+
* @see `useIModelTree`
|
|
84
|
+
* @see `useUnifiedSelectionTree`
|
|
85
|
+
* @see `UnifiedSelectionProvider`
|
|
86
|
+
* @public
|
|
87
|
+
*/
|
|
88
|
+
function useIModelUnifiedSelectionTree(props) {
|
|
89
|
+
const $ = c(16);
|
|
90
|
+
let getHierarchyDefinition;
|
|
91
|
+
let getSearchPaths;
|
|
92
|
+
let imodelAccess;
|
|
93
|
+
let imodelChanged;
|
|
94
|
+
let localizedStrings;
|
|
95
|
+
let rest;
|
|
96
|
+
if ($[0] !== props) {
|
|
97
|
+
({imodelAccess, imodelChanged, getHierarchyDefinition, getSearchPaths, localizedStrings, ...rest} = props);
|
|
98
|
+
$[0] = props;
|
|
99
|
+
$[1] = getHierarchyDefinition;
|
|
100
|
+
$[2] = getSearchPaths;
|
|
101
|
+
$[3] = imodelAccess;
|
|
102
|
+
$[4] = imodelChanged;
|
|
103
|
+
$[5] = localizedStrings;
|
|
104
|
+
$[6] = rest;
|
|
105
|
+
} else {
|
|
106
|
+
getHierarchyDefinition = $[1];
|
|
107
|
+
getSearchPaths = $[2];
|
|
108
|
+
imodelAccess = $[3];
|
|
109
|
+
imodelChanged = $[4];
|
|
110
|
+
localizedStrings = $[5];
|
|
111
|
+
rest = $[6];
|
|
112
|
+
}
|
|
113
|
+
let t0;
|
|
114
|
+
if ($[7] !== getHierarchyDefinition || $[8] !== getSearchPaths || $[9] !== imodelAccess || $[10] !== imodelChanged || $[11] !== localizedStrings) {
|
|
115
|
+
t0 = {
|
|
116
|
+
imodelAccess,
|
|
117
|
+
imodelChanged,
|
|
118
|
+
getHierarchyDefinition,
|
|
119
|
+
getSearchPaths,
|
|
120
|
+
localizedStrings
|
|
121
|
+
};
|
|
122
|
+
$[7] = getHierarchyDefinition;
|
|
123
|
+
$[8] = getSearchPaths;
|
|
124
|
+
$[9] = imodelAccess;
|
|
125
|
+
$[10] = imodelChanged;
|
|
126
|
+
$[11] = localizedStrings;
|
|
127
|
+
$[12] = t0;
|
|
128
|
+
} else t0 = $[12];
|
|
129
|
+
const t1 = useIModelTreeProps(t0);
|
|
130
|
+
let t2;
|
|
131
|
+
if ($[13] !== rest || $[14] !== t1) {
|
|
132
|
+
t2 = {
|
|
133
|
+
...rest,
|
|
134
|
+
...t1
|
|
135
|
+
};
|
|
136
|
+
$[13] = rest;
|
|
137
|
+
$[14] = t1;
|
|
138
|
+
$[15] = t2;
|
|
139
|
+
} else t2 = $[15];
|
|
140
|
+
return useUnifiedSelectionTree(t2);
|
|
49
141
|
}
|
|
50
142
|
function useIModelTreeProps(props) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
143
|
+
const $ = c(11);
|
|
144
|
+
const { imodelAccess, imodelChanged, getHierarchyDefinition, getSearchPaths, localizedStrings } = props;
|
|
145
|
+
let t0;
|
|
146
|
+
if ($[0] !== getHierarchyDefinition || $[1] !== imodelAccess || $[2] !== imodelChanged || $[3] !== localizedStrings) {
|
|
147
|
+
t0 = () => createIModelHierarchyProvider({
|
|
148
|
+
imodelAccess,
|
|
149
|
+
imodelChanged,
|
|
150
|
+
hierarchyDefinition: getHierarchyDefinition({ imodelAccess }),
|
|
151
|
+
localizedStrings
|
|
152
|
+
});
|
|
153
|
+
$[0] = getHierarchyDefinition;
|
|
154
|
+
$[1] = imodelAccess;
|
|
155
|
+
$[2] = imodelChanged;
|
|
156
|
+
$[3] = localizedStrings;
|
|
157
|
+
$[4] = t0;
|
|
158
|
+
} else t0 = $[4];
|
|
159
|
+
const t1 = t0;
|
|
160
|
+
let t2;
|
|
161
|
+
if ($[5] !== getSearchPaths || $[6] !== imodelAccess) {
|
|
162
|
+
t2 = async (t3) => {
|
|
163
|
+
const { abortSignal } = t3;
|
|
164
|
+
return getSearchPaths?.({
|
|
165
|
+
imodelAccess,
|
|
166
|
+
abortSignal
|
|
167
|
+
});
|
|
168
|
+
};
|
|
169
|
+
$[5] = getSearchPaths;
|
|
170
|
+
$[6] = imodelAccess;
|
|
171
|
+
$[7] = t2;
|
|
172
|
+
} else t2 = $[7];
|
|
173
|
+
const t3 = t2;
|
|
174
|
+
let t4;
|
|
175
|
+
if ($[8] !== t1 || $[9] !== t3) {
|
|
176
|
+
t4 = {
|
|
177
|
+
getHierarchyProvider: t1,
|
|
178
|
+
getSearchPaths: t3
|
|
179
|
+
};
|
|
180
|
+
$[8] = t1;
|
|
181
|
+
$[9] = t3;
|
|
182
|
+
$[10] = t4;
|
|
183
|
+
} else t4 = $[10];
|
|
184
|
+
return t4;
|
|
61
185
|
}
|
|
186
|
+
|
|
187
|
+
//#endregion
|
|
188
|
+
export { useIModelTree, useIModelUnifiedSelectionTree };
|
|
62
189
|
//# sourceMappingURL=UseIModelTree.js.map
|