@itwin/tree-widget-react 0.7.2 → 0.9.0-dev.2
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/lib/cjs/TreeWidget.js +1 -1
- package/lib/cjs/TreeWidget.js.map +1 -1
- package/lib/cjs/components/TreeWidgetComponent.scss +6 -6
- package/lib/cjs/components/TreeWidgetUiItemsProvider.d.ts +2 -3
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js +9 -28
- package/lib/cjs/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/cjs/components/search-bar/SearchBar.js +1 -1
- package/lib/cjs/components/search-bar/SearchBar.js.map +1 -1
- package/lib/cjs/components/search-bar/SearchBar.scss +32 -9
- package/lib/cjs/components/search-bar/SearchBox.js +8 -6
- package/lib/cjs/components/search-bar/SearchBox.js.map +1 -1
- package/lib/cjs/components/search-bar/SearchBox.scss +17 -38
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.d.ts +1 -1
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.js +15 -21
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/cjs/components/trees/VisibilityTreeBase.scss +4 -5
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.js +2 -1
- package/lib/cjs/components/trees/VisibilityTreeEventHandler.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTree.d.ts +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js +4 -3
- package/lib/cjs/components/trees/category-tree/CategoriesTree.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.d.ts +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js +16 -12
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.d.ts +1 -1
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js +4 -4
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js.map +1 -1
- package/lib/cjs/components/trees/index.d.ts +0 -1
- package/lib/cjs/components/trees/index.js +0 -1
- package/lib/cjs/components/trees/index.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTree.d.ts +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTree.js +2 -2
- package/lib/cjs/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +11 -12
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js +11 -11
- package/lib/cjs/components/trees/models-tree/ModelsVisibilityHandler.js.map +1 -1
- package/lib/cjs/components/utils/AutoSizer.js +1 -2
- package/lib/cjs/components/utils/AutoSizer.js.map +1 -1
- package/lib/cjs/components/utils/IsPromiseLike.d.ts +3 -0
- package/lib/cjs/components/utils/IsPromiseLike.js +13 -0
- package/lib/cjs/components/utils/IsPromiseLike.js.map +1 -0
- package/lib/cjs/types.d.ts +1 -4
- package/lib/cjs/types.js.map +1 -1
- package/lib/esm/TreeWidget.js +1 -1
- package/lib/esm/TreeWidget.js.map +1 -1
- package/lib/esm/components/TreeWidgetComponent.scss +6 -6
- package/lib/esm/components/TreeWidgetUiItemsProvider.d.ts +2 -3
- package/lib/esm/components/TreeWidgetUiItemsProvider.js +11 -30
- package/lib/esm/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/components/search-bar/SearchBar.js +1 -1
- package/lib/esm/components/search-bar/SearchBar.js.map +1 -1
- package/lib/esm/components/search-bar/SearchBar.scss +32 -9
- package/lib/esm/components/search-bar/SearchBox.js +8 -6
- package/lib/esm/components/search-bar/SearchBox.js.map +1 -1
- package/lib/esm/components/search-bar/SearchBox.scss +17 -38
- package/lib/esm/components/trees/CategoriesVisibilityUtils.d.ts +1 -1
- package/lib/esm/components/trees/CategoriesVisibilityUtils.js +15 -21
- package/lib/esm/components/trees/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/components/trees/VisibilityTreeBase.scss +4 -5
- package/lib/esm/components/trees/VisibilityTreeEventHandler.js +2 -1
- package/lib/esm/components/trees/VisibilityTreeEventHandler.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTree.d.ts +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTree.js +4 -3
- package/lib/esm/components/trees/category-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.d.ts +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js +16 -12
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +1 -1
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js +4 -4
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js.map +1 -1
- package/lib/esm/components/trees/index.d.ts +0 -1
- package/lib/esm/components/trees/index.js +0 -1
- package/lib/esm/components/trees/index.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTree.d.ts +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTree.js +2 -2
- package/lib/esm/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +11 -12
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js +11 -11
- package/lib/esm/components/trees/models-tree/ModelsVisibilityHandler.js.map +1 -1
- package/lib/esm/components/utils/AutoSizer.js +2 -3
- package/lib/esm/components/utils/AutoSizer.js.map +1 -1
- package/lib/esm/components/utils/IsPromiseLike.d.ts +3 -0
- package/lib/esm/components/{trees/models-tree/ModelsTree.scss → utils/IsPromiseLike.js} +4 -13
- package/lib/esm/components/utils/IsPromiseLike.js.map +1 -0
- package/lib/esm/types.d.ts +1 -4
- package/lib/esm/types.js.map +1 -1
- package/package.json +54 -31
- package/lib/cjs/components/IconButton.d.ts +0 -15
- package/lib/cjs/components/IconButton.js +0 -42
- package/lib/cjs/components/IconButton.js.map +0 -1
- package/lib/cjs/components/IconButton.scss +0 -73
- package/lib/cjs/components/trees/category-tree/CategoriesTree.scss +0 -18
- package/lib/cjs/components/trees/models-tree/ModelsTree.scss +0 -18
- package/lib/cjs/components/trees/spatial-tree/SpatialTreeComponent.d.ts +0 -4
- package/lib/cjs/components/trees/spatial-tree/SpatialTreeComponent.js +0 -22
- package/lib/cjs/components/trees/spatial-tree/SpatialTreeComponent.js.map +0 -1
- package/lib/esm/components/IconButton.d.ts +0 -15
- package/lib/esm/components/IconButton.js +0 -16
- package/lib/esm/components/IconButton.js.map +0 -1
- package/lib/esm/components/IconButton.scss +0 -73
- package/lib/esm/components/trees/category-tree/CategoriesTree.scss +0 -18
- package/lib/esm/components/trees/spatial-tree/SpatialTreeComponent.d.ts +0 -4
- package/lib/esm/components/trees/spatial-tree/SpatialTreeComponent.js +0 -15
- package/lib/esm/components/trees/spatial-tree/SpatialTreeComponent.js.map +0 -1
|
@@ -16,10 +16,10 @@ async function toggleAllCategories(viewManager, imodel, display, viewport, forAl
|
|
|
16
16
|
// istanbul ignore next
|
|
17
17
|
const activeView = viewport !== null && viewport !== void 0 ? viewport : viewManager.getFirstOpenView();
|
|
18
18
|
const ids = await getCategories(imodel, activeView);
|
|
19
|
-
// istanbul ignore
|
|
20
|
-
if (ids.length
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
// istanbul ignore if
|
|
20
|
+
if (ids.length === 0)
|
|
21
|
+
return;
|
|
22
|
+
await enableCategory(viewManager, imodel, ids, display, forAllViewports !== null && forAllViewports !== void 0 ? forAllViewports : false);
|
|
23
23
|
}
|
|
24
24
|
exports.toggleAllCategories = toggleAllCategories;
|
|
25
25
|
/**
|
|
@@ -32,10 +32,10 @@ async function getCategories(imodel, viewport) {
|
|
|
32
32
|
}
|
|
33
33
|
exports.getCategories = getCategories;
|
|
34
34
|
/** Changes category display in the viewport */
|
|
35
|
-
function enableCategory(viewManager, imodel, ids, enabled, forAllViewports, enableAllSubCategories = true) {
|
|
35
|
+
async function enableCategory(viewManager, imodel, ids, enabled, forAllViewports, enableAllSubCategories = true) {
|
|
36
36
|
if (!viewManager.selectedView)
|
|
37
37
|
return;
|
|
38
|
-
const updateViewport = (vp) => {
|
|
38
|
+
const updateViewport = async (vp) => {
|
|
39
39
|
// Only act on viewports that are both 3D or both 2D. Important if we have multiple viewports opened and we
|
|
40
40
|
// are using 'allViewports' property
|
|
41
41
|
if (viewManager.selectedView && viewManager.selectedView.view.is3d() === vp.view.is3d()) {
|
|
@@ -50,12 +50,8 @@ function enableCategory(viewManager, imodel, ids, enabled, forAllViewports, enab
|
|
|
50
50
|
vp.perModelCategoryVisibility.setOverride(modelsContainingOverrides, ids, core_frontend_1.PerModelCategoryVisibility.Override.None);
|
|
51
51
|
// changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.
|
|
52
52
|
if (false === enabled) {
|
|
53
|
-
ids.forEach((
|
|
54
|
-
|
|
55
|
-
// istanbul ignore else
|
|
56
|
-
if (subCategoryIds) {
|
|
57
|
-
subCategoryIds.forEach((subCategoryId) => enableSubCategory(viewManager, subCategoryId, false, forAllViewports));
|
|
58
|
-
}
|
|
53
|
+
(await imodel.categories.getCategoryInfo(ids)).forEach((categoryInfo) => {
|
|
54
|
+
categoryInfo.subCategories.forEach((value) => enableSubCategory(viewManager, value.id, false, forAllViewports));
|
|
59
55
|
});
|
|
60
56
|
}
|
|
61
57
|
}
|
|
@@ -63,11 +59,11 @@ function enableCategory(viewManager, imodel, ids, enabled, forAllViewports, enab
|
|
|
63
59
|
// This property let us act on all viewports or just on the selected one, configurable by the app
|
|
64
60
|
if (forAllViewports) {
|
|
65
61
|
for (const viewport of viewManager) {
|
|
66
|
-
updateViewport(viewport);
|
|
62
|
+
await updateViewport(viewport);
|
|
67
63
|
}
|
|
68
64
|
}
|
|
69
65
|
else {
|
|
70
|
-
updateViewport(viewManager.selectedView);
|
|
66
|
+
await updateViewport(viewManager.selectedView);
|
|
71
67
|
}
|
|
72
68
|
}
|
|
73
69
|
exports.enableCategory = enableCategory;
|
|
@@ -101,16 +97,14 @@ async function loadCategoriesFromViewport(iModel, vp) {
|
|
|
101
97
|
const selectUsedSpatialCategoryIds = "SELECT DISTINCT Category.Id as id from BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId from BisCore.SpatialCategory)";
|
|
102
98
|
const selectUsedDrawingCategoryIds = "SELECT DISTINCT Category.Id as id from BisCore.GeometricElement2d WHERE Model.Id=? AND Category.Id IN (SELECT ECInstanceId from BisCore.DrawingCategory)";
|
|
103
99
|
const ecsql = vp.view.is3d() ? selectUsedSpatialCategoryIds : selectUsedDrawingCategoryIds;
|
|
104
|
-
const ecsql2 = `SELECT ECInstanceId as id
|
|
100
|
+
const ecsql2 = `SELECT ECInstanceId as id FROM ${vp.view.is3d() ? "BisCore.SpatialCategory" : "BisCore.DrawingCategory"} WHERE ECInstanceId IN (${ecsql})`;
|
|
105
101
|
const categories = [];
|
|
106
102
|
// istanbul ignore else
|
|
107
103
|
if (iModel) {
|
|
108
|
-
const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
categories.push({ categoryId: row.id, subCategoryIds: (subCategoryIds) ? [...subCategoryIds] : undefined });
|
|
113
|
-
}
|
|
104
|
+
const rows = await iModel.createQueryReader(ecsql2, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }).toArray();
|
|
105
|
+
(await iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {
|
|
106
|
+
categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });
|
|
107
|
+
});
|
|
114
108
|
}
|
|
115
109
|
return categories;
|
|
116
110
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesVisibilityUtils.js","sourceRoot":"","sources":["../../../../src/components/trees/CategoriesVisibilityUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,oDAAoD;AACpD,wDAA2G;AAG3G,MAAM,sBAAsB,GAAmB,EAAE,CAAC;AAElD;;;GAGG;AACI,KAAK,UAAU,mBAAmB,CAAC,WAAwB,EAAE,MAAwB,EAAE,OAAgB,EAAE,QAAmB,EAAE,eAAyB;IAC5J,uBAAuB;IACvB,MAAM,UAAU,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,WAAW,CAAC,gBAAgB,EAAE,CAAC;IAC9D,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAEpD,
|
|
1
|
+
{"version":3,"file":"CategoriesVisibilityUtils.js","sourceRoot":"","sources":["../../../../src/components/trees/CategoriesVisibilityUtils.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;AAE/F,oDAAoD;AACpD,wDAA2G;AAG3G,MAAM,sBAAsB,GAAmB,EAAE,CAAC;AAElD;;;GAGG;AACI,KAAK,UAAU,mBAAmB,CAAC,WAAwB,EAAE,MAAwB,EAAE,OAAgB,EAAE,QAAmB,EAAE,eAAyB;IAC5J,uBAAuB;IACvB,MAAM,UAAU,GAAG,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,WAAW,CAAC,gBAAgB,EAAE,CAAC;IAC9D,MAAM,GAAG,GAAG,MAAM,aAAa,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IAEpD,qBAAqB;IACrB,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC;QAClB,OAAO;IAET,MAAM,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,eAAe,aAAf,eAAe,cAAf,eAAe,GAAI,KAAK,CAAC,CAAC;AACp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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 { QueryRowFormat } from \"@itwin/core-common\";\nimport { IModelConnection, PerModelCategoryVisibility, ViewManager, Viewport } from \"@itwin/core-frontend\";\nimport { CategoryInfo } from \"./category-tree/CategoryVisibilityHandler\";\n\nconst EMPTY_CATEGORIES_ARRAY: CategoryInfo[] = [];\n\n/**\n * Toggles visibility of categories to show or hide.\n * @alpha\n */\nexport async function toggleAllCategories(viewManager: ViewManager, imodel: IModelConnection, display: boolean, viewport?: Viewport, forAllViewports?: boolean) {\n // istanbul ignore next\n const activeView = viewport ?? viewManager.getFirstOpenView();\n const ids = await getCategories(imodel, activeView);\n\n // istanbul ignore if\n if (ids.length === 0)\n return;\n\n await enableCategory(viewManager, imodel, ids, display, forAllViewports ?? false);\n}\n\n/**\n * Gets ids of all categories from specified imodel and viewport.\n * @alpha\n */\nexport async function getCategories(imodel: IModelConnection, viewport?: Viewport) {\n const categories = await loadCategoriesFromViewport(imodel, viewport);\n return categories.map((category) => category.categoryId);\n}\n\n/** Changes category display in the viewport */\nexport async function enableCategory(viewManager: ViewManager, imodel: IModelConnection, ids: string[], enabled: boolean, forAllViewports: boolean, enableAllSubCategories = true) {\n if (!viewManager.selectedView)\n return;\n\n const updateViewport = async (vp: Viewport) => {\n // Only act on viewports that are both 3D or both 2D. Important if we have multiple viewports opened and we\n // are using 'allViewports' property\n if (viewManager.selectedView && viewManager.selectedView.view.is3d() === vp.view.is3d()) {\n vp.changeCategoryDisplay(ids, enabled, enableAllSubCategories);\n\n // remove category overrides per model\n const modelsContainingOverrides: string[] = [];\n for (const ovr of vp.perModelCategoryVisibility) {\n // istanbul ignore else\n if (ids.findIndex((id) => id === ovr.categoryId) !== -1)\n modelsContainingOverrides.push(ovr.modelId);\n }\n vp.perModelCategoryVisibility.setOverride(modelsContainingOverrides, ids, PerModelCategoryVisibility.Override.None);\n\n // changeCategoryDisplay only enables subcategories, it does not disabled them. So we must do that ourselves.\n if (false === enabled) {\n (await imodel.categories.getCategoryInfo(ids)).forEach((categoryInfo) => {\n categoryInfo.subCategories.forEach((value) => enableSubCategory(viewManager, value.id, false, forAllViewports));\n });\n }\n }\n };\n\n // This property let us act on all viewports or just on the selected one, configurable by the app\n if (forAllViewports) {\n for (const viewport of viewManager) {\n await updateViewport(viewport);\n }\n } else {\n await updateViewport(viewManager.selectedView);\n }\n}\n\n/** Changes subcategory display in the viewport */\nexport function enableSubCategory(viewManager: ViewManager, key: string, enabled: boolean, forAllViewports?: boolean) {\n if (!viewManager.selectedView)\n return;\n\n const updateViewport = (vp: Viewport) => {\n // Only act on viewports that are both 3D or both 2D. Important if we have multiple viewports opened and we\n // are using 'allViewports' property\n if (viewManager.selectedView && viewManager.selectedView.view.is3d() === vp.view.is3d()) {\n vp.changeSubCategoryDisplay(key, enabled);\n }\n };\n\n // This property let us act on all viewports or just on the selected one, configurable by the app\n if (forAllViewports) {\n for (const viewport of viewManager) {\n updateViewport(viewport);\n }\n } else {\n updateViewport(viewManager.selectedView);\n }\n}\n\n/** @internal */\nexport async function loadCategoriesFromViewport(iModel?: IModelConnection, vp?: Viewport) {\n if (!vp)\n return EMPTY_CATEGORIES_ARRAY;\n\n // Query categories and add them to state\n const selectUsedSpatialCategoryIds = \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement3d WHERE Category.Id IN (SELECT ECInstanceId from BisCore.SpatialCategory)\";\n const selectUsedDrawingCategoryIds = \"SELECT DISTINCT Category.Id as id from BisCore.GeometricElement2d WHERE Model.Id=? AND Category.Id IN (SELECT ECInstanceId from BisCore.DrawingCategory)\";\n const ecsql = vp.view.is3d() ? selectUsedSpatialCategoryIds : selectUsedDrawingCategoryIds;\n const ecsql2 = `SELECT ECInstanceId as id FROM ${vp.view.is3d() ? \"BisCore.SpatialCategory\" : \"BisCore.DrawingCategory\"} WHERE ECInstanceId IN (${ecsql})`;\n\n const categories: CategoryInfo[] = [];\n\n // istanbul ignore else\n if (iModel) {\n const rows = await iModel.createQueryReader(ecsql2, undefined, { rowFormat: QueryRowFormat.UseJsPropertyNames }).toArray();\n (await iModel.categories.getCategoryInfo(rows.map((row) => row.id))).forEach((val) => {\n categories.push({ categoryId: val.id, subCategoryIds: val.subCategories.size ? [...val.subCategories.keys()] : undefined });\n });\n }\n return categories;\n}\n"]}
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
@import "~@itwin/core-react/lib/cjs/core-react/style/themecolors";
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
.tree-widget-visibility-tree-base {
|
|
8
7
|
height: 100%;
|
|
9
8
|
width: 100%;
|
|
10
9
|
display: flex;
|
|
@@ -13,7 +12,7 @@
|
|
|
13
12
|
|
|
14
13
|
.core-tree-node.with-checkbox {
|
|
15
14
|
>.contents {
|
|
16
|
-
padding-left:
|
|
15
|
+
padding-left: var(--iui-size-xl);
|
|
17
16
|
}
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -31,7 +30,7 @@
|
|
|
31
30
|
width: 100%;
|
|
32
31
|
height: 100%;
|
|
33
32
|
z-index: 9999;
|
|
34
|
-
background-color:
|
|
33
|
+
background-color: hsl(var(--iui-color-background) / var(--iui-opacity-2));
|
|
35
34
|
}
|
|
36
35
|
|
|
37
36
|
.components-tree-errormessage {
|
|
@@ -42,7 +41,7 @@
|
|
|
42
41
|
text-align: center;
|
|
43
42
|
transform: translate(-50%, -50%);
|
|
44
43
|
font-style: italic;
|
|
45
|
-
color:
|
|
44
|
+
color: var(--iui-color-text-muted);
|
|
46
45
|
|
|
47
46
|
.errormessage-header {
|
|
48
47
|
display: block;
|
|
@@ -15,6 +15,7 @@ const map_1 = require("rxjs/internal/operators/map");
|
|
|
15
15
|
const mergeMap_1 = require("rxjs/internal/operators/mergeMap");
|
|
16
16
|
const core_react_1 = require("@itwin/core-react");
|
|
17
17
|
const presentation_components_1 = require("@itwin/presentation-components");
|
|
18
|
+
const IsPromiseLike_1 = require("../utils/IsPromiseLike");
|
|
18
19
|
/**
|
|
19
20
|
* Base event handler for visibility tree.
|
|
20
21
|
* @alpha
|
|
@@ -141,7 +142,7 @@ class VisibilityTreeEventHandler extends presentation_components_1.UnifiedSelect
|
|
|
141
142
|
if (!this._visibilityHandler)
|
|
142
143
|
return { ...node.checkbox, isVisible: false };
|
|
143
144
|
const result = (_a = visibilityStatus === null || visibilityStatus === void 0 ? void 0 : visibilityStatus.get(node.id)) !== null && _a !== void 0 ? _a : this._visibilityHandler.getVisibilityStatus(node.item, this.getNodeKey(node.item));
|
|
144
|
-
if ((0,
|
|
145
|
+
if ((0, IsPromiseLike_1.isPromiseLike)(result))
|
|
145
146
|
return this.createCheckboxInfo(await result);
|
|
146
147
|
return this.createCheckboxInfo(result);
|
|
147
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisibilityTreeEventHandler.js","sourceRoot":"","sources":["../../../../src/components/trees/VisibilityTreeEventHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,+BAAkC;AAClC,0DAAuD;AACvD,wDAAqD;AACrD,qDAAkD;AAClD,+DAA4D;AAM5D,kDAAiE;AAEjE,4EAA0H;AA2C1H;;;GAGG;AACH,MAAa,0BAA2B,SAAQ,0DAAgC;IAM9E,YAAY,MAAwC;QAClD,KAAK,CAAC,MAAM,CAAC,CAAC;QAJR,eAAU,GAAG,IAAI,KAAK,EAAc,CAAC;QAK3C,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,iBAAiB,CAAC;QACnD,IAAI,CAAC,mBAAmB,GAAG,MAAM,CAAC,kBAAkB,CAAC;QACrD,IAAI,CAAC,qBAAqB,GAAG,KAAK,CAAC;QAEnC,IAAI,IAAI,CAAC,kBAA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ourcesContent":["/*---------------------------------------------------------------------------------------------\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/** @packageDocumentation\n * @module IModelComponents\n */\n\nimport { Observable } from \"rxjs\";\nimport { EMPTY } from \"rxjs/internal/observable/empty\";\nimport { from } from \"rxjs/internal/observable/from\";\nimport { map } from \"rxjs/internal/operators/map\";\nimport { mergeMap } from \"rxjs/internal/operators/mergeMap\";\nimport {\n CheckBoxInfo, CheckboxStateChange, TreeCheckboxStateChangeEventArgs, TreeModelNode, TreeNodeItem, TreeSelectionChange,\n TreeSelectionModificationEventArgs, TreeSelectionReplacementEventArgs,\n} from \"@itwin/components-react\";\nimport { BeEvent, IDisposable } from \"@itwin/core-bentley\";\nimport { CheckBoxState, isPromiseLike } from \"@itwin/core-react\";\nimport { NodeKey } from \"@itwin/presentation-common\";\nimport { UnifiedSelectionTreeEventHandler, UnifiedSelectionTreeEventHandlerParams } from \"@itwin/presentation-components\";\n\n/**\n * Data structure that describes instance visibility status.\n * @alpha\n */\nexport interface VisibilityStatus {\n state: \"visible\" | \"partial\" | \"hidden\";\n isDisabled?: boolean;\n tooltip?: string;\n}\n\n/**\n * Type definition of visibility change event listener.\n * @alpha\n */\nexport type VisibilityChangeListener = (nodeIds?: string[], visibilityStatus?: Map<string, VisibilityStatus>) => void;\n\n/**\n * Visibility handler used to change or get visibility of instances represented by the tree node.\n * @alpha\n */\nexport interface IVisibilityHandler extends IDisposable {\n getVisibilityStatus(node: TreeNodeItem, nodeKey: NodeKey): VisibilityStatus | Promise<VisibilityStatus>;\n changeVisibility(node: TreeNodeItem, nodeKey: NodeKey, shouldDisplay: boolean): Promise<void>;\n onVisibilityChange: BeEvent<VisibilityChangeListener>;\n}\n\n/**\n * Type definition of predicate used to decide if node can be selected.\n * @alpha\n */\nexport type VisibilityTreeSelectionPredicate = (key: NodeKey, node: TreeNodeItem) => boolean;\n\n/**\n * Parameters for [[VisibilityTreeEventHandler]]\n * @alpha\n */\nexport interface VisibilityTreeEventHandlerParams extends UnifiedSelectionTreeEventHandlerParams {\n visibilityHandler: IVisibilityHandler | undefined;\n selectionPredicate?: VisibilityTreeSelectionPredicate;\n}\n\n/**\n * Base event handler for visibility tree.\n * @alpha\n */\nexport class VisibilityTreeEventHandler extends UnifiedSelectionTreeEventHandler {\n private _visibilityHandler: IVisibilityHandler | undefined;\n private _selectionPredicate?: VisibilityTreeSelectionPredicate;\n private _listeners = new Array<() => void>();\n private _isChangingVisibility: boolean;\n\n constructor(params: VisibilityTreeEventHandlerParams) {\n super(params);\n this._visibilityHandler = params.visibilityHandler;\n this._selectionPredicate = params.selectionPredicate;\n this._isChangingVisibility = false;\n\n if (this._visibilityHandler) {\n this._listeners.push(this._visibilityHandler.onVisibilityChange.addListener(async (nodeIds, visibilityStatus) => {\n if (this._isChangingVisibility)\n return;\n void this.updateCheckboxes(nodeIds, visibilityStatus);\n }));\n }\n\n this._listeners.push(this.modelSource.onModelChanged.addListener(async ([_, changes]) => {\n void this.updateCheckboxes([...changes.addedNodeIds, ...changes.modifiedNodeIds]);\n }));\n this.updateCheckboxes(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n public override dispose() {\n super.dispose();\n this._listeners.forEach((disposeFunc) => disposeFunc());\n }\n\n private filterSelectionItems(items: TreeNodeItem[]) {\n // istanbul ignore if\n if (!this._selectionPredicate)\n return items;\n\n return items.filter((item) => this._selectionPredicate!(this.getNodeKey(item), item));\n }\n\n public override onSelectionModified({ modifications }: TreeSelectionModificationEventArgs) {\n const filteredModification = new Observable<TreeSelectionChange>((subscriber) => modifications.subscribe(subscriber)).pipe(\n map(({ selectedNodeItems, deselectedNodeItems }) => {\n return {\n selectedNodeItems: this.filterSelectionItems(selectedNodeItems),\n deselectedNodeItems: this.filterSelectionItems(deselectedNodeItems),\n };\n }),\n );\n return super.onSelectionModified({ modifications: filteredModification });\n }\n\n public override onSelectionReplaced({ replacements }: TreeSelectionReplacementEventArgs) {\n const filteredReplacements = new Observable<{ selectedNodeItems: TreeNodeItem[] }>((subscriber) => replacements.subscribe(subscriber)).pipe(\n map(({ selectedNodeItems }) => {\n return {\n selectedNodeItems: this.filterSelectionItems(selectedNodeItems),\n };\n }),\n );\n return super.onSelectionReplaced({ replacements: filteredReplacements });\n }\n\n public override onCheckboxStateChanged(event: TreeCheckboxStateChangeEventArgs) {\n const handleStateChanged = () => {\n this._isChangingVisibility = false;\n void this.updateCheckboxes();\n };\n // istanbul ignore if\n if (!this._visibilityHandler)\n return undefined;\n\n // eslint-disable-next-line deprecation/deprecation\n from(event.stateChanges)\n .pipe(\n // eslint-disable-next-line deprecation/deprecation\n mergeMap((changes) => this.changeVisibility(changes)),\n )\n // eslint-disable-next-line deprecation/deprecation\n .subscribe({\n complete: handleStateChanged,\n error: handleStateChanged,\n });\n return undefined;\n }\n\n private changeVisibility(changes: CheckboxStateChange[]) {\n // eslint-disable-next-line deprecation/deprecation\n return from(changes)\n .pipe(\n // eslint-disable-next-line deprecation/deprecation\n mergeMap(({ nodeItem, newState }) => {\n // istanbul ignore if\n if (!this._visibilityHandler)\n return EMPTY;\n this._isChangingVisibility = true;\n // eslint-disable-next-line deprecation/deprecation\n return from(this._visibilityHandler.changeVisibility(nodeItem, this.getNodeKey(nodeItem), newState === CheckBoxState.On));\n }, 1),\n );\n }\n\n private async updateCheckboxes(affectedNodes?: string[], visibilityStatus?: Map<string, VisibilityStatus>) {\n const changes = await (affectedNodes ? this.collectAffectedNodesCheckboxInfos(affectedNodes, visibilityStatus) : this.collectAllNodesCheckboxInfos(visibilityStatus));\n this.updateModel(changes);\n }\n\n private updateModel(changes: Map<string, CheckBoxInfo>) {\n this.modelSource.modifyModel((model) => {\n for (const [nodeId, checkboxInfo] of changes) {\n const node = model.getNode(nodeId);\n // istanbul ignore if\n if (!node)\n continue;\n\n node.checkbox.isDisabled = checkboxInfo.isDisabled;\n node.checkbox.isVisible = checkboxInfo.isVisible;\n node.checkbox.state = checkboxInfo.state;\n node.checkbox.tooltip = checkboxInfo.tooltip;\n }\n });\n }\n\n private async collectAffectedNodesCheckboxInfos(affectedNodes: string[], visibilityStatus?: Map<string, VisibilityStatus>) {\n const nodeStates = new Map<string, CheckBoxInfo>();\n if (affectedNodes.length === 0)\n return nodeStates;\n\n await Promise.all(affectedNodes.map(async (nodeId) => {\n const node = this.modelSource.getModel().getNode(nodeId);\n // istanbul ignore else\n if (node)\n nodeStates.set(nodeId, await this.getNodeCheckBoxInfo(node, visibilityStatus));\n }));\n return nodeStates;\n }\n\n private async collectAllNodesCheckboxInfos(visibilityStatus?: Map<string, VisibilityStatus>) {\n const nodeStates = new Map<string, CheckBoxInfo>();\n for (const node of this.modelSource.getModel().iterateTreeModelNodes()) {\n nodeStates.set(node.id, await this.getNodeCheckBoxInfo(node, visibilityStatus));\n }\n return nodeStates;\n }\n\n private async getNodeCheckBoxInfo(node: TreeModelNode, visibilityStatus?: Map<string, VisibilityStatus>): Promise<CheckBoxInfo> {\n if (!this._visibilityHandler)\n return { ...node.checkbox, isVisible: false };\n\n const result = visibilityStatus?.get(node.id) ?? this._visibilityHandler.getVisibilityStatus(node.item, this.getNodeKey(node.item));\n\n if (isPromiseLike(result))\n return this.createCheckboxInfo(await result);\n return this.createCheckboxInfo(result);\n }\n\n private createCheckboxInfo(status: VisibilityStatus): CheckBoxInfo {\n return {\n state: visibilityStateToCheckboxState(status),\n isDisabled: status.isDisabled || false,\n isVisible: true,\n tooltip: status.tooltip,\n };\n }\n}\n\nconst visibilityStateToCheckboxState = (status: VisibilityStatus) => {\n switch (status.state) {\n case \"visible\":\n return CheckBoxState.On;\n // istanbul ignore next\n case \"partial\":\n return CheckBoxState.Partial;\n case \"hidden\":\n default:\n return CheckBoxState.Off;\n }\n};\n"]}
|
|
1
|
+
{"version":3,"file":"VisibilityTreeEventHandler.js","sourceRoot":"","sources":["../../../../src/components/trees/VisibilityTreeEventHandler.ts"],"names":[],"mappings":";AAAA;;;+FAG+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8B,CAAC,MAAM,CAAC;YAC7C,UAAU,EAAE,MAAM,CAAC,UAAU,IAAI,KAAK;YACtC,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,MAAM,CAAC,OAAO;SACxB,CAAC;IACJ,CAAC;CACF;AAnKD,gEAmKC;AAED,MAAM,8BAA8B,GAAG,CAAC,MAAwB,EAAE,EAAE;IAClE,QAAQ,MAAM,CAAC,KAAK,EAAE;QACpB,KAAK,SAAS;YACZ,OAAO,0BAAa,CAAC,EAAE,CAAC;QAC1B,uBAAuB;QACvB,KAAK,SAAS;YACZ,OAAO,0BAAa,CAAC,OAAO,CAAC;QAC/B,KAAK,QAAQ,CAAC;QACd;YACE,OAAO,0BAAa,CAAC,GAAG,CAAC;KAC5B;AACH,CAAC,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/** @packageDocumentation\n * @module IModelComponents\n */\n\nimport { Observable } from \"rxjs\";\nimport { EMPTY } from \"rxjs/internal/observable/empty\";\nimport { from } from \"rxjs/internal/observable/from\";\nimport { map } from \"rxjs/internal/operators/map\";\nimport { mergeMap } from \"rxjs/internal/operators/mergeMap\";\nimport {\n CheckBoxInfo, CheckboxStateChange, TreeCheckboxStateChangeEventArgs, TreeModelNode, TreeNodeItem, TreeSelectionChange,\n TreeSelectionModificationEventArgs, TreeSelectionReplacementEventArgs,\n} from \"@itwin/components-react\";\nimport { BeEvent, IDisposable } from \"@itwin/core-bentley\";\nimport { CheckBoxState } from \"@itwin/core-react\";\nimport { NodeKey } from \"@itwin/presentation-common\";\nimport { UnifiedSelectionTreeEventHandler, UnifiedSelectionTreeEventHandlerParams } from \"@itwin/presentation-components\";\nimport { isPromiseLike } from \"../utils/IsPromiseLike\";\n\n/**\n * Data structure that describes instance visibility status.\n * @alpha\n */\nexport interface VisibilityStatus {\n state: \"visible\" | \"partial\" | \"hidden\";\n isDisabled?: boolean;\n tooltip?: string;\n}\n\n/**\n * Type definition of visibility change event listener.\n * @alpha\n */\nexport type VisibilityChangeListener = (nodeIds?: string[], visibilityStatus?: Map<string, VisibilityStatus>) => void;\n\n/**\n * Visibility handler used to change or get visibility of instances represented by the tree node.\n * @alpha\n */\nexport interface IVisibilityHandler extends IDisposable {\n getVisibilityStatus(node: TreeNodeItem, nodeKey: NodeKey): VisibilityStatus | Promise<VisibilityStatus>;\n changeVisibility(node: TreeNodeItem, nodeKey: NodeKey, shouldDisplay: boolean): Promise<void>;\n onVisibilityChange: BeEvent<VisibilityChangeListener>;\n}\n\n/**\n * Type definition of predicate used to decide if node can be selected.\n * @alpha\n */\nexport type VisibilityTreeSelectionPredicate = (key: NodeKey, node: TreeNodeItem) => boolean;\n\n/**\n * Parameters for [[VisibilityTreeEventHandler]]\n * @alpha\n */\nexport interface VisibilityTreeEventHandlerParams extends UnifiedSelectionTreeEventHandlerParams {\n visibilityHandler: IVisibilityHandler | undefined;\n selectionPredicate?: VisibilityTreeSelectionPredicate;\n}\n\n/**\n * Base event handler for visibility tree.\n * @alpha\n */\nexport class VisibilityTreeEventHandler extends UnifiedSelectionTreeEventHandler {\n private _visibilityHandler: IVisibilityHandler | undefined;\n private _selectionPredicate?: VisibilityTreeSelectionPredicate;\n private _listeners = new Array<() => void>();\n private _isChangingVisibility: boolean;\n\n constructor(params: VisibilityTreeEventHandlerParams) {\n super(params);\n this._visibilityHandler = params.visibilityHandler;\n this._selectionPredicate = params.selectionPredicate;\n this._isChangingVisibility = false;\n\n if (this._visibilityHandler) {\n this._listeners.push(this._visibilityHandler.onVisibilityChange.addListener(async (nodeIds, visibilityStatus) => {\n if (this._isChangingVisibility)\n return;\n void this.updateCheckboxes(nodeIds, visibilityStatus);\n }));\n }\n\n this._listeners.push(this.modelSource.onModelChanged.addListener(async ([_, changes]) => {\n void this.updateCheckboxes([...changes.addedNodeIds, ...changes.modifiedNodeIds]);\n }));\n this.updateCheckboxes(); // eslint-disable-line @typescript-eslint/no-floating-promises\n }\n\n public override dispose() {\n super.dispose();\n this._listeners.forEach((disposeFunc) => disposeFunc());\n }\n\n private filterSelectionItems(items: TreeNodeItem[]) {\n // istanbul ignore if\n if (!this._selectionPredicate)\n return items;\n\n return items.filter((item) => this._selectionPredicate!(this.getNodeKey(item), item));\n }\n\n public override onSelectionModified({ modifications }: TreeSelectionModificationEventArgs) {\n const filteredModification = new Observable<TreeSelectionChange>((subscriber) => modifications.subscribe(subscriber)).pipe(\n map(({ selectedNodeItems, deselectedNodeItems }) => {\n return {\n selectedNodeItems: this.filterSelectionItems(selectedNodeItems),\n deselectedNodeItems: this.filterSelectionItems(deselectedNodeItems),\n };\n }),\n );\n return super.onSelectionModified({ modifications: filteredModification });\n }\n\n public override onSelectionReplaced({ replacements }: TreeSelectionReplacementEventArgs) {\n const filteredReplacements = new Observable<{ selectedNodeItems: TreeNodeItem[] }>((subscriber) => replacements.subscribe(subscriber)).pipe(\n map(({ selectedNodeItems }) => {\n return {\n selectedNodeItems: this.filterSelectionItems(selectedNodeItems),\n };\n }),\n );\n return super.onSelectionReplaced({ replacements: filteredReplacements });\n }\n\n public override onCheckboxStateChanged(event: TreeCheckboxStateChangeEventArgs) {\n const handleStateChanged = () => {\n this._isChangingVisibility = false;\n void this.updateCheckboxes();\n };\n // istanbul ignore if\n if (!this._visibilityHandler)\n return undefined;\n\n // eslint-disable-next-line deprecation/deprecation\n from(event.stateChanges)\n .pipe(\n // eslint-disable-next-line deprecation/deprecation\n mergeMap((changes) => this.changeVisibility(changes)),\n )\n // eslint-disable-next-line deprecation/deprecation\n .subscribe({\n complete: handleStateChanged,\n error: handleStateChanged,\n });\n return undefined;\n }\n\n private changeVisibility(changes: CheckboxStateChange[]) {\n // eslint-disable-next-line deprecation/deprecation\n return from(changes)\n .pipe(\n // eslint-disable-next-line deprecation/deprecation\n mergeMap(({ nodeItem, newState }) => {\n // istanbul ignore if\n if (!this._visibilityHandler)\n return EMPTY;\n this._isChangingVisibility = true;\n // eslint-disable-next-line deprecation/deprecation\n return from(this._visibilityHandler.changeVisibility(nodeItem, this.getNodeKey(nodeItem), newState === CheckBoxState.On));\n }, 1),\n );\n }\n\n private async updateCheckboxes(affectedNodes?: string[], visibilityStatus?: Map<string, VisibilityStatus>) {\n const changes = await (affectedNodes ? this.collectAffectedNodesCheckboxInfos(affectedNodes, visibilityStatus) : this.collectAllNodesCheckboxInfos(visibilityStatus));\n this.updateModel(changes);\n }\n\n private updateModel(changes: Map<string, CheckBoxInfo>) {\n this.modelSource.modifyModel((model) => {\n for (const [nodeId, checkboxInfo] of changes) {\n const node = model.getNode(nodeId);\n // istanbul ignore if\n if (!node)\n continue;\n\n node.checkbox.isDisabled = checkboxInfo.isDisabled;\n node.checkbox.isVisible = checkboxInfo.isVisible;\n node.checkbox.state = checkboxInfo.state;\n node.checkbox.tooltip = checkboxInfo.tooltip;\n }\n });\n }\n\n private async collectAffectedNodesCheckboxInfos(affectedNodes: string[], visibilityStatus?: Map<string, VisibilityStatus>) {\n const nodeStates = new Map<string, CheckBoxInfo>();\n if (affectedNodes.length === 0)\n return nodeStates;\n\n await Promise.all(affectedNodes.map(async (nodeId) => {\n const node = this.modelSource.getModel().getNode(nodeId);\n // istanbul ignore else\n if (node)\n nodeStates.set(nodeId, await this.getNodeCheckBoxInfo(node, visibilityStatus));\n }));\n return nodeStates;\n }\n\n private async collectAllNodesCheckboxInfos(visibilityStatus?: Map<string, VisibilityStatus>) {\n const nodeStates = new Map<string, CheckBoxInfo>();\n for (const node of this.modelSource.getModel().iterateTreeModelNodes()) {\n nodeStates.set(node.id, await this.getNodeCheckBoxInfo(node, visibilityStatus));\n }\n return nodeStates;\n }\n\n private async getNodeCheckBoxInfo(node: TreeModelNode, visibilityStatus?: Map<string, VisibilityStatus>): Promise<CheckBoxInfo> {\n if (!this._visibilityHandler)\n return { ...node.checkbox, isVisible: false };\n\n const result = visibilityStatus?.get(node.id) ?? this._visibilityHandler.getVisibilityStatus(node.item, this.getNodeKey(node.item));\n\n if (isPromiseLike(result))\n return this.createCheckboxInfo(await result);\n return this.createCheckboxInfo(result);\n }\n\n private createCheckboxInfo(status: VisibilityStatus): CheckBoxInfo {\n return {\n state: visibilityStateToCheckboxState(status),\n isDisabled: status.isDisabled || false,\n isVisible: true,\n tooltip: status.tooltip,\n };\n }\n}\n\nconst visibilityStateToCheckboxState = (status: VisibilityStatus) => {\n switch (status.state) {\n case \"visible\":\n return CheckBoxState.On;\n // istanbul ignore next\n case \"partial\":\n return CheckBoxState.Partial;\n case \"hidden\":\n default:\n return CheckBoxState.Off;\n }\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import "
|
|
2
|
+
import "../VisibilityTreeBase.scss";
|
|
3
3
|
import { IModelConnection, ViewManager, Viewport } from "@itwin/core-frontend";
|
|
4
4
|
import { Ruleset } from "@itwin/presentation-common";
|
|
5
5
|
import { IPresentationTreeDataProvider } from "@itwin/presentation-components";
|
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.CategoryTree = exports.RULESET_CATEGORIES = void 0;
|
|
27
|
-
require("
|
|
27
|
+
require("../VisibilityTreeBase.scss");
|
|
28
28
|
const React = __importStar(require("react"));
|
|
29
29
|
const components_react_1 = require("@itwin/components-react");
|
|
30
30
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
@@ -73,7 +73,7 @@ function CategoryTree(props) {
|
|
|
73
73
|
const noFilteredDataRenderer = React.useCallback(() => {
|
|
74
74
|
return React.createElement(VisibilityTreeRenderer_1.VisibilityTreeNoFilteredData, { title: TreeWidget_1.TreeWidget.translate("categoriesTree.noCategoryFound"), message: TreeWidget_1.TreeWidget.translate("categoriesTree.noMatchingCategoryNames") });
|
|
75
75
|
}, []);
|
|
76
|
-
return (React.createElement("div", { className: "tree-widget-
|
|
76
|
+
return (React.createElement("div", { className: "tree-widget-visibility-tree-base" },
|
|
77
77
|
React.createElement(components_react_1.ControlledTree, { nodeLoader: filteredNodeLoader, model: treeModel, selectionMode: components_react_1.SelectionMode.None, eventsHandler: eventHandler, treeRenderer: treeRenderer, descriptionsEnabled: true, nodeHighlightingProps: nodeHighlightingProps, noDataRenderer: filterApplied ? noFilteredDataRenderer : undefined, width: props.width, height: props.height }),
|
|
78
78
|
overlay));
|
|
79
79
|
}
|
|
@@ -87,7 +87,8 @@ async function setViewType(activeView) {
|
|
|
87
87
|
if (!activeView)
|
|
88
88
|
return;
|
|
89
89
|
const view = activeView.view;
|
|
90
|
-
|
|
90
|
+
// TODO: remove this eslint rule when tree-widget uses itwinjs-core 4.0.0 version
|
|
91
|
+
const viewType = view.is3d() ? "3d" : "2d"; // eslint-disable-line @itwin/no-internal
|
|
91
92
|
await presentation_frontend_1.Presentation.presentation.vars(exports.RULESET_CATEGORIES.id).setString("ViewType", viewType);
|
|
92
93
|
}
|
|
93
94
|
//# sourceMappingURL=CategoriesTree.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/category-tree/CategoriesTree.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;;;;;;AAE/F,
|
|
1
|
+
{"version":3,"file":"CategoriesTree.js","sourceRoot":"","sources":["../../../../../src/components/trees/category-tree/CategoriesTree.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;;;;;;AAE/F,sCAAoC;AACpC,6CAA+B;AAC/B,8DAAsF;AACtF,wDAA4G;AAC5G,kDAAkD;AAElD,4EAA8G;AAC9G,wEAA4D;AAC5D,oDAAiD;AAEjD,8EAA2E;AAC3E,sEAAgI;AAChI,2EAAsF;AAEtF,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB;;;GAGG;AACU,QAAA,kBAAkB,GAAY,OAA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AAjB,iBAAiB,GAAI,IAAI,qDAAyB,CAAC,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC,EACnH,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,CAAC,CAAC,CAChF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,WAAW,CAAC,UAAqB;IAC9C,IAAI,CAAC,UAAU;QACb,OAAO;IAET,MAAM,IAAI,GAAG,UAAU,CAAC,IAAwB,CAAC;IACjD,iFAAiF;IACjF,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,yCAAyC;IACrF,MAAM,oCAAY,CAAC,YAAY,CAAC,IAAI,CAAC,0BAAkB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AAC9F,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 \"../VisibilityTreeBase.scss\";\nimport * as React from \"react\";\nimport { ControlledTree, SelectionMode, useTreeModel } from \"@itwin/components-react\";\nimport { IModelApp, IModelConnection, SpatialViewState, ViewManager, Viewport } from \"@itwin/core-frontend\";\nimport { useDisposable } from \"@itwin/core-react\";\nimport { Ruleset } from \"@itwin/presentation-common\";\nimport { IPresentationTreeDataProvider, usePresentationTreeNodeLoader } from \"@itwin/presentation-components\";\nimport { Presentation } from \"@itwin/presentation-frontend\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { VisibilityTreeFilterInfo } from \"../Common\";\nimport { VisibilityTreeEventHandler } from \"../VisibilityTreeEventHandler\";\nimport { useVisibilityTreeFiltering, useVisibilityTreeRenderer, VisibilityTreeNoFilteredData } from \"../VisibilityTreeRenderer\";\nimport { CategoryInfo, CategoryVisibilityHandler } from \"./CategoryVisibilityHandler\";\n\nconst PAGING_SIZE = 20;\n\n/**\n * Presentation rules used by ControlledCategoriesTree\n * @internal\n */\nexport const RULESET_CATEGORIES: Ruleset = require(\"./Categories.json\"); // eslint-disable-line @typescript-eslint/no-var-requires\n\n/**\n * Properties for the [[CategoryTree]] component\n * @public\n */\nexport interface CategoryTreeProps {\n /** Flag for accommodating all viewports */\n allViewports?: boolean;\n /** Active viewport */\n activeView?: Viewport;\n /**\n * An IModel to pull data from\n */\n iModel: IModelConnection;\n /** Width of the component */\n width: number;\n /** Height of the component */\n height: number;\n /**\n * Information for tree filtering.\n * @alpha\n */\n filterInfo?: VisibilityTreeFilterInfo;\n /**\n * Callback invoked when tree is filtered.\n */\n onFilterApplied?: (filteredDataProvider: IPresentationTreeDataProvider, matchesCount: number) => void;\n /**\n * Custom category visibility handler to use for testing\n * @internal\n */\n categoryVisibilityHandler?: CategoryVisibilityHandler;\n /**\n * Custom view manager to use for testing\n * @internal\n */\n viewManager?: ViewManager;\n\n /**\n * Available iModel categories\n */\n categories: CategoryInfo[];\n}\n\n/**\n * Tree which displays and manages categories contained in an iModel.\n * @public\n */\nexport function CategoryTree(props: CategoryTreeProps) {\n const { nodeLoader } = usePresentationTreeNodeLoader({\n imodel: props.iModel,\n ruleset: RULESET_CATEGORIES,\n pagingSize: PAGING_SIZE,\n });\n\n const { filteredNodeLoader, isFiltering, nodeHighlightingProps } = useVisibilityTreeFiltering(nodeLoader, props.filterInfo, props.onFilterApplied);\n // istanbul ignore next\n const viewManager = props.viewManager ?? IModelApp.viewManager;\n const { activeView, allViewports, categoryVisibilityHandler } = props;\n const currentActiveView = activeView ?? viewManager.getFirstOpenView();\n const visibilityHandler = useCategoryVisibilityHandler(viewManager, props.iModel, props.categories, currentActiveView, allViewports, categoryVisibilityHandler);\n\n React.useEffect(() => {\n setViewType(currentActiveView); // eslint-disable-line @typescript-eslint/no-floating-promises\n }, [currentActiveView]);\n\n const eventHandler = useDisposable(React.useCallback(() => new VisibilityTreeEventHandler({\n nodeLoader: filteredNodeLoader,\n visibilityHandler,\n collapsedChildrenDisposalEnabled: true,\n }), [filteredNodeLoader, visibilityHandler]));\n\n const treeModel = useTreeModel(filteredNodeLoader.modelSource);\n const treeRenderer = useVisibilityTreeRenderer(false, true);\n const overlay = isFiltering ? <div className=\"filteredTreeOverlay\" /> : undefined;\n const filterApplied = filteredNodeLoader !== nodeLoader;\n\n const noFilteredDataRenderer = React.useCallback(() => {\n return <VisibilityTreeNoFilteredData\n title={TreeWidget.translate(\"categoriesTree.noCategoryFound\")}\n message={TreeWidget.translate(\"categoriesTree.noMatchingCategoryNames\")}\n />;\n }, []);\n\n return (\n <div className=\"tree-widget-visibility-tree-base\">\n <ControlledTree\n nodeLoader={filteredNodeLoader}\n model={treeModel}\n selectionMode={SelectionMode.None}\n eventsHandler={eventHandler}\n treeRenderer={treeRenderer}\n descriptionsEnabled={true}\n nodeHighlightingProps={nodeHighlightingProps}\n noDataRenderer={filterApplied ? noFilteredDataRenderer : undefined}\n width={props.width}\n height={props.height}\n />\n {overlay}\n </div>\n );\n}\n\nfunction useCategoryVisibilityHandler(viewManager: ViewManager, imodel: IModelConnection, categories: CategoryInfo[], activeView?: Viewport, allViewports?: boolean, visibilityHandler?: CategoryVisibilityHandler) {\n return useDisposable(React.useCallback(\n () =>\n // istanbul ignore next\n visibilityHandler ?? new CategoryVisibilityHandler({ viewManager, imodel, categories, activeView, allViewports }),\n [viewManager, imodel, categories, activeView, allViewports, visibilityHandler]),\n );\n}\n\nasync function setViewType(activeView?: Viewport) {\n if (!activeView)\n return;\n\n const view = activeView.view as SpatialViewState;\n // TODO: remove this eslint rule when tree-widget uses itwinjs-core 4.0.0 version\n const viewType = view.is3d() ? \"3d\" : \"2d\"; // eslint-disable-line @itwin/no-internal\n await Presentation.presentation.vars(RULESET_CATEGORIES.id).setString(\"ViewType\", viewType);\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import "
|
|
2
|
+
import "../VisibilityTreeBase.scss";
|
|
3
3
|
import type { CategoriesTreeHeaderButtonProps, CategoriesTreeProps } from "../../../types";
|
|
4
4
|
export declare function CategoriesTreeComponent(props: CategoriesTreeProps): JSX.Element | null;
|
|
5
5
|
export declare namespace CategoriesTreeComponent {
|
|
@@ -24,16 +24,17 @@ exports.CategoriesTreeComponent = void 0;
|
|
|
24
24
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
25
25
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
26
26
|
*--------------------------------------------------------------------------------------------*/
|
|
27
|
-
require("
|
|
27
|
+
require("../VisibilityTreeBase.scss");
|
|
28
28
|
const react_1 = __importStar(require("react"));
|
|
29
29
|
const appui_react_1 = require("@itwin/appui-react");
|
|
30
30
|
const core_frontend_1 = require("@itwin/core-frontend");
|
|
31
|
+
const itwinui_icons_react_1 = require("@itwin/itwinui-icons-react");
|
|
32
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
31
33
|
const CategoriesTree_1 = require("./CategoriesTree");
|
|
32
34
|
const CategoryVisibilityHandler_1 = require("./CategoryVisibilityHandler");
|
|
33
35
|
const CategoriesVisibilityUtils_1 = require("../CategoriesVisibilityUtils");
|
|
34
36
|
const TreeFilteringState_1 = require("../../TreeFilteringState");
|
|
35
37
|
const AutoSizer_1 = require("../../utils/AutoSizer");
|
|
36
|
-
const IconButton_1 = require("../../IconButton");
|
|
37
38
|
const TreeWidget_1 = require("../../../TreeWidget");
|
|
38
39
|
const SearchBar_1 = require("../../search-bar/SearchBar");
|
|
39
40
|
function CategoriesTreeComponent(props) {
|
|
@@ -76,21 +77,23 @@ async function getFilteredCategories(filteredProvider) {
|
|
|
76
77
|
return nodes.map((node) => CategoryVisibilityHandler_1.CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(filteredProvider.getNodeKey(node)));
|
|
77
78
|
}
|
|
78
79
|
function ShowAllButton(props) {
|
|
79
|
-
const showAll = () => {
|
|
80
|
+
const showAll = async () => {
|
|
80
81
|
var _a;
|
|
81
|
-
(0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, props.viewport.iModel, ((_a = props.filteredCategories) !== null && _a !== void 0 ? _a : props.categories).map((category) => category.categoryId), true, true);
|
|
82
|
+
await (0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, props.viewport.iModel, ((_a = props.filteredCategories) !== null && _a !== void 0 ? _a : props.categories).map((category) => category.categoryId), true, true);
|
|
82
83
|
};
|
|
83
|
-
return (react_1.default.createElement(
|
|
84
|
+
return (react_1.default.createElement(itwinui_react_1.IconButton, { className: "tree-widget-header-tree-toolbar-icon", size: "small", styleType: "borderless", title: TreeWidget_1.TreeWidget.translate("showAll"), onClick: showAll },
|
|
85
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgVisibilityShow, null)));
|
|
84
86
|
}
|
|
85
87
|
function HideAllButton(props) {
|
|
86
|
-
const hideAll = () => {
|
|
88
|
+
const hideAll = async () => {
|
|
87
89
|
var _a;
|
|
88
|
-
(0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, props.viewport.iModel, ((_a = props.filteredCategories) !== null && _a !== void 0 ? _a : props.categories).map((category) => category.categoryId), false, true);
|
|
90
|
+
await (0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, props.viewport.iModel, ((_a = props.filteredCategories) !== null && _a !== void 0 ? _a : props.categories).map((category) => category.categoryId), false, true);
|
|
89
91
|
};
|
|
90
|
-
return (react_1.default.createElement(
|
|
92
|
+
return (react_1.default.createElement(itwinui_react_1.IconButton, { className: "tree-widget-header-tree-toolbar-icon", size: "small", styleType: "borderless", title: TreeWidget_1.TreeWidget.translate("hideAll"), onClick: hideAll },
|
|
93
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgVisibilityHide, null)));
|
|
91
94
|
}
|
|
92
95
|
function InvertButton(props) {
|
|
93
|
-
const invert = () => {
|
|
96
|
+
const invert = async () => {
|
|
94
97
|
var _a;
|
|
95
98
|
const ids = ((_a = props.filteredCategories) !== null && _a !== void 0 ? _a : props.categories).map((category) => category.categoryId);
|
|
96
99
|
const enabled = [];
|
|
@@ -104,10 +107,11 @@ function InvertButton(props) {
|
|
|
104
107
|
}
|
|
105
108
|
}
|
|
106
109
|
// Disable enabled
|
|
107
|
-
(0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, props.viewport.iModel, enabled, false, true);
|
|
110
|
+
await (0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, props.viewport.iModel, enabled, false, true);
|
|
108
111
|
// Enable disabled
|
|
109
|
-
(0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, props.viewport.iModel, disabled, true, true);
|
|
112
|
+
await (0, CategoriesVisibilityUtils_1.enableCategory)(core_frontend_1.IModelApp.viewManager, props.viewport.iModel, disabled, true, true);
|
|
110
113
|
};
|
|
111
|
-
return (react_1.default.createElement(
|
|
114
|
+
return (react_1.default.createElement(itwinui_react_1.IconButton, { className: "tree-widget-header-tree-toolbar-icon", title: TreeWidget_1.TreeWidget.translate("invert"), size: "small", styleType: "borderless", onClick: invert },
|
|
115
|
+
react_1.default.createElement(itwinui_icons_react_1.SvgVisibilityHalf, null)));
|
|
112
116
|
}
|
|
113
117
|
//# sourceMappingURL=CategoriesTreeComponent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/category-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,iCAA+B;AAC/B,+CAAmD;AACnD,oDAAkF;AAClF,wDAAmF;AACnF,qDAAgD;AAChD,2EAAqG;AACrG,4EAA8D;AA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,EACJ,IAAI,CACL,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,8BAAC,uBAAU,IACT,SAAS,EAAC,sCAAsC,EAChD,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,EACrC,IAAI,EAAC,wBAAwB,EAC7B,OAAO,EAAE,MAAM,GACf,CACH,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*--------------------------------------------------------------------------------------------*/\nimport \"./CategoriesTree.scss\";\nimport React, { useEffect, useState } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { IModelApp, IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport { CategoryTree } from \"./CategoriesTree\";\nimport { CategoryInfo, CategoryVisibilityHandler, useCategories } from \"./CategoryVisibilityHandler\";\nimport { enableCategory } from \"../CategoriesVisibilityUtils\";\nimport { useTreeFilteringState } from \"../../TreeFilteringState\";\nimport { AutoSizer } from \"../../utils/AutoSizer\";\nimport type { CategoriesTreeHeaderButtonProps, CategoriesTreeProps } from \"../../../types\";\nimport type { IPresentationTreeDataProvider } from \"@itwin/presentation-components\";\nimport { IconButton } from \"../../IconButton\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { SearchBar } from \"../../search-bar/SearchBar\";\n\nexport function CategoriesTreeComponent(props: CategoriesTreeProps) {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return (\n <CategoriesTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />\n );\n}\n\nCategoriesTreeComponent.ShowAllButton = ShowAllButton;\nCategoriesTreeComponent.HideAllButton = HideAllButton;\nCategoriesTreeComponent.InvertButton = InvertButton;\n\nfunction CategoriesTreeComponentImpl(props: CategoriesTreeProps & { iModel: IModelConnection, viewport: ScreenViewport }) {\n const categories = useCategories(IModelApp.viewManager, props.iModel, props.viewport);\n const [filteredCategories, setFilteredCategories] = useState<CategoryInfo[]>();\n const {\n searchOptions,\n filterString,\n activeMatchIndex,\n onFilterApplied,\n filteredProvider,\n } = useTreeFilteringState();\n\n useEffect(() => {\n (async () => {\n if (filteredProvider)\n setFilteredCategories((await getFilteredCategories(filteredProvider)).map((category) => ({ categoryId: category })));\n else\n setFilteredCategories(undefined);\n })();\n }, [filteredProvider]);\n\n return (\n <>\n <SearchBar\n value=\"\"\n valueChangedDelay={500}\n placeholder={TreeWidget.translate(\"search\")}\n title={TreeWidget.translate(\"searchForSomething\")}\n filteringInProgress={searchOptions.isFiltering}\n onFilterClear={searchOptions.onFilterCancel}\n onFilterStart={searchOptions.onFilterStart}\n onSelectedChanged={searchOptions.onResultSelectedChanged}\n resultCount={searchOptions.matchedResultCount ?? 0}\n >\n {props.headerButtons\n ? props.headerButtons.map((btn, index) =>\n <React.Fragment key={index}>\n {btn({ viewport: props.viewport, categories, filteredCategories })}\n </React.Fragment>)\n : [\n <ShowAllButton viewport={props.viewport} categories={categories} filteredCategories={filteredCategories} key=\"show-all-btn\" />,\n <HideAllButton viewport={props.viewport} categories={categories} filteredCategories={filteredCategories} key=\"hide-all-btn\" />,\n <InvertButton viewport={props.viewport} categories={categories} filteredCategories={filteredCategories} key=\"invert-all-btn\" />,\n ]\n }\n </SearchBar>\n <AutoSizer>\n {({ width, height }) => (\n <CategoryTree\n {...props}\n categories={categories}\n width={width}\n height={height}\n filterInfo={{ filter: filterString, activeMatchIndex }}\n onFilterApplied={onFilterApplied}\n />\n )}\n </AutoSizer>\n </>\n );\n}\n\nasync function getFilteredCategories(filteredProvider: IPresentationTreeDataProvider) {\n const nodes = await filteredProvider.getNodes();\n return nodes.map((node) => CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(filteredProvider.getNodeKey(node)));\n}\n\nfunction ShowAllButton(props: CategoriesTreeHeaderButtonProps) {\n const showAll = () => {\n enableCategory(\n IModelApp.viewManager,\n props.viewport.iModel,\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n true,\n true,\n );\n };\n\n return (\n <IconButton\n className=\"tree-widget-header-tree-toolbar-icon\"\n icon=\"icon-visibility\"\n title={TreeWidget.translate(\"showAll\")}\n onClick={showAll}\n />\n );\n}\n\nfunction HideAllButton(props: CategoriesTreeHeaderButtonProps) {\n const hideAll = () => {\n enableCategory(\n IModelApp.viewManager,\n props.viewport.iModel,\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n false,\n true,\n );\n };\n\n return (\n <IconButton\n className=\"tree-widget-header-tree-toolbar-icon\"\n icon=\"icon-visibility-hide-2\"\n title={TreeWidget.translate(\"hideAll\")}\n onClick={hideAll}\n />\n );\n}\n\nfunction InvertButton(props: CategoriesTreeHeaderButtonProps) {\n const invert = () => {\n const ids = (props.filteredCategories ?? props.categories).map((category) => category.categoryId);\n\n const enabled: string[] = [];\n const disabled: string[] = [];\n for (const id of ids) {\n if (props.viewport.view.viewsCategory(id)) {\n enabled.push(id);\n } else {\n disabled.push(id);\n }\n }\n // Disable enabled\n enableCategory(\n IModelApp.viewManager,\n props.viewport.iModel,\n enabled,\n false,\n true\n );\n\n // Enable disabled\n enableCategory(\n IModelApp.viewManager,\n props.viewport.iModel,\n disabled,\n true,\n true\n );\n };\n\n return (\n <IconButton\n className=\"tree-widget-header-tree-toolbar-icon\"\n title={TreeWidget.translate(\"invert\")}\n icon=\"icon-visibility-invert\"\n onClick={invert}\n />\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CategoriesTreeComponent.js","sourceRoot":"","sources":["../../../../../src/components/trees/category-tree/CategoriesTreeComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,sCAAoC;AACpC,+CAAmD;AACnD,oDAAkF;AAClF,wDAAmF;AACnF,oEAAqG;AACrG,wDAAkD;AAClD,qDAAgD;AAChD,2EAAqG;AACrG,4EAA8D;AAC9D,i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BAAkB;QAClB,MAAM,IAAA,0CAAc,EAClB,yBAAS,CAAC,WAAW,EACrB,KAAK,CAAC,QAAQ,CAAC,MAAM,EACrB,QAAQ,EACR,IAAI,EACJ,IAAI,CACL,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,CACL,8BAAC,0BAAU,IACT,SAAS,EAAC,sCAAsC,EAChD,KAAK,EAAE,uBAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,EACrC,IAAI,EAAC,OAAO,EACZ,SAAS,EAAC,YAAY,EACtB,OAAO,EAAE,MAAM;QAEf,8BAAC,uCAAiB,OAAG,CACV,CACd,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*--------------------------------------------------------------------------------------------*/\nimport \"../VisibilityTreeBase.scss\";\nimport React, { useEffect, useState } from \"react\";\nimport { useActiveIModelConnection, useActiveViewport } from \"@itwin/appui-react\";\nimport { IModelApp, IModelConnection, ScreenViewport } from \"@itwin/core-frontend\";\nimport { SvgVisibilityHalf, SvgVisibilityHide, SvgVisibilityShow } from \"@itwin/itwinui-icons-react\";\nimport { IconButton } from \"@itwin/itwinui-react\";\nimport { CategoryTree } from \"./CategoriesTree\";\nimport { CategoryInfo, CategoryVisibilityHandler, useCategories } from \"./CategoryVisibilityHandler\";\nimport { enableCategory } from \"../CategoriesVisibilityUtils\";\nimport { useTreeFilteringState } from \"../../TreeFilteringState\";\nimport { AutoSizer } from \"../../utils/AutoSizer\";\nimport type { CategoriesTreeHeaderButtonProps, CategoriesTreeProps } from \"../../../types\";\nimport type { IPresentationTreeDataProvider } from \"@itwin/presentation-components\";\nimport { TreeWidget } from \"../../../TreeWidget\";\nimport { SearchBar } from \"../../search-bar/SearchBar\";\n\nexport function CategoriesTreeComponent(props: CategoriesTreeProps) {\n const iModel = useActiveIModelConnection();\n const viewport = useActiveViewport();\n\n if (!iModel || !viewport) {\n return null;\n }\n\n return (\n <CategoriesTreeComponentImpl {...props} iModel={iModel} viewport={viewport} />\n );\n}\n\nCategoriesTreeComponent.ShowAllButton = ShowAllButton;\nCategoriesTreeComponent.HideAllButton = HideAllButton;\nCategoriesTreeComponent.InvertButton = InvertButton;\n\nfunction CategoriesTreeComponentImpl(props: CategoriesTreeProps & { iModel: IModelConnection, viewport: ScreenViewport }) {\n const categories = useCategories(IModelApp.viewManager, props.iModel, props.viewport);\n const [filteredCategories, setFilteredCategories] = useState<CategoryInfo[]>();\n const {\n searchOptions,\n filterString,\n activeMatchIndex,\n onFilterApplied,\n filteredProvider,\n } = useTreeFilteringState();\n\n useEffect(() => {\n (async () => {\n if (filteredProvider)\n setFilteredCategories((await getFilteredCategories(filteredProvider)).map((category) => ({ categoryId: category })));\n else\n setFilteredCategories(undefined);\n })();\n }, [filteredProvider]);\n\n return (\n <>\n <SearchBar\n value=\"\"\n valueChangedDelay={500}\n placeholder={TreeWidget.translate(\"search\")}\n title={TreeWidget.translate(\"searchForSomething\")}\n filteringInProgress={searchOptions.isFiltering}\n onFilterClear={searchOptions.onFilterCancel}\n onFilterStart={searchOptions.onFilterStart}\n onSelectedChanged={searchOptions.onResultSelectedChanged}\n resultCount={searchOptions.matchedResultCount ?? 0}\n >\n {props.headerButtons\n ? props.headerButtons.map((btn, index) =>\n <React.Fragment key={index}>\n {btn({ viewport: props.viewport, categories, filteredCategories })}\n </React.Fragment>)\n : [\n <ShowAllButton viewport={props.viewport} categories={categories} filteredCategories={filteredCategories} key=\"show-all-btn\" />,\n <HideAllButton viewport={props.viewport} categories={categories} filteredCategories={filteredCategories} key=\"hide-all-btn\" />,\n <InvertButton viewport={props.viewport} categories={categories} filteredCategories={filteredCategories} key=\"invert-all-btn\" />,\n ]\n }\n </SearchBar>\n <AutoSizer>\n {({ width, height }) => (\n <CategoryTree\n {...props}\n categories={categories}\n width={width}\n height={height}\n filterInfo={{ filter: filterString, activeMatchIndex }}\n onFilterApplied={onFilterApplied}\n />\n )}\n </AutoSizer>\n </>\n );\n}\n\nasync function getFilteredCategories(filteredProvider: IPresentationTreeDataProvider) {\n const nodes = await filteredProvider.getNodes();\n return nodes.map((node) => CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(filteredProvider.getNodeKey(node)));\n}\n\nfunction ShowAllButton(props: CategoriesTreeHeaderButtonProps) {\n const showAll = async () => {\n await enableCategory(\n IModelApp.viewManager,\n props.viewport.iModel,\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n true,\n true,\n );\n };\n\n return (\n <IconButton\n className=\"tree-widget-header-tree-toolbar-icon\"\n size=\"small\"\n styleType=\"borderless\"\n title={TreeWidget.translate(\"showAll\")}\n onClick={showAll}\n >\n <SvgVisibilityShow />\n </IconButton>\n );\n}\n\nfunction HideAllButton(props: CategoriesTreeHeaderButtonProps) {\n const hideAll = async () => {\n await enableCategory(\n IModelApp.viewManager,\n props.viewport.iModel,\n (props.filteredCategories ?? props.categories).map((category) => category.categoryId),\n false,\n true,\n );\n };\n\n return (\n <IconButton\n className=\"tree-widget-header-tree-toolbar-icon\"\n size=\"small\"\n styleType=\"borderless\"\n title={TreeWidget.translate(\"hideAll\")}\n onClick={hideAll}\n >\n <SvgVisibilityHide />\n </IconButton>\n );\n}\n\nfunction InvertButton(props: CategoriesTreeHeaderButtonProps) {\n const invert = async () => {\n const ids = (props.filteredCategories ?? props.categories).map((category) => category.categoryId);\n\n const enabled: string[] = [];\n const disabled: string[] = [];\n for (const id of ids) {\n if (props.viewport.view.viewsCategory(id)) {\n enabled.push(id);\n } else {\n disabled.push(id);\n }\n }\n // Disable enabled\n await enableCategory(\n IModelApp.viewManager,\n props.viewport.iModel,\n enabled,\n false,\n true\n );\n\n // Enable disabled\n await enableCategory(\n IModelApp.viewManager,\n props.viewport.iModel,\n disabled,\n true,\n true\n );\n };\n\n return (\n <IconButton\n className=\"tree-widget-header-tree-toolbar-icon\"\n title={TreeWidget.translate(\"invert\")}\n size=\"small\"\n styleType=\"borderless\"\n onClick={invert}\n >\n <SvgVisibilityHalf />\n </IconButton>\n );\n}\n"]}
|
|
@@ -44,7 +44,7 @@ export declare class CategoryVisibilityHandler implements IVisibilityHandler {
|
|
|
44
44
|
private onViewedCategoriesChanged;
|
|
45
45
|
private onVisibilityChangeInternal;
|
|
46
46
|
static getInstanceIdFromTreeNodeKey(nodeKey: NodeKey): string;
|
|
47
|
-
enableCategory(ids: string[], enabled: boolean, enableAllSubCategories?: boolean): void
|
|
47
|
+
enableCategory(ids: string[], enabled: boolean, enableAllSubCategories?: boolean): Promise<void>;
|
|
48
48
|
enableSubCategory(key: string, enabled: boolean): void;
|
|
49
49
|
}
|
|
50
50
|
//# sourceMappingURL=CategoryVisibilityHandler.d.ts.map
|
|
@@ -85,12 +85,12 @@ class CategoryVisibilityHandler {
|
|
|
85
85
|
const parentId = (_a = this.getParent(childId)) === null || _a === void 0 ? void 0 : _a.categoryId;
|
|
86
86
|
// make sure parent category is enabled
|
|
87
87
|
if (shouldDisplay && parentId)
|
|
88
|
-
this.enableCategory([parentId], true, false);
|
|
88
|
+
await this.enableCategory([parentId], true, false);
|
|
89
89
|
this.enableSubCategory(childId, shouldDisplay);
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
const instanceId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);
|
|
93
|
-
this.enableCategory([instanceId], shouldDisplay, true);
|
|
93
|
+
await this.enableCategory([instanceId], shouldDisplay, true);
|
|
94
94
|
}
|
|
95
95
|
getSubCategoryVisibility(id) {
|
|
96
96
|
const parentItem = this.getParent(id);
|
|
@@ -125,8 +125,8 @@ class CategoryVisibilityHandler {
|
|
|
125
125
|
static getInstanceIdFromTreeNodeKey(nodeKey) {
|
|
126
126
|
return (presentation_common_1.NodeKey.isInstancesNodeKey(nodeKey) && nodeKey.instanceKeys.length > 0) ? nodeKey.instanceKeys[0].id : /* istanbul ignore next */ "";
|
|
127
127
|
}
|
|
128
|
-
enableCategory(ids, enabled, enableAllSubCategories = true) {
|
|
129
|
-
(0, CategoriesVisibilityUtils_1.enableCategory)(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);
|
|
128
|
+
async enableCategory(ids, enabled, enableAllSubCategories = true) {
|
|
129
|
+
await (0, CategoriesVisibilityUtils_1.enableCategory)(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);
|
|
130
130
|
}
|
|
131
131
|
enableSubCategory(key, enabled) {
|
|
132
132
|
(0, CategoriesVisibilityUtils_1.enableSubCategory)(this._viewManager, key, enabled, this._useAllViewports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryVisibilityHandler.js","sourceRoot":"","sources":["../../../../../src/components/trees/category-tree/CategoryVisibilityHandler.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;;;;;;AAE/F,6CAA+B;AAC/B,8DAAsE;AACtE,sDAA8C;AAE9C,oEAAqD;AACrD,4EAA6G;AAG7G,MAAM,sBAAsB,GAAmB,EAAE,CAAC;AAElD;;;GAGG;AACH,SAAgB,aAAa,CAAC,WAAwB,EAAE,MAAwB,EAAE,IAAe;;IAC/F,MAAM,WAAW,GAAG,IAAI,IAAI,WAAW,CAAC,gBAAgB,EAAE,CAAC;IAC3D,MAAM,iBAAiB,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,IAAA,sDAA0B,EAAC,MAAM,EAAE,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAC5H,OAAO,MAAA,IAAA,gCAAa,EAAC,iBAAiB,CAAC,mCAAI,sBAAsB,CAAC;AACpE,CAAC;AAJD,sCAIC;AAoBD,aAAa;AACb,MAAa,yBAAyB;IAQpC,YAAY,MAAuC;;QAqB5C,uBAAkB,GAAG,IAAI,sBAAO,EAA4B,CAAC;QAqDpE,gEAAgE;QACxD,0BAAqB,GAAG,GAAG,EAAE;YACnC,IAAI,C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A,6CAAiB,EAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC5E,CAAC;CACF;AAjHD,8DAiHC","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 * as React from \"react\";\nimport { TreeNodeItem, useAsyncValue } from \"@itwin/components-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { IModelConnection, ViewManager, Viewport } from \"@itwin/core-frontend\";\nimport { NodeKey } from \"@itwin/presentation-common\";\nimport { enableCategory, enableSubCategory, loadCategoriesFromViewport } from \"../CategoriesVisibilityUtils\";\nimport { IVisibilityHandler, VisibilityChangeListener, VisibilityStatus } from \"../VisibilityTreeEventHandler\";\n\nconst EMPTY_CATEGORIES_ARRAY: CategoryInfo[] = [];\n\n/**\n * Loads categories from viewport or uses provided list of categories.\n * @internal\n */\nexport function useCategories(viewManager: ViewManager, imodel: IModelConnection, view?: Viewport) {\n const currentView = view || viewManager.getFirstOpenView();\n const categoriesPromise = React.useMemo(async () => loadCategoriesFromViewport(imodel, currentView), [imodel, currentView]);\n return useAsyncValue(categoriesPromise) ?? EMPTY_CATEGORIES_ARRAY;\n}\n\n/**\n * Data structure that describes category.\n * @alpha\n */\nexport interface CategoryInfo {\n categoryId: string;\n subCategoryIds?: string[];\n}\n\n/** @alpha */\nexport interface CategoryVisibilityHandlerParams {\n viewManager: ViewManager;\n imodel: IModelConnection;\n categories: CategoryInfo[];\n activeView?: Viewport;\n allViewports?: boolean;\n}\n\n/** @alpha */\nexport class CategoryVisibilityHandler implements IVisibilityHandler {\n private _viewManager: ViewManager;\n private _imodel: IModelConnection;\n private _pendingVisibilityChange: any | undefined;\n private _activeView?: Viewport;\n private _useAllViewports: boolean;\n private _categories: CategoryInfo[];\n\n constructor(params: CategoryVisibilityHandlerParams) {\n this._viewManager = params.viewManager;\n this._imodel = params.imodel;\n this._activeView = params.activeView;\n // istanbul ignore next\n this._useAllViewports = params.allViewports ?? false;\n this._categories = params.categories;\n if (this._activeView) {\n this._activeView.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);\n this._activeView.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);\n }\n }\n\n public dispose() {\n if (this._activeView) {\n this._activeView.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);\n this._activeView.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);\n }\n clearTimeout(this._pendingVisibilityChange);\n }\n\n public onVisibilityChange = new BeEvent<VisibilityChangeListener>();\n\n public getVisibilityStatus(node: TreeNodeItem, nodeKey: NodeKey): VisibilityStatus {\n const instanceId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);\n return { state: node.parentId ? this.getSubCategoryVisibility(instanceId) : this.getCategoryVisibility(instanceId) };\n }\n\n public async changeVisibility(node: TreeNodeItem, nodeKey: NodeKey, shouldDisplay: boolean): Promise<void> {\n // handle subcategory visibility change\n if (node.parentId) {\n const childId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);\n // istanbul ignore next\n const parentId = this.getParent(childId)?.categoryId;\n\n // make sure parent category is enabled\n if (shouldDisplay && parentId)\n this.enableCategory([parentId], true, false);\n\n this.enableSubCategory(childId, shouldDisplay);\n return;\n }\n\n const instanceId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);\n this.enableCategory([instanceId], shouldDisplay, true);\n }\n\n public getSubCategoryVisibility(id: string) {\n const parentItem = this.getParent(id);\n if (!parentItem || !this._activeView)\n return \"hidden\";\n\n const isVisible = this._activeView.view.viewsCategory(parentItem.categoryId) && this._activeView.isSubCategoryVisible(id);\n return isVisible ? \"visible\" : \"hidden\";\n }\n\n public getCategoryVisibility(id: string) {\n if (!this._activeView)\n return \"hidden\";\n return this._activeView.view.viewsCategory(id) ? \"visible\" : \"hidden\";\n }\n\n public getParent(key: string): CategoryInfo | undefined {\n for (const category of this._categories) {\n // istanbul ignore else\n if (category.subCategoryIds) {\n if (category.subCategoryIds.indexOf(key) !== -1)\n return category;\n }\n }\n\n return undefined;\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 this._pendingVisibilityChange = setTimeout(() => {\n this.onVisibilityChange.raiseEvent();\n this._pendingVisibilityChange = undefined;\n }, 0);\n }\n\n public static getInstanceIdFromTreeNodeKey(nodeKey: NodeKey) {\n return (NodeKey.isInstancesNodeKey(nodeKey) && nodeKey.instanceKeys.length > 0) ? nodeKey.instanceKeys[0].id : /* istanbul ignore next */ \"\";\n }\n\n public enableCategory(ids: string[], enabled: boolean, enableAllSubCategories = true) {\n enableCategory(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);\n }\n\n public enableSubCategory(key: string, enabled: boolean) {\n enableSubCategory(this._viewManager, key, enabled, this._useAllViewports);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"CategoryVisibilityHandler.js","sourceRoot":"","sources":["../../../../../src/components/trees/category-tree/CategoryVisibilityHandler.tsx"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;;;;;;;;;;;AAE/F,6CAA+B;AAC/B,8DAAsE;AACtE,sDAA8C;AAE9C,oEAAqD;AACrD,4EAA6G;AAG7G,MAAM,sBAAsB,GAAmB,EAAE,CAAC;AAElD;;;GAGG;AACH,SAAgB,aAAa,CAAC,WAAwB,EAAE,MAAwB,EAAE,IAAe;;IAC/F,MAAM,WAAW,GAAG,IAAI,IAAI,WAAW,CAAC,gBAAgB,EAAE,CAAC;IAC3D,MAAM,iBAAiB,GAAG,KAAK,CA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AG,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,0BAA0B,CAAC,EAAE,CAAC;IAC/I,CAAC;IAEM,KAAK,CAAC,cAAc,CAAC,GAAa,EAAE,OAAgB,EAAE,sBAAsB,GAAG,IAAI;QACxF,MAAM,IAAA,0CAAc,EAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,EAAE,sBAAsB,CAAC,CAAC;IACrH,CAAC;IAEM,iBAAiB,CAAC,GAAW,EAAE,OAAgB;QACpD,IAAA,6CAAiB,EAAC,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC5E,CAAC;CACF;AAjHD,8DAiHC","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 * as React from \"react\";\nimport { TreeNodeItem, useAsyncValue } from \"@itwin/components-react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { IModelConnection, ViewManager, Viewport } from \"@itwin/core-frontend\";\nimport { NodeKey } from \"@itwin/presentation-common\";\nimport { enableCategory, enableSubCategory, loadCategoriesFromViewport } from \"../CategoriesVisibilityUtils\";\nimport { IVisibilityHandler, VisibilityChangeListener, VisibilityStatus } from \"../VisibilityTreeEventHandler\";\n\nconst EMPTY_CATEGORIES_ARRAY: CategoryInfo[] = [];\n\n/**\n * Loads categories from viewport or uses provided list of categories.\n * @internal\n */\nexport function useCategories(viewManager: ViewManager, imodel: IModelConnection, view?: Viewport) {\n const currentView = view || viewManager.getFirstOpenView();\n const categoriesPromise = React.useMemo(async () => loadCategoriesFromViewport(imodel, currentView), [imodel, currentView]);\n return useAsyncValue(categoriesPromise) ?? EMPTY_CATEGORIES_ARRAY;\n}\n\n/**\n * Data structure that describes category.\n * @alpha\n */\nexport interface CategoryInfo {\n categoryId: string;\n subCategoryIds?: string[];\n}\n\n/** @alpha */\nexport interface CategoryVisibilityHandlerParams {\n viewManager: ViewManager;\n imodel: IModelConnection;\n categories: CategoryInfo[];\n activeView?: Viewport;\n allViewports?: boolean;\n}\n\n/** @alpha */\nexport class CategoryVisibilityHandler implements IVisibilityHandler {\n private _viewManager: ViewManager;\n private _imodel: IModelConnection;\n private _pendingVisibilityChange: any | undefined;\n private _activeView?: Viewport;\n private _useAllViewports: boolean;\n private _categories: CategoryInfo[];\n\n constructor(params: CategoryVisibilityHandlerParams) {\n this._viewManager = params.viewManager;\n this._imodel = params.imodel;\n this._activeView = params.activeView;\n // istanbul ignore next\n this._useAllViewports = params.allViewports ?? false;\n this._categories = params.categories;\n if (this._activeView) {\n this._activeView.onDisplayStyleChanged.addListener(this.onDisplayStyleChanged);\n this._activeView.onViewedCategoriesChanged.addListener(this.onViewedCategoriesChanged);\n }\n }\n\n public dispose() {\n if (this._activeView) {\n this._activeView.onDisplayStyleChanged.removeListener(this.onDisplayStyleChanged);\n this._activeView.onViewedCategoriesChanged.removeListener(this.onViewedCategoriesChanged);\n }\n clearTimeout(this._pendingVisibilityChange);\n }\n\n public onVisibilityChange = new BeEvent<VisibilityChangeListener>();\n\n public getVisibilityStatus(node: TreeNodeItem, nodeKey: NodeKey): VisibilityStatus {\n const instanceId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);\n return { state: node.parentId ? this.getSubCategoryVisibility(instanceId) : this.getCategoryVisibility(instanceId) };\n }\n\n public async changeVisibility(node: TreeNodeItem, nodeKey: NodeKey, shouldDisplay: boolean): Promise<void> {\n // handle subcategory visibility change\n if (node.parentId) {\n const childId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);\n // istanbul ignore next\n const parentId = this.getParent(childId)?.categoryId;\n\n // make sure parent category is enabled\n if (shouldDisplay && parentId)\n await this.enableCategory([parentId], true, false);\n\n this.enableSubCategory(childId, shouldDisplay);\n return;\n }\n\n const instanceId = CategoryVisibilityHandler.getInstanceIdFromTreeNodeKey(nodeKey);\n await this.enableCategory([instanceId], shouldDisplay, true);\n }\n\n public getSubCategoryVisibility(id: string) {\n const parentItem = this.getParent(id);\n if (!parentItem || !this._activeView)\n return \"hidden\";\n\n const isVisible = this._activeView.view.viewsCategory(parentItem.categoryId) && this._activeView.isSubCategoryVisible(id);\n return isVisible ? \"visible\" : \"hidden\";\n }\n\n public getCategoryVisibility(id: string) {\n if (!this._activeView)\n return \"hidden\";\n return this._activeView.view.viewsCategory(id) ? \"visible\" : \"hidden\";\n }\n\n public getParent(key: string): CategoryInfo | undefined {\n for (const category of this._categories) {\n // istanbul ignore else\n if (category.subCategoryIds) {\n if (category.subCategoryIds.indexOf(key) !== -1)\n return category;\n }\n }\n\n return undefined;\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 this._pendingVisibilityChange = setTimeout(() => {\n this.onVisibilityChange.raiseEvent();\n this._pendingVisibilityChange = undefined;\n }, 0);\n }\n\n public static getInstanceIdFromTreeNodeKey(nodeKey: NodeKey) {\n return (NodeKey.isInstancesNodeKey(nodeKey) && nodeKey.instanceKeys.length > 0) ? nodeKey.instanceKeys[0].id : /* istanbul ignore next */ \"\";\n }\n\n public async enableCategory(ids: string[], enabled: boolean, enableAllSubCategories = true) {\n await enableCategory(this._viewManager, this._imodel, ids, enabled, this._useAllViewports, enableAllSubCategories);\n }\n\n public enableSubCategory(key: string, enabled: boolean) {\n enableSubCategory(this._viewManager, key, enabled, this._useAllViewports);\n }\n}\n"]}
|
|
@@ -8,5 +8,4 @@ export * from "./category-tree/CategoryVisibilityHandler";
|
|
|
8
8
|
export * from "./models-tree/ModelsTree";
|
|
9
9
|
export * from "./models-tree/ModelsTreeComponent";
|
|
10
10
|
export * from "./models-tree/ModelsVisibilityHandler";
|
|
11
|
-
export * from "./spatial-tree/SpatialTreeComponent";
|
|
12
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -24,5 +24,4 @@ __exportStar(require("./category-tree/CategoryVisibilityHandler"), exports);
|
|
|
24
24
|
__exportStar(require("./models-tree/ModelsTree"), exports);
|
|
25
25
|
__exportStar(require("./models-tree/ModelsTreeComponent"), exports);
|
|
26
26
|
__exportStar(require("./models-tree/ModelsVisibilityHandler"), exports);
|
|
27
|
-
__exportStar(require("./spatial-tree/SpatialTreeComponent"), exports);
|
|
28
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;AAE/F,2CAAyB;AACzB,sDAAoC;AACpC,+DAA6C;AAC7C,2DAAyC;AACzC,iEAA+C;AAC/C,0EAAwD;AACxD,4EAA0D;AAC1D,2DAAyC;AACzC,oEAAkD;AAClD,wEAAsD
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/trees/index.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;;;;;;;;;;;;AAE/F,2CAAyB;AACzB,sDAAoC;AACpC,+DAA6C;AAC7C,2DAAyC;AACzC,iEAA+C;AAC/C,0EAAwD;AACxD,4EAA0D;AAC1D,2DAAyC;AACzC,oEAAkD;AAClD,wEAAsD","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\nexport * from \"./Common\";\nexport * from \"./IModelContentTree\";\nexport * from \"./VisibilityTreeEventHandler\";\nexport * from \"./VisibilityTreeRenderer\";\nexport * from \"./category-tree/CategoriesTree\";\nexport * from \"./category-tree/CategoriesTreeComponent\";\nexport * from \"./category-tree/CategoryVisibilityHandler\";\nexport * from \"./models-tree/ModelsTree\";\nexport * from \"./models-tree/ModelsTreeComponent\";\nexport * from \"./models-tree/ModelsVisibilityHandler\";\n"]}
|