@itwin/tree-widget-react 2.3.1 → 3.0.0-dev.0
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 +2 -2
- package/lib/cjs/TreeWidget.d.ts +2 -3
- package/lib/cjs/TreeWidget.js.map +1 -1
- package/lib/cjs/components/tree-header/TreeHeader.js +11 -3
- package/lib/cjs/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.d.ts +1 -1
- package/lib/cjs/components/trees/CategoriesVisibilityUtils.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.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoriesTreeButtons.d.ts +28 -0
- package/lib/cjs/components/trees/category-tree/CategoriesTreeButtons.js +38 -0
- package/lib/cjs/components/trees/category-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.d.ts +2 -17
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js +7 -26
- package/lib/cjs/components/trees/category-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.d.ts +1 -8
- package/lib/cjs/components/trees/category-tree/CategoryVisibilityHandler.js.map +1 -1
- package/lib/cjs/components/trees/index.d.ts +3 -0
- package/lib/cjs/components/trees/index.js +1 -0
- package/lib/cjs/components/trees/index.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.d.ts +33 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js +86 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeButtons.js.map +1 -0
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.d.ts +2 -24
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js +24 -76
- package/lib/cjs/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/cjs/components/trees/models-tree/Utils.d.ts +2 -2
- package/lib/cjs/components/trees/models-tree/Utils.js.map +1 -1
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.d.ts +20 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.js +61 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.d.ts +16 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.js +43 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeDefinition.d.ts +23 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js +180 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.d.ts +36 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js +94 -0
- package/lib/cjs/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContext.d.ts +13 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContext.js +16 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContext.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContextProvider.d.ts +8 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContextProvider.js +47 -0
- package/lib/cjs/components/trees/stateless/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchiesLocalization.d.ts +8 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchiesLocalization.js +33 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchiesLocalization.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.d.ts +16 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.js +139 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyFiltering.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.d.ts +21 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.js +82 -0
- package/lib/cjs/components/trees/stateless/common/UseHierarchyVisibility.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.d.ts +13 -0
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.js +34 -0
- package/lib/cjs/components/trees/stateless/common/UseMultiCheckboxHandler.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/Utils.d.ts +3 -0
- package/lib/cjs/components/trees/stateless/common/Utils.js +23 -0
- package/lib/cjs/components/trees/stateless/common/Utils.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/Delayed.d.ts +6 -0
- package/lib/cjs/components/trees/stateless/common/components/Delayed.js +31 -0
- package/lib/cjs/components/trees/stateless/common/components/Delayed.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.d.ts +23 -0
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.js +66 -0
- package/lib/cjs/components/trees/stateless/common/components/FilterableTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.d.ts +5 -0
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.js +16 -0
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/ProgressOverlay.scss +21 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.d.ts +26 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.js +68 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.d.ts +12 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js +24 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.d.ts +10 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js +20 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.d.ts +16 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.js +23 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.js.map +1 -0
- package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeRenderer.scss +41 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.d.ts +13 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js +40 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js +25 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +20 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js +244 -0
- package/lib/cjs/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.d.ts +13 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.js +48 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js +25 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.d.ts +25 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js +639 -0
- package/lib/cjs/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/stateless/index.d.ts +5 -0
- package/lib/cjs/components/trees/stateless/index.js +16 -0
- package/lib/cjs/components/trees/stateless/index.js.map +1 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.d.ts +16 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.js +77 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTree.js.map +1 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.d.ts +17 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.js +55 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeComponent.js.map +1 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.d.ts +35 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.js +856 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsTreeDefinition.js.map +1 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.d.ts +48 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.js +470 -0
- package/lib/cjs/components/trees/stateless/models-tree/ModelsVisibilityHandler.js.map +1 -0
- package/lib/esm/TreeWidget.d.ts +2 -3
- package/lib/esm/TreeWidget.js.map +1 -1
- package/lib/esm/components/tree-header/TreeHeader.js +11 -3
- package/lib/esm/components/tree-header/TreeHeader.js.map +1 -1
- package/lib/esm/components/trees/CategoriesVisibilityUtils.d.ts +1 -1
- package/lib/esm/components/trees/CategoriesVisibilityUtils.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.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoriesTreeButtons.d.ts +28 -0
- package/lib/esm/components/trees/category-tree/CategoriesTreeButtons.js +32 -0
- package/lib/esm/components/trees/category-tree/CategoriesTreeButtons.js.map +1 -0
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.d.ts +2 -17
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js +2 -21
- package/lib/esm/components/trees/category-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.d.ts +1 -8
- package/lib/esm/components/trees/category-tree/CategoryVisibilityHandler.js.map +1 -1
- package/lib/esm/components/trees/index.d.ts +3 -0
- package/lib/esm/components/trees/index.js +1 -0
- package/lib/esm/components/trees/index.js.map +1 -1
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.d.ts +33 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js +77 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeButtons.js.map +1 -0
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.d.ts +2 -24
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js +20 -72
- package/lib/esm/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/components/trees/models-tree/Utils.d.ts +2 -2
- package/lib/esm/components/trees/models-tree/Utils.js.map +1 -1
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.d.ts +20 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.js +57 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.d.ts +16 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.js +39 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeDefinition.d.ts +23 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js +176 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.d.ts +36 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js +90 -0
- package/lib/esm/components/trees/stateless/categories-tree/CategoriesVisibilityHandler.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContext.d.ts +13 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContext.js +12 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContext.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContextProvider.d.ts +8 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContextProvider.js +43 -0
- package/lib/esm/components/trees/stateless/common/FocusedInstancesContextProvider.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.d.ts +8 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.js +29 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchiesLocalization.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.d.ts +16 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.js +135 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyFiltering.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.d.ts +21 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.js +78 -0
- package/lib/esm/components/trees/stateless/common/UseHierarchyVisibility.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.d.ts +13 -0
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.js +30 -0
- package/lib/esm/components/trees/stateless/common/UseMultiCheckboxHandler.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/Utils.d.ts +3 -0
- package/lib/esm/components/trees/stateless/common/Utils.js +19 -0
- package/lib/esm/components/trees/stateless/common/Utils.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/Delayed.d.ts +6 -0
- package/lib/esm/components/trees/stateless/common/components/Delayed.js +27 -0
- package/lib/esm/components/trees/stateless/common/components/Delayed.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.d.ts +23 -0
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.js +62 -0
- package/lib/esm/components/trees/stateless/common/components/FilterableTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.d.ts +5 -0
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.js +12 -0
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/ProgressOverlay.scss +21 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.d.ts +26 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.js +64 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.d.ts +12 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js +20 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.d.ts +10 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js +13 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.d.ts +16 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.js +19 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.js.map +1 -0
- package/lib/esm/components/trees/stateless/common/components/VisibilityTreeRenderer.scss +41 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.d.ts +13 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js +36 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.d.ts +14 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js +21 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.d.ts +20 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js +240 -0
- package/lib/esm/components/trees/stateless/external-sources-tree/ExternalSourcesTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.d.ts +13 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.js +44 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.d.ts +14 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js +21 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.d.ts +25 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js +635 -0
- package/lib/esm/components/trees/stateless/imodel-content-tree/IModelContentTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/stateless/index.d.ts +5 -0
- package/lib/esm/components/trees/stateless/index.js +9 -0
- package/lib/esm/components/trees/stateless/index.js.map +1 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.d.ts +16 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.js +73 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTree.js.map +1 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.d.ts +17 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.js +51 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeComponent.js.map +1 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.d.ts +35 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.js +852 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsTreeDefinition.js.map +1 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.d.ts +48 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.js +466 -0
- package/lib/esm/components/trees/stateless/models-tree/ModelsVisibilityHandler.js.map +1 -0
- package/lib/public/locales/en/TreeWidget.json +21 -0
- package/package.json +7 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.useMultiCheckboxHandler = void 0;
|
|
8
|
+
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
9
|
+
/** @internal */
|
|
10
|
+
function useMultiCheckboxHandler({ rootNodes, isNodeSelected, onClick }) {
|
|
11
|
+
const clickSelectedNodes = (nodes, checked) => {
|
|
12
|
+
nodes.forEach((node) => {
|
|
13
|
+
if (!(0, presentation_hierarchies_react_1.isPresentationHierarchyNode)(node)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
if (isNodeSelected(node.id)) {
|
|
17
|
+
onClick(node, checked);
|
|
18
|
+
}
|
|
19
|
+
if (node.isExpanded && typeof node.children !== "boolean") {
|
|
20
|
+
clickSelectedNodes(node.children, checked);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
const onCheckboxClicked = (node, checked) => {
|
|
25
|
+
if (!isNodeSelected(node.id)) {
|
|
26
|
+
onClick(node, checked);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
rootNodes && clickSelectedNodes(rootNodes, checked);
|
|
30
|
+
};
|
|
31
|
+
return { onCheckboxClicked };
|
|
32
|
+
}
|
|
33
|
+
exports.useMultiCheckboxHandler = useMultiCheckboxHandler;
|
|
34
|
+
//# sourceMappingURL=UseMultiCheckboxHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UseMultiCheckboxHandler.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/common/UseMultiCheckboxHandler.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAEhG,0FAAoF;AAcpF,gBAAgB;AAChB,SAAgB,uBAAuB,CAAC,EAAE,SAAS,EAAE,cAAc,EAAE,OAAO,EAAgC;IAC1G,MAAM,kBAAkB,GAAG,CAAC,KAAkC,EAAE,OAAgB,EAAE,EAAE;QAClF,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACrB,IAAI,CAAC,IAAA,4DAA2B,EAAC,IAAI,CAAC,EAAE;gBACtC,OAAO;aACR;YACD,IAAI,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;gBAC3B,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aACxB;YACD,IAAI,IAAI,CAAC,UAAU,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,SAAS,EAAE;gBACzD,kBAAkB,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;aAC5C;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,MAAM,iBAAiB,GAAG,CAAC,IAA+B,EAAE,OAAgB,EAAE,EAAE;QAC9E,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE;YAC5B,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;YACvB,OAAO;SACR;QACD,SAAS,IAAI,kBAAkB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IACtD,CAAC,CAAC;IAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC;AAC/B,CAAC;AAxBD,0DAwBC","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 { isPresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\nimport type { PresentationHierarchyNode, PresentationTreeNode } from \"@itwin/presentation-hierarchies-react\";\n\ninterface UseMultiCheckboxHandlerProps {\n rootNodes: PresentationTreeNode[] | undefined;\n isNodeSelected: (nodeId: string) => boolean;\n onClick: (node: PresentationHierarchyNode, checked: boolean) => void;\n}\n\ninterface UseMultiCheckboxHandlerResult {\n onCheckboxClicked: (node: PresentationHierarchyNode, checked: boolean) => void;\n}\n\n/** @internal */\nexport function useMultiCheckboxHandler({ rootNodes, isNodeSelected, onClick }: UseMultiCheckboxHandlerProps): UseMultiCheckboxHandlerResult {\n const clickSelectedNodes = (nodes: Array<PresentationTreeNode>, checked: boolean) => {\n nodes.forEach((node) => {\n if (!isPresentationHierarchyNode(node)) {\n return;\n }\n if (isNodeSelected(node.id)) {\n onClick(node, checked);\n }\n if (node.isExpanded && typeof node.children !== \"boolean\") {\n clickSelectedNodes(node.children, checked);\n }\n });\n };\n\n const onCheckboxClicked = (node: PresentationHierarchyNode, checked: boolean) => {\n if (!isNodeSelected(node.id)) {\n onClick(node, checked);\n return;\n }\n rootNodes && clickSelectedNodes(rootNodes, checked);\n };\n\n return { onCheckboxClicked };\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.createIdsSelector = void 0;
|
|
8
|
+
/** @internal */
|
|
9
|
+
function createIdsSelector(ids) {
|
|
10
|
+
// Note: `json_array` function only accepts up to 127 arguments and we may have more `ids` than that. As a workaround,
|
|
11
|
+
// we're creating an array of arrays
|
|
12
|
+
const slices = new Array();
|
|
13
|
+
for (let sliceStartIndex = 0; sliceStartIndex < ids.length; sliceStartIndex += 127) {
|
|
14
|
+
let sliceEndIndex = sliceStartIndex + 127;
|
|
15
|
+
if (sliceEndIndex > ids.length) {
|
|
16
|
+
sliceEndIndex = undefined;
|
|
17
|
+
}
|
|
18
|
+
slices.push(ids.slice(sliceStartIndex, sliceEndIndex));
|
|
19
|
+
}
|
|
20
|
+
return `json_array(${slices.map((sliceIds) => `json_array(${sliceIds.map((id) => `'${id}'`).join(",")})`).join(",")})`;
|
|
21
|
+
}
|
|
22
|
+
exports.createIdsSelector = createIdsSelector;
|
|
23
|
+
//# sourceMappingURL=Utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../../../../../../src/components/trees/stateless/common/Utils.ts"],"names":[],"mappings":";AAAA;;;gGAGgG;;;AAIhG,gBAAgB;AAChB,SAAgB,iBAAiB,CAAC,GAAa;IAC7C,sHAAsH;IACtH,oCAAoC;IACpC,MAAM,MAAM,GAAG,IAAI,KAAK,EAAgB,CAAC;IACzC,KAAK,IAAI,eAAe,GAAG,CAAC,EAAE,eAAe,GAAG,GAAG,CAAC,MAAM,EAAE,eAAe,IAAI,GAAG,EAAE;QAClF,IAAI,aAAa,GAAuB,eAAe,GAAG,GAAG,CAAC;QAC9D,IAAI,aAAa,GAAG,GAAG,CAAC,MAAM,EAAE;YAC9B,aAAa,GAAG,SAAS,CAAC;SAC3B;QACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,eAAe,EAAE,aAAa,CAAC,CAAC,CAAC;KACxD;IACD,OAAO,cAAc,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,cAAc,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AACzH,CAAC;AAZD,8CAYC","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 type { Id64String } from \"@itwin/core-bentley\";\n\n/** @internal */\nexport function createIdsSelector(ids: string[]): string {\n // Note: `json_array` function only accepts up to 127 arguments and we may have more `ids` than that. As a workaround,\n // we're creating an array of arrays\n const slices = new Array<Id64String[]>();\n for (let sliceStartIndex = 0; sliceStartIndex < ids.length; sliceStartIndex += 127) {\n let sliceEndIndex: number | undefined = sliceStartIndex + 127;\n if (sliceEndIndex > ids.length) {\n sliceEndIndex = undefined;\n }\n slices.push(ids.slice(sliceStartIndex, sliceEndIndex));\n }\n return `json_array(${slices.map((sliceIds) => `json_array(${sliceIds.map((id) => `'${id}'`).join(\",\")})`).join(\",\")})`;\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Delayed = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
/** @internal */
|
|
11
|
+
function Delayed({ show, children }) {
|
|
12
|
+
const [visible, setVisible] = (0, react_1.useState)(false);
|
|
13
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
14
|
+
if (!show) {
|
|
15
|
+
setVisible(false);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
const timer = setTimeout(() => {
|
|
19
|
+
setVisible(show);
|
|
20
|
+
}, 250);
|
|
21
|
+
return () => {
|
|
22
|
+
clearTimeout(timer);
|
|
23
|
+
};
|
|
24
|
+
}, [show]);
|
|
25
|
+
if (!visible) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children });
|
|
29
|
+
}
|
|
30
|
+
exports.Delayed = Delayed;
|
|
31
|
+
//# sourceMappingURL=Delayed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Delayed.js","sourceRoot":"","sources":["../../../../../../../src/components/trees/stateless/common/components/Delayed.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAAkD;AAIlD,gBAAgB;AAChB,SAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAwC;IAC9E,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAC,KAAK,CAAC,CAAC;IAE9C,IAAA,uBAAe,EAAC,GAAG,EAAE;QACnB,IAAI,CAAC,IAAI,EAAE;YACT,UAAU,CAAC,KAAK,CAAC,CAAC;YAClB,OAAO;SACR;QAED,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,UAAU,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC,EAAE,GAAG,CAAC,CAAC;QACR,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC;IAEX,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,IAAI,CAAC;KACb;IAED,OAAO,2DAAG,QAAQ,GAAI,CAAC;AACzB,CAAC;AAtBD,0BAsBC","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 { useLayoutEffect, useState } from \"react\";\n\nimport type { PropsWithChildren } from \"react\";\n\n/** @internal */\nexport function Delayed({ show, children }: PropsWithChildren<{ show: boolean }>) {\n const [visible, setVisible] = useState(false);\n\n useLayoutEffect(() => {\n if (!show) {\n setVisible(false);\n return;\n }\n\n const timer = setTimeout(() => {\n setVisible(show);\n }, 250);\n return () => {\n clearTimeout(timer);\n };\n }, [show]);\n\n if (!visible) {\n return null;\n }\n\n return <>{children}</>;\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactElement, ReactNode } from "react";
|
|
2
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
3
|
+
import type { SchemaContext } from "@itwin/ecschema-metadata";
|
|
4
|
+
import type { PresentationHierarchyNode, useSelectionHandler, useTree } from "@itwin/presentation-hierarchies-react";
|
|
5
|
+
interface FilterableTreeOwnProps {
|
|
6
|
+
imodel: IModelConnection;
|
|
7
|
+
getSchemaContext: (imodel: IModelConnection) => SchemaContext;
|
|
8
|
+
height: number;
|
|
9
|
+
width: number;
|
|
10
|
+
treeName: string;
|
|
11
|
+
hierarchyLevelSizeLimit?: number;
|
|
12
|
+
getIcon?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
13
|
+
getSublabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
14
|
+
density?: "default" | "enlarged";
|
|
15
|
+
noDataMessage?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
type UseTreeProps = Parameters<typeof useTree>[0];
|
|
18
|
+
type UseSelectionHandlerProps = Parameters<typeof useSelectionHandler>[0];
|
|
19
|
+
type FilterableTreeProps = FilterableTreeOwnProps & Pick<UseTreeProps, "getFilteredPaths" | "getHierarchyDefinition" | "onPerformanceMeasured"> & Pick<Partial<UseSelectionHandlerProps>, "selectionMode">;
|
|
20
|
+
/** @internal */
|
|
21
|
+
export declare function FilterableTree({ imodel, getSchemaContext, hierarchyLevelSizeLimit, ...props }: FilterableTreeProps): JSX.Element | null;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=FilterableTree.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FilterableTree = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
11
|
+
const presentation_core_interop_1 = require("@itwin/presentation-core-interop");
|
|
12
|
+
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
13
|
+
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
14
|
+
const presentation_shared_1 = require("@itwin/presentation-shared");
|
|
15
|
+
const TreeWidget_1 = require("../../../../../TreeWidget");
|
|
16
|
+
const UseHierarchiesLocalization_1 = require("../UseHierarchiesLocalization");
|
|
17
|
+
const UseHierarchyFiltering_1 = require("../UseHierarchyFiltering");
|
|
18
|
+
const Delayed_1 = require("./Delayed");
|
|
19
|
+
const ProgressOverlay_1 = require("./ProgressOverlay");
|
|
20
|
+
/** @internal */
|
|
21
|
+
function FilterableTree({ imodel, getSchemaContext, hierarchyLevelSizeLimit, ...props }) {
|
|
22
|
+
const [imodelAccess, setIModelAccess] = (0, react_1.useState)();
|
|
23
|
+
const defaultHierarchyLevelSizeLimit = hierarchyLevelSizeLimit ?? 1000;
|
|
24
|
+
(0, react_1.useEffect)(() => {
|
|
25
|
+
const schemas = getSchemaContext(imodel);
|
|
26
|
+
const schemaProvider = (0, presentation_core_interop_1.createECSchemaProvider)(schemas);
|
|
27
|
+
setIModelAccess({
|
|
28
|
+
...schemaProvider,
|
|
29
|
+
...(0, presentation_shared_1.createCachingECClassHierarchyInspector)({ schemaProvider }),
|
|
30
|
+
...(0, presentation_hierarchies_1.createLimitingECSqlQueryExecutor)((0, presentation_core_interop_1.createECSqlQueryExecutor)(imodel), 1000),
|
|
31
|
+
});
|
|
32
|
+
}, [imodel, getSchemaContext]);
|
|
33
|
+
if (!imodelAccess) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
return (0, jsx_runtime_1.jsx)(FilterableTreeRenderer, { ...props, imodel: imodel, imodelAccess: imodelAccess, defaultHierarchyLevelSizeLimit: defaultHierarchyLevelSizeLimit });
|
|
37
|
+
}
|
|
38
|
+
exports.FilterableTree = FilterableTree;
|
|
39
|
+
/** @internal */
|
|
40
|
+
function FilterableTreeRenderer({ imodel, imodelAccess, height, width, treeName, getIcon, getSublabel, noDataMessage, defaultHierarchyLevelSizeLimit, getHierarchyDefinition, selectionMode, onPerformanceMeasured, }) {
|
|
41
|
+
const localizedStrings = (0, UseHierarchiesLocalization_1.useHierarchiesLocalization)();
|
|
42
|
+
const { rootNodes, isLoading, reloadTree: _reloadTree, setFormatter: _setFormatter, ...treeProps } = (0, presentation_hierarchies_react_1.useUnifiedSelectionTree)({
|
|
43
|
+
imodelKey: imodel.key,
|
|
44
|
+
sourceName: treeName,
|
|
45
|
+
imodelAccess,
|
|
46
|
+
getHierarchyDefinition,
|
|
47
|
+
onPerformanceMeasured,
|
|
48
|
+
localizedStrings,
|
|
49
|
+
});
|
|
50
|
+
const { filteringDialog, onFilterClick } = (0, UseHierarchyFiltering_1.useHierarchyLevelFiltering)({
|
|
51
|
+
imodel,
|
|
52
|
+
getHierarchyLevelDetails: treeProps.getHierarchyLevelDetails,
|
|
53
|
+
defaultHierarchyLevelSizeLimit,
|
|
54
|
+
});
|
|
55
|
+
const renderContent = () => {
|
|
56
|
+
if (rootNodes === undefined) {
|
|
57
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.Flex, { alignItems: "center", justifyContent: "center", flexDirection: "column", style: { width, height }, children: (0, jsx_runtime_1.jsx)(Delayed_1.Delayed, { show: true, children: (0, jsx_runtime_1.jsx)(itwinui_react_1.ProgressRadial, { size: "large" }) }) }));
|
|
58
|
+
}
|
|
59
|
+
if ((rootNodes.length === 0 && !isLoading) || (rootNodes.length === 1 && !(0, presentation_hierarchies_react_1.isPresentationHierarchyNode)(rootNodes[0]) && rootNodes[0].type === "Unknown")) {
|
|
60
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.Flex, { alignItems: "center", justifyContent: "center", flexDirection: "column", style: { width, height }, children: noDataMessage ? noDataMessage : (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: TreeWidget_1.TreeWidget.translate("stateless.dataIsNotAvailable") }) }));
|
|
61
|
+
}
|
|
62
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.Flex.Item, { alignSelf: "flex-start", style: { width: "100%", overflow: "auto" }, children: (0, jsx_runtime_1.jsx)(presentation_hierarchies_react_1.TreeRenderer, { rootNodes: rootNodes, ...treeProps, onFilterClick: onFilterClick, getIcon: getIcon, getSublabel: getSublabel, selectionMode: selectionMode, localizedStrings: localizedStrings }) }));
|
|
63
|
+
};
|
|
64
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: "relative", height, overflow: "hidden" }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { overflow: "auto", height: "100%" }, children: [renderContent(), filteringDialog] }), (0, jsx_runtime_1.jsx)(Delayed_1.Delayed, { show: isLoading && !!rootNodes, children: (0, jsx_runtime_1.jsx)(ProgressOverlay_1.ProgressOverlay, {}) })] }));
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=FilterableTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FilterableTree.js","sourceRoot":"","sources":["../../../../../../../src/components/trees/stateless/common/components/FilterableTree.tsx"],"names":[],"mappings":"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","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 { Flex, ProgressRadial, Text } from \"@itwin/itwinui-react\";\nimport { createECSchemaProvider, createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport { createLimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\nimport { isPresentationHierarchyNode, TreeRenderer, useUnifiedSelectionTree } from \"@itwin/presentation-hierarchies-react\";\nimport { createCachingECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport { TreeWidget } from \"../../../../../TreeWidget\";\nimport { useHierarchiesLocalization } from \"../UseHierarchiesLocalization\";\nimport { useHierarchyLevelFiltering } from \"../UseHierarchyFiltering\";\nimport { Delayed } from \"./Delayed\";\nimport { ProgressOverlay } from \"./ProgressOverlay\";\n\nimport type { ReactElement, ReactNode } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { SchemaContext } from \"@itwin/ecschema-metadata\";\nimport type { PresentationHierarchyNode, useSelectionHandler, useTree } from \"@itwin/presentation-hierarchies-react\";\n\ninterface FilterableTreeOwnProps {\n imodel: IModelConnection;\n getSchemaContext: (imodel: IModelConnection) => SchemaContext;\n height: number;\n width: number;\n treeName: string;\n hierarchyLevelSizeLimit?: number;\n getIcon?: (node: PresentationHierarchyNode) => ReactElement | undefined;\n getSublabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;\n density?: \"default\" | \"enlarged\";\n noDataMessage?: ReactNode;\n}\n\ntype UseTreeProps = Parameters<typeof useTree>[0];\ntype UseSelectionHandlerProps = Parameters<typeof useSelectionHandler>[0];\ntype IModelAccess = UseTreeProps[\"imodelAccess\"];\n\ntype FilterableTreeProps = FilterableTreeOwnProps &\n Pick<UseTreeProps, \"getFilteredPaths\" | \"getHierarchyDefinition\" | \"onPerformanceMeasured\"> &\n Pick<Partial<UseSelectionHandlerProps>, \"selectionMode\">;\n\n/** @internal */\nexport function FilterableTree({ imodel, getSchemaContext, hierarchyLevelSizeLimit, ...props }: FilterableTreeProps) {\n const [imodelAccess, setIModelAccess] = useState<IModelAccess>();\n const defaultHierarchyLevelSizeLimit = hierarchyLevelSizeLimit ?? 1000;\n\n useEffect(() => {\n const schemas = getSchemaContext(imodel);\n const schemaProvider = createECSchemaProvider(schemas);\n setIModelAccess({\n ...schemaProvider,\n ...createCachingECClassHierarchyInspector({ schemaProvider }),\n ...createLimitingECSqlQueryExecutor(createECSqlQueryExecutor(imodel), 1000),\n });\n }, [imodel, getSchemaContext]);\n\n if (!imodelAccess) {\n return null;\n }\n\n return <FilterableTreeRenderer {...props} imodel={imodel} imodelAccess={imodelAccess} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />;\n}\n\n/** @internal */\nfunction FilterableTreeRenderer({\n imodel,\n imodelAccess,\n height,\n width,\n treeName,\n getIcon,\n getSublabel,\n noDataMessage,\n defaultHierarchyLevelSizeLimit,\n getHierarchyDefinition,\n selectionMode,\n onPerformanceMeasured,\n}: Omit<FilterableTreeProps, \"getSchemaContext\"> & { imodelAccess: IModelAccess; defaultHierarchyLevelSizeLimit: number }) {\n const localizedStrings = useHierarchiesLocalization();\n const {\n rootNodes,\n isLoading,\n reloadTree: _reloadTree,\n setFormatter: _setFormatter,\n ...treeProps\n } = useUnifiedSelectionTree({\n imodelKey: imodel.key,\n sourceName: treeName,\n imodelAccess,\n getHierarchyDefinition,\n onPerformanceMeasured,\n localizedStrings,\n });\n\n const { filteringDialog, onFilterClick } = useHierarchyLevelFiltering({\n imodel,\n getHierarchyLevelDetails: treeProps.getHierarchyLevelDetails,\n defaultHierarchyLevelSizeLimit,\n });\n\n const renderContent = () => {\n if (rootNodes === undefined) {\n return (\n <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width, height }}>\n <Delayed show={true}>\n <ProgressRadial size=\"large\" />\n </Delayed>\n </Flex>\n );\n }\n\n if ((rootNodes.length === 0 && !isLoading) || (rootNodes.length === 1 && !isPresentationHierarchyNode(rootNodes[0]) && rootNodes[0].type === \"Unknown\")) {\n return (\n <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width, height }}>\n {noDataMessage ? noDataMessage : <Text>{TreeWidget.translate(\"stateless.dataIsNotAvailable\")}</Text>}\n </Flex>\n );\n }\n\n return (\n <Flex.Item alignSelf=\"flex-start\" style={{ width: \"100%\", overflow: \"auto\" }}>\n <TreeRenderer\n rootNodes={rootNodes}\n {...treeProps}\n onFilterClick={onFilterClick}\n getIcon={getIcon}\n getSublabel={getSublabel}\n selectionMode={selectionMode}\n localizedStrings={localizedStrings}\n />\n </Flex.Item>\n );\n };\n\n return (\n <div style={{ position: \"relative\", height, overflow: \"hidden\" }}>\n <div style={{ overflow: \"auto\", height: \"100%\" }}>\n {renderContent()}\n {filteringDialog}\n </div>\n <Delayed show={isLoading && !!rootNodes}>\n <ProgressOverlay />\n </Delayed>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProgressOverlay = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
require("./ProgressOverlay.scss");
|
|
10
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
11
|
+
/** @internal */
|
|
12
|
+
function ProgressOverlay() {
|
|
13
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "tw-progress-overlay-container", children: [(0, jsx_runtime_1.jsx)(itwinui_react_1.ProgressLinear, { indeterminate: true }), (0, jsx_runtime_1.jsx)("div", { className: "tw-progress-overlay-backdrop" })] }));
|
|
14
|
+
}
|
|
15
|
+
exports.ProgressOverlay = ProgressOverlay;
|
|
16
|
+
//# sourceMappingURL=ProgressOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressOverlay.js","sourceRoot":"","sources":["../../../../../../../src/components/trees/stateless/common/components/ProgressOverlay.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,kCAAgC;AAChC,wDAAsD;AAEtD,gBAAgB;AAChB,SAAgB,eAAe;IAC7B,OAAO,CACL,iCAAK,SAAS,EAAC,+BAA+B,aAC5C,uBAAC,8BAAc,IAAC,aAAa,SAAG,EAChC,gCAAK,SAAS,EAAC,8BAA8B,GAAG,IAC5C,CACP,CAAC;AACJ,CAAC;AAPD,0CAOC","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 \"./ProgressOverlay.scss\";\nimport { ProgressLinear } from \"@itwin/itwinui-react\";\n\n/** @internal */\nexport function ProgressOverlay() {\n return (\n <div className=\"tw-progress-overlay-container\">\n <ProgressLinear indeterminate />\n <div className=\"tw-progress-overlay-backdrop\" />\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
|
|
6
|
+
.tw-progress-overlay-container {
|
|
7
|
+
position: absolute;
|
|
8
|
+
left: 0;
|
|
9
|
+
top: 0;
|
|
10
|
+
z-index: 1;
|
|
11
|
+
height: 100%;
|
|
12
|
+
width: 100%;
|
|
13
|
+
overflow: hidden;
|
|
14
|
+
|
|
15
|
+
.tw-progress-overlay-backdrop {
|
|
16
|
+
opacity: 0.5;
|
|
17
|
+
background-color: var(--iui-color-background-backdrop);
|
|
18
|
+
height: 100%;
|
|
19
|
+
width: 100%;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useSelectionHandler } from "@itwin/presentation-hierarchies-react";
|
|
2
|
+
import { useHierarchyVisibility } from "../UseHierarchyVisibility";
|
|
3
|
+
import type { ReactElement, ReactNode } from "react";
|
|
4
|
+
import type { IModelConnection } from "@itwin/core-frontend";
|
|
5
|
+
import type { SchemaContext } from "@itwin/ecschema-metadata";
|
|
6
|
+
import type { PresentationHierarchyNode, useTree } from "@itwin/presentation-hierarchies-react";
|
|
7
|
+
interface VisibilityTreeOwnProps {
|
|
8
|
+
imodel: IModelConnection;
|
|
9
|
+
getSchemaContext: (imodel: IModelConnection) => SchemaContext;
|
|
10
|
+
height: number;
|
|
11
|
+
width: number;
|
|
12
|
+
treeName: string;
|
|
13
|
+
hierarchyLevelSizeLimit?: number;
|
|
14
|
+
getIcon?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
15
|
+
getSublabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
16
|
+
density?: "default" | "enlarged";
|
|
17
|
+
noDataMessage?: ReactNode;
|
|
18
|
+
}
|
|
19
|
+
type UseTreeProps = Parameters<typeof useTree>[0];
|
|
20
|
+
type UseHierarchyVisibilityProps = Parameters<typeof useHierarchyVisibility>[0];
|
|
21
|
+
type UseSelectionHandlerProps = Parameters<typeof useSelectionHandler>[0];
|
|
22
|
+
type VisibilityTreeProps = VisibilityTreeOwnProps & Pick<UseTreeProps, "getFilteredPaths" | "getHierarchyDefinition" | "onPerformanceMeasured"> & UseHierarchyVisibilityProps & Pick<Partial<UseSelectionHandlerProps>, "selectionMode">;
|
|
23
|
+
/** @internal */
|
|
24
|
+
export declare function VisibilityTree({ imodel, getSchemaContext, hierarchyLevelSizeLimit, ...props }: VisibilityTreeProps): JSX.Element | null;
|
|
25
|
+
export {};
|
|
26
|
+
//# sourceMappingURL=VisibilityTree.d.ts.map
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisibilityTree = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
const react_1 = require("react");
|
|
10
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
11
|
+
const presentation_core_interop_1 = require("@itwin/presentation-core-interop");
|
|
12
|
+
const presentation_hierarchies_1 = require("@itwin/presentation-hierarchies");
|
|
13
|
+
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
14
|
+
const presentation_shared_1 = require("@itwin/presentation-shared");
|
|
15
|
+
const TreeWidget_1 = require("../../../../../TreeWidget");
|
|
16
|
+
const UseHierarchiesLocalization_1 = require("../UseHierarchiesLocalization");
|
|
17
|
+
const UseHierarchyFiltering_1 = require("../UseHierarchyFiltering");
|
|
18
|
+
const UseHierarchyVisibility_1 = require("../UseHierarchyVisibility");
|
|
19
|
+
const UseMultiCheckboxHandler_1 = require("../UseMultiCheckboxHandler");
|
|
20
|
+
const Delayed_1 = require("./Delayed");
|
|
21
|
+
const ProgressOverlay_1 = require("./ProgressOverlay");
|
|
22
|
+
const VisibilityTreeRenderer_1 = require("./VisibilityTreeRenderer");
|
|
23
|
+
/** @internal */
|
|
24
|
+
function VisibilityTree({ imodel, getSchemaContext, hierarchyLevelSizeLimit, ...props }) {
|
|
25
|
+
const [imodelAccess, setImodelAccess] = (0, react_1.useState)();
|
|
26
|
+
const defaultHierarchyLevelSizeLimit = hierarchyLevelSizeLimit ?? 1000;
|
|
27
|
+
(0, react_1.useEffect)(() => {
|
|
28
|
+
const schemaProvider = (0, presentation_core_interop_1.createECSchemaProvider)(getSchemaContext(imodel));
|
|
29
|
+
setImodelAccess({
|
|
30
|
+
...(0, presentation_hierarchies_1.createLimitingECSqlQueryExecutor)((0, presentation_core_interop_1.createECSqlQueryExecutor)(imodel), defaultHierarchyLevelSizeLimit),
|
|
31
|
+
...schemaProvider,
|
|
32
|
+
...(0, presentation_shared_1.createCachingECClassHierarchyInspector)({ schemaProvider }),
|
|
33
|
+
});
|
|
34
|
+
}, [imodel, getSchemaContext, defaultHierarchyLevelSizeLimit]);
|
|
35
|
+
if (!imodelAccess) {
|
|
36
|
+
return null;
|
|
37
|
+
}
|
|
38
|
+
return (0, jsx_runtime_1.jsx)(VisibilityTreeImpl, { ...props, imodel: imodel, imodelAccess: imodelAccess, defaultHierarchyLevelSizeLimit: defaultHierarchyLevelSizeLimit });
|
|
39
|
+
}
|
|
40
|
+
exports.VisibilityTree = VisibilityTree;
|
|
41
|
+
function VisibilityTreeImpl({ height, width, imodel, imodelAccess, getHierarchyDefinition, getFilteredPaths, visibilityHandlerFactory, defaultHierarchyLevelSizeLimit, noDataMessage, treeName, getIcon, getSublabel, density, selectionMode, onPerformanceMeasured, }) {
|
|
42
|
+
const localizedStrings = (0, UseHierarchiesLocalization_1.useHierarchiesLocalization)();
|
|
43
|
+
const { rootNodes, isLoading, reloadTree: _reloadTree, selectNodes, setFormatter: _setFormatter, ...treeProps } = (0, presentation_hierarchies_react_1.useUnifiedSelectionTree)({
|
|
44
|
+
imodelAccess,
|
|
45
|
+
getHierarchyDefinition,
|
|
46
|
+
getFilteredPaths,
|
|
47
|
+
imodelKey: imodel.key,
|
|
48
|
+
sourceName: treeName,
|
|
49
|
+
onPerformanceMeasured,
|
|
50
|
+
localizedStrings,
|
|
51
|
+
});
|
|
52
|
+
const { onNodeClick, onNodeKeyDown } = (0, presentation_hierarchies_react_1.useSelectionHandler)({ rootNodes, selectNodes, selectionMode: selectionMode ?? "single" });
|
|
53
|
+
const { getCheckboxStatus, onCheckboxClicked: onClick } = (0, UseHierarchyVisibility_1.useHierarchyVisibility)({ visibilityHandlerFactory });
|
|
54
|
+
const { onCheckboxClicked } = (0, UseMultiCheckboxHandler_1.useMultiCheckboxHandler)({ rootNodes, isNodeSelected: treeProps.isNodeSelected, onClick });
|
|
55
|
+
const { filteringDialog, onFilterClick } = (0, UseHierarchyFiltering_1.useHierarchyLevelFiltering)({
|
|
56
|
+
imodel,
|
|
57
|
+
getHierarchyLevelDetails: treeProps.getHierarchyLevelDetails,
|
|
58
|
+
defaultHierarchyLevelSizeLimit,
|
|
59
|
+
});
|
|
60
|
+
if (rootNodes === undefined) {
|
|
61
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.Flex, { alignItems: "center", justifyContent: "center", flexDirection: "column", style: { width, height }, children: (0, jsx_runtime_1.jsx)(Delayed_1.Delayed, { show: true, children: (0, jsx_runtime_1.jsx)(itwinui_react_1.ProgressRadial, { size: "large" }) }) }));
|
|
62
|
+
}
|
|
63
|
+
if (rootNodes.length === 0 && !isLoading) {
|
|
64
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.Flex, { alignItems: "center", justifyContent: "center", flexDirection: "column", style: { width, height }, children: noDataMessage ? noDataMessage : (0, jsx_runtime_1.jsx)(itwinui_react_1.Text, { children: TreeWidget_1.TreeWidget.translate("stateless.dataIsNotAvailable") }) }));
|
|
65
|
+
}
|
|
66
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: "relative", height, overflow: "hidden" }, children: [(0, jsx_runtime_1.jsxs)("div", { style: { overflow: "auto", height: "100%" }, children: [(0, jsx_runtime_1.jsx)(presentation_hierarchies_react_1.LocalizationContextProvider, { localizedStrings: localizedStrings, children: (0, jsx_runtime_1.jsx)(VisibilityTreeRenderer_1.VisibilityTreeRenderer, { rootNodes: rootNodes, ...treeProps, onNodeClick: onNodeClick, onNodeKeyDown: onNodeKeyDown, getCheckboxStatus: getCheckboxStatus, onCheckboxClicked: onCheckboxClicked, onFilterClick: onFilterClick, getIcon: getIcon, getSublabel: getSublabel, size: density === "enlarged" ? "default" : "small" }) }), filteringDialog] }), (0, jsx_runtime_1.jsx)(Delayed_1.Delayed, { show: isLoading, children: (0, jsx_runtime_1.jsx)(ProgressOverlay_1.ProgressOverlay, {}) })] }));
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=VisibilityTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisibilityTree.js","sourceRoot":"","sources":["../../../../../../../src/components/trees/stateless/common/components/VisibilityTree.tsx"],"names":[],"mappings":"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","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 { Flex, ProgressRadial, Text } from \"@itwin/itwinui-react\";\nimport { createECSchemaProvider, createECSqlQueryExecutor } from \"@itwin/presentation-core-interop\";\nimport { createLimitingECSqlQueryExecutor } from \"@itwin/presentation-hierarchies\";\nimport { LocalizationContextProvider, useSelectionHandler, useUnifiedSelectionTree } from \"@itwin/presentation-hierarchies-react\";\nimport { createCachingECClassHierarchyInspector } from \"@itwin/presentation-shared\";\nimport { TreeWidget } from \"../../../../../TreeWidget\";\nimport { useHierarchiesLocalization } from \"../UseHierarchiesLocalization\";\nimport { useHierarchyLevelFiltering } from \"../UseHierarchyFiltering\";\nimport { useHierarchyVisibility } from \"../UseHierarchyVisibility\";\nimport { useMultiCheckboxHandler } from \"../UseMultiCheckboxHandler\";\nimport { Delayed } from \"./Delayed\";\nimport { ProgressOverlay } from \"./ProgressOverlay\";\nimport { VisibilityTreeRenderer } from \"./VisibilityTreeRenderer\";\n\nimport type { ReactElement, ReactNode } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { SchemaContext } from \"@itwin/ecschema-metadata\";\nimport type { PresentationHierarchyNode, useTree } from \"@itwin/presentation-hierarchies-react\";\n\ninterface VisibilityTreeOwnProps {\n imodel: IModelConnection;\n getSchemaContext: (imodel: IModelConnection) => SchemaContext;\n height: number;\n width: number;\n treeName: string;\n hierarchyLevelSizeLimit?: number;\n getIcon?: (node: PresentationHierarchyNode) => ReactElement | undefined;\n getSublabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;\n density?: \"default\" | \"enlarged\";\n noDataMessage?: ReactNode;\n}\n\ntype UseTreeProps = Parameters<typeof useTree>[0];\ntype UseHierarchyVisibilityProps = Parameters<typeof useHierarchyVisibility>[0];\ntype IModelAccess = UseTreeProps[\"imodelAccess\"];\ntype UseSelectionHandlerProps = Parameters<typeof useSelectionHandler>[0];\n\ntype VisibilityTreeProps = VisibilityTreeOwnProps &\n Pick<UseTreeProps, \"getFilteredPaths\" | \"getHierarchyDefinition\" | \"onPerformanceMeasured\"> &\n UseHierarchyVisibilityProps &\n Pick<Partial<UseSelectionHandlerProps>, \"selectionMode\">;\n\n/** @internal */\nexport function VisibilityTree({ imodel, getSchemaContext, hierarchyLevelSizeLimit, ...props }: VisibilityTreeProps) {\n const [imodelAccess, setImodelAccess] = useState<IModelAccess>();\n const defaultHierarchyLevelSizeLimit = hierarchyLevelSizeLimit ?? 1000;\n\n useEffect(() => {\n const schemaProvider = createECSchemaProvider(getSchemaContext(imodel));\n setImodelAccess({\n ...createLimitingECSqlQueryExecutor(createECSqlQueryExecutor(imodel), defaultHierarchyLevelSizeLimit),\n ...schemaProvider,\n ...createCachingECClassHierarchyInspector({ schemaProvider }),\n });\n }, [imodel, getSchemaContext, defaultHierarchyLevelSizeLimit]);\n\n if (!imodelAccess) {\n return null;\n }\n\n return <VisibilityTreeImpl {...props} imodel={imodel} imodelAccess={imodelAccess} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />;\n}\n\nfunction VisibilityTreeImpl({\n height,\n width,\n imodel,\n imodelAccess,\n getHierarchyDefinition,\n getFilteredPaths,\n visibilityHandlerFactory,\n defaultHierarchyLevelSizeLimit,\n noDataMessage,\n treeName,\n getIcon,\n getSublabel,\n density,\n selectionMode,\n onPerformanceMeasured,\n}: Omit<VisibilityTreeProps, \"getSchemaContext\" | \"hierarchyLevelSizeLimit\"> & { imodelAccess: IModelAccess; defaultHierarchyLevelSizeLimit: number }) {\n const localizedStrings = useHierarchiesLocalization();\n const {\n rootNodes,\n isLoading,\n reloadTree: _reloadTree,\n selectNodes,\n setFormatter: _setFormatter,\n ...treeProps\n } = useUnifiedSelectionTree({\n imodelAccess,\n getHierarchyDefinition,\n getFilteredPaths,\n imodelKey: imodel.key,\n sourceName: treeName,\n onPerformanceMeasured,\n localizedStrings,\n });\n const { onNodeClick, onNodeKeyDown } = useSelectionHandler({ rootNodes, selectNodes, selectionMode: selectionMode ?? \"single\" });\n const { getCheckboxStatus, onCheckboxClicked: onClick } = useHierarchyVisibility({ visibilityHandlerFactory });\n const { onCheckboxClicked } = useMultiCheckboxHandler({ rootNodes, isNodeSelected: treeProps.isNodeSelected, onClick });\n const { filteringDialog, onFilterClick } = useHierarchyLevelFiltering({\n imodel,\n getHierarchyLevelDetails: treeProps.getHierarchyLevelDetails,\n defaultHierarchyLevelSizeLimit,\n });\n\n if (rootNodes === undefined) {\n return (\n <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width, height }}>\n <Delayed show={true}>\n <ProgressRadial size=\"large\" />\n </Delayed>\n </Flex>\n );\n }\n\n if (rootNodes.length === 0 && !isLoading) {\n return (\n <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width, height }}>\n {noDataMessage ? noDataMessage : <Text>{TreeWidget.translate(\"stateless.dataIsNotAvailable\")}</Text>}\n </Flex>\n );\n }\n\n return (\n <div style={{ position: \"relative\", height, overflow: \"hidden\" }}>\n <div style={{ overflow: \"auto\", height: \"100%\" }}>\n <LocalizationContextProvider localizedStrings={localizedStrings}>\n <VisibilityTreeRenderer\n rootNodes={rootNodes}\n {...treeProps}\n onNodeClick={onNodeClick}\n onNodeKeyDown={onNodeKeyDown}\n getCheckboxStatus={getCheckboxStatus}\n onCheckboxClicked={onCheckboxClicked}\n onFilterClick={onFilterClick}\n getIcon={getIcon}\n getSublabel={getSublabel}\n size={density === \"enlarged\" ? \"default\" : \"small\"}\n />\n </LocalizationContextProvider>\n {filteringDialog}\n </div>\n <Delayed show={isLoading}>\n <ProgressOverlay />\n </Delayed>\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PresentationHierarchyNode, RenderedTreeNode } from "@itwin/presentation-hierarchies-react";
|
|
3
|
+
import type { VisibilityStatus } from "../../../VisibilityTreeEventHandler";
|
|
4
|
+
interface VisibilityTreeNodeCheckboxProps {
|
|
5
|
+
node: RenderedTreeNode;
|
|
6
|
+
onCheckboxClicked: (node: PresentationHierarchyNode, checked: boolean) => void;
|
|
7
|
+
getCheckboxStatus: (node: PresentationHierarchyNode) => VisibilityStatus;
|
|
8
|
+
}
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare function VisibilityTreeNodeCheckbox({ node, onCheckboxClicked, getCheckboxStatus }: VisibilityTreeNodeCheckboxProps): JSX.Element | null;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=VisibilityTreeNodeCheckbox.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisibilityTreeNodeCheckbox = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
10
|
+
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
11
|
+
/** @internal */
|
|
12
|
+
function VisibilityTreeNodeCheckbox({ node, onCheckboxClicked, getCheckboxStatus }) {
|
|
13
|
+
if ("type" in node || !(0, presentation_hierarchies_react_1.isPresentationHierarchyNode)(node)) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const checkboxStatus = getCheckboxStatus(node);
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.Checkbox, { className: "tw-visibility-tree-node-checkbox", variant: "eyeball", checked: checkboxStatus.state === "visible", onClick: (e) => {
|
|
18
|
+
e.stopPropagation();
|
|
19
|
+
}, onChange: (e) => {
|
|
20
|
+
onCheckboxClicked(node, e.currentTarget.checked);
|
|
21
|
+
}, indeterminate: checkboxStatus.state === "partial", disabled: checkboxStatus.isDisabled, title: checkboxStatus.tooltip }));
|
|
22
|
+
}
|
|
23
|
+
exports.VisibilityTreeNodeCheckbox = VisibilityTreeNodeCheckbox;
|
|
24
|
+
//# sourceMappingURL=VisibilityTreeNodeCheckbox.js.map
|
package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisibilityTreeNodeCheckbox.js","sourceRoot":"","sources":["../../../../../../../src/components/trees/stateless/common/components/VisibilityTreeNodeCheckbox.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,wDAAgD;AAChD,0FAAoF;AAWpF,gBAAgB;AAChB,SAAgB,0BAA0B,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,iBAAiB,EAAmC;IACxH,IAAI,MAAM,IAAI,IAAI,IAAI,CAAC,IAAA,4DAA2B,EAAC,IAAI,CAAC,EAAE;QACxD,OAAO,IAAI,CAAC;KACb;IAED,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC/C,OAAO,CACL,uBAAC,wBAAQ,IACP,SAAS,EAAC,kCAAkC,EAC5C,OAAO,EAAC,SAAS,EACjB,OAAO,EAAE,cAAc,CAAC,KAAK,KAAK,SAAS,EAC3C,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;YACb,CAAC,CAAC,eAAe,EAAE,CAAC;QACtB,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;YACd,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACnD,CAAC,EACD,aAAa,EAAE,cAAc,CAAC,KAAK,KAAK,SAAS,EACjD,QAAQ,EAAE,cAAc,CAAC,UAAU,EACnC,KAAK,EAAE,cAAc,CAAC,OAAO,GAC7B,CACH,CAAC;AACJ,CAAC;AAtBD,gEAsBC","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 { Checkbox } from \"@itwin/itwinui-react\";\nimport { isPresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\nimport type { PresentationHierarchyNode, RenderedTreeNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { VisibilityStatus } from \"../../../VisibilityTreeEventHandler\";\n\ninterface VisibilityTreeNodeCheckboxProps {\n node: RenderedTreeNode;\n onCheckboxClicked: (node: PresentationHierarchyNode, checked: boolean) => void;\n getCheckboxStatus: (node: PresentationHierarchyNode) => VisibilityStatus;\n}\n\n/** @internal */\nexport function VisibilityTreeNodeCheckbox({ node, onCheckboxClicked, getCheckboxStatus }: VisibilityTreeNodeCheckboxProps) {\n if (\"type\" in node || !isPresentationHierarchyNode(node)) {\n return null;\n }\n\n const checkboxStatus = getCheckboxStatus(node);\n return (\n <Checkbox\n className=\"tw-visibility-tree-node-checkbox\"\n variant=\"eyeball\"\n checked={checkboxStatus.state === \"visible\"}\n onClick={(e) => {\n e.stopPropagation();\n }}\n onChange={(e) => {\n onCheckboxClicked(node, e.currentTarget.checked);\n }}\n indeterminate={checkboxStatus.state === \"partial\"}\n disabled={checkboxStatus.isDisabled}\n title={checkboxStatus.tooltip}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { TreeNodeRenderer } from "@itwin/presentation-hierarchies-react";
|
|
2
|
+
import { VisibilityTreeNodeCheckbox } from "./VisibilityTreeNodeCheckbox";
|
|
3
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
4
|
+
type VisibilityTreeNodeCheckboxProps = ComponentPropsWithoutRef<typeof VisibilityTreeNodeCheckbox>;
|
|
5
|
+
type TreeNodeRendererProps = ComponentPropsWithoutRef<typeof TreeNodeRenderer>;
|
|
6
|
+
type VisibilityTreeNodeRendererProps = TreeNodeRendererProps & Pick<VisibilityTreeNodeCheckboxProps, "onCheckboxClicked" | "getCheckboxStatus">;
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare function VisibilityTreeNodeRenderer({ onCheckboxClicked, getCheckboxStatus, ...restProps }: VisibilityTreeNodeRendererProps): JSX.Element;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=VisibilityTreeNodeRenderer.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.VisibilityTreeNodeRenderer = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
/*---------------------------------------------------------------------------------------------
|
|
9
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
10
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
11
|
+
*--------------------------------------------------------------------------------------------*/
|
|
12
|
+
const classnames_1 = __importDefault(require("classnames"));
|
|
13
|
+
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
14
|
+
const VisibilityTreeNodeCheckbox_1 = require("./VisibilityTreeNodeCheckbox");
|
|
15
|
+
/** @internal */
|
|
16
|
+
function VisibilityTreeNodeRenderer({ onCheckboxClicked, getCheckboxStatus, ...restProps }) {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(presentation_hierarchies_react_1.TreeNodeRenderer, { ...restProps, className: (0, classnames_1.default)("tw-visibility-tree-node", restProps.isSelected && "selected"), actionButtonsClassName: "tw-visibility-tree-node-action-buttons", checkbox: (0, jsx_runtime_1.jsx)(VisibilityTreeNodeCheckbox_1.VisibilityTreeNodeCheckbox, { node: restProps.node, onCheckboxClicked: onCheckboxClicked, getCheckboxStatus: getCheckboxStatus }) }));
|
|
18
|
+
}
|
|
19
|
+
exports.VisibilityTreeNodeRenderer = VisibilityTreeNodeRenderer;
|
|
20
|
+
//# sourceMappingURL=VisibilityTreeNodeRenderer.js.map
|
package/lib/cjs/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisibilityTreeNodeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/components/trees/stateless/common/components/VisibilityTreeNodeRenderer.tsx"],"names":[],"mappings":";;;;;;;AAAA;;;gGAGgG;AAEhG,4DAA4B;AAC5B,0FAAyE;AACzE,6EAA0E;AAS1E,gBAAgB;AAChB,SAAgB,0BAA0B,CAAC,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,GAAG,SAAS,EAAmC;IAChI,OAAO,CACL,uBAAC,iDAAgB,OACX,SAAS,EACb,SAAS,EAAE,IAAA,oBAAE,EAAC,yBAAyB,EAAE,SAAS,CAAC,UAAU,IAAI,UAAU,CAAC,EAC5E,sBAAsB,EAAC,wCAAwC,EAC/D,QAAQ,EAAE,uBAAC,uDAA0B,IAAC,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,GAAI,GAC1I,CACH,CAAC;AACJ,CAAC;AATD,gEASC","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 cx from \"classnames\";\nimport { TreeNodeRenderer } from \"@itwin/presentation-hierarchies-react\";\nimport { VisibilityTreeNodeCheckbox } from \"./VisibilityTreeNodeCheckbox\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\n\ntype VisibilityTreeNodeCheckboxProps = ComponentPropsWithoutRef<typeof VisibilityTreeNodeCheckbox>;\ntype TreeNodeRendererProps = ComponentPropsWithoutRef<typeof TreeNodeRenderer>;\n\ntype VisibilityTreeNodeRendererProps = TreeNodeRendererProps & Pick<VisibilityTreeNodeCheckboxProps, \"onCheckboxClicked\" | \"getCheckboxStatus\">;\n\n/** @internal */\nexport function VisibilityTreeNodeRenderer({ onCheckboxClicked, getCheckboxStatus, ...restProps }: VisibilityTreeNodeRendererProps) {\n return (\n <TreeNodeRenderer\n {...restProps}\n className={cx(\"tw-visibility-tree-node\", restProps.isSelected && \"selected\")}\n actionButtonsClassName=\"tw-visibility-tree-node-action-buttons\"\n checkbox={<VisibilityTreeNodeCheckbox node={restProps.node} onCheckboxClicked={onCheckboxClicked} getCheckboxStatus={getCheckboxStatus} />}\n />\n );\n}\n"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import "./VisibilityTreeRenderer.scss";
|
|
2
|
+
import { Tree } from "@itwin/itwinui-react";
|
|
3
|
+
import { VisibilityTreeNodeRenderer } from "./VisibilityTreeNodeRenderer";
|
|
4
|
+
import type { ComponentPropsWithoutRef } from "react";
|
|
5
|
+
import type { PresentationTreeNode, RenderedTreeNode } from "@itwin/presentation-hierarchies-react";
|
|
6
|
+
interface VisibilityTreeRendererOwnProps {
|
|
7
|
+
rootNodes: PresentationTreeNode[];
|
|
8
|
+
isNodeSelected: (nodeId: string) => boolean;
|
|
9
|
+
}
|
|
10
|
+
type VisibilityTreeRendererProps = Pick<VisibilityTreeNodeRendererProps, "expandNode" | "onNodeClick" | "onNodeKeyDown" | "onFilterClick" | "getIcon" | "getSublabel" | "getCheckboxStatus" | "onCheckboxClicked" | "getHierarchyLevelDetails"> & Omit<TreeProps<RenderedTreeNode>, "data" | "nodeRenderer" | "getNode"> & VisibilityTreeRendererOwnProps;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare function VisibilityTreeRenderer({ rootNodes, expandNode, onNodeClick, onNodeKeyDown, isNodeSelected, onFilterClick, getIcon, getSublabel, getCheckboxStatus, onCheckboxClicked, getHierarchyLevelDetails, ...props }: VisibilityTreeRendererProps): JSX.Element;
|
|
13
|
+
type TreeProps<T> = ComponentPropsWithoutRef<typeof Tree<T>>;
|
|
14
|
+
type VisibilityTreeNodeRendererProps = ComponentPropsWithoutRef<typeof VisibilityTreeNodeRenderer>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=VisibilityTreeRenderer.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VisibilityTreeRenderer = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
/*---------------------------------------------------------------------------------------------
|
|
6
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
|
+
*--------------------------------------------------------------------------------------------*/
|
|
9
|
+
require("./VisibilityTreeRenderer.scss");
|
|
10
|
+
const react_1 = require("react");
|
|
11
|
+
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
12
|
+
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
13
|
+
const VisibilityTreeNodeRenderer_1 = require("./VisibilityTreeNodeRenderer");
|
|
14
|
+
/** @internal */
|
|
15
|
+
function VisibilityTreeRenderer({ rootNodes, expandNode, onNodeClick, onNodeKeyDown, isNodeSelected, onFilterClick, getIcon, getSublabel, getCheckboxStatus, onCheckboxClicked, getHierarchyLevelDetails, ...props }) {
|
|
16
|
+
const nodeRenderer = (0, react_1.useCallback)((nodeProps) => {
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(VisibilityTreeNodeRenderer_1.VisibilityTreeNodeRenderer, { ...nodeProps, expandNode: expandNode, onNodeClick: onNodeClick, onNodeKeyDown: onNodeKeyDown, getIcon: getIcon, getSublabel: getSublabel, getCheckboxStatus: getCheckboxStatus, onCheckboxClicked: onCheckboxClicked, onFilterClick: onFilterClick, getHierarchyLevelDetails: getHierarchyLevelDetails }));
|
|
18
|
+
}, [expandNode, onNodeClick, onNodeKeyDown, getHierarchyLevelDetails, getIcon, getSublabel, getCheckboxStatus, onCheckboxClicked, onFilterClick]);
|
|
19
|
+
const getNode = (0, react_1.useCallback)((node) => (0, presentation_hierarchies_react_1.createRenderedTreeNodeData)(node, isNodeSelected), [isNodeSelected]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(itwinui_react_1.Tree, { ...props, className: "tw-visibility-tree-renderer", data: rootNodes, nodeRenderer: nodeRenderer, getNode: getNode, enableVirtualization: true }));
|
|
21
|
+
}
|
|
22
|
+
exports.VisibilityTreeRenderer = VisibilityTreeRenderer;
|
|
23
|
+
//# sourceMappingURL=VisibilityTreeRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VisibilityTreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/components/trees/stateless/common/components/VisibilityTreeRenderer.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,yCAAuC;AACvC,iCAAoC;AACpC,wDAA4C;AAC5C,0FAAmF;AACnF,6EAA0E;AAyB1E,gBAAgB;AAChB,SAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,UAAU,EACV,WAAW,EACX,aAAa,EACb,cAAc,EACd,aAAa,EACb,OAAO,EACP,WAAW,EACX,iBAAiB,EACjB,iBAAiB,EACjB,wBAAwB,EACxB,GAAG,KAAK,EACoB;IAC5B,MAAM,YAAY,GAAG,IAAA,mBAAW,EAC9B,CAAC,SAAS,EAAE,EAAE;QACZ,OAAO,CACL,uBAAC,uDAA0B,OACrB,SAAS,EACb,UAAU,EAAE,UAAU,EACtB,WAAW,EAAE,WAAW,EACxB,aAAa,EAAE,aAAa,EAC5B,OAAO,EAAE,OAAO,EAChB,WAAW,EAAE,WAAW,EACxB,iBAAiB,EAAE,iBAAiB,EACpC,iBAAiB,EAAE,iBAAiB,EACpC,aAAa,EAAE,aAAa,EAC5B,wBAAwB,EAAE,wBAAwB,GAClD,CACH,CAAC;IACJ,CAAC,EACD,CAAC,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,wBAAwB,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,aAAa,CAAC,CAC9I,CAAC;IAEF,MAAM,OAAO,GAAG,IAAA,mBAAW,EAAyC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,2DAA0B,EAAC,IAAI,EAAE,cAAc,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC;IAElJ,OAAO,CACL,uBAAC,oBAAI,OACC,KAAK,EACT,SAAS,EAAC,6BAA6B,EACvC,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,oBAAoB,EAAE,IAAI,GAC1B,CACH,CAAC;AACJ,CAAC;AA9CD,wDA8CC","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 \"./VisibilityTreeRenderer.scss\";\nimport { useCallback } from \"react\";\nimport { Tree } from \"@itwin/itwinui-react\";\nimport { createRenderedTreeNodeData } from \"@itwin/presentation-hierarchies-react\";\nimport { VisibilityTreeNodeRenderer } from \"./VisibilityTreeNodeRenderer\";\n\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { PresentationTreeNode, RenderedTreeNode } from \"@itwin/presentation-hierarchies-react\";\n\ninterface VisibilityTreeRendererOwnProps {\n rootNodes: PresentationTreeNode[];\n isNodeSelected: (nodeId: string) => boolean;\n}\n\ntype VisibilityTreeRendererProps = Pick<\n VisibilityTreeNodeRendererProps,\n | \"expandNode\"\n | \"onNodeClick\"\n | \"onNodeKeyDown\"\n | \"onFilterClick\"\n | \"getIcon\"\n | \"getSublabel\"\n | \"getCheckboxStatus\"\n | \"onCheckboxClicked\"\n | \"getHierarchyLevelDetails\"\n> &\n Omit<TreeProps<RenderedTreeNode>, \"data\" | \"nodeRenderer\" | \"getNode\"> &\n VisibilityTreeRendererOwnProps;\n\n/** @internal */\nexport function VisibilityTreeRenderer({\n rootNodes,\n expandNode,\n onNodeClick,\n onNodeKeyDown,\n isNodeSelected,\n onFilterClick,\n getIcon,\n getSublabel,\n getCheckboxStatus,\n onCheckboxClicked,\n getHierarchyLevelDetails,\n ...props\n}: VisibilityTreeRendererProps) {\n const nodeRenderer = useCallback<TreeProps<RenderedTreeNode>[\"nodeRenderer\"]>(\n (nodeProps) => {\n return (\n <VisibilityTreeNodeRenderer\n {...nodeProps}\n expandNode={expandNode}\n onNodeClick={onNodeClick}\n onNodeKeyDown={onNodeKeyDown}\n getIcon={getIcon}\n getSublabel={getSublabel}\n getCheckboxStatus={getCheckboxStatus}\n onCheckboxClicked={onCheckboxClicked}\n onFilterClick={onFilterClick}\n getHierarchyLevelDetails={getHierarchyLevelDetails}\n />\n );\n },\n [expandNode, onNodeClick, onNodeKeyDown, getHierarchyLevelDetails, getIcon, getSublabel, getCheckboxStatus, onCheckboxClicked, onFilterClick],\n );\n\n const getNode = useCallback<TreeProps<RenderedTreeNode>[\"getNode\"]>((node) => createRenderedTreeNodeData(node, isNodeSelected), [isNodeSelected]);\n\n return (\n <Tree<RenderedTreeNode>\n {...props}\n className=\"tw-visibility-tree-renderer\"\n data={rootNodes}\n nodeRenderer={nodeRenderer}\n getNode={getNode}\n enableVirtualization={true}\n />\n );\n}\n\ntype TreeProps<T> = ComponentPropsWithoutRef<typeof Tree<T>>;\ntype VisibilityTreeNodeRendererProps = ComponentPropsWithoutRef<typeof VisibilityTreeNodeRenderer>;\n"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
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
|
+
|
|
6
|
+
.tw-visibility-tree-renderer {
|
|
7
|
+
width: fit-content;
|
|
8
|
+
min-width: 100%;
|
|
9
|
+
|
|
10
|
+
div:has(> .tw-visibility-tree-node-checkbox) {
|
|
11
|
+
position: sticky;
|
|
12
|
+
left: 0;
|
|
13
|
+
z-index: 1;
|
|
14
|
+
background-color: var(--iui-color-background);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.tw-visibility-tree-node-action-buttons {
|
|
18
|
+
position: sticky;
|
|
19
|
+
right: 0;
|
|
20
|
+
z-index: 1;
|
|
21
|
+
background-color: var(--iui-color-background);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
div:has(> .tw-visibility-tree-node-action-buttons) {
|
|
25
|
+
overflow: visible;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.tw-visibility-tree-node:not(.selected) {
|
|
29
|
+
div:has(> .tw-visibility-tree-node-checkbox),
|
|
30
|
+
.tw-visibility-tree-node-action-buttons {
|
|
31
|
+
background-color: var(--iui-color-background-hover);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.tw-visibility-tree-node.selected {
|
|
36
|
+
div:has(> .tw-visibility-tree-node-checkbox),
|
|
37
|
+
.tw-visibility-tree-node-action-buttons {
|
|
38
|
+
background-color: var(--iui-color-background-accent-muted);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|