@itwin/presentation-hierarchies 2.0.0-alpha.6 → 2.0.0-alpha.7
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 +26 -0
- package/README.md +3 -3
- package/lib/cjs/hierarchies/HierarchyMerge.js +1 -1
- package/lib/cjs/hierarchies/HierarchyMerge.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNode.d.ts +14 -24
- package/lib/cjs/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyNode.js +1 -21
- package/lib/cjs/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts +11 -11
- package/lib/cjs/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/{HierarchyFiltering.d.ts → HierarchySearch.d.ts} +42 -52
- package/lib/cjs/hierarchies/HierarchySearch.d.ts.map +1 -0
- package/lib/cjs/hierarchies/{HierarchyFiltering.js → HierarchySearch.js} +69 -85
- package/lib/cjs/hierarchies/HierarchySearch.js.map +1 -0
- package/lib/cjs/hierarchies/imodel/HierarchyCache.js +3 -3
- package/lib/cjs/hierarchies/imodel/HierarchyCache.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts +4 -4
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js +20 -20
- package/lib/cjs/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/cjs/hierarchies/imodel/{FilteringHierarchyDefinition.d.ts → SearchHierarchyDefinition.d.ts} +10 -10
- package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -0
- package/lib/cjs/hierarchies/imodel/{FilteringHierarchyDefinition.js → SearchHierarchyDefinition.js} +53 -53
- package/lib/cjs/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -0
- package/lib/cjs/presentation-hierarchies.d.ts +1 -1
- package/lib/cjs/presentation-hierarchies.d.ts.map +1 -1
- package/lib/cjs/presentation-hierarchies.js +4 -5
- package/lib/cjs/presentation-hierarchies.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyMerge.js +1 -1
- package/lib/esm/hierarchies/HierarchyMerge.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.d.ts +14 -24
- package/lib/esm/hierarchies/HierarchyNode.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyNode.js +0 -20
- package/lib/esm/hierarchies/HierarchyNode.js.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.d.ts +11 -11
- package/lib/esm/hierarchies/HierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/HierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/{HierarchyFiltering.d.ts → HierarchySearch.d.ts} +42 -52
- package/lib/esm/hierarchies/HierarchySearch.d.ts.map +1 -0
- package/lib/esm/hierarchies/{HierarchyFiltering.js → HierarchySearch.js} +67 -82
- package/lib/esm/hierarchies/HierarchySearch.js.map +1 -0
- package/lib/esm/hierarchies/imodel/HierarchyCache.js +3 -3
- package/lib/esm/hierarchies/imodel/HierarchyCache.js.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts +4 -4
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.d.ts.map +1 -1
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js +20 -20
- package/lib/esm/hierarchies/imodel/IModelHierarchyProvider.js.map +1 -1
- package/lib/esm/hierarchies/imodel/{FilteringHierarchyDefinition.d.ts → SearchHierarchyDefinition.d.ts} +10 -10
- package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.d.ts.map +1 -0
- package/lib/esm/hierarchies/imodel/{FilteringHierarchyDefinition.js → SearchHierarchyDefinition.js} +48 -48
- package/lib/esm/hierarchies/imodel/SearchHierarchyDefinition.js.map +1 -0
- package/lib/esm/presentation-hierarchies.d.ts +1 -1
- package/lib/esm/presentation-hierarchies.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies.js +1 -1
- package/lib/esm/presentation-hierarchies.js.map +1 -1
- package/package.json +1 -1
- package/lib/cjs/hierarchies/HierarchyFiltering.d.ts.map +0 -1
- package/lib/cjs/hierarchies/HierarchyFiltering.js.map +0 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +0 -1
- package/lib/cjs/hierarchies/imodel/FilteringHierarchyDefinition.js.map +0 -1
- package/lib/esm/hierarchies/HierarchyFiltering.d.ts.map +0 -1
- package/lib/esm/hierarchies/HierarchyFiltering.js.map +0 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.d.ts.map +0 -1
- package/lib/esm/hierarchies/imodel/FilteringHierarchyDefinition.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @itwin/presentation-hierarchies
|
|
2
2
|
|
|
3
|
+
## 2.0.0-alpha.7
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1011](https://github.com/iTwin/presentation/pull/1011): Rename full‑hierarchy "filtering" to "search" across the package.
|
|
8
|
+
|
|
9
|
+
Properties and APIs were renamed accordingly to clarify the distinction and avoid confusion between hierarchy‑wide search and per-hierarchy‑level filtering.
|
|
10
|
+
|
|
11
|
+
**Breaking changes:**
|
|
12
|
+
- Removed deprecated `extractFilteringProps`.
|
|
13
|
+
- Removed deprecated `HierarchyNodeFilteringProps.create`.
|
|
14
|
+
- Renamed `createHierarchyFilteringHelper` to `createHierarchySearchHelper`. It's return type was also adjusted for the rename:
|
|
15
|
+
- `hasFilter` renamed to `hasSearch`,
|
|
16
|
+
- `hasFilterTargetAncestor` renamed to `hasSearchTargetAncestor`,
|
|
17
|
+
- `getChildNodeFilteringIdentifiers` renamed to `getChildNodeSearchIdentifiers`.
|
|
18
|
+
- Renamed `HierarchyChangedEventArgs.filterChange` to `searchChange`.
|
|
19
|
+
- Renamed `HierarchyProvider.setHierarchyFilter` to `setHierarchySearch`.
|
|
20
|
+
- Renamed `createMergedIModelHierarchyProvider` prop `filtering` to `search.
|
|
21
|
+
- Renamed `HierarchyFilteringPath` to `HierarchySearchPath`.
|
|
22
|
+
- Renamed `HierarchyFilteringPathOptions` to `HierarchySearchPathOptions`.
|
|
23
|
+
- Renamed `NonGroupingHierarchyNode.filtering` to `search`. It's type was also adjusted for the rename:
|
|
24
|
+
- `hasFilterTargetAncestor` renamed to `hasSearchTargetAncestor`,
|
|
25
|
+
- `filteredChildrenIdentifierPaths` renamed to `childrenTargetPaths`,
|
|
26
|
+
- `isFilterTarget` renamed to `isSearchTarget`,
|
|
27
|
+
- `filterTargetOptions` renamed to `searchTargetOptions`.
|
|
28
|
+
|
|
3
29
|
## 2.0.0-alpha.6
|
|
4
30
|
|
|
5
31
|
### Major Changes
|
package/README.md
CHANGED
|
@@ -50,15 +50,15 @@ Below is a list of learning material related to building hierarchies:
|
|
|
50
50
|
- General topics:
|
|
51
51
|
- [Formatting](./learning/Formatting.md)
|
|
52
52
|
- [Logging](./learning/Logging.md)
|
|
53
|
-
- [Hierarchy
|
|
54
|
-
- [Hierarchy level filtering](./learning/
|
|
53
|
+
- [Hierarchy search](./learning/HierarchySearch.md)
|
|
54
|
+
- [Hierarchy level filtering](./learning/HierarchyLevelFiltering.md)
|
|
55
55
|
- [Merged hierarchies](./learning/MergedHierarchies.md)
|
|
56
56
|
- [Custom hierarchy providers](./learning/CustomHierarchyProviders.md)
|
|
57
57
|
- iModel-based hierarchies:
|
|
58
58
|
- [Hierarchy provider](./learning/imodel/HierarchyProvider.md)
|
|
59
59
|
- [Hierarchy definition](./learning/imodel/HierarchyDefinition.md)
|
|
60
60
|
- [Hierarchy node labels](./learning/imodel/HierarchyNodeLabels.md)
|
|
61
|
-
- [Hierarchy
|
|
61
|
+
- [Hierarchy search](./learning/imodel/HierarchySearch.md)
|
|
62
62
|
- [Hierarchy level filtering](./learning/imodel/HierarchyLevelFiltering.md)
|
|
63
63
|
- [Grouping](./learning/imodel/Grouping.md)
|
|
64
64
|
- [Localization](./learning/imodel/Localization.md)
|
|
@@ -36,7 +36,7 @@ function mergeProviders({ providers }) {
|
|
|
36
36
|
}))), Sorting_js_1.sortNodesByLabelOperator)),
|
|
37
37
|
getNodeInstanceKeys: (props) => (0, EachValueFrom_js_1.eachValueFrom)((0, rxjs_1.from)(providers).pipe((0, rxjs_1.mergeMap)((p) => p.getNodeInstanceKeys(props)))),
|
|
38
38
|
setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),
|
|
39
|
-
|
|
39
|
+
setHierarchySearch: (props) => providers.forEach((p) => p.setHierarchySearch(props)),
|
|
40
40
|
[Symbol.dispose]: dispose,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyMerge.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyMerge.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAwBhG,wCA2CC;AAjED,yCAAuC;AAEvC,+BAA8D;AAC9D,sDAA8C;AAE9C,oDAAmD;AACnD,kEAA4D;AAC5D,gEAA2E;AAW3E;;;GAGG;AACH,SAAgB,cAAc,CAAC,EAAE,SAAS,EAAgC;IAGxE,MAAM,gBAAgB,GAAG,IAAI,sBAAO,EAAc,CAAC;IACnD,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACtB,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,gBAAgB,CAAC,KAAK,EAAE,CAAC;QACzB,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC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AAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QAClH,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;QAChF,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACpF,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;KAC1B,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 \"./internal/DisposePolyfill.js\";\n\nimport { filter, first, from, map, mergeMap, of } from \"rxjs\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { HierarchyProvider } from \"./HierarchyProvider.js\";\nimport { safeDispose } from \"./internal/Common.js\";\nimport { eachValueFrom } from \"./internal/EachValueFrom.js\";\nimport { sortNodesByLabelOperator } from \"./internal/operators/Sorting.js\";\n\n/**\n * Props for `mergeProviders` function.\n * @public\n */\ninterface MergeHierarchyProvidersProps {\n /** List of providers to merge. */\n providers: HierarchyProvider[];\n}\n\n/**\n * Creates a single, merged, hierarchy provider from multiple given providers.\n * @public\n */\nexport function mergeProviders({ providers }: MergeHierarchyProvidersProps): HierarchyProvider & {\n [Symbol.dispose]: () => void;\n} {\n const hierarchyChanged = new BeEvent<() => void>();\n providers.forEach((p) => {\n p.hierarchyChanged.addListener(() => hierarchyChanged.raiseEvent());\n });\n const dispose = () => {\n hierarchyChanged.clear();\n providers.forEach((p) => safeDispose(p));\n };\n\n return {\n hierarchyChanged,\n getNodes: (props) =>\n eachValueFrom(\n from(providers).pipe(\n mergeMap((provider) =>\n from(provider.getNodes(props)).pipe(\n mergeMap((node) => {\n if (node.children) {\n return of(node);\n }\n // each provider only considers its own data when determining node's children - in case it says\n // the node has no children, we have to check against the other providers too\n return from(providers).pipe(\n filter((p) => p !== provider),\n mergeMap((p) => p.getNodes({ parentNode: node })),\n map(() => true),\n first(undefined, false),\n map((hasChildren) => ({ ...node, children: hasChildren })),\n );\n }),\n ),\n ),\n sortNodesByLabelOperator,\n ),\n ),\n getNodeInstanceKeys: (props) => eachValueFrom(from(providers).pipe(mergeMap((p) => p.getNodeInstanceKeys(props)))),\n setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),\n
|
|
1
|
+
{"version":3,"file":"HierarchyMerge.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyMerge.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;AAwBhG,wCA2CC;AAjED,yCAAuC;AAEvC,+BAA8D;AAC9D,sDAA8C;AAE9C,oDAAmD;AACnD,kEAA4D;AAC5D,gEAA2E;AAW3E;;;GAGG;AACH,SAAgB,cAAc,CAAC,EAAE,SAAS,EAAgC;IAGxE,MAAM,gBAAgB,GAAG,IAAI,sBAAO,EAAc,CAAC;IACnD,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QACtB,CAAC,CAAC,gBAAgB,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,gBAAgB,CAAC,KAAK,EAAE,CAAC;QACzB,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,uBAAW,EAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC,CAAC;IAEF,OAAO;QACL,gBAAgB;QAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,EAAE,CAClB,IAAA,gCAAa,EACX,IAAA,WAAI,EAAC,SAAS,CAAC,CA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AAC;QAChF,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACpF,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO;KAC1B,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 \"./internal/DisposePolyfill.js\";\n\nimport { filter, first, from, map, mergeMap, of } from \"rxjs\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { HierarchyProvider } from \"./HierarchyProvider.js\";\nimport { safeDispose } from \"./internal/Common.js\";\nimport { eachValueFrom } from \"./internal/EachValueFrom.js\";\nimport { sortNodesByLabelOperator } from \"./internal/operators/Sorting.js\";\n\n/**\n * Props for `mergeProviders` function.\n * @public\n */\ninterface MergeHierarchyProvidersProps {\n /** List of providers to merge. */\n providers: HierarchyProvider[];\n}\n\n/**\n * Creates a single, merged, hierarchy provider from multiple given providers.\n * @public\n */\nexport function mergeProviders({ providers }: MergeHierarchyProvidersProps): HierarchyProvider & {\n [Symbol.dispose]: () => void;\n} {\n const hierarchyChanged = new BeEvent<() => void>();\n providers.forEach((p) => {\n p.hierarchyChanged.addListener(() => hierarchyChanged.raiseEvent());\n });\n const dispose = () => {\n hierarchyChanged.clear();\n providers.forEach((p) => safeDispose(p));\n };\n\n return {\n hierarchyChanged,\n getNodes: (props) =>\n eachValueFrom(\n from(providers).pipe(\n mergeMap((provider) =>\n from(provider.getNodes(props)).pipe(\n mergeMap((node) => {\n if (node.children) {\n return of(node);\n }\n // each provider only considers its own data when determining node's children - in case it says\n // the node has no children, we have to check against the other providers too\n return from(providers).pipe(\n filter((p) => p !== provider),\n mergeMap((p) => p.getNodes({ parentNode: node })),\n map(() => true),\n first(undefined, false),\n map((hasChildren) => ({ ...node, children: hasChildren })),\n );\n }),\n ),\n ),\n sortNodesByLabelOperator,\n ),\n ),\n getNodeInstanceKeys: (props) => eachValueFrom(from(providers).pipe(mergeMap((p) => p.getNodeInstanceKeys(props)))),\n setFormatter: (formatter) => providers.forEach((p) => p.setFormatter(formatter)),\n setHierarchySearch: (props) => providers.forEach((p) => p.setHierarchySearch(props)),\n [Symbol.dispose]: dispose,\n };\n}\n"]}
|
|
@@ -1,31 +1,21 @@
|
|
|
1
1
|
import { OmitOverUnion } from "@itwin/presentation-shared";
|
|
2
|
-
import { HierarchyFilteringPath, HierarchyFilteringPathOptions } from "./HierarchyFiltering.js";
|
|
3
2
|
import { ClassGroupingNodeKey, GenericNodeKey, GroupingNodeKey, HierarchyNodeKey, IModelHierarchyNodeKey, IModelInstanceKey, InstancesNodeKey, LabelGroupingNodeKey, PropertyGroupingNodeKey, PropertyOtherValuesGroupingNodeKey, PropertyValueGroupingNodeKey, PropertyValueRangeGroupingNodeKey } from "./HierarchyNodeKey.js";
|
|
3
|
+
import { HierarchySearchPath, HierarchySearchPathOptions } from "./HierarchySearch.js";
|
|
4
4
|
/** @public */
|
|
5
|
-
export type
|
|
6
|
-
/** If set to true, then one of the ancestor nodes in the hierarchy is the
|
|
7
|
-
|
|
8
|
-
/** Paths to node's children that are
|
|
9
|
-
|
|
5
|
+
export type HierarchyNodeSearchProps = {
|
|
6
|
+
/** If set to true, then one of the ancestor nodes in the hierarchy is the search target. */
|
|
7
|
+
hasSearchTargetAncestor?: boolean;
|
|
8
|
+
/** Paths to node's children that are search targets. */
|
|
9
|
+
childrenTargetPaths?: HierarchySearchPath[];
|
|
10
10
|
} & ({
|
|
11
|
-
/** Whether or not this node is a
|
|
12
|
-
|
|
11
|
+
/** Whether or not this node is a search target. */
|
|
12
|
+
isSearchTarget?: false;
|
|
13
13
|
} | {
|
|
14
|
-
/** Whether or not this node is a
|
|
15
|
-
|
|
16
|
-
/** Options that were used to
|
|
17
|
-
|
|
14
|
+
/** Whether or not this node is a search target. */
|
|
15
|
+
isSearchTarget: true;
|
|
16
|
+
/** Options that were used to search the node. */
|
|
17
|
+
searchTargetOptions?: HierarchySearchPathOptions;
|
|
18
18
|
});
|
|
19
|
-
/** @public */
|
|
20
|
-
export declare namespace HierarchyNodeFilteringProps {
|
|
21
|
-
/** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */
|
|
22
|
-
function create(props: {
|
|
23
|
-
hasFilterTargetAncestor?: boolean;
|
|
24
|
-
filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];
|
|
25
|
-
isFilterTarget?: boolean;
|
|
26
|
-
filterTargetOptions?: HierarchyFilteringPathOptions;
|
|
27
|
-
}): HierarchyNodeFilteringProps | undefined;
|
|
28
|
-
}
|
|
29
19
|
/**
|
|
30
20
|
* A data structure that defines attributes that are common to all types of hierarchy nodes.
|
|
31
21
|
* @public
|
|
@@ -56,8 +46,8 @@ export interface NonGroupingHierarchyNode extends BaseHierarchyNode {
|
|
|
56
46
|
* filter when requesting child hierarchy level will have no effect.
|
|
57
47
|
*/
|
|
58
48
|
supportsFiltering?: boolean;
|
|
59
|
-
/** Data that
|
|
60
|
-
|
|
49
|
+
/** Data that is assigned to the node if hierarchy search is enabled */
|
|
50
|
+
search?: HierarchyNodeSearchProps;
|
|
61
51
|
}
|
|
62
52
|
/**
|
|
63
53
|
* A data structure that represents a grouping node that groups other nodes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyNode.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNode.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"HierarchyNode.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNode.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B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AC;QAAC,iBAAiB,CAAC,EAAE,SAAS,CAAA;KAAE,GAAG,qBAAqB,CAEzG;CACF;AAED;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,CAAC,KAAK,GAAG,aAAa,IAAI,aAAa,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC"}
|
|
@@ -4,30 +4,10 @@
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.HierarchyNode =
|
|
7
|
+
exports.HierarchyNode = void 0;
|
|
8
8
|
const HierarchyNodeKey_js_1 = require("./HierarchyNodeKey.js");
|
|
9
9
|
/** @public */
|
|
10
10
|
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
11
|
-
var HierarchyNodeFilteringProps;
|
|
12
|
-
(function (HierarchyNodeFilteringProps) {
|
|
13
|
-
/** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */
|
|
14
|
-
/* c8 ignore start */
|
|
15
|
-
function create(props) {
|
|
16
|
-
const { hasFilterTargetAncestor, filteredChildrenIdentifierPaths, isFilterTarget, filterTargetOptions } = props;
|
|
17
|
-
if (isFilterTarget || hasFilterTargetAncestor || filteredChildrenIdentifierPaths?.length) {
|
|
18
|
-
return {
|
|
19
|
-
...(isFilterTarget ? { isFilterTarget, filterTargetOptions } : undefined),
|
|
20
|
-
...(hasFilterTargetAncestor ? { hasFilterTargetAncestor } : undefined),
|
|
21
|
-
...(!!filteredChildrenIdentifierPaths?.length ? { filteredChildrenIdentifierPaths } : undefined),
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
return undefined;
|
|
25
|
-
}
|
|
26
|
-
HierarchyNodeFilteringProps.create = create;
|
|
27
|
-
/* c8 ignore end */
|
|
28
|
-
})(HierarchyNodeFilteringProps || (exports.HierarchyNodeFilteringProps = HierarchyNodeFilteringProps = {}));
|
|
29
|
-
/** @public */
|
|
30
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
31
11
|
var HierarchyNode;
|
|
32
12
|
(function (HierarchyNode) {
|
|
33
13
|
/** Checks whether the given node is a generic node */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyNode.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNode.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAIhG,+DAa+B;AAoB/B,cAAc;AACd,2DAA2D;AAC3D,IAAiB,2BAA2B,CAoB3C;AApBD,WAAiB,2BAA2B;IAC1C,4IAA4I;IAC5I,qBAAqB;IACrB,SAAgB,MAAM,CAAC,KAKtB;QACC,MAAM,EAAE,uBAAuB,EAAE,+BAA+B,EAAE,cAAc,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC;QAChH,IAAI,cAAc,IAAI,uBAAuB,IAAI,+BAA+B,EAAE,MAAM,EAAE,CAAC;YACzF,OAAO;gBACL,GAAG,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,mBAAmB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;gBACzE,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,uBAAuB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;gBACtE,GAAG,CAAC,CAAC,CAAC,+BAA+B,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,+BAA+B,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;aACjG,CAAC;QACJ,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAfe,kCAAM,SAerB,CAAA;IACD,mBAAmB;AACrB,CAAC,EApBgB,2BAA2B,2CAA3B,2BAA2B,QAoB3C;AA2DD,cAAc;AACd,2DAA2D;AAC3D,IAAiB,aAAa,CAqD7B;AArDD,WAAiB,aAAa;IAC5B,sDAAsD;IACtD,SAAgB,SAAS,CAA0C,IAAW;QAC5E,OAAO,sC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9C,IAAW;QAEX,OAAO,sCAAgB,CAAC,4BAA4B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC;IAJe,8CAAgC,mCAI/C,CAAA;IACD,gEAAgE;IAChE,SAAgB,sBAAsB,CACpC,IAAW;QAEX,OAAO,sCAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;IAJe,oCAAsB,yBAIrC,CAAA;AACH,CAAC,EArDgB,aAAa,6BAAb,aAAa,QAqD7B","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 { OmitOverUnion } from \"@itwin/presentation-shared\";\nimport { HierarchyFilteringPath, HierarchyFilteringPathOptions } from \"./HierarchyFiltering.js\";\nimport {\n ClassGroupingNodeKey,\n GenericNodeKey,\n GroupingNodeKey,\n HierarchyNodeKey,\n IModelHierarchyNodeKey,\n IModelInstanceKey,\n InstancesNodeKey,\n LabelGroupingNodeKey,\n PropertyGroupingNodeKey,\n PropertyOtherValuesGroupingNodeKey,\n PropertyValueGroupingNodeKey,\n PropertyValueRangeGroupingNodeKey,\n} from \"./HierarchyNodeKey.js\";\n\n/** @public */\nexport type HierarchyNodeFilteringProps = {\n /** If set to true, then one of the ancestor nodes in the hierarchy is the filter target. */\n hasFilterTargetAncestor?: boolean;\n /** Paths to node's children that are filter targets. */\n filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];\n} & (\n | {\n /** Whether or not this node is a filter target. */\n isFilterTarget?: false;\n }\n | {\n /** Whether or not this node is a filter target. */\n isFilterTarget: true;\n /** Options that were used to filter the node. */\n filterTargetOptions?: HierarchyFilteringPathOptions;\n }\n);\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNodeFilteringProps {\n /** @deprecated in 1.3. Use `createHierarchyFilteringHelper` and its `createChildNodeProps` function to create filtering props for nodes. */\n /* c8 ignore start */\n export function create(props: {\n hasFilterTargetAncestor?: boolean;\n filteredChildrenIdentifierPaths?: HierarchyFilteringPath[];\n isFilterTarget?: boolean;\n filterTargetOptions?: HierarchyFilteringPathOptions;\n }): HierarchyNodeFilteringProps | undefined {\n const { hasFilterTargetAncestor, filteredChildrenIdentifierPaths, isFilterTarget, filterTargetOptions } = props;\n if (isFilterTarget || hasFilterTargetAncestor || filteredChildrenIdentifierPaths?.length) {\n return {\n ...(isFilterTarget ? { isFilterTarget, filterTargetOptions } : undefined),\n ...(hasFilterTargetAncestor ? { hasFilterTargetAncestor } : undefined),\n ...(!!filteredChildrenIdentifierPaths?.length ? { filteredChildrenIdentifierPaths } : undefined),\n };\n }\n return undefined;\n }\n /* c8 ignore end */\n}\n\n/**\n * A data structure that defines attributes that are common to all types of hierarchy nodes.\n * @public\n */\ninterface BaseHierarchyNode {\n /** Identifiers of all node ancestors. Can be used to identify a node in the hierarchy. */\n parentKeys: HierarchyNodeKey[];\n /** Node's display label. */\n label: string;\n /** A flag indicating whether the node has children or not. */\n children: boolean;\n /** A flag indicating whether this node should be auto-expanded in the UI. */\n autoExpand?: boolean;\n /** Additional data that may be assigned to this node. */\n extendedData?: { [key: string]: any };\n}\n\n/**\n * A data structure that represents a single non-grouping hierarchy node.\n * @public\n */\nexport interface NonGroupingHierarchyNode extends BaseHierarchyNode {\n /** An identifier to identify the node in its hierarchy level. */\n key: GenericNodeKey | InstancesNodeKey;\n /**\n * Identifies whether the hierarchy level below this node supports filtering. If not, supplying an instance\n * filter when requesting child hierarchy level will have no effect.\n */\n supportsFiltering?: boolean;\n /** Data that may be assigned to the node if filtering is enabled */\n filtering?: HierarchyNodeFilteringProps;\n}\n\n/**\n * A data structure that represents a grouping node that groups other nodes.\n * @public\n */\nexport interface GroupingHierarchyNode extends BaseHierarchyNode {\n /** An identifier to identify this grouping node in its hierarchy level. */\n key: GroupingNodeKey;\n\n /**\n * Keys of all instances grouped by this node, including deeply nested under\n * other grouping nodes.\n */\n groupedInstanceKeys: IModelInstanceKey[];\n\n /** The closest ancestor node that is not a grouping node. May be `undefined` if the grouping node grouped root level nodes. */\n nonGroupingAncestor?: ParentHierarchyNode<NonGroupingHierarchyNode>;\n}\n\n/**\n * A data structure that represents a single hierarchy node.\n * @public\n */\nexport type HierarchyNode = NonGroupingHierarchyNode | GroupingHierarchyNode;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNode {\n /** Checks whether the given node is a generic node */\n export function isGeneric<TNode extends { key: HierarchyNodeKey }>(node: TNode): node is TNode & NonGroupingHierarchyNode & { key: GenericNodeKey } {\n return HierarchyNodeKey.isGeneric(node.key);\n }\n /** Checks whether the given node is a standard (iModel content based) node */\n export function isIModelNode<TNode extends { key: HierarchyNodeKey }>(node: TNode): node is TNode & { key: IModelHierarchyNodeKey } {\n return HierarchyNodeKey.isIModelNodeKey(node.key);\n }\n /** Checks whether the given node is an ECInstances-based node */\n export function isInstancesNode<TNode extends { key: HierarchyNodeKey }>(node: TNode): node is TNode & NonGroupingHierarchyNode & { key: InstancesNodeKey } {\n return HierarchyNodeKey.isInstances(node.key);\n }\n /** Checks whether the given node is a grouping node */\n export function isGroupingNode<TNode extends { key: HierarchyNodeKey }>(node: TNode): node is TNode & GroupingHierarchyNode {\n return HierarchyNodeKey.isGrouping(node.key);\n }\n /** Checks whether the given node is a class grouping node */\n export function isClassGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: ClassGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isClassGrouping(node.key);\n }\n /** Checks whether the given node is a label grouping node */\n export function isLabelGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: LabelGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isLabelGrouping(node.key);\n }\n /** Checks whether the given node is property grouping node for other values */\n export function isPropertyOtherValuesGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyOtherValuesGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyOtherValuesGrouping(node.key);\n }\n /** Checks whether the given node is a property value grouping node */\n export function isPropertyValueGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyValueGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyValueGrouping(node.key);\n }\n /** Checks whether the given node is a property value range grouping node */\n export function isPropertyValueRangeGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyValueRangeGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyValueRangeGrouping(node.key);\n }\n /** Checks whether the given node is a property grouping node */\n export function isPropertyGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyGrouping(node.key);\n }\n}\n\n/**\n * A type of `HierarchyNode` that doesn't know about its children and is an input when requesting\n * them using `HierarchyProvider.getNodes`.\n * @public\n */\nexport type ParentHierarchyNode<TBase = HierarchyNode> = OmitOverUnion<TBase, \"children\">;\n"]}
|
|
1
|
+
{"version":3,"file":"HierarchyNode.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyNode.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAGhG,+DAa+B;AA+E/B,cAAc;AACd,2DAA2D;AAC3D,IAAiB,aAAa,CAqD7B;AArDD,WAAiB,aAAa;IAC5B,sDAAsD;IACtD,SAAgB,SAAS,CAA0C,IAAW;QAC5E,OAAO,sCAAgB,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC9C,CAAC;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,CAAC,CAAC;IACjE,CAAC;IAJe,8CAAgC,mCAI/C,CAAA;IACD,gEAAgE;IAChE,SAAgB,sBAAsB,CACpC,IAAW;QAEX,OAAO,sCAAgB,CAAC,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACvD,CAAC;IAJe,oCAAsB,yBAIrC,CAAA;AACH,CAAC,EArDgB,aAAa,6BAAb,aAAa,QAqD7B","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 { OmitOverUnion } from \"@itwin/presentation-shared\";\nimport {\n ClassGroupingNodeKey,\n GenericNodeKey,\n GroupingNodeKey,\n HierarchyNodeKey,\n IModelHierarchyNodeKey,\n IModelInstanceKey,\n InstancesNodeKey,\n LabelGroupingNodeKey,\n PropertyGroupingNodeKey,\n PropertyOtherValuesGroupingNodeKey,\n PropertyValueGroupingNodeKey,\n PropertyValueRangeGroupingNodeKey,\n} from \"./HierarchyNodeKey.js\";\nimport { HierarchySearchPath, HierarchySearchPathOptions } from \"./HierarchySearch.js\";\n\n/** @public */\nexport type HierarchyNodeSearchProps = {\n /** If set to true, then one of the ancestor nodes in the hierarchy is the search target. */\n hasSearchTargetAncestor?: boolean;\n /** Paths to node's children that are search targets. */\n childrenTargetPaths?: HierarchySearchPath[];\n} & (\n | {\n /** Whether or not this node is a search target. */\n isSearchTarget?: false;\n }\n | {\n /** Whether or not this node is a search target. */\n isSearchTarget: true;\n /** Options that were used to search the node. */\n searchTargetOptions?: HierarchySearchPathOptions;\n }\n);\n\n/**\n * A data structure that defines attributes that are common to all types of hierarchy nodes.\n * @public\n */\ninterface BaseHierarchyNode {\n /** Identifiers of all node ancestors. Can be used to identify a node in the hierarchy. */\n parentKeys: HierarchyNodeKey[];\n /** Node's display label. */\n label: string;\n /** A flag indicating whether the node has children or not. */\n children: boolean;\n /** A flag indicating whether this node should be auto-expanded in the UI. */\n autoExpand?: boolean;\n /** Additional data that may be assigned to this node. */\n extendedData?: { [key: string]: any };\n}\n\n/**\n * A data structure that represents a single non-grouping hierarchy node.\n * @public\n */\nexport interface NonGroupingHierarchyNode extends BaseHierarchyNode {\n /** An identifier to identify the node in its hierarchy level. */\n key: GenericNodeKey | InstancesNodeKey;\n /**\n * Identifies whether the hierarchy level below this node supports filtering. If not, supplying an instance\n * filter when requesting child hierarchy level will have no effect.\n */\n supportsFiltering?: boolean;\n /** Data that is assigned to the node if hierarchy search is enabled */\n search?: HierarchyNodeSearchProps;\n}\n\n/**\n * A data structure that represents a grouping node that groups other nodes.\n * @public\n */\nexport interface GroupingHierarchyNode extends BaseHierarchyNode {\n /** An identifier to identify this grouping node in its hierarchy level. */\n key: GroupingNodeKey;\n\n /**\n * Keys of all instances grouped by this node, including deeply nested under\n * other grouping nodes.\n */\n groupedInstanceKeys: IModelInstanceKey[];\n\n /** The closest ancestor node that is not a grouping node. May be `undefined` if the grouping node grouped root level nodes. */\n nonGroupingAncestor?: ParentHierarchyNode<NonGroupingHierarchyNode>;\n}\n\n/**\n * A data structure that represents a single hierarchy node.\n * @public\n */\nexport type HierarchyNode = NonGroupingHierarchyNode | GroupingHierarchyNode;\n\n/** @public */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport namespace HierarchyNode {\n /** Checks whether the given node is a generic node */\n export function isGeneric<TNode extends { key: HierarchyNodeKey }>(node: TNode): node is TNode & NonGroupingHierarchyNode & { key: GenericNodeKey } {\n return HierarchyNodeKey.isGeneric(node.key);\n }\n /** Checks whether the given node is a standard (iModel content based) node */\n export function isIModelNode<TNode extends { key: HierarchyNodeKey }>(node: TNode): node is TNode & { key: IModelHierarchyNodeKey } {\n return HierarchyNodeKey.isIModelNodeKey(node.key);\n }\n /** Checks whether the given node is an ECInstances-based node */\n export function isInstancesNode<TNode extends { key: HierarchyNodeKey }>(node: TNode): node is TNode & NonGroupingHierarchyNode & { key: InstancesNodeKey } {\n return HierarchyNodeKey.isInstances(node.key);\n }\n /** Checks whether the given node is a grouping node */\n export function isGroupingNode<TNode extends { key: HierarchyNodeKey }>(node: TNode): node is TNode & GroupingHierarchyNode {\n return HierarchyNodeKey.isGrouping(node.key);\n }\n /** Checks whether the given node is a class grouping node */\n export function isClassGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: ClassGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isClassGrouping(node.key);\n }\n /** Checks whether the given node is a label grouping node */\n export function isLabelGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: LabelGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isLabelGrouping(node.key);\n }\n /** Checks whether the given node is property grouping node for other values */\n export function isPropertyOtherValuesGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyOtherValuesGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyOtherValuesGrouping(node.key);\n }\n /** Checks whether the given node is a property value grouping node */\n export function isPropertyValueGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyValueGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyValueGrouping(node.key);\n }\n /** Checks whether the given node is a property value range grouping node */\n export function isPropertyValueRangeGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyValueRangeGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyValueRangeGrouping(node.key);\n }\n /** Checks whether the given node is a property grouping node */\n export function isPropertyGroupingNode<TNode extends { key: HierarchyNodeKey }>(\n node: TNode,\n ): node is TNode & { key: PropertyGroupingNodeKey; supportsFiltering?: undefined } & GroupingHierarchyNode {\n return HierarchyNodeKey.isPropertyGrouping(node.key);\n }\n}\n\n/**\n * A type of `HierarchyNode` that doesn't know about its children and is an input when requesting\n * them using `HierarchyProvider.getNodes`.\n * @public\n */\nexport type ParentHierarchyNode<TBase = HierarchyNode> = OmitOverUnion<TBase, \"children\">;\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { GenericInstanceFilter } from "@itwin/core-common";
|
|
2
2
|
import { Event, InstanceKey, IPrimitiveValueFormatter, Props } from "@itwin/presentation-shared";
|
|
3
|
-
import { HierarchyFilteringPath } from "./HierarchyFiltering.js";
|
|
4
3
|
import { HierarchyNode, ParentHierarchyNode } from "./HierarchyNode.js";
|
|
4
|
+
import { HierarchySearchPath } from "./HierarchySearch.js";
|
|
5
5
|
/**
|
|
6
6
|
* Props for the `HierarchyProvider.getNodes` call.
|
|
7
7
|
* @public
|
|
@@ -31,9 +31,9 @@ interface HierarchyChangedEventArgs {
|
|
|
31
31
|
formatterChange?: {
|
|
32
32
|
newFormatter: IPrimitiveValueFormatter | undefined;
|
|
33
33
|
};
|
|
34
|
-
/** Set when the hierarchy change was caused by a hierarchy
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
/** Set when the hierarchy change was caused by a hierarchy search change. */
|
|
35
|
+
searchChange?: {
|
|
36
|
+
newSearch: Props<HierarchyProvider["setHierarchySearch"]>;
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
@@ -73,18 +73,18 @@ export interface HierarchyProvider {
|
|
|
73
73
|
*/
|
|
74
74
|
setFormatter(formatter: IPrimitiveValueFormatter | undefined): void;
|
|
75
75
|
/**
|
|
76
|
-
* Sets the hierarchy
|
|
77
|
-
* removes the
|
|
76
|
+
* Sets the hierarchy search used by this hierarchy provider. Setting to `undefined`
|
|
77
|
+
* removes the search.
|
|
78
78
|
*
|
|
79
|
-
* @note There's a difference between `undefined`
|
|
80
|
-
* former means no
|
|
79
|
+
* @note There's a difference between `undefined` search and search with empty paths list. The
|
|
80
|
+
* former means no search is applied, while the latter means the search is applied and it filters-out
|
|
81
81
|
* all hierarchy.
|
|
82
82
|
*
|
|
83
|
-
* @note Changing
|
|
83
|
+
* @note Changing search is expected to trigger the `hierarchyChanged` event with `searchChange` arg.
|
|
84
84
|
*/
|
|
85
|
-
|
|
85
|
+
setHierarchySearch(props: {
|
|
86
86
|
/** A list of node identifiers from root to target node. */
|
|
87
|
-
paths:
|
|
87
|
+
paths: HierarchySearchPath[];
|
|
88
88
|
} | undefined): void;
|
|
89
89
|
}
|
|
90
90
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyProvider.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"HierarchyProvider.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,wBAAwB,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACjG,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;GAGG;AACH,MAAM,WAAW,sBAAsB;IACrC,2EAA2E;IAC3E,UAAU,EAAE,mBAAmB,GAAG,SAAS,CAAC;IAE5C,0FAA0F;IAC1F,cAAc,CAAC,EAAE,qBAAqB,CAAC;IAEvC;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IAE/C,wEAAwE;IACxE,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;GAGG;AACH,UAAU,yBAAyB;IACjC,sEAAsE;IACtE,eAAe,CAAC,EAAE;QAChB,YAAY,EAAE,wBAAwB,GAAG,SAAS,CAAC;KACpD,CAAC;IAEF,6EAA6E;IAC7E,YAAY,CAAC,EAAE;QACb,SAAS,EAAE,KAAK,CAAC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC,CAAC;KAC3D,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;;OAOG;IACH,QAAQ,CAAC,gBAAgB,EAAE,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,yBAAyB,KAAK,IAAI,CAAC,CAAC;IAE7E;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,sBAAsB,GAAG,qBAAqB,CAAC,aAAa,CAAC,CAAC;IAE9E;;;;;;OAMG;IACH,mBAAmB,CAAC,KAAK,EAAE,IAAI,CAAC,sBAAsB,EAAE,aAAa,CAAC,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAE5G;;;;;;;OAOG;IACH,YAAY,CAAC,SAAS,EAAE,wBAAwB,GAAG,SAAS,GAAG,IAAI,CAAC;IAEpE;;;;;;;;;OASG;IACH,kBAAkB,CAChB,KAAK,EACD;QACE,2DAA2D;QAC3D,KAAK,EAAE,mBAAmB,EAAE,CAAC;KAC9B,GACD,SAAS,GACZ,IAAI,CAAC;CACT"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HierarchyProvider.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG","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 { GenericInstanceFilter } from \"@itwin/core-common\";\nimport { Event, InstanceKey, IPrimitiveValueFormatter, Props } from \"@itwin/presentation-shared\";\nimport {
|
|
1
|
+
{"version":3,"file":"HierarchyProvider.js","sourceRoot":"","sources":["../../../src/hierarchies/HierarchyProvider.ts"],"names":[],"mappings":";AAAA;;;gGAGgG","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 { GenericInstanceFilter } from \"@itwin/core-common\";\nimport { Event, InstanceKey, IPrimitiveValueFormatter, Props } from \"@itwin/presentation-shared\";\nimport { HierarchyNode, ParentHierarchyNode } from \"./HierarchyNode.js\";\nimport { HierarchySearchPath } from \"./HierarchySearch.js\";\n\n/**\n * Props for the `HierarchyProvider.getNodes` call.\n * @public\n */\nexport interface GetHierarchyNodesProps {\n /** Parent node to get children for. Pass `undefined` to get root nodes. */\n parentNode: ParentHierarchyNode | undefined;\n\n /** Optional hierarchy level filter. Has no effect if `parentNode` is a `GroupingNode`. */\n instanceFilter?: GenericInstanceFilter;\n\n /**\n * Optional hierarchy level size limit override. This value is passed to `LimitingECSqlQueryExecutor` used\n * by this provider to override query rows limit per hierarchy level. If not provided, defaults to whatever\n * is used by the limiting query executor.\n *\n * Has no effect if `parentNode` is a `GroupingNode`.\n */\n hierarchyLevelSizeLimit?: number | \"unbounded\";\n\n /** When set to `true` ignores the cache and fetches the nodes again. */\n ignoreCache?: boolean;\n}\n\n/**\n * Event arguments for `HierarchyProvider.hierarchyChanged` event.\n * @public\n */\ninterface HierarchyChangedEventArgs {\n /** Set when the hierarchy change was caused by a formatter change. */\n formatterChange?: {\n newFormatter: IPrimitiveValueFormatter | undefined;\n };\n\n /** Set when the hierarchy change was caused by a hierarchy search change. */\n searchChange?: {\n newSearch: Props<HierarchyProvider[\"setHierarchySearch\"]>;\n };\n}\n\n/**\n * An interface for a hierarchy provider that knows how to create child nodes for a given parent node.\n * @public\n */\nexport interface HierarchyProvider {\n /**\n * An event that provider raises due to a hierarchy change, that requires a reload. Provider may\n * set additional event arguments to provide extra information about what caused the change.\n *\n * Consumers are expected to subscribe to this event and reload the hierarchy when it's raised.\n * Implementations may provide additional details on what caused the change through the optional\n * event arguments.\n */\n readonly hierarchyChanged: Event<(args?: HierarchyChangedEventArgs) => void>;\n\n /**\n * Gets nodes for the specified parent node. This is **the method to implement**, otherwise\n * the provider doesn't return any nodes.\n */\n getNodes(props: GetHierarchyNodesProps): AsyncIterableIterator<HierarchyNode>;\n\n /**\n * Gets instance keys for the specified parent node.\n *\n * The result of this method may be used to determine instances whose nodes would be displayed as children\n * of the specified parent node. For such use cases calling this method should be more efficient compared\n * to calling `getNodes`.\n */\n getNodeInstanceKeys(props: Omit<GetHierarchyNodesProps, \"ignoreCache\">): AsyncIterableIterator<InstanceKey>;\n\n /**\n * Overrides the property value formatter used by the hierarchy provider. Setting to `undefined`\n * resets the formatter, but what that means depends on the provider implementation - it could just\n * use unformatted values, or use some default formatter, e.g. the on created by `createDefaultValueFormatter`\n * from `@itwin/presentation-shared` package.\n *\n * @note Changing formatter is expected to trigger the `hierarchyChanged` event with `formatterChange` arg.\n */\n setFormatter(formatter: IPrimitiveValueFormatter | undefined): void;\n\n /**\n * Sets the hierarchy search used by this hierarchy provider. Setting to `undefined`\n * removes the search.\n *\n * @note There's a difference between `undefined` search and search with empty paths list. The\n * former means no search is applied, while the latter means the search is applied and it filters-out\n * all hierarchy.\n *\n * @note Changing search is expected to trigger the `hierarchyChanged` event with `searchChange` arg.\n */\n setHierarchySearch(\n props:\n | {\n /** A list of node identifiers from root to target node. */\n paths: HierarchySearchPath[];\n }\n | undefined,\n ): void;\n}\n"]}
|
|
@@ -2,9 +2,9 @@ import { NonGroupingHierarchyNode } from "./HierarchyNode.js";
|
|
|
2
2
|
import { HierarchyNodeIdentifier, HierarchyNodeIdentifiersPath } from "./HierarchyNodeIdentifier.js";
|
|
3
3
|
import { GenericNodeKey, HierarchyNodeKey, InstancesNodeKey } from "./HierarchyNodeKey.js";
|
|
4
4
|
/** @public */
|
|
5
|
-
export interface
|
|
5
|
+
export interface SearchPathRevealDepthInPath {
|
|
6
6
|
/**
|
|
7
|
-
* Index of the node in
|
|
7
|
+
* Index of the node in search 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
|
*
|
|
@@ -19,12 +19,12 @@ export interface FilteringPathRevealDepthInPath {
|
|
|
19
19
|
*
|
|
20
20
|
* Provide `{ path: [Node1, Element1], reveal: { depthInPath: 1 } }`
|
|
21
21
|
*
|
|
22
|
-
* **NOTE**: All nodes that are up to `depthInPath` will be expanded **except**
|
|
22
|
+
* **NOTE**: All nodes that are up to `depthInPath` will be expanded **except** search targets.
|
|
23
23
|
*/
|
|
24
24
|
depthInPath: number;
|
|
25
25
|
}
|
|
26
26
|
/** @public */
|
|
27
|
-
export interface
|
|
27
|
+
export interface SearchPathRevealDepthInHierarchy {
|
|
28
28
|
/**
|
|
29
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.
|
|
30
30
|
*
|
|
@@ -43,46 +43,46 @@ export interface FilteringPathRevealDepthInHierarchy {
|
|
|
43
43
|
*
|
|
44
44
|
* To get the correct depth use `HierarchyNode.parentKeys.length`.
|
|
45
45
|
*
|
|
46
|
-
* **NOTE**: All nodes that are up to `depthInHierarchy` will be expanded **except**
|
|
46
|
+
* **NOTE**: All nodes that are up to `depthInHierarchy` will be expanded **except** search targets.
|
|
47
47
|
*/
|
|
48
48
|
depthInHierarchy: number;
|
|
49
49
|
}
|
|
50
50
|
/** @public */
|
|
51
|
-
export interface
|
|
51
|
+
export interface HierarchySearchPathOptions {
|
|
52
52
|
/**
|
|
53
|
-
* This option specifies the way `autoExpand` flag should be assigned to nodes in the
|
|
53
|
+
* This option specifies the way `autoExpand` flag should be assigned to nodes in the searched hierarchy.
|
|
54
54
|
* - If it's `false` or `undefined`, nodes have no 'autoExpand' flag.
|
|
55
|
-
* - If it's `true`, then all nodes up to the
|
|
56
|
-
* - If it's an instance of `
|
|
57
|
-
* - If it's an instance of `
|
|
55
|
+
* - If it's `true`, then all nodes up to the search target will have `autoExpand` flag.
|
|
56
|
+
* - If it's an instance of `SearchPathRevealDepthInPath`, then all nodes up to `depthInPath` will have `autoExpand` flag.
|
|
57
|
+
* - If it's an instance of `SearchPathRevealDepthInHierarchy`, then all nodes up to `depthInHierarchy` will have `autoExpand` flag.
|
|
58
58
|
*/
|
|
59
|
-
reveal?: boolean |
|
|
59
|
+
reveal?: boolean | SearchPathRevealDepthInHierarchy | SearchPathRevealDepthInPath;
|
|
60
60
|
/**
|
|
61
|
-
* This option specifies whether or not
|
|
62
|
-
* - If it's `false` or `undefined`,
|
|
63
|
-
* - If it's `true`,
|
|
61
|
+
* This option specifies whether or not search target should be expanded.
|
|
62
|
+
* - If it's `false` or `undefined`, search target won't have 'autoExpand' flag.
|
|
63
|
+
* - If it's `true`, search target will have `autoExpand` flag.
|
|
64
64
|
*
|
|
65
|
-
* **NOTE**: this attribute does not set `autoExpand` flag on nodes up to the
|
|
65
|
+
* **NOTE**: this attribute does not set `autoExpand` flag on nodes up to the search target. For that use `reveal`.
|
|
66
66
|
*/
|
|
67
67
|
autoExpand?: boolean;
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
70
|
-
* A path of hierarchy node identifiers for
|
|
70
|
+
* A path of hierarchy node identifiers for search the hierarchy with additional options.
|
|
71
71
|
* @public
|
|
72
72
|
*/
|
|
73
|
-
export type
|
|
73
|
+
export type HierarchySearchPath = HierarchyNodeIdentifiersPath | {
|
|
74
74
|
path: HierarchyNodeIdentifiersPath;
|
|
75
|
-
options?:
|
|
75
|
+
options?: HierarchySearchPathOptions;
|
|
76
76
|
};
|
|
77
77
|
/** @public */
|
|
78
|
-
export declare namespace
|
|
78
|
+
export declare namespace HierarchySearchPath {
|
|
79
79
|
/**
|
|
80
|
-
* Normalizes the hierarchy
|
|
80
|
+
* Normalizes the hierarchy search path to the object form.
|
|
81
81
|
* @public
|
|
82
82
|
*/
|
|
83
|
-
function normalize(source:
|
|
83
|
+
function normalize(source: HierarchySearchPath): Exclude<HierarchySearchPath, HierarchyNodeIdentifiersPath>;
|
|
84
84
|
/**
|
|
85
|
-
* Merges two given `
|
|
85
|
+
* Merges two given `HierarchySearchPathOptions` objects.
|
|
86
86
|
*
|
|
87
87
|
* For the `reveal` attribute, the merge chooses to `reveal` as deep as the deepest input:
|
|
88
88
|
* - if any one of the inputs is `true`, return `true`,
|
|
@@ -94,42 +94,32 @@ export declare namespace HierarchyFilteringPath {
|
|
|
94
94
|
*
|
|
95
95
|
* @public
|
|
96
96
|
*/
|
|
97
|
-
function mergeOptions(lhs:
|
|
97
|
+
function mergeOptions(lhs: HierarchySearchPathOptions | undefined, rhs: HierarchySearchPathOptions | undefined): HierarchySearchPathOptions | undefined;
|
|
98
98
|
}
|
|
99
99
|
/**
|
|
100
|
-
*
|
|
101
|
-
* the parent node. Returns `undefined` if filtering props are not present.
|
|
102
|
-
* @public
|
|
103
|
-
* @deprecated in 1.3. Use `createHierarchyFilteringHelper` instead.
|
|
104
|
-
*/
|
|
105
|
-
export declare function extractFilteringProps(rootLevelFilteringProps: HierarchyFilteringPath[], parentNode: Pick<NonGroupingHierarchyNode, "filtering"> | undefined): {
|
|
106
|
-
filteredNodePaths: HierarchyFilteringPath[];
|
|
107
|
-
hasFilterTargetAncestor: boolean;
|
|
108
|
-
} | undefined;
|
|
109
|
-
/**
|
|
110
|
-
* Creates a set of utilities for making it easier to filter the given hierarchy
|
|
100
|
+
* Creates a set of utilities for making it easier to search the given hierarchy
|
|
111
101
|
* level.
|
|
112
102
|
*
|
|
113
103
|
* @public
|
|
114
104
|
*/
|
|
115
|
-
export declare function
|
|
105
|
+
export declare function createHierarchySearchHelper(rootLevelSearchProps: HierarchySearchPath[] | undefined, parentNode: Pick<NonGroupingHierarchyNode, "search"> | undefined): {
|
|
116
106
|
/** Returns a flag indicating if the hierarchy level is filtered. */
|
|
117
|
-
|
|
107
|
+
hasSearch: boolean;
|
|
118
108
|
/**
|
|
119
109
|
* Returns a flag indicating whether this hierarchy level has an ancestor node
|
|
120
|
-
* that is a
|
|
121
|
-
* levels should be displayed without
|
|
110
|
+
* that is a search target. That generally means that this and all downstream hierarchy
|
|
111
|
+
* levels should be displayed without search being applied to them, even if search paths
|
|
122
112
|
* say otherwise.
|
|
123
113
|
*/
|
|
124
|
-
|
|
114
|
+
hasSearchTargetAncestor: boolean;
|
|
125
115
|
/**
|
|
126
116
|
* Returns a list of hierarchy node identifiers that apply specifically for this
|
|
127
|
-
* hierarchy level. Returns `undefined` if
|
|
117
|
+
* hierarchy level. Returns `undefined` if search is not applied to this level.
|
|
128
118
|
*/
|
|
129
|
-
|
|
119
|
+
getChildNodeSearchIdentifiers: () => HierarchyNodeIdentifier[] | undefined;
|
|
130
120
|
/**
|
|
131
|
-
* When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `
|
|
132
|
-
* and `autoExpand`) to be set based on the
|
|
121
|
+
* When a hierarchy node is created for a filtered hierarchy level, it needs some attributes (e.g. `search`
|
|
122
|
+
* and `autoExpand`) to be set based on the search paths and search options. This function calculates
|
|
133
123
|
* these props for a child node based on its key or path matcher.
|
|
134
124
|
*
|
|
135
125
|
* When using `pathMatcher` or `asyncPathMatcher` prop, callers have more flexibility to decide whether the given `HierarchyNodeIdentifier` applies
|
|
@@ -137,7 +127,7 @@ export declare function createHierarchyFilteringHelper(rootLevelFilteringProps:
|
|
|
137
127
|
* `nodeKey` prop can be used to check the whole identifier.
|
|
138
128
|
*
|
|
139
129
|
* 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** `
|
|
130
|
+
* - `parentKeys` is defined and `pathMatcher` or `nodeKey` is provided - returns undefined **or** `search` and `autoExpand` prop from `HierarchyNode`;
|
|
141
131
|
* - `parentKeys` is undefined - does not return `HierarchyNode.autoExpand` option;
|
|
142
132
|
* - props have `asyncPathMatcher` - returns either Promise or the regular return value based on whether or not `asyncPathMatcher` returns a promise.
|
|
143
133
|
*/
|
|
@@ -145,33 +135,33 @@ export declare function createHierarchyFilteringHelper(rootLevelFilteringProps:
|
|
|
145
135
|
(props: {
|
|
146
136
|
parentKeys?: undefined;
|
|
147
137
|
nodeKey: InstancesNodeKey | GenericNodeKey;
|
|
148
|
-
}): Pick<NonGroupingHierarchyNode, "
|
|
138
|
+
}): Pick<NonGroupingHierarchyNode, "search"> | undefined;
|
|
149
139
|
(props: {
|
|
150
140
|
parentKeys?: undefined;
|
|
151
141
|
pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;
|
|
152
|
-
}): Pick<NonGroupingHierarchyNode, "
|
|
142
|
+
}): Pick<NonGroupingHierarchyNode, "search"> | undefined;
|
|
153
143
|
(props: {
|
|
154
144
|
parentKeys?: undefined;
|
|
155
145
|
asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;
|
|
156
|
-
}): Promise<Pick<NonGroupingHierarchyNode, "
|
|
146
|
+
}): Promise<Pick<NonGroupingHierarchyNode, "search"> | undefined> | Pick<NonGroupingHierarchyNode, "search"> | undefined;
|
|
157
147
|
(props: {
|
|
158
148
|
parentKeys: HierarchyNodeKey[];
|
|
159
149
|
nodeKey: InstancesNodeKey | GenericNodeKey;
|
|
160
|
-
}): Pick<NonGroupingHierarchyNode, "
|
|
150
|
+
}): Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined;
|
|
161
151
|
(props: {
|
|
162
152
|
parentKeys: HierarchyNodeKey[];
|
|
163
153
|
pathMatcher: (identifier: HierarchyNodeIdentifier) => boolean;
|
|
164
|
-
}): Pick<NonGroupingHierarchyNode, "
|
|
154
|
+
}): Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined;
|
|
165
155
|
(props: {
|
|
166
156
|
parentKeys: HierarchyNodeKey[];
|
|
167
157
|
asyncPathMatcher: (identifier: HierarchyNodeIdentifier) => boolean | Promise<boolean>;
|
|
168
|
-
}): Promise<Pick<NonGroupingHierarchyNode, "
|
|
158
|
+
}): Promise<Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined> | Pick<NonGroupingHierarchyNode, "search" | "autoExpand"> | undefined;
|
|
169
159
|
};
|
|
170
160
|
};
|
|
171
161
|
/** @internal */
|
|
172
162
|
export declare function shouldAutoExpandBasedOnReveal({ reveal, nodePositionInPath, nodePositionInHierarchy, }: {
|
|
173
|
-
reveal:
|
|
163
|
+
reveal: HierarchySearchPathOptions["reveal"];
|
|
174
164
|
nodePositionInPath: number;
|
|
175
165
|
nodePositionInHierarchy: number;
|
|
176
166
|
}): boolean;
|
|
177
|
-
//# sourceMappingURL=
|
|
167
|
+
//# sourceMappingURL=HierarchySearch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HierarchySearch.d.ts","sourceRoot":"","sources":["../../../src/hierarchies/HierarchySearch.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AACrG,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE3F,cAAc;AACd,MAAM,WAAW,2BAA2B;IAC1C;;;;;;;;;;;;;;;;;OAiBG;IACH,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,cAAc;AACd,MAAM,WAAW,gCAAgC;IAC/C;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED,cAAc;AACd,MAAM,WAAW,0BAA0B;IACzC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,GAAG,gCAAgC,GAAG,2BAA2B,CAAC;IAClF;;;;;;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