@itwin/tree-widget-react 4.0.0-alpha.6 → 4.0.0-alpha.8
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 +22 -1
- package/README.md +2 -1
- package/lib/esm/tree-widget-react/TreeWidget.d.ts +6 -1
- package/lib/esm/tree-widget-react/TreeWidget.js +19 -2
- package/lib/esm/tree-widget-react/TreeWidget.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.d.ts +6 -0
- package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js +22 -23
- package/lib/esm/tree-widget-react/components/TreeWidgetComponentImpl.js.map +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js +4 -4
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.css +2 -0
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.css +1 -0
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.d.ts +12 -4
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js +13 -9
- package/lib/esm/tree-widget-react/components/tree-header/WidgetHeader.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.d.ts +9 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +53 -7
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +17 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +561 -161
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +6 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +46 -117
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +30 -15
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +188 -38
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts +18 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +30 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeVisibilityHandler.d.ts +24 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeVisibilityHandler.js +701 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/FilteredTree.d.ts +39 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/FilteredTree.js +221 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/FilteredTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.d.ts +25 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.js +133 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseFilteredPaths.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseIdsCache.d.ts +8 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseIdsCache.js +48 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/UseIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +5 -17
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +5 -62
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js +11 -5
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyVisibility.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js +13 -11
- package/lib/esm/tree-widget-react/components/trees/common/UseNodeHighlighting.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseTelemetryContext.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/Utils.d.ts +38 -23
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js +65 -47
- package/lib/esm/tree-widget-react/components/trees/common/Utils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js +4 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/BaseTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Delayed.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.css +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +3 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +15 -6
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.d.ts +6 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js +20 -25
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +10 -4
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js +7 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/UseVisibilityButtonHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +12 -11
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.d.ts +44 -0
- package/lib/esm/tree-widget-react/components/trees/{models-tree → common}/internal/AlwaysAndNeverDrawnElementInfo.js +81 -31
- package/lib/esm/tree-widget-react/components/trees/common/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.d.ts +33 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js +37 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ClassNameDefinitions.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.d.ts +16 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js +72 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/ModelCategoryElementsCountCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.d.ts → internal/Rxjs.d.ts} +9 -2
- package/lib/esm/tree-widget-react/components/trees/common/{Rxjs.js → internal/Rxjs.js} +9 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/Rxjs.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{Tooltip.d.ts → internal/Tooltip.d.ts} +4 -8
- package/lib/esm/tree-widget-react/components/trees/common/{Tooltip.js → internal/Tooltip.js} +4 -10
- package/lib/esm/tree-widget-react/components/trees/common/internal/Tooltip.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.d.ts +14 -0
- package/lib/esm/tree-widget-react/components/{tree-header/SearchBox.css → trees/common/internal/Types.js} +2 -4
- package/lib/esm/tree-widget-react/components/trees/common/internal/Types.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseActiveViewport.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.d.ts → internal/UseHierarchiesLocalization.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchiesLocalization.js → internal/UseHierarchiesLocalization.js} +6 -2
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchiesLocalization.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.d.ts → internal/UseHierarchyFiltering.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseHierarchyFiltering.js → internal/UseHierarchyFiltering.js} +4 -3
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseHierarchyFiltering.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.d.ts → internal/UseIModelChangeListener.d.ts} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/{UseIModelChangeListener.js → internal/UseIModelChangeListener.js} +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/UseIModelChangeListener.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.d.ts +47 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js +101 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/Utils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.d.ts +20 -0
- package/lib/esm/tree-widget-react/components/trees/{models-tree → common}/internal/VisibilityChangeEventListener.js +17 -9
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityChangeEventListener.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.d.ts +63 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js +210 -0
- package/lib/esm/tree-widget-react/components/trees/common/internal/VisibilityUtils.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +8 -8
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +4 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +22 -18
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.d.ts +13 -0
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js +39 -38
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.d.ts +5 -5
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js +25 -24
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/internal/IModelContentTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +15 -11
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.d.ts +7 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js +73 -70
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +36 -202
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.d.ts +7 -9
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js +4 -6
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/FilteredTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +4 -5
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +54 -104
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +0 -26
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +80 -359
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.d.ts +27 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.js +170 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseFilteredPaths.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseIdsCache.d.ts +8 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseIdsCache.js +47 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/UseIdsCache.js.map +1 -0
- package/lib/public/locales/en/TreeWidget.json +13 -59
- package/package.json +19 -20
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.d.ts +0 -37
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +0 -214
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.js +0 -11
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/Rxjs.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/Tooltip.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseActiveViewport.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.d.ts +0 -11
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js +0 -24
- package/lib/esm/tree-widget-react/components/trees/common/UseFiltering.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchiesLocalization.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseHierarchyFiltering.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/UseIModelChangeListener.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js +0 -21
- package/lib/esm/tree-widget-react/components/trees/models-tree/Utils.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.d.ts +0 -29
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.d.ts +0 -12
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/VisibilityChangeEventListener.js.map +0 -1
- /package/lib/esm/tree-widget-react/components/trees/common/{UseActiveViewport.d.ts → internal/UseActiveViewport.d.ts} +0 -0
- /package/lib/esm/tree-widget-react/components/trees/common/{UseActiveViewport.js → internal/UseActiveViewport.js} +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { createECSqlQueryExecutor } from "@itwin/presentation-core-interop";
|
|
7
|
+
import { useIModelChangeListener } from "../../common/internal/UseIModelChangeListener.js";
|
|
8
|
+
import { ModelsTreeIdsCache } from "./ModelsTreeIdsCache.js";
|
|
9
|
+
/** @internal */
|
|
10
|
+
export function useIdsCache(imodel, hierarchyConfig) {
|
|
11
|
+
const cacheRef = useRef(undefined);
|
|
12
|
+
const clearCacheRef = useRef(() => {
|
|
13
|
+
cacheRef.current?.[Symbol.dispose]?.();
|
|
14
|
+
cacheRef.current = undefined;
|
|
15
|
+
});
|
|
16
|
+
const createCacheGetterRef = useRef((currImodel, currHierarchyConfig) => {
|
|
17
|
+
return () => {
|
|
18
|
+
if (cacheRef.current === undefined) {
|
|
19
|
+
cacheRef.current = new ModelsTreeIdsCache(createECSqlQueryExecutor(currImodel), currHierarchyConfig);
|
|
20
|
+
}
|
|
21
|
+
return cacheRef.current;
|
|
22
|
+
};
|
|
23
|
+
});
|
|
24
|
+
const [getCache, setCacheGetter] = useState(() => createCacheGetterRef.current(imodel, hierarchyConfig));
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
// clear cache in case it was created before `useEffect` was run first time
|
|
27
|
+
clearCacheRef.current();
|
|
28
|
+
// make sure all cache users rerender
|
|
29
|
+
setCacheGetter(() => createCacheGetterRef.current(imodel, hierarchyConfig));
|
|
30
|
+
return () => {
|
|
31
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
32
|
+
clearCacheRef.current();
|
|
33
|
+
};
|
|
34
|
+
}, [imodel, hierarchyConfig]);
|
|
35
|
+
useIModelChangeListener({
|
|
36
|
+
imodel,
|
|
37
|
+
action: useCallback(() => {
|
|
38
|
+
clearCacheRef.current();
|
|
39
|
+
// make sure all cache users rerender
|
|
40
|
+
setCacheGetter(() => createCacheGetterRef.current(imodel, hierarchyConfig));
|
|
41
|
+
}, [imodel, hierarchyConfig]),
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
getCache,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=UseIdsCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseIdsCache.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/models-tree/internal/UseIdsCache.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AA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E,eAAe,CAAC,CAAC,CAAC;IAE9B,uBAAuB,CAAC;QACtB,MAAM;QACN,MAAM,EAAE,WAAW,CAAC,GAAG,EAAE;YACvB,aAAa,CAAC,OAAO,EAAE,CAAC;YACxB,qCAAqC;YACrC,cAAc,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;QAC9E,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;KAC9B,CAAC,CAAC;IAEH,OAAO;QACL,QAAQ;KACT,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, useRef, useState } from \"react\";\nimport { createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport { useIModelChangeListener } from \"../../common/internal/UseIModelChangeListener.js\";\nimport { ModelsTreeIdsCache } from \"./ModelsTreeIdsCache.js\";\n\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { ModelsTreeHierarchyConfiguration } from \"../ModelsTreeDefinition.js\";\n\n/** @internal */\nexport function useIdsCache(imodel: IModelConnection, hierarchyConfig: ModelsTreeHierarchyConfiguration) {\n const cacheRef = useRef<ModelsTreeIdsCache | undefined>(undefined);\n const clearCacheRef = useRef(() => {\n cacheRef.current?.[Symbol.dispose]?.();\n cacheRef.current = undefined;\n });\n const createCacheGetterRef = useRef((currImodel: IModelConnection, currHierarchyConfig: ModelsTreeHierarchyConfiguration) => {\n return () => {\n if (cacheRef.current === undefined) {\n cacheRef.current = new ModelsTreeIdsCache(createECSqlQueryExecutor(currImodel), currHierarchyConfig);\n }\n return cacheRef.current;\n };\n });\n const [getCache, setCacheGetter] = useState<() => ModelsTreeIdsCache>(() => createCacheGetterRef.current(imodel, hierarchyConfig));\n\n useEffect(() => {\n // clear cache in case it was created before `useEffect` was run first time\n clearCacheRef.current();\n\n // make sure all cache users rerender\n setCacheGetter(() => createCacheGetterRef.current(imodel, hierarchyConfig));\n return () => {\n // eslint-disable-next-line react-hooks/exhaustive-deps\n clearCacheRef.current();\n };\n }, [imodel, hierarchyConfig]);\n\n useIModelChangeListener({\n imodel,\n action: useCallback(() => {\n clearCacheRef.current();\n // make sure all cache users rerender\n setCacheGetter(() => createCacheGetterRef.current(imodel, hierarchyConfig));\n }, [imodel, hierarchyConfig]),\n });\n\n return {\n getCache,\n };\n}\n"]}
|
|
@@ -27,60 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"visibilityTooltips": {
|
|
29
29
|
"status": {
|
|
30
|
-
"visible": "
|
|
31
|
-
"hidden": "
|
|
30
|
+
"visible": "Hide",
|
|
31
|
+
"hidden": "Show",
|
|
32
32
|
"disabled": "Disabled",
|
|
33
|
-
"partial": "
|
|
34
|
-
|
|
35
|
-
"modelsTree": {
|
|
36
|
-
"subject": {
|
|
37
|
-
"nonSpatialView": "Active view is not spatial",
|
|
38
|
-
"allModelsHidden": "All models are hidden",
|
|
39
|
-
"someModelsHidden": "Some models are hidden",
|
|
40
|
-
"allModelsVisible": "All models are visible"
|
|
41
|
-
},
|
|
42
|
-
"model": {
|
|
43
|
-
"nonSpatialView": "Active view is not spatial",
|
|
44
|
-
"hiddenThroughModelSelector": "Model display is hidden through model selector",
|
|
45
|
-
"someCategoriesHidden": "Some categories are visible and some are hidden",
|
|
46
|
-
"allCategoriesVisible": "All categories visible",
|
|
47
|
-
"allCategoriesHidden": "All categories hidden",
|
|
48
|
-
"someSubModelsVisible": "Some sub-models are visible"
|
|
49
|
-
},
|
|
50
|
-
"category": {
|
|
51
|
-
"displayedThroughPerModelOverride": "Per-model category override set to 'Show'",
|
|
52
|
-
"hiddenThroughPerModelOverride": "Per-model category override set to 'Hide'",
|
|
53
|
-
"displayedThroughCategorySelector": "Category display enabled through category selector",
|
|
54
|
-
"hiddenThroughCategorySelector": "Category display disabled through category selector",
|
|
55
|
-
"allElementsHidden": "All category elements are in the never drawn list or none of the category elements are in the exclusive always drawn list",
|
|
56
|
-
"someElementsAreHidden": "There are both visible and hidden elements in this category",
|
|
57
|
-
"allElementsVisible": "All category elements are in the always drawn list",
|
|
58
|
-
"allElementsAndSubModelsHidden": "All elements are hidden",
|
|
59
|
-
"someElementsOrSubModelsHidden": "Some elements are hidden and some are visible",
|
|
60
|
-
"hiddenThroughModel": "Model is hidden",
|
|
61
|
-
"allModeledElementsHidden": "All elements in the category are hidden",
|
|
62
|
-
"someModeledElementsHidden": "There are both visible and hidden elements in this category"
|
|
63
|
-
},
|
|
64
|
-
"element": {
|
|
65
|
-
"hiddenThroughNeverDrawnList": "Element(s) in \"never drawn\" list",
|
|
66
|
-
"displayedThroughAlwaysDrawnList": "Element(s) in \"always drawn\" list",
|
|
67
|
-
"hiddenDueToOtherElementsExclusivelyAlwaysDrawn": "Other elements in \"exclusively always drawn\" list",
|
|
68
|
-
"hiddenThroughModel": "Model is not displayed",
|
|
69
|
-
"hiddenThroughCategory": "Category is not displayed",
|
|
70
|
-
"someElementsAreHidden": "Modeled elements subModel has partial state",
|
|
71
|
-
"partialThroughSubModel": "Modeled element is hidden, but its subModel is visible",
|
|
72
|
-
"partialThroughElement": "Modeled element is visible due to override, but its subModel is hidden",
|
|
73
|
-
"partialThroughCategory": "Modeled element is visible due to category visibility, but its subModel is hidden"
|
|
74
|
-
},
|
|
75
|
-
"groupingNode": {
|
|
76
|
-
"allElementsHidden": "All elements are in the never drawn list or none of the elements are in the exclusive always drawn list",
|
|
77
|
-
"someElementsAreHidden": "There are both visible and hidden elements",
|
|
78
|
-
"allElementsVisible": "All elements are in the always drawn list",
|
|
79
|
-
"visibleThroughCategory": "All elements are visible through category",
|
|
80
|
-
"hiddenThroughCategory": "All elements are hidden through category",
|
|
81
|
-
"allElementsAndSubModelsHidden": "All elements are hidden",
|
|
82
|
-
"someElementsOrSubModelsHidden": "There are both visible and hidden elements"
|
|
83
|
-
}
|
|
33
|
+
"partial": "Show",
|
|
34
|
+
"determining": "Determining visibility..."
|
|
84
35
|
}
|
|
85
36
|
},
|
|
86
37
|
"categoriesTree": {
|
|
@@ -166,12 +117,15 @@
|
|
|
166
117
|
"other": "Other",
|
|
167
118
|
"loading": "Loading...",
|
|
168
119
|
"filterHierarchyLevel": "Apply filter",
|
|
169
|
-
"
|
|
170
|
-
"
|
|
171
|
-
"
|
|
172
|
-
"
|
|
173
|
-
"
|
|
174
|
-
"
|
|
120
|
+
"filterHierarchyLevelActiveDescription": "Filter is applied",
|
|
121
|
+
"noFilteredChildrenChangeFilter": "Change filter",
|
|
122
|
+
"failedToCreateHierarchy": "Failed to create hierarchy for {{node}}.",
|
|
123
|
+
"clearHierarchyLevelFilter": "Clear active filter.",
|
|
124
|
+
"noFilteredChildren": "No matches for current filter for {{node}}.",
|
|
125
|
+
"resultLimitExceeded": "The hierarchy for {{node}} contains {{limit}}+ items. Try using filters or increase the limit.",
|
|
126
|
+
"issuesFound": "issue(s) found",
|
|
127
|
+
"increaseHierarchyLimit": "Increase limit to {{limit}}",
|
|
128
|
+
"increaseHierarchyLimitWithFiltering": "Add Filter",
|
|
175
129
|
"retry": "Retry"
|
|
176
130
|
}
|
|
177
131
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/tree-widget-react",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.8",
|
|
4
4
|
"description": "Tree Widget React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Bentley",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
"./package.json": "./package.json"
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
|
-
"build": "npm run -s
|
|
30
|
-
"dual-build": "npm run -s build:esm",
|
|
29
|
+
"build": "npm run -s build:esm && npm run -s copy:assets",
|
|
31
30
|
"build:esm": "tsc 1>&2 -p tsconfig.esm.json",
|
|
32
31
|
"copy:assets": "npm run -s copy:public && npm run -s copy:esm",
|
|
33
32
|
"copy:public": "cpx \"./public/**/*\" ./lib/public",
|
|
34
33
|
"copy:esm": "cpx \"./src/**/*.{css,scss,json}\" ./lib/esm",
|
|
34
|
+
"cover": "c8 npm run test",
|
|
35
35
|
"extract-api": "betools extract-api --entry=lib/esm/tree-widget-react --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api --includeUnexportedApis",
|
|
36
36
|
"check-internal": "node ../../../scripts/checkInternal.js --apiSummary ./api/tree-widget-react.api.md",
|
|
37
37
|
"lint": "npm run lint:eslint && npm run lint:stylelint",
|
|
@@ -39,6 +39,8 @@
|
|
|
39
39
|
"lint:stylelint": "stylelint \"./src/**/*.css\"",
|
|
40
40
|
"lint:fix": "npm run lint:eslint -- --fix && npm run lint:stylelint -- --fix",
|
|
41
41
|
"pseudolocalize": "betools pseudolocalize --englishDir ./public/locales/en --out ./lib/public/locales/en-PSEUDO",
|
|
42
|
+
"test:dev": "node --experimental-test-module-mocks --enable-source-maps --import ../../../node-hooks/ignore-styles/register.cjs ./node_modules/mocha/bin/mocha.js --config ./.mocharc.json",
|
|
43
|
+
"test": "npm run test:dev -- --parallel --jobs=4",
|
|
42
44
|
"test:e2e": "node ../../../scripts/run-e2e-with-docker.js tree-widget",
|
|
43
45
|
"test:e2e:local": "node ../../../scripts/run-e2e-tests.js",
|
|
44
46
|
"test:e2e:debug": "cross-env PWDEBUG=1 playwright test --ui",
|
|
@@ -53,8 +55,8 @@
|
|
|
53
55
|
"@itwin/components-react": "^4.10.0 || ^5.0.0",
|
|
54
56
|
"@itwin/core-frontend": "^4.0.0",
|
|
55
57
|
"@itwin/ecschema-metadata": "^4.0.0",
|
|
56
|
-
"@itwin/itwinui-react": "5.0.0-alpha.
|
|
57
|
-
"@itwin/itwinui-icons": "5.0.0-alpha.
|
|
58
|
+
"@itwin/itwinui-react": "5.0.0-alpha.14",
|
|
59
|
+
"@itwin/itwinui-icons": "5.0.0-alpha.7",
|
|
58
60
|
"@itwin/presentation-components": "^5.0.0",
|
|
59
61
|
"react": "^17.0.0 || ^18.0.0",
|
|
60
62
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
@@ -62,7 +64,7 @@
|
|
|
62
64
|
"dependencies": {
|
|
63
65
|
"@itwin/presentation-core-interop": "^1.3.0",
|
|
64
66
|
"@itwin/presentation-hierarchies": "^1.4.1",
|
|
65
|
-
"@itwin/presentation-hierarchies-react": "2.0.0-alpha.
|
|
67
|
+
"@itwin/presentation-hierarchies-react": "2.0.0-alpha.16",
|
|
66
68
|
"@itwin/presentation-shared": "^1.2.0",
|
|
67
69
|
"@itwin/unified-selection": "^1.3.0",
|
|
68
70
|
"classnames": "^2.5.1",
|
|
@@ -90,8 +92,8 @@
|
|
|
90
92
|
"@itwin/ecschema-rpcinterface-impl": "^4.10.2",
|
|
91
93
|
"@itwin/eslint-plugin": "^4.1.1",
|
|
92
94
|
"@itwin/imodel-components-react": "^5.0.5",
|
|
93
|
-
"@itwin/itwinui-react": "5.0.0-alpha.
|
|
94
|
-
"@itwin/itwinui-icons": "5.0.0-alpha.
|
|
95
|
+
"@itwin/itwinui-react": "5.0.0-alpha.14",
|
|
96
|
+
"@itwin/itwinui-icons": "5.0.0-alpha.7",
|
|
95
97
|
"@itwin/oidc-signin-tool": "^4.4.0",
|
|
96
98
|
"@itwin/presentation-backend": "^4.10.2",
|
|
97
99
|
"@itwin/presentation-common": "^4.10.2",
|
|
@@ -102,15 +104,14 @@
|
|
|
102
104
|
"@playwright/test": "^1.48.2",
|
|
103
105
|
"@testing-library/dom": "^10.4.0",
|
|
104
106
|
"@testing-library/react": "^16.2.0",
|
|
105
|
-
"@testing-library/user-event": "^14.6.
|
|
106
|
-
"@types/chai": "^
|
|
107
|
+
"@testing-library/user-event": "^14.6.1",
|
|
108
|
+
"@types/chai": "^5.2.1",
|
|
107
109
|
"@types/chai-as-promised": "^8.0.1",
|
|
108
110
|
"@types/chai-jest-snapshot": "^1.3.8",
|
|
109
|
-
"@types/chai-subset": "^1.3.5",
|
|
110
111
|
"@types/deep-equal": "^1.0.1",
|
|
111
|
-
"@types/jsdom": "^21.1.
|
|
112
|
+
"@types/jsdom": "^21.1.7",
|
|
112
113
|
"@types/mocha": "^10.0.10",
|
|
113
|
-
"@types/node": "^
|
|
114
|
+
"@types/node": "^22.13.9",
|
|
114
115
|
"@types/react": "^18.3.3",
|
|
115
116
|
"@types/react-dom": "^18.3.0",
|
|
116
117
|
"@types/sinon": "^17.0.3",
|
|
@@ -118,10 +119,9 @@
|
|
|
118
119
|
"@typescript-eslint/eslint-plugin": "^7.16.1",
|
|
119
120
|
"@typescript-eslint/parser": "^7.16.1",
|
|
120
121
|
"c8": "^10.1.3",
|
|
121
|
-
"chai": "^
|
|
122
|
+
"chai": "^5.2.0",
|
|
122
123
|
"chai-as-promised": "^8.0.1",
|
|
123
124
|
"chai-jest-snapshot": "^2.0.0",
|
|
124
|
-
"chai-subset": "^1.6.0",
|
|
125
125
|
"cpx2": "^3.0.0",
|
|
126
126
|
"cross-env": "^7.0.3",
|
|
127
127
|
"deep-equal": "^1.0.0",
|
|
@@ -132,11 +132,11 @@
|
|
|
132
132
|
"eslint-plugin-react": "^7.34.4",
|
|
133
133
|
"eslint-plugin-unused-imports": "^3.2.0",
|
|
134
134
|
"fast-xml-parser": "^4.3.6",
|
|
135
|
-
"global-jsdom": "^
|
|
135
|
+
"global-jsdom": "^26.0.0",
|
|
136
136
|
"http-server": "^14.1.1",
|
|
137
137
|
"ignore-styles": "^5.0.1",
|
|
138
|
-
"jsdom": "^
|
|
139
|
-
"mocha": "^11.0
|
|
138
|
+
"jsdom": "^26.0.0",
|
|
139
|
+
"mocha": "^11.1.0",
|
|
140
140
|
"postcss": "^8.4.32",
|
|
141
141
|
"raf": "^3.4.0",
|
|
142
142
|
"react": "^18.3.1",
|
|
@@ -145,10 +145,9 @@
|
|
|
145
145
|
"redux": "^4.1.0",
|
|
146
146
|
"rimraf": "^6.0.1",
|
|
147
147
|
"sinon": "^19.0.2",
|
|
148
|
-
"sinon-chai": "^
|
|
148
|
+
"sinon-chai": "^4.0.0",
|
|
149
149
|
"stylelint": "^15.11.0",
|
|
150
150
|
"stylelint-config-standard-scss": "^11.1.0",
|
|
151
|
-
"testdouble": "^3.20.2",
|
|
152
151
|
"typemoq": "^2.1.0",
|
|
153
152
|
"typescript": "~5.2.0"
|
|
154
153
|
},
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { BeEvent } from "@itwin/core-bentley";
|
|
2
|
-
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
3
|
-
import type { Viewport } from "@itwin/core-frontend";
|
|
4
|
-
import type { HierarchyVisibilityHandler, VisibilityStatus } from "../../common/UseHierarchyVisibility.js";
|
|
5
|
-
import type { CategoriesTreeIdsCache } from "./CategoriesTreeIdsCache.js";
|
|
6
|
-
/** @internal */
|
|
7
|
-
export interface CategoriesVisibilityHandlerProps {
|
|
8
|
-
viewport: Viewport;
|
|
9
|
-
idsCache: CategoriesTreeIdsCache;
|
|
10
|
-
}
|
|
11
|
-
/** @internal */
|
|
12
|
-
export declare class CategoriesVisibilityHandler implements HierarchyVisibilityHandler {
|
|
13
|
-
private _pendingVisibilityChange;
|
|
14
|
-
private _viewport;
|
|
15
|
-
private _idsCache;
|
|
16
|
-
constructor(props: CategoriesVisibilityHandlerProps);
|
|
17
|
-
dispose(): void;
|
|
18
|
-
[Symbol.dispose](): void;
|
|
19
|
-
onVisibilityChange: BeEvent<import("@itwin/core-bentley").Listener>;
|
|
20
|
-
/** Returns visibility status of the tree node. */
|
|
21
|
-
getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus>;
|
|
22
|
-
changeVisibility(node: HierarchyNode, on: boolean): Promise<void>;
|
|
23
|
-
private getSubCategoryVisibility;
|
|
24
|
-
private getDefinitionContainerVisibility;
|
|
25
|
-
private getCategoriesVisibility;
|
|
26
|
-
private getCategoryVisibilityFromOverrides;
|
|
27
|
-
private changeSubCategoryVisibility;
|
|
28
|
-
private changeCategoryVisibility;
|
|
29
|
-
private changeDefinitionContainerVisibility;
|
|
30
|
-
private onDisplayStyleChanged;
|
|
31
|
-
private onViewedCategoriesChanged;
|
|
32
|
-
private onVisibilityChangeInternal;
|
|
33
|
-
private static getInstanceIdsFromHierarchyNode;
|
|
34
|
-
private changeCategoryState;
|
|
35
|
-
private changeSubCategoryState;
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=CategoriesVisibilityHandler.d.ts.map
|
|
@@ -1,214 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
import { BeEvent } from "@itwin/core-bentley";
|
|
6
|
-
import { HierarchyNode } from "@itwin/presentation-hierarchies";
|
|
7
|
-
import { enableCategoryDisplay, enableSubCategoryDisplay } from "../../common/CategoriesVisibilityUtils.js";
|
|
8
|
-
import { createVisibilityStatus } from "../../common/Tooltip.js";
|
|
9
|
-
import { CategoriesTreeNode } from "./CategoriesTreeNode.js";
|
|
10
|
-
/** @internal */
|
|
11
|
-
export class CategoriesVisibilityHandler {
|
|
12
|
-
constructor(props) {
|
|
13
|
-
this.onVisibilityChange = new BeEvent();
|
|
14
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
15
|
-
this.onDisplayStyleChanged = () => {
|
|
16
|
-
this.onVisibilityChangeInternal();
|
|
17
|
-
};
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
19
|
-
this.onViewedCategoriesChanged = () => {
|
|
20
|
-
this.onVisibilityChangeInternal();
|
|
21
|
-
};
|
|
22
|
-
this._idsCache = props.idsCache;
|
|
23
|
-
this._viewport = props.viewport;
|
|
24
|
-
this._viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);
|
|
25
|
-
this._viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);
|
|
26
|
-
}
|
|
27
|
-
dispose() {
|
|
28
|
-
this[Symbol.dispose]();
|
|
29
|
-
}
|
|
30
|
-
[Symbol.dispose]() {
|
|
31
|
-
this._viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);
|
|
32
|
-
this._viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);
|
|
33
|
-
clearTimeout(this._pendingVisibilityChange);
|
|
34
|
-
}
|
|
35
|
-
/** Returns visibility status of the tree node. */
|
|
36
|
-
async getVisibilityStatus(node) {
|
|
37
|
-
if (!HierarchyNode.isInstancesNode(node)) {
|
|
38
|
-
return { state: "hidden", isDisabled: true };
|
|
39
|
-
}
|
|
40
|
-
if (CategoriesTreeNode.isSubCategoryNode(node)) {
|
|
41
|
-
return createVisibilityStatus(this.getSubCategoryVisibility(node));
|
|
42
|
-
}
|
|
43
|
-
if (CategoriesTreeNode.isCategoryNode(node)) {
|
|
44
|
-
return createVisibilityStatus(await this.getCategoriesVisibility(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node)));
|
|
45
|
-
}
|
|
46
|
-
if (CategoriesTreeNode.isDefinitionContainerNode(node)) {
|
|
47
|
-
return createVisibilityStatus(await this.getDefinitionContainerVisibility(node));
|
|
48
|
-
}
|
|
49
|
-
return { state: "hidden", isDisabled: true };
|
|
50
|
-
}
|
|
51
|
-
async changeVisibility(node, on) {
|
|
52
|
-
if (!HierarchyNode.isInstancesNode(node)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
if (CategoriesTreeNode.isCategoryNode(node)) {
|
|
56
|
-
return this.changeCategoryVisibility(node, on);
|
|
57
|
-
}
|
|
58
|
-
if (CategoriesTreeNode.isSubCategoryNode(node)) {
|
|
59
|
-
return this.changeSubCategoryVisibility(node, on);
|
|
60
|
-
}
|
|
61
|
-
if (CategoriesTreeNode.isDefinitionContainerNode(node)) {
|
|
62
|
-
return this.changeDefinitionContainerVisibility(node, on);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
getSubCategoryVisibility(node) {
|
|
66
|
-
const parentCategoryId = node.extendedData?.categoryId;
|
|
67
|
-
if (!parentCategoryId) {
|
|
68
|
-
return "hidden";
|
|
69
|
-
}
|
|
70
|
-
const categoryOverrideResult = this.getCategoryVisibilityFromOverrides(parentCategoryId);
|
|
71
|
-
if (categoryOverrideResult === "hidden" || categoryOverrideResult === "visible") {
|
|
72
|
-
return categoryOverrideResult;
|
|
73
|
-
}
|
|
74
|
-
if (!this._viewport.view.viewsCategory(parentCategoryId)) {
|
|
75
|
-
return "hidden";
|
|
76
|
-
}
|
|
77
|
-
const subCategoryIds = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);
|
|
78
|
-
let visibleCount = 0;
|
|
79
|
-
let hiddenCount = 0;
|
|
80
|
-
for (const subCategoryId of subCategoryIds) {
|
|
81
|
-
const isVisible = this._viewport.isSubCategoryVisible(subCategoryId);
|
|
82
|
-
if (isVisible) {
|
|
83
|
-
++visibleCount;
|
|
84
|
-
}
|
|
85
|
-
else {
|
|
86
|
-
++hiddenCount;
|
|
87
|
-
}
|
|
88
|
-
if (visibleCount > 0 && hiddenCount > 0) {
|
|
89
|
-
return "partial";
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return visibleCount > 0 ? "visible" : "hidden";
|
|
93
|
-
}
|
|
94
|
-
async getDefinitionContainerVisibility(node) {
|
|
95
|
-
const childrenResult = await this._idsCache.getAllContainedCategories(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node));
|
|
96
|
-
let hiddenCount = 0;
|
|
97
|
-
let visibleCount = 0;
|
|
98
|
-
for (const categoryId of childrenResult) {
|
|
99
|
-
const categoryVisibility = await this.getCategoriesVisibility([categoryId]);
|
|
100
|
-
if (categoryVisibility === "partial") {
|
|
101
|
-
return "partial";
|
|
102
|
-
}
|
|
103
|
-
if (categoryVisibility === "hidden") {
|
|
104
|
-
++hiddenCount;
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
++visibleCount;
|
|
108
|
-
}
|
|
109
|
-
if (hiddenCount > 0 && visibleCount > 0) {
|
|
110
|
-
return "partial";
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
return hiddenCount > 0 ? "hidden" : "visible";
|
|
114
|
-
}
|
|
115
|
-
async getCategoriesVisibility(categoryIds) {
|
|
116
|
-
const overrideResult = this.getCategoryVisibilityFromOverrides(categoryIds);
|
|
117
|
-
if (overrideResult !== "none") {
|
|
118
|
-
return overrideResult;
|
|
119
|
-
}
|
|
120
|
-
let visibleCount = 0;
|
|
121
|
-
let hiddenCount = 0;
|
|
122
|
-
for (const categoryId of categoryIds) {
|
|
123
|
-
const isVisible = this._viewport.view.viewsCategory(categoryId);
|
|
124
|
-
if (isVisible) {
|
|
125
|
-
++visibleCount;
|
|
126
|
-
}
|
|
127
|
-
else {
|
|
128
|
-
++hiddenCount;
|
|
129
|
-
}
|
|
130
|
-
if (visibleCount > 0 && hiddenCount > 0) {
|
|
131
|
-
return "partial";
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
if (hiddenCount > 0) {
|
|
135
|
-
return "hidden";
|
|
136
|
-
}
|
|
137
|
-
const subCategories = (await Promise.all(categoryIds.map(async (id) => this._idsCache.getSubCategories(id)))).reduce((acc, val) => acc.concat(val), []);
|
|
138
|
-
let visibleSubCategoryCount = 0;
|
|
139
|
-
let hiddenSubCategoryCount = 0;
|
|
140
|
-
for (const subCategory of subCategories) {
|
|
141
|
-
const isVisible = this._viewport.isSubCategoryVisible(subCategory);
|
|
142
|
-
if (isVisible) {
|
|
143
|
-
++visibleSubCategoryCount;
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
++hiddenSubCategoryCount;
|
|
147
|
-
}
|
|
148
|
-
if (hiddenSubCategoryCount > 0 && visibleSubCategoryCount > 0) {
|
|
149
|
-
return "partial";
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
return hiddenSubCategoryCount > 0 ? "hidden" : "visible";
|
|
153
|
-
}
|
|
154
|
-
getCategoryVisibilityFromOverrides(categoryIds) {
|
|
155
|
-
let showOverrides = 0;
|
|
156
|
-
let hideOverrides = 0;
|
|
157
|
-
for (const currentOverride of this._viewport.perModelCategoryVisibility) {
|
|
158
|
-
if (categoryIds.includes(currentOverride.categoryId)) {
|
|
159
|
-
if (currentOverride.visible) {
|
|
160
|
-
++showOverrides;
|
|
161
|
-
}
|
|
162
|
-
else {
|
|
163
|
-
++hideOverrides;
|
|
164
|
-
}
|
|
165
|
-
if (showOverrides > 0 && hideOverrides > 0) {
|
|
166
|
-
return "partial";
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
if (showOverrides === 0 && hideOverrides === 0) {
|
|
171
|
-
return "none";
|
|
172
|
-
}
|
|
173
|
-
return showOverrides > 0 ? "visible" : "hidden";
|
|
174
|
-
}
|
|
175
|
-
async changeSubCategoryVisibility(node, on) {
|
|
176
|
-
const parentCategoryId = node.extendedData?.categoryId;
|
|
177
|
-
// make sure parent category is enabled
|
|
178
|
-
if (on && parentCategoryId) {
|
|
179
|
-
await this.changeCategoryState([parentCategoryId], true, false);
|
|
180
|
-
}
|
|
181
|
-
const subCategoryIds = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);
|
|
182
|
-
subCategoryIds.forEach((id) => {
|
|
183
|
-
this.changeSubCategoryState(id, on);
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
async changeCategoryVisibility(node, on) {
|
|
187
|
-
const categoryIds = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);
|
|
188
|
-
return this.changeCategoryState(categoryIds, on, on);
|
|
189
|
-
}
|
|
190
|
-
async changeDefinitionContainerVisibility(node, on) {
|
|
191
|
-
const definitionContainerId = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);
|
|
192
|
-
const childCategories = await this._idsCache.getAllContainedCategories(definitionContainerId);
|
|
193
|
-
return this.changeCategoryState(childCategories, on, on);
|
|
194
|
-
}
|
|
195
|
-
onVisibilityChangeInternal() {
|
|
196
|
-
if (this._pendingVisibilityChange) {
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
this._pendingVisibilityChange = setTimeout(() => {
|
|
200
|
-
this.onVisibilityChange.raiseEvent();
|
|
201
|
-
this._pendingVisibilityChange = undefined;
|
|
202
|
-
}, 0);
|
|
203
|
-
}
|
|
204
|
-
static getInstanceIdsFromHierarchyNode(node) {
|
|
205
|
-
return HierarchyNode.isInstancesNode(node) ? node.key.instanceKeys.map((instanceKey) => instanceKey.id) : /* istanbul ignore next */ [];
|
|
206
|
-
}
|
|
207
|
-
async changeCategoryState(ids, enabled, enableAllSubCategories) {
|
|
208
|
-
await enableCategoryDisplay(this._viewport, ids, enabled, enableAllSubCategories);
|
|
209
|
-
}
|
|
210
|
-
changeSubCategoryState(key, enabled) {
|
|
211
|
-
enableSubCategoryDisplay(this._viewport, key, enabled);
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
//# sourceMappingURL=CategoriesVisibilityHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesVisibilityHandler.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,qBAAqB,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC5G,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAa7D,gBAAgB;AAChB,MAAM,OAAO,2BAA2B;I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I,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,0BAA0B,CAAC,EAAE,CAAC;IAC1I,CAAC;IAEO,KAAK,CAAC,mBAAmB,CAAC,GAAa,EAAE,OAAgB,EAAE,sBAA+B;QAChG,MAAM,qBAAqB,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,EAAE,sBAAsB,CAAC,CAAC;IACpF,CAAC;IAEO,sBAAsB,CAAC,GAAW,EAAE,OAAgB;QAC1D,wBAAwB,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;CACF","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 { BeEvent } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { enableCategoryDisplay, enableSubCategoryDisplay } from \"../../common/CategoriesVisibilityUtils.js\";\nimport { createVisibilityStatus } from \"../../common/Tooltip.js\";\nimport { CategoriesTreeNode } from \"./CategoriesTreeNode.js\";\n\nimport type { Id64Array } from \"@itwin/core-bentley\";\nimport type { Viewport } from \"@itwin/core-frontend\";\nimport type { HierarchyVisibilityHandler, VisibilityStatus } from \"../../common/UseHierarchyVisibility.js\";\nimport type { CategoriesTreeIdsCache } from \"./CategoriesTreeIdsCache.js\";\n\n/** @internal */\nexport interface CategoriesVisibilityHandlerProps {\n viewport: Viewport;\n idsCache: CategoriesTreeIdsCache;\n}\n\n/** @internal */\nexport class CategoriesVisibilityHandler implements HierarchyVisibilityHandler {\n private _pendingVisibilityChange: any;\n private _viewport: Viewport;\n private _idsCache: CategoriesTreeIdsCache;\n\n constructor(props: CategoriesVisibilityHandlerProps) {\n this._idsCache = props.idsCache;\n this._viewport = props.viewport;\n this._viewport.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);\n }\n\n public dispose() {\n this[Symbol.dispose]();\n }\n\n public [Symbol.dispose]() {\n this._viewport.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);\n this._viewport.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);\n clearTimeout(this._pendingVisibilityChange);\n }\n\n public onVisibilityChange = new BeEvent();\n\n /** Returns visibility status of the tree node. */\n public async getVisibilityStatus(node: HierarchyNode): Promise<VisibilityStatus> {\n if (!HierarchyNode.isInstancesNode(node)) {\n return { state: \"hidden\", isDisabled: true };\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n return createVisibilityStatus(this.getSubCategoryVisibility(node));\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return createVisibilityStatus(await this.getCategoriesVisibility(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node)));\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return createVisibilityStatus(await this.getDefinitionContainerVisibility(node));\n }\n\n return { state: \"hidden\", isDisabled: true };\n }\n\n public async changeVisibility(node: HierarchyNode, on: boolean) {\n if (!HierarchyNode.isInstancesNode(node)) {\n return;\n }\n\n if (CategoriesTreeNode.isCategoryNode(node)) {\n return this.changeCategoryVisibility(node, on);\n }\n\n if (CategoriesTreeNode.isSubCategoryNode(node)) {\n return this.changeSubCategoryVisibility(node, on);\n }\n\n if (CategoriesTreeNode.isDefinitionContainerNode(node)) {\n return this.changeDefinitionContainerVisibility(node, on);\n }\n }\n\n private getSubCategoryVisibility(node: HierarchyNode): VisibilityStatus[\"state\"] {\n const parentCategoryId = node.extendedData?.categoryId;\n if (!parentCategoryId) {\n return \"hidden\";\n }\n\n const categoryOverrideResult = this.getCategoryVisibilityFromOverrides(parentCategoryId);\n if (categoryOverrideResult === \"hidden\" || categoryOverrideResult === \"visible\") {\n return categoryOverrideResult;\n }\n\n if (!this._viewport.view.viewsCategory(parentCategoryId)) {\n return \"hidden\";\n }\n const subCategoryIds = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);\n let visibleCount = 0;\n let hiddenCount = 0;\n for (const subCategoryId of subCategoryIds) {\n const isVisible = this._viewport.isSubCategoryVisible(subCategoryId);\n if (isVisible) {\n ++visibleCount;\n } else {\n ++hiddenCount;\n }\n if (visibleCount > 0 && hiddenCount > 0) {\n return \"partial\";\n }\n }\n return visibleCount > 0 ? \"visible\" : \"hidden\";\n }\n\n private async getDefinitionContainerVisibility(node: HierarchyNode): Promise<VisibilityStatus[\"state\"]> {\n const childrenResult = await this._idsCache.getAllContainedCategories(CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node));\n let hiddenCount = 0;\n let visibleCount = 0;\n for (const categoryId of childrenResult) {\n const categoryVisibility = await this.getCategoriesVisibility([categoryId]);\n if (categoryVisibility === \"partial\") {\n return \"partial\";\n }\n\n if (categoryVisibility === \"hidden\") {\n ++hiddenCount;\n } else {\n ++visibleCount;\n }\n\n if (hiddenCount > 0 && visibleCount > 0) {\n return \"partial\";\n }\n }\n\n return hiddenCount > 0 ? \"hidden\" : \"visible\";\n }\n\n private async getCategoriesVisibility(categoryIds: Id64Array): Promise<VisibilityStatus[\"state\"]> {\n const overrideResult = this.getCategoryVisibilityFromOverrides(categoryIds);\n if (overrideResult !== \"none\") {\n return overrideResult;\n }\n let visibleCount = 0;\n let hiddenCount = 0;\n for (const categoryId of categoryIds) {\n const isVisible = this._viewport.view.viewsCategory(categoryId);\n if (isVisible) {\n ++visibleCount;\n } else {\n ++hiddenCount;\n }\n if (visibleCount > 0 && hiddenCount > 0) {\n return \"partial\";\n }\n }\n\n if (hiddenCount > 0) {\n return \"hidden\";\n }\n\n const subCategories = (await Promise.all(categoryIds.map(async (id) => this._idsCache.getSubCategories(id)))).reduce((acc, val) => acc.concat(val), []);\n let visibleSubCategoryCount = 0;\n let hiddenSubCategoryCount = 0;\n\n for (const subCategory of subCategories) {\n const isVisible = this._viewport.isSubCategoryVisible(subCategory);\n if (isVisible) {\n ++visibleSubCategoryCount;\n } else {\n ++hiddenSubCategoryCount;\n }\n if (hiddenSubCategoryCount > 0 && visibleSubCategoryCount > 0) {\n return \"partial\";\n }\n }\n\n return hiddenSubCategoryCount > 0 ? \"hidden\" : \"visible\";\n }\n\n private getCategoryVisibilityFromOverrides(categoryIds: Id64Array): VisibilityStatus[\"state\"] | \"none\" {\n let showOverrides = 0;\n let hideOverrides = 0;\n\n for (const currentOverride of this._viewport.perModelCategoryVisibility) {\n if (categoryIds.includes(currentOverride.categoryId)) {\n if (currentOverride.visible) {\n ++showOverrides;\n } else {\n ++hideOverrides;\n }\n\n if (showOverrides > 0 && hideOverrides > 0) {\n return \"partial\";\n }\n }\n }\n\n if (showOverrides === 0 && hideOverrides === 0) {\n return \"none\";\n }\n\n return showOverrides > 0 ? \"visible\" : \"hidden\";\n }\n\n private async changeSubCategoryVisibility(node: HierarchyNode, on: boolean) {\n const parentCategoryId = node.extendedData?.categoryId;\n\n // make sure parent category is enabled\n if (on && parentCategoryId) {\n await this.changeCategoryState([parentCategoryId], true, false);\n }\n\n const subCategoryIds = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);\n subCategoryIds.forEach((id) => {\n this.changeSubCategoryState(id, on);\n });\n }\n\n private async changeCategoryVisibility(node: HierarchyNode, on: boolean) {\n const categoryIds = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);\n return this.changeCategoryState(categoryIds, on, on);\n }\n\n private async changeDefinitionContainerVisibility(node: HierarchyNode, on: boolean) {\n const definitionContainerId = CategoriesVisibilityHandler.getInstanceIdsFromHierarchyNode(node);\n const childCategories = await this._idsCache.getAllContainedCategories(definitionContainerId);\n return this.changeCategoryState(childCategories, on, on);\n }\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onDisplayStyleChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n // eslint-disable-next-line @typescript-eslint/naming-convention\n private onViewedCategoriesChanged = () => {\n this.onVisibilityChangeInternal();\n };\n\n private onVisibilityChangeInternal() {\n if (this._pendingVisibilityChange) {\n return;\n }\n\n this._pendingVisibilityChange = setTimeout(() => {\n this.onVisibilityChange.raiseEvent();\n this._pendingVisibilityChange = undefined;\n }, 0);\n }\n\n private static getInstanceIdsFromHierarchyNode(node: HierarchyNode) {\n return HierarchyNode.isInstancesNode(node) ? node.key.instanceKeys.map((instanceKey) => instanceKey.id) : /* istanbul ignore next */ [];\n }\n\n private async changeCategoryState(ids: string[], enabled: boolean, enableAllSubCategories: boolean) {\n await enableCategoryDisplay(this._viewport, ids, enabled, enableAllSubCategories);\n }\n\n private changeSubCategoryState(key: string, enabled: boolean) {\n enableSubCategoryDisplay(this._viewport, key, enabled);\n }\n}\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/** @internal */
|
|
2
|
-
export declare const SUB_CATEGORY_CLASS = "BisCore.SubCategory";
|
|
3
|
-
/** @internal */
|
|
4
|
-
export declare const DEFINITION_CONTAINER_CLASS = "BisCore.DefinitionContainer";
|
|
5
|
-
/** @internal */
|
|
6
|
-
export declare const DEFINITION_ELEMENT_CLASS = "BisCore.DefinitionElement";
|
|
7
|
-
//# sourceMappingURL=ClassNameDefinitions.d.ts.map
|
package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
/** @internal */
|
|
6
|
-
export const SUB_CATEGORY_CLASS = "BisCore.SubCategory";
|
|
7
|
-
/** @internal */
|
|
8
|
-
export const DEFINITION_CONTAINER_CLASS = "BisCore.DefinitionContainer";
|
|
9
|
-
/** @internal */
|
|
10
|
-
export const DEFINITION_ELEMENT_CLASS = "BisCore.DefinitionElement";
|
|
11
|
-
//# sourceMappingURL=ClassNameDefinitions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ClassNameDefinitions.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,gBAAgB;AAChB,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAExD,gBAAgB;AAChB,MAAM,CAAC,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AAExE,gBAAgB;AAChB,MAAM,CAAC,MAAM,wBAAwB,GAAG,2BAA2B,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\n/** @internal */\nexport const SUB_CATEGORY_CLASS = \"BisCore.SubCategory\";\n\n/** @internal */\nexport const DEFINITION_CONTAINER_CLASS = \"BisCore.DefinitionContainer\";\n\n/** @internal */\nexport const DEFINITION_ELEMENT_CLASS = \"BisCore.DefinitionElement\";\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Rxjs.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/Rxjs.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAInE;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,SAAuC,EACvC,UAA4D,EAC5D,OAAqB;IAErB,OAAO,CAAC,GAAG,EAAE,EAAE;QACb,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,EAAE,IAAI,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5G,CAAC,CAAC;AACJ,CAAC;AAED,wFAAwF;AACxF,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,GAAoB;IACtD,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,GAAG,CAAC,SAAS,CAAC;YACZ,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,EAAE;YACzB,KAAK,EAAE,MAAM;SACd,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,6CAA6C;AAC7C,MAAM,CAAC,KAAK,UAAU,OAAO,CAAI,GAAuB;IACtD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,GAAG,GAAG,IAAI,KAAK,EAAK,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;YAClB,IAAI,CAAC,IAAO;gBACV,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjB,CAAC;YACD,QAAQ;gBACN,OAAO,CAAC,GAAG,CAAC,CAAC;YACf,CAAC;YACD,KAAK,CAAC,MAAM;gBACV,MAAM,CAAC,MAAM,CAAC,CAAC;YACjB,CAAC;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,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 { defaultIfEmpty, from, last, scan, takeWhile } from \"rxjs\";\n\nimport type { Observable, ObservableInput, OperatorFunction } from \"rxjs\";\n\n/**\n * Applies reduce function and \"returns\" early if the predicate returns `false` for the accumulator.\n */\nexport function reduceWhile<TValue, TAccumulator>(\n predicate: (x: TAccumulator) => boolean,\n reduceFunc: (acc: TAccumulator, val: TValue) => TAccumulator,\n initial: TAccumulator,\n): OperatorFunction<TValue, TAccumulator | undefined> {\n return (obs) => {\n return obs.pipe(scan(reduceFunc, initial), takeWhile(predicate, true), defaultIfEmpty(undefined), last());\n };\n}\n\n/** Same as `firstValueFrom` except it won't throw if the observable emits no values. */\nexport async function toVoidPromise(obs: Observable<any>): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n obs.subscribe({\n complete: () => resolve(),\n error: reject,\n });\n });\n}\n\n/** Returns observable results in an array */\nexport async function collect<T>(obs: ObservableInput<T>): Promise<T[]> {\n return new Promise((resolve, reject) => {\n const arr = new Array<T>();\n from(obs).subscribe({\n next(item: T) {\n arr.push(item);\n },\n complete() {\n resolve(arr);\n },\n error(reason) {\n reject(reason);\n },\n });\n });\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/Tooltip.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAmBpD,MAAM,UAAU,sBAAsB,CAAC,MAA+B,EAAE,EAAE,UAAU,KAA8B,EAAE;IAClH,OAAO;QACL,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM;QAChD,UAAU,EAAE,MAAM,KAAK,UAAU;QACjC,OAAO,EAAE,UAAU,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC;KAC9E,CAAC;AACJ,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,aAAa,CAAC,MAA+B,EAAE,eAAmC;IAChG,MAAM,cAAc,GAAG,6BAA6B,MAAM,EAAE,CAAC;IAC7D,MAAM,YAAY,GAAG,UAAU,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IAC1D,IAAI,CAAC,eAAe,EAAE;QACpB,OAAO,YAAY,CAAC;KACrB;IAED,eAAe,GAAG,sBAAsB,eAAe,EAAE,CAAC;IAC1D,MAAM,aAAa,GAAG,UAAU,CAAC,SAAS,CAAC,eAAe,CAAC,CAAC;IAC5D,OAAO,GAAG,YAAY,KAAK,aAAa,EAAE,CAAC;AAC7C,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 { TreeWidget } from \"../../../TreeWidget.js\";\n\nimport type { VisibilityStatus } from \"./UseHierarchyVisibility.js\";\n\n/** @internal */\nexport type Visibility = \"visible\" | \"hidden\" | \"partial\";\n\n/** @internal */\nexport type NonPartialVisibilityStatus = Omit<VisibilityStatus, \"state\"> & { state: \"visible\" | \"hidden\" };\n\ninterface VisibilityStatusOptions {\n // id of localized string to use as an additional tooltip or false to not use tooltip at all\n // if undefined tooltip will be created based only on the visibility status\n useTooltip?: string | false;\n}\n\n/** @internal */\nexport function createVisibilityStatus(status: \"visible\" | \"hidden\", options?: VisibilityStatusOptions): NonPartialVisibilityStatus;\nexport function createVisibilityStatus(status: \"visible\" | \"hidden\" | \"partial\" | \"disabled\", options?: VisibilityStatusOptions): VisibilityStatus;\nexport function createVisibilityStatus(status: Visibility | \"disabled\", { useTooltip }: VisibilityStatusOptions = {}): VisibilityStatus {\n return {\n state: status === \"disabled\" ? \"hidden\" : status,\n isDisabled: status === \"disabled\",\n tooltip: useTooltip === false ? undefined : createTooltip(status, useTooltip),\n };\n}\n\n/** @internal */\nexport function createTooltip(status: Visibility | \"disabled\", tooltipStringId: string | undefined): string {\n const statusStringId = `visibilityTooltips.status.${status}`;\n const statusString = TreeWidget.translate(statusStringId);\n if (!tooltipStringId) {\n return statusString;\n }\n\n tooltipStringId = `visibilityTooltips.${tooltipStringId}`;\n const tooltipString = TreeWidget.translate(tooltipStringId);\n return `${statusString}: ${tooltipString}`;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UseActiveViewport.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/common/UseActiveViewport.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;;;GAGG;AACH,MAAM,UAAU,iBAAiB;IAC/B,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IACzF,SAAS,CAAC,GAAG,EAAE;QACb,iBAAiB,CAAC,SAAS,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QACtD,OAAO,SAAS,CAAC,WAAW,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,EAAE;YAC1E,iBAAiB,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClC,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,cAAc,CAAC;AACxB,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 { useEffect, useState } from \"react\";\nimport type { ScreenViewport } from \"@itwin/core-frontend\";\nimport { IModelApp } from \"@itwin/core-frontend\";\n\n/**\n * A copy of `useActiveViewport` from `@itwin/appui-react` package until X is fixed.\n * @internal\n */\nexport function useActiveViewport(): ScreenViewport | undefined {\n const [activeViewport, setActiveViewport] = useState(IModelApp.viewManager.selectedView);\n useEffect(() => {\n setActiveViewport(IModelApp.viewManager.selectedView);\n return IModelApp.viewManager.onSelectedViewportChanged.addListener((args) => {\n setActiveViewport(args.current);\n });\n }, []);\n\n return activeViewport;\n}\n"]}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
interface UseFilteringResult {
|
|
2
|
-
filter: string;
|
|
3
|
-
activeMatchIndex: number;
|
|
4
|
-
totalMatches: number;
|
|
5
|
-
applyFilter: (filter: string) => void;
|
|
6
|
-
clearFilter: () => void;
|
|
7
|
-
onHighlightChanged: (index: number, matches?: number) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare function useFiltering(): UseFilteringResult;
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=UseFiltering.d.ts.map
|