@itwin/tree-widget-react 3.0.0-dev.3 → 3.0.0-dev.5

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.
Files changed (172) hide show
  1. package/README.md +122 -6
  2. package/lib/cjs/components/SelectableTree.js +1 -2
  3. package/lib/cjs/components/SelectableTree.js.map +1 -1
  4. package/lib/cjs/components/SelectableTree.scss +5 -0
  5. package/lib/cjs/components/tree-header/TreeHeader.d.ts +12 -9
  6. package/lib/cjs/components/tree-header/TreeHeader.js +4 -6
  7. package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -1
  8. package/lib/cjs/components/tree-header/TreeWithHeader.d.ts +13 -0
  9. package/lib/cjs/components/tree-header/TreeWithHeader.js +20 -0
  10. package/lib/cjs/components/tree-header/TreeWithHeader.js.map +1 -0
  11. package/lib/cjs/components/trees/categories-tree/CategoriesTree.d.ts +3 -7
  12. package/lib/cjs/components/trees/categories-tree/CategoriesTree.js +7 -63
  13. package/lib/cjs/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  14. package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.d.ts +9 -2
  15. package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js +24 -4
  16. package/lib/cjs/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  17. package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.d.ts +0 -1
  18. package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js +17 -19
  19. package/lib/cjs/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  20. package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +2 -2
  21. package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js +5 -4
  22. package/lib/cjs/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  23. package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +1 -9
  24. package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js +2 -6
  25. package/lib/cjs/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -1
  26. package/lib/cjs/components/trees/categories-tree/UseCategoriesTree.d.ts +25 -0
  27. package/lib/cjs/components/trees/categories-tree/UseCategoriesTree.js +90 -0
  28. package/lib/cjs/components/trees/categories-tree/UseCategoriesTree.js.map +1 -0
  29. package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.d.ts +6 -6
  30. package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js +32 -78
  31. package/lib/cjs/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
  32. package/lib/cjs/components/trees/common/FocusedInstancesContext.d.ts +1 -1
  33. package/lib/cjs/components/trees/common/FocusedInstancesContext.js.map +1 -1
  34. package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js +4 -4
  35. package/lib/cjs/components/trees/common/FocusedInstancesContextProvider.js.map +1 -1
  36. package/lib/cjs/components/trees/common/TreeErrors.d.ts +9 -0
  37. package/lib/cjs/components/trees/common/TreeErrors.js +19 -0
  38. package/lib/cjs/components/trees/common/TreeErrors.js.map +1 -0
  39. package/lib/cjs/components/trees/common/UseActiveViewport.d.ts +7 -0
  40. package/lib/cjs/components/trees/common/UseActiveViewport.js +25 -0
  41. package/lib/cjs/components/trees/common/UseActiveViewport.js.map +1 -0
  42. package/lib/cjs/components/trees/common/UseTelemetryContext.d.ts +1 -1
  43. package/lib/cjs/components/trees/common/UseTelemetryContext.js.map +1 -1
  44. package/lib/cjs/components/trees/common/components/Tree.d.ts +0 -2
  45. package/lib/cjs/components/trees/common/components/Tree.js +5 -4
  46. package/lib/cjs/components/trees/common/components/Tree.js.map +1 -1
  47. package/lib/cjs/components/trees/common/components/VisibilityTree.d.ts +2 -3
  48. package/lib/cjs/components/trees/common/components/VisibilityTree.js.map +1 -1
  49. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
  50. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  51. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +1 -2
  52. package/lib/cjs/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  53. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
  54. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  55. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js +1 -2
  56. package/lib/cjs/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  57. package/lib/cjs/components/trees/index.d.ts +5 -0
  58. package/lib/cjs/components/trees/index.js +11 -1
  59. package/lib/cjs/components/trees/index.js.map +1 -1
  60. package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +6 -11
  61. package/lib/cjs/components/trees/models-tree/ModelsTree.js +4 -203
  62. package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
  63. package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.d.ts +9 -3
  64. package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +13 -3
  65. package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  66. package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -2
  67. package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +29 -21
  68. package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  69. package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.d.ts +10 -6
  70. package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js +63 -43
  71. package/lib/cjs/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  72. package/lib/cjs/components/trees/models-tree/UseModelsTree.d.ts +38 -0
  73. package/lib/cjs/components/trees/models-tree/UseModelsTree.js +253 -0
  74. package/lib/cjs/components/trees/models-tree/UseModelsTree.js.map +1 -0
  75. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +5 -4
  76. package/lib/cjs/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
  77. package/lib/cjs/tree-widget-react.d.ts +1 -0
  78. package/lib/cjs/tree-widget-react.js +3 -1
  79. package/lib/cjs/tree-widget-react.js.map +1 -1
  80. package/lib/esm/components/SelectableTree.js +2 -3
  81. package/lib/esm/components/SelectableTree.js.map +1 -1
  82. package/lib/esm/components/SelectableTree.scss +5 -0
  83. package/lib/esm/components/tree-header/TreeHeader.d.ts +12 -9
  84. package/lib/esm/components/tree-header/TreeHeader.js +4 -6
  85. package/lib/esm/components/tree-header/TreeHeader.js.map +1 -1
  86. package/lib/esm/components/tree-header/TreeWithHeader.d.ts +13 -0
  87. package/lib/esm/components/tree-header/TreeWithHeader.js +13 -0
  88. package/lib/esm/components/tree-header/TreeWithHeader.js.map +1 -0
  89. package/lib/esm/components/trees/categories-tree/CategoriesTree.d.ts +3 -7
  90. package/lib/esm/components/trees/categories-tree/CategoriesTree.js +7 -63
  91. package/lib/esm/components/trees/categories-tree/CategoriesTree.js.map +1 -1
  92. package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.d.ts +9 -2
  93. package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js +22 -4
  94. package/lib/esm/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
  95. package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.d.ts +0 -1
  96. package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js +18 -17
  97. package/lib/esm/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
  98. package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +2 -2
  99. package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js +5 -4
  100. package/lib/esm/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
  101. package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.d.ts +1 -9
  102. package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js +2 -6
  103. package/lib/esm/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +1 -1
  104. package/lib/esm/components/trees/categories-tree/UseCategoriesTree.d.ts +25 -0
  105. package/lib/esm/components/trees/categories-tree/UseCategoriesTree.js +86 -0
  106. package/lib/esm/components/trees/categories-tree/UseCategoriesTree.js.map +1 -0
  107. package/lib/esm/components/trees/common/CategoriesVisibilityUtils.d.ts +6 -6
  108. package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js +33 -79
  109. package/lib/esm/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
  110. package/lib/esm/components/trees/common/FocusedInstancesContext.d.ts +1 -1
  111. package/lib/esm/components/trees/common/FocusedInstancesContext.js.map +1 -1
  112. package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js +4 -4
  113. package/lib/esm/components/trees/common/FocusedInstancesContextProvider.js.map +1 -1
  114. package/lib/esm/components/trees/common/TreeErrors.d.ts +9 -0
  115. package/lib/esm/components/trees/common/TreeErrors.js +15 -0
  116. package/lib/esm/components/trees/common/TreeErrors.js.map +1 -0
  117. package/lib/esm/components/trees/common/UseActiveViewport.d.ts +7 -0
  118. package/lib/esm/components/trees/common/UseActiveViewport.js +21 -0
  119. package/lib/esm/components/trees/common/UseActiveViewport.js.map +1 -0
  120. package/lib/esm/components/trees/common/UseTelemetryContext.d.ts +1 -1
  121. package/lib/esm/components/trees/common/UseTelemetryContext.js.map +1 -1
  122. package/lib/esm/components/trees/common/components/Tree.d.ts +0 -2
  123. package/lib/esm/components/trees/common/components/Tree.js +5 -4
  124. package/lib/esm/components/trees/common/components/Tree.js.map +1 -1
  125. package/lib/esm/components/trees/common/components/VisibilityTree.d.ts +2 -3
  126. package/lib/esm/components/trees/common/components/VisibilityTree.js.map +1 -1
  127. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +1 -1
  128. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
  129. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js +1 -2
  130. package/lib/esm/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
  131. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.d.ts +1 -1
  132. package/lib/esm/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
  133. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js +1 -2
  134. package/lib/esm/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
  135. package/lib/esm/components/trees/index.d.ts +5 -0
  136. package/lib/esm/components/trees/index.js +5 -0
  137. package/lib/esm/components/trees/index.js.map +1 -1
  138. package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +6 -11
  139. package/lib/esm/components/trees/models-tree/ModelsTree.js +5 -204
  140. package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
  141. package/lib/esm/components/trees/models-tree/ModelsTreeButtons.d.ts +9 -3
  142. package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +12 -2
  143. package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
  144. package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -2
  145. package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +31 -20
  146. package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
  147. package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.d.ts +10 -6
  148. package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js +63 -43
  149. package/lib/esm/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
  150. package/lib/esm/components/trees/models-tree/UseModelsTree.d.ts +38 -0
  151. package/lib/esm/components/trees/models-tree/UseModelsTree.js +249 -0
  152. package/lib/esm/components/trees/models-tree/UseModelsTree.js.map +1 -0
  153. package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +6 -5
  154. package/lib/esm/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
  155. package/lib/esm/tree-widget-react.d.ts +1 -0
  156. package/lib/esm/tree-widget-react.js +1 -0
  157. package/lib/esm/tree-widget-react.js.map +1 -1
  158. package/package.json +37 -41
  159. package/lib/cjs/components/trees/categories-tree/UseCategories.d.ts +0 -8
  160. package/lib/cjs/components/trees/categories-tree/UseCategories.js +0 -22
  161. package/lib/cjs/components/trees/categories-tree/UseCategories.js.map +0 -1
  162. package/lib/cjs/components/utils/AutoSizer.d.ts +0 -13
  163. package/lib/cjs/components/utils/AutoSizer.js +0 -21
  164. package/lib/cjs/components/utils/AutoSizer.js.map +0 -1
  165. package/lib/esm/components/trees/categories-tree/UseCategories.d.ts +0 -8
  166. package/lib/esm/components/trees/categories-tree/UseCategories.js +0 -18
  167. package/lib/esm/components/trees/categories-tree/UseCategories.js.map +0 -1
  168. package/lib/esm/components/utils/AutoSizer.d.ts +0 -13
  169. package/lib/esm/components/utils/AutoSizer.js +0 -17
  170. package/lib/esm/components/utils/AutoSizer.js.map +0 -1
  171. /package/lib/cjs/components/{trees/Tree.scss → tree-header/TreeWithHeader.scss} +0 -0
  172. /package/lib/esm/components/{trees/Tree.scss → tree-header/TreeWithHeader.scss} +0 -0
