@itwin/presentation-hierarchies 2.0.0-alpha.5 → 2.0.0-alpha.6
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 +36 -0
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts +77 -36
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyFiltering.js +126 -98
- package/lib/cjs/hierarchies/HierarchyFiltering.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyMerge.d.ts +19 -0
- package/lib/cjs/hierarchies/HierarchyMerge.d.ts.map +1 -0
- package/lib/cjs/hierarchies/HierarchyMerge.js +43 -0
- package/lib/cjs/hierarchies/HierarchyMerge.js.map +1 -0
- package/lib/cjs/hierarchies/HierarchyNode.d.ts +2 -2
- package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNodeKey.js +8 -8
- package/lib/cjs/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts +0 -18
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.js +0 -37
- package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +2 -0
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js +45 -30
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +42 -7
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +136 -45
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js +8 -1
- package/lib/cjs/hierarchies/imodel/TreeNodesReader.js.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.d.ts +3 -0
- package/lib/cjs/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/Common.js +12 -1
- package/lib/cjs/hierarchies/internal/Common.js.map +1 -1
- package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -1
- package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js +2 -1
- package/lib/cjs/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -1
- package/lib/cjs/presentation-hierarchies.d.ts +3 -2
- package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies.js +4 -3
- package/lib/cjs/presentation-hierarchies.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts +77 -36
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyFiltering.js +125 -98
- package/lib/esm/hierarchies/HierarchyFiltering.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyMerge.d.ts +19 -0
- package/lib/esm/hierarchies/HierarchyMerge.d.ts.map +1 -0
- package/lib/esm/hierarchies/HierarchyMerge.js +40 -0
- package/lib/esm/hierarchies/HierarchyMerge.js.map +1 -0
- package/lib/esm/hierarchies/HierarchyNode.d.ts +2 -2
- package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNodeKey.js +9 -9
- package/lib/esm/hierarchies/HierarchyNodeKey.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.d.ts +0 -18
- package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.js +1 -36
- package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts +2 -0
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js +47 -32
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +42 -7
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +138 -48
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js +8 -1
- package/lib/esm/hierarchies/imodel/TreeNodesReader.js.map +1 -1
- package/lib/esm/hierarchies/internal/Common.d.ts +3 -0
- package/lib/esm/hierarchies/internal/Common.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/Common.js +11 -1
- package/lib/esm/hierarchies/internal/Common.js.map +1 -1
- package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.d.ts.map +1 -1
- package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js +3 -2
- package/lib/esm/hierarchies/internal/RxjsHierarchyDefinition.js.map +1 -1
- package/lib/esm/presentation-hierarchies.d.ts +3 -2
- package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies.js +2 -2
- package/lib/esm/presentation-hierarchies.js.map +1 -1
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @itwin/presentation-hierarchies
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.6
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 6a00754233e6d1b8956a5fc7680829562156d659: Fixed a bug causing `HierarchyNode.autoExpand` flag to be set on non-grouping nodes, when `HierarchyFilteringPathOptions.autoExpand.depthInHierarchy` points to a grouping node whose child non-grouping node is not a filter target.
|
|
8
|
+
|
|
9
|
+
**Breaking changes:**
|
|
10
|
+
- `GroupingHierarchyNode` no longer contains `filtering` attribute. This was always the case, but now the types have been updated to match it.
|
|
11
|
+
- Changed return type of `createHierarchyFilteringHelper`:
|
|
12
|
+
- Removed `createChildNodePropsAsync` - it became an overload of `createChildNodeProps`, whose path matching is done through `asyncPathMatcher` callback.
|
|
13
|
+
- `createChildNodeProps` now has multiple overloads and returns different types based on provided props. `autoExpand` flag is only returned when `parentKeys` are provided.
|
|
14
|
+
- Renamed `HierarchyFilteringPathOptions.autoExpand` -> `HierarchyFilteringPathOptions.reveal` to match intent.
|
|
15
|
+
- Changed `HierarchyFilteringPathOptions.reveal.depthInHierarchy` and `depthInPath` to use 0-based indexing instead of 1-based indexing.
|
|
16
|
+
- Changed `HierarchyFilteringPathOptions.reveal.depthInHierarchy` to not set `autoExpand` flag on the node that is at the `depthInHierarchy` position.
|
|
17
|
+
|
|
18
|
+
- e9ef80880c776522ce3b2632c8c3c461e62d6444: The hierarchy provider returned by `mergeProviders` doesn't have the deprecated `dispose` method anymore. Use `[Symbol.dispose]` instead.
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- e9e42c3a513cb7d594351ee2244c7efe67cc4385: Added `HierarchyFilteringPathOptions.autoExpand` option to enable auto-expanding of filter target nodes.
|
|
23
|
+
- e9ef80880c776522ce3b2632c8c3c461e62d6444: Add an experimental (`@alpha`) function `createMergedIModelHierarchyProvider` for creating a hierarchy from multiple versions of the same iModel.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- e9ef80880c776522ce3b2632c8c3c461e62d6444: Fix `HierarchyNodeKey` methods `equals` and `compare` not handling different schema-class separators and casing.
|
|
28
|
+
- Updated dependencies:
|
|
29
|
+
- @itwin/presentation-shared@2.0.0-alpha.4
|
|
30
|
+
|
|
3
31
|
## 2.0.0-alpha.5
|
|
4
32
|
|
|
5
33
|
### Patch Changes
|
|
@@ -59,6 +87,14 @@
|
|
|
59
87
|
- Updated dependencies:
|
|
60
88
|
- @itwin/presentation-shared@2.0.0-alpha.0
|
|
61
89
|
|
|
90
|
+
## 1.7.5
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- [#1124](https://github.com/iTwin/presentation/pull/1124): Bump dependencies.
|
|
95
|
+
- Updated dependencies:
|
|
96
|
+
- @itwin/presentation-shared@1.2.4
|
|
97
|
+
|
|
62
98
|
## 1.7.4
|
|
63
99
|
|
|
64
100
|
### Patch Changes
|
|
@@ -1,37 +1,49 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { NonGroupingHierarchyNode } from "./HierarchyNode.js";
|
|
2
2
|
import { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from "./HierarchyNodeIdentifier.js";
|
|
3
|
-
import { GenericNodeKey, InstancesNodeKey } from "./HierarchyNodeKey.js";
|
|
3
|
+
import { GenericNodeKey, HierarchyNodeKey, InstancesNodeKey } from "./HierarchyNodeKey.js";
|
|
4
4
|
/** @public */
|
|
5
|
-
export interface
|
|
5
|
+
export interface FilteringPathRevealDepthInPath {
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Index of the node in filtering path should be revealed in hierarchy by auto-expanding its ancestors.
|
|
8
8
|
*
|
|
9
9
|
* Use when you want to expand up to specific instance node and don't care about grouping nodes.
|
|
10
10
|
*
|
|
11
|
-
* **
|
|
11
|
+
* **Use case example:**
|
|
12
|
+
*
|
|
13
|
+
* All nodes up to `Element1` should be expanded in the following hierarchy:
|
|
14
|
+
* - Node1
|
|
15
|
+
* - GroupingNode1
|
|
16
|
+
* - GroupingNode2
|
|
17
|
+
* - Element1
|
|
18
|
+
* - Element2
|
|
19
|
+
*
|
|
20
|
+
* Provide `{ path: [Node1, Element1], reveal: { depthInPath: 1 } }`
|
|
21
|
+
*
|
|
22
|
+
* **NOTE**: All nodes that are up to `depthInPath` will be expanded **except** filter targets.
|
|
12
23
|
*/
|
|
13
24
|
depthInPath: number;
|
|
14
25
|
}
|
|
15
26
|
/** @public */
|
|
16
|
-
export interface
|
|
27
|
+
export interface FilteringPathRevealDepthInHierarchy {
|
|
17
28
|
/**
|
|
18
|
-
*
|
|
29
|
+
* Considering the list of nodes from root to the target node, this is an index in that list, identifying the node that should be revealed in hierarchy by auto-expanding its ancestors.
|
|
19
30
|
*
|
|
20
31
|
* This should take into account the number of grouping nodes in hierarchy.
|
|
21
32
|
*
|
|
22
|
-
*
|
|
33
|
+
* **Use case example:**
|
|
23
34
|
*
|
|
24
|
-
*
|
|
35
|
+
* Only `Node1` and `GroupingNode1` should have `autoExpand` flag in the following hierarchy:
|
|
25
36
|
* - Node1
|
|
26
37
|
* - GroupingNode1
|
|
27
38
|
* - GroupingNode2
|
|
28
39
|
* - Element1
|
|
29
40
|
* - Element2
|
|
30
|
-
*
|
|
41
|
+
*
|
|
42
|
+
* Provide `{ path: [Node1, Element1], reveal: { depthInHierarchy: 2 } }`
|
|
31
43
|
*
|
|
32
44
|
* To get the correct depth use `HierarchyNode.parentKeys.length`.
|
|
33
45
|
*
|
|
34
|
-
* **NOTE**: All nodes that are up to
|
|
46
|
+
* **NOTE**: All nodes that are up to `depthInHierarchy` will be expanded **except** filter targets.
|
|
35
47
|
*/
|
|
36
48
|
depthInHierarchy: number;
|
|
37
49
|
}
|
|
@@ -41,10 +53,18 @@ export interface HierarchyFilteringPathOptions {
|
|
|
41
53
|
* This option specifies the way `autoExpand` flag should be assigned to nodes in the filtered hierarchy.
|
|
42
54
|
* - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.
|
|
43
55
|
* - If it's `true`, then all nodes up to the filter target will have `autoExpand` flag.
|
|
44
|
-
* - If it's an instance of `
|
|
45
|
-
* - If it's an instance of `
|
|
56
|
+
* - If it's an instance of `FilteringPathRevealDepthInPath`, then all nodes up to `depthInPath` will have `autoExpand` flag.
|
|
57
|
+
* - If it's an instance of `FilteringPathRevealDepthInHierarchy`, then all nodes up to `depthInHierarchy` will have `autoExpand` flag.
|
|
46
58
|
*/
|
|
47
|
-
|
|
59
|
+
reveal?: boolean | FilteringPathRevealDepthInHierarchy | FilteringPathRevealDepthInPath;
|
|
60
|
+
/**
|
|
61
|
+
* This option specifies whether or not filter target should be expanded.
|
|
62
|
+
* - If it's `false` or `undefined`, filter target won't have 'autoExpand' flag.
|
|
63
|
+
* - If it's `true`, filter target will have `autoExpand` flag.
|
|
64
|
+
*
|
|
65
|
+
* **NOTE**: this attribute does not set `autoExpand` flag on nodes up to the filter target. For that use `reveal`.
|
|
66
|
+
*/
|
|
67
|
+
autoExpand?: boolean;
|
|
48
68
|
}
|
|
49
69
|
/**
|
|
50
70
|
* A path of hierarchy node identifiers for filtering the hierarchy with additional options.
|
|
@@ -63,17 +83,14 @@ export declare namespace HierarchyFilteringPath {
|
|
|
63
83
|
function normalize(source: HierarchyFilteringPath): Exclude<HierarchyFilteringPath, HierarchyNodeIdentifiersPath>;
|
|
64
84
|
/**
|
|
65
85
|
* Merges two given `HierarchyFilteringPathOptions` objects.
|
|
66
|
-
* - if both inputs are `undefined`, `undefined` is returned,
|
|
67
|
-
* - else if one of the inputs is `undefined`, the other one is returned.
|
|
68
|
-
* - else, merge each option individually.
|
|
69
86
|
*
|
|
70
|
-
* For the `
|
|
87
|
+
* For the `reveal` attribute, the merge chooses to `reveal` as deep as the deepest input:
|
|
71
88
|
* - if any one of the inputs is `true`, return `true`,
|
|
72
89
|
* - else if only one of the inputs is an object, return it,
|
|
73
90
|
* - else if both inputs are falsy, return `false` or `undefined`,
|
|
74
91
|
* - else:
|
|
75
|
-
* - if only one of the inputs has `
|
|
76
|
-
* - else return the one with greater `
|
|
92
|
+
* - if only one of the inputs has `depthInHierarchy` set, return the other one,
|
|
93
|
+
* - else return the one with greater `depthInPath` or `depthInHierarchy`.
|
|
77
94
|
*
|
|
78
95
|
* @public
|
|
79
96
|
*/
|
|
@@ -95,10 +112,8 @@ export declare function extractFilteringProps(rootLevelFilteringProps: Hierarchy
|
|
|
95
112
|
*
|
|
96
113
|
* @public
|
|
97
114
|
*/
|
|
98
|
-
export declare function createHierarchyFilteringHelper(rootLevelFilteringProps: HierarchyFilteringPath[] | undefined, parentNode: Pick<NonGroupingHierarchyNode, "filtering"
|
|
99
|
-
/**
|
|
100
|
-
* Returns a flag indicating if the hierarchy level is filtered.
|
|
101
|
-
*/
|
|
115
|
+
export declare function createHierarchyFilteringHelper(rootLevelFilteringProps: HierarchyFilteringPath[] | undefined, parentNode: Pick<NonGroupingHierarchyNode, "filtering"> | undefined): {
|
|
116
|
+
/** Returns a flag indicating if the hierarchy level is filtered. */
|
|
102
117
|
hasFilter: boolean;
|
|
103
118
|
/**
|
|
104
119
|
* Returns a flag indicating whether this hierarchy level has an ancestor node
|
|
@@ -117,20 +132,46 @@ export declare function createHierarchyFilteringHelper(rootLevelFilteringProps:
|
|
|
117
132
|
* and `autoExpand`) to be set based on the filter paths and filtering options. This function calculates
|
|
118
133
|
* these props for a child node based on its key or path matcher.
|
|
119
134
|
*
|
|
120
|
-
* When using `pathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies
|
|
135
|
+
* When using `pathMatcher` or `asyncPathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies
|
|
121
136
|
* to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the
|
|
122
137
|
* `nodeKey` prop can be used to check the whole identifier.
|
|
138
|
+
*
|
|
139
|
+
* There are multiple overloads of `createChildNodeProps`: depending on props type it returns different values:
|
|
140
|
+
* - `parentKeys` is defined and `pathMatcher` or `nodeKey` is provided - returns undefined **or** `filtering` and `autoExpand` prop from `HierarchyNode`;
|
|
141
|
+
* - `parentKeys` is undefined - does not return `HierarchyNode.autoExpand` option;
|
|
142
|
+
* - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.
|
|
123
143
|
*/
|
|
124
|
-
createChildNodeProps:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
144
|
+
createChildNodeProps: {
|
|
145
|
+
(props: {
|
|
146
|
+
parentKeys?: undefined;
|
|
147
|
+
nodeKey: InstancesNodeKey | GenericNodeKey;
|
|
148
|
+
}): Pick<NonGroupingHierarchyNode, "filtering"> | undefined;
|
|
149
|
+
(props: {
|
|
150
|
+
parentKeys?: undefined;
|
|
151
|
+
pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;
|
|
152
|
+
}): Pick<NonGroupingHierarchyNode, "filtering"> | undefined;
|
|
153
|
+
(props: {
|
|
154
|
+
parentKeys?: undefined;
|
|
155
|
+
asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;
|
|
156
|
+
}): Promise<Pick<NonGroupingHierarchyNode, "filtering"> | undefined> | Pick<NonGroupingHierarchyNode, "filtering"> | undefined;
|
|
157
|
+
(props: {
|
|
158
|
+
parentKeys: HierarchyNodeKey[];
|
|
159
|
+
nodeKey: InstancesNodeKey | GenericNodeKey;
|
|
160
|
+
}): Pick<NonGroupingHierarchyNode, "filtering" | "autoExpand"> | undefined;
|
|
161
|
+
(props: {
|
|
162
|
+
parentKeys: HierarchyNodeKey[];
|
|
163
|
+
pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;
|
|
164
|
+
}): Pick<NonGroupingHierarchyNode, "filtering" | "autoExpand"> | undefined;
|
|
165
|
+
(props: {
|
|
166
|
+
parentKeys: HierarchyNodeKey[];
|
|
167
|
+
asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;
|
|
168
|
+
}): Promise<Pick<NonGroupingHierarchyNode, "filtering" | "autoExpand"> | undefined> | Pick<NonGroupingHierarchyNode, "filtering" | "autoExpand"> | undefined;
|
|
169
|
+
};
|
|
135
170
|
};
|
|
171
|
+
/** @internal */
|
|
172
|
+
export declare function shouldAutoExpandBasedOnReveal({ reveal, nodePositionInPath, nodePositionInHierarchy, }: {
|
|
173
|
+
reveal: HierarchyFilteringPathOptions["reveal"];
|
|
174
|
+
nodePositionInPath: number;
|
|
175
|
+
nodePositionInHierarchy: number;
|
|
176
|
+
}): boolean;
|
|
136
177
|
//# sourceMappingURL=HierarchyFiltering.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyFiltering.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyFiltering.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"HierarchyFiltering.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyFiltering.ts"],"names":[],"mappings":"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"}
|
|
@@ -7,11 +7,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.HierarchyFilteringPath = void 0;
|
|
8
8
|
exports.extractFilteringProps = extractFilteringProps;
|
|
9
9
|
exports.createHierarchyFilteringHelper = createHierarchyFilteringHelper;
|
|
10
|
+
exports.shouldAutoExpandBasedOnReveal = shouldAutoExpandBasedOnReveal;
|
|
10
11
|
const HierarchyNodeIdentifier_js_1 = require("./HierarchyNodeIdentifier.js");
|
|
11
12
|
const HierarchyNodeKey_js_1 = require("./HierarchyNodeKey.js");
|
|
12
13
|
var HierarchyFilteringPathOptions;
|
|
13
14
|
(function (HierarchyFilteringPathOptions) {
|
|
14
|
-
function
|
|
15
|
+
function mergeRevealOptions(lhs, rhs) {
|
|
15
16
|
if (rhs === true || lhs === true) {
|
|
16
17
|
return true;
|
|
17
18
|
}
|
|
@@ -33,7 +34,11 @@ var HierarchyFilteringPathOptions;
|
|
|
33
34
|
}
|
|
34
35
|
return lhsDepth > rhsDepth ? lhs : rhs;
|
|
35
36
|
}
|
|
36
|
-
HierarchyFilteringPathOptions.
|
|
37
|
+
HierarchyFilteringPathOptions.mergeRevealOptions = mergeRevealOptions;
|
|
38
|
+
function mergeAutoExpandOption(lhs, rhs) {
|
|
39
|
+
return lhs || rhs ? true : undefined;
|
|
40
|
+
}
|
|
41
|
+
HierarchyFilteringPathOptions.mergeAutoExpandOption = mergeAutoExpandOption;
|
|
37
42
|
})(HierarchyFilteringPathOptions || (HierarchyFilteringPathOptions = {}));
|
|
38
43
|
/** @public */
|
|
39
44
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
@@ -52,27 +57,26 @@ var HierarchyFilteringPath;
|
|
|
52
57
|
HierarchyFilteringPath.normalize = normalize;
|
|
53
58
|
/**
|
|
54
59
|
* Merges two given `HierarchyFilteringPathOptions` objects.
|
|
55
|
-
* - if both inputs are `undefined`, `undefined` is returned,
|
|
56
|
-
* - else if one of the inputs is `undefined`, the other one is returned.
|
|
57
|
-
* - else, merge each option individually.
|
|
58
60
|
*
|
|
59
|
-
* For the `
|
|
61
|
+
* For the `reveal` attribute, the merge chooses to `reveal` as deep as the deepest input:
|
|
60
62
|
* - if any one of the inputs is `true`, return `true`,
|
|
61
63
|
* - else if only one of the inputs is an object, return it,
|
|
62
64
|
* - else if both inputs are falsy, return `false` or `undefined`,
|
|
63
65
|
* - else:
|
|
64
|
-
* - if only one of the inputs has `
|
|
65
|
-
* - else return the one with greater `
|
|
66
|
+
* - if only one of the inputs has `depthInHierarchy` set, return the other one,
|
|
67
|
+
* - else return the one with greater `depthInPath` or `depthInHierarchy`.
|
|
66
68
|
*
|
|
67
69
|
* @public
|
|
68
70
|
*/
|
|
69
71
|
function mergeOptions(lhs, rhs) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
const reveal = HierarchyFilteringPathOptions.mergeRevealOptions(lhs?.reveal, rhs?.reveal);
|
|
73
|
+
const autoExpand = HierarchyFilteringPathOptions.mergeAutoExpandOption(lhs?.autoExpand, rhs?.autoExpand);
|
|
74
|
+
return reveal || autoExpand
|
|
75
|
+
? {
|
|
76
|
+
...(reveal !== undefined ? { reveal } : undefined),
|
|
77
|
+
...(autoExpand !== undefined ? { autoExpand } : undefined),
|
|
78
|
+
}
|
|
79
|
+
: undefined;
|
|
76
80
|
}
|
|
77
81
|
HierarchyFilteringPath.mergeOptions = mergeOptions;
|
|
78
82
|
})(HierarchyFilteringPath || (exports.HierarchyFilteringPath = HierarchyFilteringPath = {}));
|
|
@@ -84,19 +88,24 @@ var HierarchyFilteringPath;
|
|
|
84
88
|
*/
|
|
85
89
|
/* c8 ignore start */
|
|
86
90
|
function extractFilteringProps(rootLevelFilteringProps, parentNode) {
|
|
87
|
-
|
|
91
|
+
const filteringProps = extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);
|
|
92
|
+
return filteringProps?.filteredNodePaths !== undefined
|
|
93
|
+
? {
|
|
94
|
+
filteredNodePaths: filteringProps.filteredNodePaths,
|
|
95
|
+
hasFilterTargetAncestor: filteringProps.hasFilterTargetAncestor,
|
|
96
|
+
}
|
|
97
|
+
: undefined;
|
|
88
98
|
}
|
|
89
99
|
/* c8 ignore end */
|
|
90
100
|
function extractFilteringPropsInternal(rootLevelFilteringProps, parentNode) {
|
|
91
101
|
if (!parentNode) {
|
|
92
102
|
return rootLevelFilteringProps ? { filteredNodePaths: rootLevelFilteringProps, hasFilterTargetAncestor: false } : undefined;
|
|
93
103
|
}
|
|
94
|
-
|
|
95
|
-
? {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
: undefined;
|
|
104
|
+
const filteringProps = {
|
|
105
|
+
...(parentNode.filtering?.filteredChildrenIdentifierPaths ? { filteredNodePaths: parentNode.filtering.filteredChildrenIdentifierPaths } : undefined),
|
|
106
|
+
hasFilterTargetAncestor: !!parentNode.filtering?.hasFilterTargetAncestor || !!parentNode.filtering?.isFilterTarget,
|
|
107
|
+
};
|
|
108
|
+
return filteringProps.filteredNodePaths || filteringProps.hasFilterTargetAncestor ? filteringProps : undefined;
|
|
100
109
|
}
|
|
101
110
|
/**
|
|
102
111
|
* Creates a set of utilities for making it easier to filter the given hierarchy
|
|
@@ -107,10 +116,61 @@ function extractFilteringPropsInternal(rootLevelFilteringProps, parentNode) {
|
|
|
107
116
|
function createHierarchyFilteringHelper(rootLevelFilteringProps, parentNode) {
|
|
108
117
|
const filteringProps = extractFilteringPropsInternal(rootLevelFilteringProps, parentNode);
|
|
109
118
|
const hasFilter = !!filteringProps;
|
|
119
|
+
function saveFilteringPropsFromPathsIntoReducer(extractionProps) {
|
|
120
|
+
// Passes down matching normalized paths to the reducer.
|
|
121
|
+
// It uses `nodeKey`, `pathMatcher` or `asyncPathMatcher` to check if `HierarchyNodeIdentifier` at the first position in filtering path matches the node
|
|
122
|
+
// and if it does, the path is passed down to the reducer.
|
|
123
|
+
// This function returns a promise only if asyncPathMatcher returns a promise.
|
|
124
|
+
if (!filteringProps?.filteredNodePaths) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
const matchedPathPromises = new Array();
|
|
128
|
+
for (const filteredChildrenNodeIdentifierPath of filteringProps.filteredNodePaths) {
|
|
129
|
+
const normalizedPath = HierarchyFilteringPath.normalize(filteredChildrenNodeIdentifierPath);
|
|
130
|
+
/* c8 ignore next 3 */
|
|
131
|
+
if (normalizedPath.path.length === 0) {
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if ("nodeKey" in extractionProps) {
|
|
135
|
+
if ((HierarchyNodeKey_js_1.HierarchyNodeKey.isGeneric(extractionProps.nodeKey) && HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.equal(normalizedPath.path[0], extractionProps.nodeKey)) ||
|
|
136
|
+
(HierarchyNodeKey_js_1.HierarchyNodeKey.isInstances(extractionProps.nodeKey) &&
|
|
137
|
+
extractionProps.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik)))) {
|
|
138
|
+
extractionProps.pathsReducer.accept(normalizedPath);
|
|
139
|
+
}
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
const matchesPossiblyPromise = "pathMatcher" in extractionProps ? extractionProps.pathMatcher(normalizedPath.path[0]) : extractionProps.asyncPathMatcher(normalizedPath.path[0]);
|
|
143
|
+
if (matchesPossiblyPromise instanceof Promise) {
|
|
144
|
+
matchedPathPromises.push(matchesPossiblyPromise.then((matches) => (matches ? normalizedPath : undefined)));
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
if (matchesPossiblyPromise) {
|
|
148
|
+
extractionProps.pathsReducer.accept(normalizedPath);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (matchedPathPromises.length === 0) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
return Promise.all(matchedPathPromises).then((matchedPath) => matchedPath.forEach((normalizedPath) => normalizedPath && extractionProps.pathsReducer.accept(normalizedPath)));
|
|
155
|
+
}
|
|
156
|
+
function createChildNodeProps(props) {
|
|
157
|
+
if (!hasFilter) {
|
|
158
|
+
return undefined;
|
|
159
|
+
}
|
|
160
|
+
const reducer = new MatchingFilteringPathsReducer(filteringProps.hasFilterTargetAncestor);
|
|
161
|
+
if ("asyncPathMatcher" in props) {
|
|
162
|
+
const extractResult = saveFilteringPropsFromPathsIntoReducer({ pathsReducer: reducer, asyncPathMatcher: props.asyncPathMatcher });
|
|
163
|
+
if (extractResult instanceof Promise) {
|
|
164
|
+
return extractResult.then(() => reducer.getNodeProps(props.parentKeys));
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
saveFilteringPropsFromPathsIntoReducer({ ...props, pathsReducer: reducer });
|
|
169
|
+
}
|
|
170
|
+
return reducer.getNodeProps(props.parentKeys);
|
|
171
|
+
}
|
|
110
172
|
return {
|
|
111
|
-
/**
|
|
112
|
-
* Returns a flag indicating if the hierarchy level is filtered.
|
|
113
|
-
*/
|
|
173
|
+
/** Returns a flag indicating if the hierarchy level is filtered. */
|
|
114
174
|
hasFilter,
|
|
115
175
|
/**
|
|
116
176
|
* Returns a flag indicating whether this hierarchy level has an ancestor node
|
|
@@ -124,7 +184,7 @@ function createHierarchyFilteringHelper(rootLevelFilteringProps, parentNode) {
|
|
|
124
184
|
* hierarchy level. Returns `undefined` if filtering is not applied to this level.
|
|
125
185
|
*/
|
|
126
186
|
getChildNodeFilteringIdentifiers: () => {
|
|
127
|
-
if (!
|
|
187
|
+
if (!filteringProps?.filteredNodePaths) {
|
|
128
188
|
return undefined;
|
|
129
189
|
}
|
|
130
190
|
return filteringProps.filteredNodePaths
|
|
@@ -137,68 +197,33 @@ function createHierarchyFilteringHelper(rootLevelFilteringProps, parentNode) {
|
|
|
137
197
|
* and `autoExpand`) to be set based on the filter paths and filtering options. This function calculates
|
|
138
198
|
* these props for a child node based on its key or path matcher.
|
|
139
199
|
*
|
|
140
|
-
* When using `pathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies
|
|
200
|
+
* When using `pathMatcher` or `asyncPathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies
|
|
141
201
|
* to their node. For example, only some parts of the identifier can be checked for improved performance. Otherwise, the
|
|
142
202
|
* `nodeKey` prop can be used to check the whole identifier.
|
|
203
|
+
*
|
|
204
|
+
* There are multiple overloads of `createChildNodeProps`: depending on props type it returns different values:
|
|
205
|
+
* - `parentKeys` is defined and `pathMatcher` or `nodeKey` is provided - returns undefined **or** `filtering` and `autoExpand` prop from `HierarchyNode`;
|
|
206
|
+
* - `parentKeys` is undefined - does not return `HierarchyNode.autoExpand` option;
|
|
207
|
+
* - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.
|
|
143
208
|
*/
|
|
144
|
-
createChildNodeProps
|
|
145
|
-
if (!hasFilter) {
|
|
146
|
-
return undefined;
|
|
147
|
-
}
|
|
148
|
-
const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);
|
|
149
|
-
filteringProps.filteredNodePaths.forEach((filteredPath) => {
|
|
150
|
-
const normalizedPath = HierarchyFilteringPath.normalize(filteredPath);
|
|
151
|
-
if ("nodeKey" in props &&
|
|
152
|
-
((HierarchyNodeKey_js_1.HierarchyNodeKey.isGeneric(props.nodeKey) && HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.equal(normalizedPath.path[0], props.nodeKey)) ||
|
|
153
|
-
(HierarchyNodeKey_js_1.HierarchyNodeKey.isInstances(props.nodeKey) && props.nodeKey.instanceKeys.some((ik) => HierarchyNodeIdentifier_js_1.HierarchyNodeIdentifier.equal(normalizedPath.path[0], ik))))) {
|
|
154
|
-
reducer.accept(normalizedPath);
|
|
155
|
-
}
|
|
156
|
-
else if ("pathMatcher" in props && props.pathMatcher(normalizedPath.path[0])) {
|
|
157
|
-
reducer.accept(normalizedPath);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
return reducer.getNodeProps(parentNode);
|
|
161
|
-
},
|
|
162
|
-
/**
|
|
163
|
-
* Similar to `createChildNodeProps`, but takes an async `pathMatcher` prop.
|
|
164
|
-
*/
|
|
165
|
-
createChildNodePropsAsync: (props) => {
|
|
166
|
-
if (!hasFilter) {
|
|
167
|
-
return undefined;
|
|
168
|
-
}
|
|
169
|
-
const reducer = new MatchingFilteringPathsReducer(filteringProps?.hasFilterTargetAncestor);
|
|
170
|
-
const matchedPathPromises = new Array();
|
|
171
|
-
for (const filteredChildrenNodeIdentifierPath of filteringProps.filteredNodePaths) {
|
|
172
|
-
const normalizedPath = HierarchyFilteringPath.normalize(filteredChildrenNodeIdentifierPath);
|
|
173
|
-
/* c8 ignore next 3 */
|
|
174
|
-
if (normalizedPath.path.length === 0) {
|
|
175
|
-
continue;
|
|
176
|
-
}
|
|
177
|
-
const matchesPossiblyPromise = props.pathMatcher(normalizedPath.path[0]);
|
|
178
|
-
if (matchesPossiblyPromise instanceof Promise) {
|
|
179
|
-
matchedPathPromises.push(matchesPossiblyPromise.then((matches) => (matches ? normalizedPath : undefined)));
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
if (!matchesPossiblyPromise) {
|
|
183
|
-
continue;
|
|
184
|
-
}
|
|
185
|
-
reducer.accept(normalizedPath);
|
|
186
|
-
}
|
|
187
|
-
if (matchedPathPromises.length === 0) {
|
|
188
|
-
return reducer.getNodeProps(parentNode);
|
|
189
|
-
}
|
|
190
|
-
return Promise.all(matchedPathPromises)
|
|
191
|
-
.then((matchedPath) => matchedPath.forEach((normalizedPath) => normalizedPath && reducer.accept(normalizedPath)))
|
|
192
|
-
.then(() => reducer.getNodeProps(parentNode));
|
|
193
|
-
},
|
|
209
|
+
createChildNodeProps,
|
|
194
210
|
};
|
|
195
211
|
}
|
|
212
|
+
/**
|
|
213
|
+
* Extracts information from filtering paths and later returns `filtering` and `autoExpand` values from `HierarchyNode`.
|
|
214
|
+
*
|
|
215
|
+
* Saved values can be applied to a single `HierarchyNode` - this means that a new reducer should be created every time these props are requested for a `HierarchyNode`.
|
|
216
|
+
*
|
|
217
|
+
* Extracts information using `accept` function:
|
|
218
|
+
* - Determines if node is filter target, and if it is saves the options as `filterTargetOptions`
|
|
219
|
+
* - Saves `HierarchyFilteringPathOptions` and `filteredChildrenIdentifierPaths`
|
|
220
|
+
*/
|
|
196
221
|
class MatchingFilteringPathsReducer {
|
|
197
222
|
_hasFilterTargetAncestor;
|
|
198
223
|
_filteredChildrenIdentifierPaths = new Array();
|
|
199
224
|
_isFilterTarget = false;
|
|
200
225
|
_filterTargetOptions = undefined;
|
|
201
|
-
|
|
226
|
+
_revealOption = false;
|
|
202
227
|
constructor(_hasFilterTargetAncestor) {
|
|
203
228
|
this._hasFilterTargetAncestor = _hasFilterTargetAncestor;
|
|
204
229
|
}
|
|
@@ -210,28 +235,10 @@ class MatchingFilteringPathsReducer {
|
|
|
210
235
|
}
|
|
211
236
|
else if (path.length > 1) {
|
|
212
237
|
this._filteredChildrenIdentifierPaths.push({ path: path.slice(1), options });
|
|
213
|
-
this.
|
|
238
|
+
this._revealOption = HierarchyFilteringPathOptions.mergeRevealOptions(options?.reveal, this._revealOption);
|
|
214
239
|
}
|
|
215
240
|
}
|
|
216
|
-
|
|
217
|
-
if (this._autoExpandOption === true) {
|
|
218
|
-
return true;
|
|
219
|
-
}
|
|
220
|
-
if (typeof this._autoExpandOption === "object") {
|
|
221
|
-
const parentLength = !parentNode
|
|
222
|
-
? 0
|
|
223
|
-
: "depthInHierarchy" in this._autoExpandOption
|
|
224
|
-
? 1 + parentNode.parentKeys.length
|
|
225
|
-
: 1 + parentNode.parentKeys.filter((key) => !HierarchyNodeKey_js_1.HierarchyNodeKey.isGrouping(key)).length;
|
|
226
|
-
const depth = "depthInHierarchy" in this._autoExpandOption
|
|
227
|
-
? this._autoExpandOption.depthInHierarchy
|
|
228
|
-
: // With `depthInPath` option we don't want to expand node that is at the `depthInPath` position
|
|
229
|
-
this._autoExpandOption.depthInPath - 1;
|
|
230
|
-
return parentLength < depth;
|
|
231
|
-
}
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
getNodeProps(parentNode) {
|
|
241
|
+
getNodeProps(parentKeys) {
|
|
235
242
|
return {
|
|
236
243
|
...(this._hasFilterTargetAncestor || this._isFilterTarget || this._filteredChildrenIdentifierPaths.length > 0
|
|
237
244
|
? {
|
|
@@ -242,8 +249,29 @@ class MatchingFilteringPathsReducer {
|
|
|
242
249
|
},
|
|
243
250
|
}
|
|
244
251
|
: undefined),
|
|
245
|
-
...(
|
|
252
|
+
...(parentKeys &&
|
|
253
|
+
(shouldAutoExpandBasedOnReveal({
|
|
254
|
+
reveal: this._revealOption,
|
|
255
|
+
nodePositionInHierarchy: parentKeys.length,
|
|
256
|
+
nodePositionInPath: parentKeys.filter((key) => !HierarchyNodeKey_js_1.HierarchyNodeKey.isGrouping(key)).length,
|
|
257
|
+
}) ||
|
|
258
|
+
!!this._filterTargetOptions?.autoExpand)
|
|
259
|
+
? { autoExpand: true }
|
|
260
|
+
: undefined),
|
|
246
261
|
};
|
|
247
262
|
}
|
|
248
263
|
}
|
|
264
|
+
/** @internal */
|
|
265
|
+
function shouldAutoExpandBasedOnReveal({ reveal, nodePositionInPath, nodePositionInHierarchy, }) {
|
|
266
|
+
if (!reveal) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
if (reveal === true) {
|
|
270
|
+
return true;
|
|
271
|
+
}
|
|
272
|
+
if ("depthInHierarchy" in reveal) {
|
|
273
|
+
return nodePositionInHierarchy < reveal.depthInHierarchy;
|
|
274
|
+
}
|
|
275
|
+
return nodePositionInPath < reveal.depthInPath;
|
|
276
|
+
}
|
|
249
277
|
//# sourceMappingURL=HierarchyFiltering.js.map
|