@@ -0,0 +1,249 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
7
+ import { IModelApp } from "@itwin/core-frontend";
8
+ import { SvgFolder, SvgImodelHollow, SvgItem, SvgLayers, SvgModel } from "@itwin/itwinui-icons-react";
9
+ import { Anchor, Icon, Text } from "@itwin/itwinui-react";
10
+ import { createECSqlQueryExecutor } from "@itwin/presentation-core-interop";
11
+ import { HierarchyNode, HierarchyNodeKey } from "@itwin/presentation-hierarchies";
12
+ import { TreeWidget } from "../../../TreeWidget";
13
+ import { useFocusedInstancesContext } from "../common/FocusedInstancesContext";
14
+ import { FilterLimitExceededError } from "../common/TreeErrors";
15
+ import { useIModelChangeListener } from "../common/UseIModelChangeListener";
16
+ import { useTelemetryContext } from "../common/UseTelemetryContext";
17
+ import { ModelsTreeIdsCache } from "./internal/ModelsTreeIdsCache";
18
+ import { createModelsTreeVisibilityHandler } from "./internal/ModelsTreeVisibilityHandler";
19
+ import { defaultHierarchyConfiguration, ModelsTreeDefinition } from "./ModelsTreeDefinition";
20
+ /**
21
+ * Custom hook to create and manage state for the models tree.
22
+ * @beta
23
+ */
24
+ export function useModelsTree({ activeView, filter, hierarchyConfig, visibilityHandlerOverrides, getFilteredPaths }) {
25
+ const [filteringError, setFilteringError] = useState(undefined);
26
+ const hierarchyConfiguration = useMemo(() => ({
27
+ ...defaultHierarchyConfiguration,
28
+ ...hierarchyConfig,
29
+ }),
30
+ // eslint-disable-next-line react-hooks/exhaustive-deps
31
+ Object.values(hierarchyConfig ?? {}));
32
+ const { onFeatureUsed } = useTelemetryContext();
33
+ const { getModelsTreeIdsCache, visibilityHandlerFactory } = useCachedVisibility(activeView, hierarchyConfiguration, visibilityHandlerOverrides);
34
+ const { loadFocusedItems } = useFocusedInstancesContext();
35
+ const getHierarchyDefinition = useCallback(({ imodelAccess }) => new ModelsTreeDefinition({ imodelAccess, idsCache: getModelsTreeIdsCache(), hierarchyConfig: hierarchyConfiguration }), [getModelsTreeIdsCache, hierarchyConfiguration]);
36
+ const onNodeDoubleClick = useCallback(async ({ nodeData, extendedData }) => {
37
+ if (!HierarchyNode.isInstancesNode(nodeData) || (extendedData && (extendedData.isSubject || extendedData.isModel || extendedData.isCategory))) {
38
+ return;
39
+ }
40
+ const instanceIds = nodeData.key.instanceKeys.map((instanceKey) => instanceKey.id);
41
+ await IModelApp.viewManager.selectedView?.zoomToElements(instanceIds);
42
+ onFeatureUsed({ featureId: "zoom-to-node", reportInteraction: false });
43
+ }, [onFeatureUsed]);
44
+ const getPaths = useMemo(() => {
45
+ setFilteringError(undefined);
46
+ if (loadFocusedItems) {
47
+ return async ({ imodelAccess }) => {
48
+ try {
49
+ const focusedItems = await collectFocusedItems(loadFocusedItems);
50
+ const paths = await ModelsTreeDefinition.createInstanceKeyPaths({
51
+ imodelAccess,
52
+ idsCache: getModelsTreeIdsCache(),
53
+ targetItems: focusedItems,
54
+ hierarchyConfig: hierarchyConfiguration,
55
+ });
56
+ return paths.map((path) => ("path" in path ? path : { path, options: { autoExpand: true } }));
57
+ }
58
+ catch (e) {
59
+ const newError = e instanceof FilterLimitExceededError ? "tooManyInstancesFocused" : "unknownInstanceFocusError";
60
+ if (newError !== "tooManyInstancesFocused") {
61
+ const feature = e instanceof Error && e.message.includes("query too long to execute or server is too busy") ? "error-timeout" : "error-unknown";
62
+ onFeatureUsed({ featureId: feature, reportInteraction: false });
63
+ }
64
+ setFilteringError(newError);
65
+ return [];
66
+ }
67
+ };
68
+ }
69
+ if (getFilteredPaths) {
70
+ return async ({ imodelAccess }) => {
71
+ try {
72
+ return await getFilteredPaths({
73
+ createInstanceKeyPaths: async (props) => ModelsTreeDefinition.createInstanceKeyPaths({
74
+ ...props,
75
+ imodelAccess,
76
+ idsCache: getModelsTreeIdsCache(),
77
+ hierarchyConfig: hierarchyConfiguration,
78
+ }),
79
+ });
80
+ }
81
+ catch (e) {
82
+ const newError = e instanceof FilterLimitExceededError ? "tooManyFilterMatches" : "unknownFilterError";
83
+ if (newError !== "tooManyFilterMatches") {
84
+ const feature = e instanceof Error && e.message.includes("query too long to execute or server is too busy") ? "error-timeout" : "error-unknown";
85
+ onFeatureUsed({ featureId: feature, reportInteraction: false });
86
+ }
87
+ setFilteringError(newError);
88
+ return [];
89
+ }
90
+ };
91
+ }
92
+ if (filter) {
93
+ return async ({ imodelAccess }) => {
94
+ onFeatureUsed({ featureId: "filtering", reportInteraction: true });
95
+ try {
96
+ const paths = await ModelsTreeDefinition.createInstanceKeyPaths({
97
+ imodelAccess,
98
+ label: filter,
99
+ idsCache: getModelsTreeIdsCache(),
100
+ hierarchyConfig: hierarchyConfiguration,
101
+ });
102
+ return paths.map((path) => ("path" in path ? path : { path, options: { autoExpand: true } }));
103
+ }
104
+ catch (e) {
105
+ const newError = e instanceof FilterLimitExceededError ? "tooManyFilterMatches" : "unknownFilterError";
106
+ if (newError !== "tooManyFilterMatches") {
107
+ const feature = e instanceof Error && e.message.includes("query too long to execute or server is too busy") ? "error-timeout" : "error-unknown";
108
+ onFeatureUsed({ featureId: feature, reportInteraction: false });
109
+ }
110
+ setFilteringError(newError);
111
+ return [];
112
+ }
113
+ };
114
+ }
115
+ return undefined;
116
+ }, [filter, loadFocusedItems, getModelsTreeIdsCache, onFeatureUsed, getFilteredPaths, hierarchyConfiguration]);
117
+ return {
118
+ modelsTreeProps: {
119
+ treeName: "models-tree-v2",
120
+ visibilityHandlerFactory,
121
+ getHierarchyDefinition,
122
+ getFilteredPaths: getPaths,
123
+ noDataMessage: getNoDataMessage(filter, filteringError),
124
+ highlight: filter ? { text: filter } : undefined,
125
+ },
126
+ rendererProps: {
127
+ onNodeDoubleClick,
128
+ getIcon,
129
+ },
130
+ };
131
+ }
132
+ function getNoDataMessage(filter, error) {
133
+ if (isInstanceFocusError(error)) {
134
+ return _jsx(InstanceFocusError, { error: error });
135
+ }
136
+ if (isFilterError(error)) {
137
+ return _jsx(Text, { children: TreeWidget.translate(`modelsTree.filtering.${error}`) });
138
+ }
139
+ if (filter) {
140
+ return _jsx(Text, { children: TreeWidget.translate("modelsTree.filtering.noMatches", { filter }) });
141
+ }
142
+ return undefined;
143
+ }
144
+ function isFilterError(error) {
145
+ return error === "tooManyFilterMatches" || error === "unknownFilterError";
146
+ }
147
+ function isInstanceFocusError(error) {
148
+ return error === "tooManyInstancesFocused" || error === "unknownInstanceFocusError";
149
+ }
150
+ function InstanceFocusError({ error }) {
151
+ const { toggle } = useFocusedInstancesContext();
152
+ const localizedMessage = createLocalizedMessage(TreeWidget.translate(`modelsTree.filtering.${error}`), () => toggle());
153
+ return _jsx(Text, { children: localizedMessage });
154
+ }
155
+ function getIcon(node) {
156
+ if (node.extendedData?.imageId === undefined) {
157
+ return undefined;
158
+ }
159
+ switch (node.extendedData.imageId) {
160
+ case "icon-layers":
161
+ return _jsx(SvgLayers, {});
162
+ case "icon-item":
163
+ return _jsx(SvgItem, {});
164
+ case "icon-ec-class":
165
+ return _jsx(SvgClassGrouping, {});
166
+ case "icon-imodel-hollow-2":
167
+ return _jsx(SvgImodelHollow, {});
168
+ case "icon-folder":
169
+ return _jsx(SvgFolder, {});
170
+ case "icon-model":
171
+ return _jsx(SvgModel, {});
172
+ }
173
+ return undefined;
174
+ }
175
+ function createVisibilityHandlerFactory(activeView, idsCacheGetter, overrides) {
176
+ return ({ imodelAccess }) => createModelsTreeVisibilityHandler({ viewport: activeView, idsCache: idsCacheGetter(), imodelAccess, overrides });
177
+ }
178
+ function useCachedVisibility(activeView, hierarchyConfig, overrides) {
179
+ const cacheRef = useRef();
180
+ const currentIModelRef = useRef(activeView.iModel);
181
+ const getModelsTreeIdsCache = useCallback(() => {
182
+ if (!cacheRef.current) {
183
+ cacheRef.current = new ModelsTreeIdsCache(createECSqlQueryExecutor(currentIModelRef.current), hierarchyConfig);
184
+ }
185
+ return cacheRef.current;
186
+ }, [hierarchyConfig]);
187
+ const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));
188
+ useIModelChangeListener({
189
+ imodel: activeView.iModel,
190
+ action: useCallback(() => {
191
+ cacheRef.current = undefined;
192
+ setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));
193
+ }, [activeView, getModelsTreeIdsCache, overrides]),
194
+ });
195
+ useEffect(() => {
196
+ currentIModelRef.current = activeView.iModel;
197
+ cacheRef.current = undefined;
198
+ setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));
199
+ }, [activeView, getModelsTreeIdsCache, overrides]);
200
+ return {
201
+ getModelsTreeIdsCache,
202
+ visibilityHandlerFactory,
203
+ };
204
+ }
205
+ function SvgClassGrouping() {
206
+ return (_jsx(Icon, { children: _jsx("svg", { id: "Calque_1", "data-name": "Calque 1", xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 16 16", children: _jsx("path", { d: "M8.00933,0,0,3.97672V11.986L8.00933,16,16,11.93V3.97651ZM1.66173,11.27642c-.26155.03734-.59754-.26154-.76553-.69085-.168-.41066-.09334-.784.168-.82152.26154-.03734.59754.26154.76553.67219C1.99772,10.86577,1.92306,11.23909,1.66173,11.27642Zm0-3.32319c-.26155.03733-.59754-.28-.76553-.69086-.168-.42932-.09334-.80285.168-.84.26133-.03733.59754.28.76532.69086C1.99772,7.54236,1.92306,7.89723,1.66173,7.95323Zm4.31276,5.52621a.18186.18186,0,0,1-.16821-.01866L3.41657,12.15394a.94275.94275,0,0,1-.29887-.80285c.03754-.33621.22421-.52265.41108-.41066L5.9185,12.24727a.88656.88656,0,0,1,.28.80285A.5057.5057,0,0,1,5.97449,13.47944Zm0-3.37919a.18184.18184,0,0,1-.16821-.01867L3.41657,8.77475a.943.943,0,0,1-.29887-.80286c.03754-.3362.22421-.52286.41108-.42953L5.9185,8.86786a.83112.83112,0,0,1,.28.78419A.51684.51684,0,0,1,5.97449,10.10025Z" }) }) }));
207
+ }
208
+ async function collectFocusedItems(loadFocusedItems) {
209
+ const focusedItems = [];
210
+ const groupingNodeInfos = [];
211
+ for await (const key of loadFocusedItems()) {
212
+ if ("id" in key) {
213
+ focusedItems.push(key);
214
+ continue;
215
+ }
216
+ if (!HierarchyNodeKey.isClassGrouping(key.key)) {
217
+ continue;
218
+ }
219
+ const groupingNode = key;
220
+ if (!groupingNode.nonGroupingAncestor || !HierarchyNodeKey.isInstances(groupingNode.nonGroupingAncestor.key)) {
221
+ continue;
222
+ }
223
+ const parentKey = groupingNode.nonGroupingAncestor.key;
224
+ const type = groupingNode.nonGroupingAncestor.extendedData?.isCategory ? "category" : "element";
225
+ const modelIds = (groupingNode.nonGroupingAncestor.extendedData?.modelIds ?? []).flatMap((ids) => ids);
226
+ groupingNodeInfos.push({ groupingNode, parentType: type, parentKey, modelIds });
227
+ }
228
+ focusedItems.push(...groupingNodeInfos.map(({ parentKey, parentType, groupingNode, modelIds }) => ({
229
+ parent: parentType === "element"
230
+ ? { type: "element", ids: parentKey.instanceKeys.map((key) => key.id) }
231
+ : { type: "category", ids: parentKey.instanceKeys.map((key) => key.id), modelIds },
232
+ groupingNode,
233
+ })));
234
+ return focusedItems;
235
+ }
236
+ function createLocalizedMessage(message, onClick) {
237
+ const exp = new RegExp("<link>(.*)</link>");
238
+ const match = message.match(exp);
239
+ if (!match) {
240
+ return message;
241
+ }
242
+ const [fullText, innerText] = match;
243
+ const [textBefore, textAfter] = message.split(fullText);
244
+ return (_jsxs(_Fragment, { children: [textBefore ? textBefore : null, _jsx(Anchor, { underline: true, onClick: (e) => {
245
+ e.stopPropagation();
246
+ onClick?.();
247
+ }, children: innerText }), textAfter ? textAfter : null] }));
248
+ }
249
+ //# sourceMappingURL=UseModelsTree.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"UseModelsTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/models-tree/UseModelsTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,gBAA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AO,EAAE,EAAE,CAAC;gBACd,CAAC,YAEA,SAAS,GACH,EACR,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAC5B,CACJ,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 { useCallback, useEffect, useMemo, useRef, useState } from \"react\";\nimport { IModelApp } from \"@itwin/core-frontend\";\nimport { SvgFolder, SvgImodelHollow, SvgItem, SvgLayers, SvgModel } from \"@itwin/itwinui-icons-react\";\nimport { Anchor, Icon, Text } from \"@itwin/itwinui-react\";\nimport { createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport { HierarchyNode, HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { useFocusedInstancesContext } from \"../common/FocusedInstancesContext\";\nimport { FilterLimitExceededError } from \"../common/TreeErrors\";\nimport { useIModelChangeListener } from \"../common/UseIModelChangeListener\";\nimport { useTelemetryContext } from \"../common/UseTelemetryContext\";\nimport { ModelsTreeIdsCache } from \"./internal/ModelsTreeIdsCache\";\nimport { createModelsTreeVisibilityHandler } from \"./internal/ModelsTreeVisibilityHandler\";\nimport { defaultHierarchyConfiguration, ModelsTreeDefinition } from \"./ModelsTreeDefinition\";\n\nimport type { Id64String } from \"@itwin/core-bentley\";\nimport type { GroupingHierarchyNode, InstancesNodeKey } from \"@itwin/presentation-hierarchies\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { ComponentPropsWithoutRef, ReactElement } from \"react\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { ClassGroupingHierarchyNode, ElementsGroupInfo, ModelsTreeHierarchyConfiguration } from \"./ModelsTreeDefinition\";\nimport type { ModelsTreeVisibilityHandlerOverrides } from \"./internal/ModelsTreeVisibilityHandler\";\nimport type { VisibilityTree } from \"../common/components/VisibilityTree\";\nimport type { VisibilityTreeRenderer } from \"../common/components/VisibilityTreeRenderer\";\n\ntype ModelsTreeFilteringError = \"tooManyFilterMatches\" | \"tooManyInstancesFocused\" | \"unknownFilterError\" | \"unknownInstanceFocusError\";\ntype HierarchyFilteringPaths = Awaited<ReturnType<Required<VisibilityTreeProps>[\"getFilteredPaths\"]>>;\n\n/** @beta */\ntype VisibilityTreeRendererProps = ComponentPropsWithoutRef<typeof VisibilityTreeRenderer>;\n\n/** @beta */\ntype VisibilityTreeProps = ComponentPropsWithoutRef<typeof VisibilityTree>;\n\n/** @beta */\ninterface UseModelsTreeProps {\n filter?: string;\n activeView: Viewport;\n hierarchyConfig?: Partial<ModelsTreeHierarchyConfiguration>;\n visibilityHandlerOverrides?: ModelsTreeVisibilityHandlerOverrides;\n getFilteredPaths?: (props: {\n createInstanceKeyPaths: (props: { targetItems: Array<InstanceKey | ElementsGroupInfo> } | { label: string }) => Promise<HierarchyFilteringPaths>;\n }) => Promise<HierarchyFilteringPaths>;\n}\n\n/** @beta */\ninterface UseModelsTreeResult {\n modelsTreeProps: Pick<\n VisibilityTreeProps,\n \"treeName\" | \"getHierarchyDefinition\" | \"getFilteredPaths\" | \"visibilityHandlerFactory\" | \"highlight\" | \"noDataMessage\"\n >;\n rendererProps: Pick<Required<VisibilityTreeRendererProps>, \"getIcon\" | \"onNodeDoubleClick\">;\n}\n\n/**\n * Custom hook to create and manage state for the models tree.\n * @beta\n */\nexport function useModelsTree({ activeView, filter, hierarchyConfig, visibilityHandlerOverrides, getFilteredPaths }: UseModelsTreeProps): UseModelsTreeResult {\n const [filteringError, setFilteringError] = useState<ModelsTreeFilteringError | undefined>(undefined);\n const hierarchyConfiguration = useMemo<ModelsTreeHierarchyConfiguration>(\n () => ({\n ...defaultHierarchyConfiguration,\n ...hierarchyConfig,\n }),\n // eslint-disable-next-line react-hooks/exhaustive-deps\n Object.values(hierarchyConfig ?? {}),\n );\n const { onFeatureUsed } = useTelemetryContext();\n\n const { getModelsTreeIdsCache, visibilityHandlerFactory } = useCachedVisibility(activeView, hierarchyConfiguration, visibilityHandlerOverrides);\n const { loadFocusedItems } = useFocusedInstancesContext();\n\n const getHierarchyDefinition = useCallback<VisibilityTreeProps[\"getHierarchyDefinition\"]>(\n ({ imodelAccess }) => new ModelsTreeDefinition({ imodelAccess, idsCache: getModelsTreeIdsCache(), hierarchyConfig: hierarchyConfiguration }),\n [getModelsTreeIdsCache, hierarchyConfiguration],\n );\n\n const onNodeDoubleClick = useCallback(\n async ({ nodeData, extendedData }: PresentationHierarchyNode) => {\n if (!HierarchyNode.isInstancesNode(nodeData) || (extendedData && (extendedData.isSubject || extendedData.isModel || extendedData.isCategory))) {\n return;\n }\n const instanceIds = nodeData.key.instanceKeys.map((instanceKey) => instanceKey.id);\n await IModelApp.viewManager.selectedView?.zoomToElements(instanceIds);\n onFeatureUsed({ featureId: \"zoom-to-node\", reportInteraction: false });\n },\n [onFeatureUsed],\n );\n\n const getPaths = useMemo<VisibilityTreeProps[\"getFilteredPaths\"] | undefined>(() => {\n setFilteringError(undefined);\n if (loadFocusedItems) {\n return async ({ imodelAccess }) => {\n try {\n const focusedItems = await collectFocusedItems(loadFocusedItems);\n const paths = await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n idsCache: getModelsTreeIdsCache(),\n targetItems: focusedItems,\n hierarchyConfig: hierarchyConfiguration,\n });\n return paths.map((path) => (\"path\" in path ? path : { path, options: { autoExpand: true } }));\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyInstancesFocused\" : \"unknownInstanceFocusError\";\n if (newError !== \"tooManyInstancesFocused\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }\n\n if (getFilteredPaths) {\n return async ({ imodelAccess }) => {\n try {\n return await getFilteredPaths({\n createInstanceKeyPaths: async (props) =>\n ModelsTreeDefinition.createInstanceKeyPaths({\n ...props,\n imodelAccess,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n }),\n });\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n if (newError !== \"tooManyFilterMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }\n\n if (filter) {\n return async ({ imodelAccess }) => {\n onFeatureUsed({ featureId: \"filtering\", reportInteraction: true });\n try {\n const paths = await ModelsTreeDefinition.createInstanceKeyPaths({\n imodelAccess,\n label: filter,\n idsCache: getModelsTreeIdsCache(),\n hierarchyConfig: hierarchyConfiguration,\n });\n return paths.map((path) => (\"path\" in path ? path : { path, options: { autoExpand: true } }));\n } catch (e) {\n const newError = e instanceof FilterLimitExceededError ? \"tooManyFilterMatches\" : \"unknownFilterError\";\n if (newError !== \"tooManyFilterMatches\") {\n const feature = e instanceof Error && e.message.includes(\"query too long to execute or server is too busy\") ? \"error-timeout\" : \"error-unknown\";\n onFeatureUsed({ featureId: feature, reportInteraction: false });\n }\n setFilteringError(newError);\n return [];\n }\n };\n }\n return undefined;\n }, [filter, loadFocusedItems, getModelsTreeIdsCache, onFeatureUsed, getFilteredPaths, hierarchyConfiguration]);\n\n return {\n modelsTreeProps: {\n treeName: \"models-tree-v2\",\n visibilityHandlerFactory,\n getHierarchyDefinition,\n getFilteredPaths: getPaths,\n noDataMessage: getNoDataMessage(filter, filteringError),\n highlight: filter ? { text: filter } : undefined,\n },\n rendererProps: {\n onNodeDoubleClick,\n getIcon,\n },\n };\n}\n\nfunction getNoDataMessage(filter?: string, error?: ModelsTreeFilteringError) {\n if (isInstanceFocusError(error)) {\n return <InstanceFocusError error={error!} />;\n }\n if (isFilterError(error)) {\n return <Text>{TreeWidget.translate(`modelsTree.filtering.${error}`)}</Text>;\n }\n if (filter) {\n return <Text>{TreeWidget.translate(\"modelsTree.filtering.noMatches\", { filter })}</Text>;\n }\n return undefined;\n}\n\nfunction isFilterError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyFilterMatches\" || error === \"unknownFilterError\";\n}\n\nfunction isInstanceFocusError(error: ModelsTreeFilteringError | undefined) {\n return error === \"tooManyInstancesFocused\" || error === \"unknownInstanceFocusError\";\n}\n\nfunction InstanceFocusError({ error }: { error: ModelsTreeFilteringError }) {\n const { toggle } = useFocusedInstancesContext();\n const localizedMessage = createLocalizedMessage(TreeWidget.translate(`modelsTree.filtering.${error}`), () => toggle());\n return <Text>{localizedMessage}</Text>;\n}\n\nfunction getIcon(node: PresentationHierarchyNode): ReactElement | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-layers\":\n return <SvgLayers />;\n case \"icon-item\":\n return <SvgItem />;\n case \"icon-ec-class\":\n return <SvgClassGrouping />;\n case \"icon-imodel-hollow-2\":\n return <SvgImodelHollow />;\n case \"icon-folder\":\n return <SvgFolder />;\n case \"icon-model\":\n return <SvgModel />;\n }\n\n return undefined;\n}\n\nfunction createVisibilityHandlerFactory(\n activeView: Viewport,\n idsCacheGetter: () => ModelsTreeIdsCache,\n overrides?: ModelsTreeVisibilityHandlerOverrides,\n): VisibilityTreeProps[\"visibilityHandlerFactory\"] {\n return ({ imodelAccess }) => createModelsTreeVisibilityHandler({ viewport: activeView, idsCache: idsCacheGetter(), imodelAccess, overrides });\n}\n\nfunction useCachedVisibility(activeView: Viewport, hierarchyConfig: ModelsTreeHierarchyConfiguration, overrides?: ModelsTreeVisibilityHandlerOverrides) {\n const cacheRef = useRef<ModelsTreeIdsCache>();\n const currentIModelRef = useRef(activeView.iModel);\n\n const getModelsTreeIdsCache = useCallback(() => {\n if (!cacheRef.current) {\n cacheRef.current = new ModelsTreeIdsCache(createECSqlQueryExecutor(currentIModelRef.current), hierarchyConfig);\n }\n return cacheRef.current;\n }, [hierarchyConfig]);\n\n const [visibilityHandlerFactory, setVisibilityHandlerFactory] = useState(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));\n\n useIModelChangeListener({\n imodel: activeView.iModel,\n action: useCallback(() => {\n cacheRef.current = undefined;\n setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));\n }, [activeView, getModelsTreeIdsCache, overrides]),\n });\n\n useEffect(() => {\n currentIModelRef.current = activeView.iModel;\n cacheRef.current = undefined;\n setVisibilityHandlerFactory(() => createVisibilityHandlerFactory(activeView, getModelsTreeIdsCache, overrides));\n }, [activeView, getModelsTreeIdsCache, overrides]);\n\n return {\n getModelsTreeIdsCache,\n visibilityHandlerFactory,\n };\n}\n\nfunction SvgClassGrouping() {\n return (\n <Icon>\n <svg id=\"Calque_1\" data-name=\"Calque 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 16 16\">\n <path d=\"M8.00933,0,0,3.97672V11.986L8.00933,16,16,11.93V3.97651ZM1.66173,11.27642c-.26155.03734-.59754-.26154-.76553-.69085-.168-.41066-.09334-.784.168-.82152.26154-.03734.59754.26154.76553.67219C1.99772,10.86577,1.92306,11.23909,1.66173,11.27642Zm0-3.32319c-.26155.03733-.59754-.28-.76553-.69086-.168-.42932-.09334-.80285.168-.84.26133-.03733.59754.28.76532.69086C1.99772,7.54236,1.92306,7.89723,1.66173,7.95323Zm4.31276,5.52621a.18186.18186,0,0,1-.16821-.01866L3.41657,12.15394a.94275.94275,0,0,1-.29887-.80285c.03754-.33621.22421-.52265.41108-.41066L5.9185,12.24727a.88656.88656,0,0,1,.28.80285A.5057.5057,0,0,1,5.97449,13.47944Zm0-3.37919a.18184.18184,0,0,1-.16821-.01867L3.41657,8.77475a.943.943,0,0,1-.29887-.80286c.03754-.3362.22421-.52286.41108-.42953L5.9185,8.86786a.83112.83112,0,0,1,.28.78419A.51684.51684,0,0,1,5.97449,10.10025Z\" />\n </svg>\n </Icon>\n );\n}\n\nasync function collectFocusedItems(loadFocusedItems: () => AsyncIterableIterator<InstanceKey | GroupingHierarchyNode>) {\n const focusedItems: Array<InstanceKey | ElementsGroupInfo> = [];\n const groupingNodeInfos: Array<{\n parentKey: InstancesNodeKey;\n parentType: \"element\" | \"category\";\n groupingNode: ClassGroupingHierarchyNode;\n modelIds: Id64String[];\n }> = [];\n for await (const key of loadFocusedItems()) {\n if (\"id\" in key) {\n focusedItems.push(key);\n continue;\n }\n\n if (!HierarchyNodeKey.isClassGrouping(key.key)) {\n continue;\n }\n\n const groupingNode = key as ClassGroupingHierarchyNode;\n if (!groupingNode.nonGroupingAncestor || !HierarchyNodeKey.isInstances(groupingNode.nonGroupingAncestor.key)) {\n continue;\n }\n\n const parentKey = groupingNode.nonGroupingAncestor.key;\n const type = groupingNode.nonGroupingAncestor.extendedData?.isCategory ? \"category\" : \"element\";\n const modelIds = ((groupingNode.nonGroupingAncestor.extendedData?.modelIds as Id64String[][]) ?? []).flatMap((ids) => ids);\n groupingNodeInfos.push({ groupingNode, parentType: type, parentKey, modelIds });\n }\n focusedItems.push(\n ...groupingNodeInfos.map(({ parentKey, parentType, groupingNode, modelIds }) => ({\n parent:\n parentType === \"element\"\n ? { type: \"element\" as const, ids: parentKey.instanceKeys.map((key) => key.id) }\n : { type: \"category\" as const, ids: parentKey.instanceKeys.map((key) => key.id), modelIds },\n groupingNode,\n })),\n );\n return focusedItems;\n}\n\nfunction createLocalizedMessage(message: string, onClick?: () => void) {\n const exp = new RegExp(\"<link>(.*)</link>\");\n const match = message.match(exp);\n if (!match) {\n return message;\n }\n\n const [fullText, innerText] = match;\n const [textBefore, textAfter] = message.split(fullText);\n\n return (\n <>\n {textBefore ? textBefore : null}\n <Anchor\n underline\n onClick={(e) => {\n e.stopPropagation();\n onClick?.();\n }}\n >\n {innerText}\n </Anchor>\n {textAfter ? textAfter : null}\n </>\n );\n}\n"]}
@@ -4,7 +4,7 @@
4
4
  *--------------------------------------------------------------------------------------------*/
5
5
  import { concat, concatAll, defer, distinct, EMPTY, firstValueFrom, forkJoin, from, map, merge, mergeMap, of, reduce } from "rxjs";
6
6
  import { assert } from "@itwin/core-bentley";
7
- import { IModelApp, PerModelCategoryVisibility } from "@itwin/core-frontend";
7
+ import { PerModelCategoryVisibility } from "@itwin/core-frontend";
8
8
  import { HierarchyNode, HierarchyNodeIdentifier, HierarchyNodeKey } from "@itwin/presentation-hierarchies";
9
9
  import { toggleAllCategories } from "../../common/CategoriesVisibilityUtils";
10
10
  import { reduceWhile, toVoidPromise } from "../../common/Rxjs";
@@ -301,8 +301,8 @@ class ModelsTreeVisibilityHandlerImpl {
301
301
  }
302
302
  const imodelAccess = this._props.imodelAccess;
303
303
  // Remove all paths such that there are paths to any of the ancestors of the filter target.
304
- filterPaths = reduceFilterPaths(filterPaths);
305
- await Promise.all(filterPaths.map(async (path) => {
304
+ const paths = reduceFilterPaths(filterPaths);
305
+ await Promise.all(paths.map(async (path) => {
306
306
  const target = path[path.length - 1];
307
307
  if (!HierarchyNodeIdentifier.isInstanceNodeIdentifier(target)) {
308
308
  return;
@@ -658,7 +658,8 @@ function setIntersection(lhs, rhs) {
658
658
  lhs.forEach((x) => rhs.has(x) && result.add(x));
659
659
  return result;
660
660
  }
661
- function reduceFilterPaths(paths) {
661
+ function reduceFilterPaths(filteringPaths) {
662
+ let paths = filteringPaths.map((filteringPath) => ("path" in filteringPath ? filteringPath.path : filteringPath));
662
663
  const sorted = [...paths].sort((a, b) => a.length - b.length);
663
664
  paths = [];
664
665
  for (const path of sorted) {
@@ -695,7 +696,7 @@ export async function showAllModels(models, viewport) {
695
696
  await viewport.addViewedModels(models);
696
697
  viewport.clearNeverDrawn();
697
698
  viewport.clearAlwaysDrawn();
698
- await toggleAllCategories(IModelApp.viewManager, viewport.iModel, true, viewport, false);
699
+ await toggleAllCategories(viewport, true);
699
700
  }
700
701
  /**
701
702
  * Disables display of all given models.