@itwin/tree-widget-react 4.0.0-alpha.3 → 4.0.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +34 -1
- package/README.md +1 -3
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +3 -2
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js +2 -2
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js +4 -4
- package/lib/esm/tree-widget-react/components/tree-header/SearchBox.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/SelectableTree.css +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +6 -6
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +10 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +246 -129
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +75 -25
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.d.ts +54 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js +280 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeIdsCache.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.d.ts +26 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js +23 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesTreeNode.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/{CategoriesVisibilityHandler.d.ts → internal/CategoriesVisibilityHandler.d.ts} +18 -9
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js +214 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/CategoriesVisibilityHandler.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.d.ts +7 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.js +11 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/internal/ClassNameDefinitions.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.d.ts +0 -4
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/CategoriesVisibilityUtils.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.d.ts +28 -4
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js +73 -2
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContext.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.css +24 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.d.ts +21 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js +42 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +6 -7
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.css +2 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js +6 -6
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +3 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js +3 -6
- package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +10 -10
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +16 -16
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/index.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/index.js +1 -0
- package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +12 -12
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +6 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js +7 -3
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +22 -33
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/AlwaysAndNeverDrawnElementInfo.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.d.ts +5 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js +45 -0
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeIdsCache.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.d.ts +2 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js +128 -38
- package/lib/esm/tree-widget-react/components/trees/models-tree/internal/ModelsTreeVisibilityHandler.js.map +1 -1
- package/lib/public/locales/en/TreeWidget.json +26 -10
- package/package.json +6 -9
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js +0 -87
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesVisibilityHandler.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js +0 -66
- package/lib/esm/tree-widget-react/components/trees/common/FocusedInstancesContextProvider.js.map +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.d.ts +0 -7
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.js +0 -12
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTreeContent.js.map +0 -1
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "./EmptyTree.css";
|
|
2
|
+
interface FilterEmptyTreeProps {
|
|
3
|
+
base: string;
|
|
4
|
+
}
|
|
5
|
+
/** @internal */
|
|
6
|
+
export declare function TooManyFilterMatches({ base }: FilterEmptyTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
/** @internal */
|
|
8
|
+
export declare function NoFilterMatches({ base }: FilterEmptyTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
/** @internal */
|
|
10
|
+
export declare function FilterUnknownError({ base }: FilterEmptyTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
/** @internal */
|
|
12
|
+
export declare function TooManyInstancesFocused({ base }: FilterEmptyTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
/** @internal */
|
|
14
|
+
export declare function UnknownInstanceFocusError({ base }: FilterEmptyTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
interface EmptyTreeContentProps {
|
|
16
|
+
icon?: string;
|
|
17
|
+
}
|
|
18
|
+
/** @internal */
|
|
19
|
+
export declare function EmptyTreeContent({ icon }: EmptyTreeContentProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=EmptyTree.d.ts.map
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/*---------------------------------------------------------------------------------------------
|
|
3
|
+
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
+
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
+
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
import "./EmptyTree.css";
|
|
7
|
+
import { Anchor, Icon, Text } from "@itwin/itwinui-react/bricks";
|
|
8
|
+
import { TreeWidget } from "../../../../TreeWidget.js";
|
|
9
|
+
import { useFocusedInstancesContext } from "../FocusedInstancesContext.js";
|
|
10
|
+
/** @internal */
|
|
11
|
+
export function TooManyFilterMatches({ base }) {
|
|
12
|
+
return (_jsxs("div", { className: "tw-filter-empty-tree-container", children: [_jsx(Text, { variant: "body-sm", children: TreeWidget.translate(`${base}.filtering.tooManyFilterMatches`) }), _jsx(Text, { variant: "body-sm", children: TreeWidget.translate(`${base}.filtering.tooManyFilterMatchesRetry`) })] }));
|
|
13
|
+
}
|
|
14
|
+
/** @internal */
|
|
15
|
+
export function NoFilterMatches({ base }) {
|
|
16
|
+
return (_jsxs("div", { className: "tw-filter-empty-tree-container", children: [_jsx(Text, { variant: "body-sm", children: TreeWidget.translate(`${base}.filtering.noMatches`) }), _jsx(Text, { variant: "body-sm", children: TreeWidget.translate(`${base}.filtering.noMatchesRetry`) })] }));
|
|
17
|
+
}
|
|
18
|
+
/** @internal */
|
|
19
|
+
export function FilterUnknownError({ base }) {
|
|
20
|
+
return (_jsx("div", { className: "tw-filter-empty-tree-container", children: _jsx(Text, { variant: "body-sm", children: TreeWidget.translate(`${base}.filtering.unknownFilterError`) }) }));
|
|
21
|
+
}
|
|
22
|
+
/** @internal */
|
|
23
|
+
export function TooManyInstancesFocused({ base }) {
|
|
24
|
+
const { toggle } = useFocusedInstancesContext();
|
|
25
|
+
return (_jsxs("div", { className: "tw-filter-empty-tree-container", children: [_jsx(Text, { variant: "body-sm", children: TreeWidget.translate(`${base}.filtering.tooManyInstancesFocused`) }), _jsx(Anchor, { style: { textDecoration: "underline" }, onClick: (e) => {
|
|
26
|
+
e.stopPropagation();
|
|
27
|
+
toggle();
|
|
28
|
+
}, children: TreeWidget.translate(`${base}.filtering.disableInstanceFocusMode`) })] }));
|
|
29
|
+
}
|
|
30
|
+
/** @internal */
|
|
31
|
+
export function UnknownInstanceFocusError({ base }) {
|
|
32
|
+
const { toggle } = useFocusedInstancesContext();
|
|
33
|
+
return (_jsxs("div", { className: "tw-filter-empty-tree-container", children: [_jsx(Text, { variant: "body-sm", children: TreeWidget.translate(`${base}.filtering.unknownInstanceFocusError`) }), _jsx(Anchor, { style: { textDecoration: "underline" }, onClick: (e) => {
|
|
34
|
+
e.stopPropagation();
|
|
35
|
+
toggle();
|
|
36
|
+
}, children: TreeWidget.translate(`${base}.filtering.disableInstanceFocusMode`) })] }));
|
|
37
|
+
}
|
|
38
|
+
/** @internal */
|
|
39
|
+
export function EmptyTreeContent({ icon }) {
|
|
40
|
+
return (_jsxs("div", { className: "tw-empty-tree-container", children: [icon ? _jsx(Icon, { size: "large", href: icon }) : null, _jsx(Text, { variant: "body-sm", style: { textAlign: "center" }, children: TreeWidget.translate("baseTree.dataIsNotAvailable") })] }));
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=EmptyTree.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EmptyTree.js","sourceRoot":"","sources":["../../../../../../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AAC,IAAI,EAAC,OAAO,EAAC,IAAI,EAAE,IAAI,GAAI,CAAC,CAAC,CAAC,IAAI,EAChD,KAAC,IAAI,IAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,YACrD,UAAU,CAAC,SAAS,CAAC,6BAA6B,CAAC,GAC/C,IACH,CACP,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./EmptyTree.css\";\nimport { Anchor, Icon, Text } from \"@itwin/itwinui-react/bricks\";\nimport { TreeWidget } from \"../../../../TreeWidget.js\";\nimport { useFocusedInstancesContext } from \"../FocusedInstancesContext.js\";\n\ninterface FilterEmptyTreeProps {\n base: string;\n}\n\n/** @internal */\nexport function TooManyFilterMatches({ base }: FilterEmptyTreeProps) {\n return (\n <div className={\"tw-filter-empty-tree-container\"}>\n <Text variant={\"body-sm\"}>{TreeWidget.translate(`${base}.filtering.tooManyFilterMatches`)}</Text>\n <Text variant={\"body-sm\"}>{TreeWidget.translate(`${base}.filtering.tooManyFilterMatchesRetry`)}</Text>\n </div>\n );\n}\n\n/** @internal */\nexport function NoFilterMatches({ base }: FilterEmptyTreeProps) {\n return (\n <div className={\"tw-filter-empty-tree-container\"}>\n <Text variant={\"body-sm\"}>{TreeWidget.translate(`${base}.filtering.noMatches`)}</Text>\n <Text variant={\"body-sm\"}>{TreeWidget.translate(`${base}.filtering.noMatchesRetry`)}</Text>\n </div>\n );\n}\n\n/** @internal */\nexport function FilterUnknownError({ base }: FilterEmptyTreeProps) {\n return (\n <div className={\"tw-filter-empty-tree-container\"}>\n <Text variant={\"body-sm\"}>{TreeWidget.translate(`${base}.filtering.unknownFilterError`)}</Text>\n </div>\n );\n}\n\n/** @internal */\nexport function TooManyInstancesFocused({ base }: FilterEmptyTreeProps) {\n const { toggle } = useFocusedInstancesContext();\n return (\n <div className={\"tw-filter-empty-tree-container\"}>\n <Text variant={\"body-sm\"}>{TreeWidget.translate(`${base}.filtering.tooManyInstancesFocused`)}</Text>\n <Anchor\n style={{ textDecoration: \"underline\" }}\n onClick={(e) => {\n e.stopPropagation();\n toggle();\n }}\n >\n {TreeWidget.translate(`${base}.filtering.disableInstanceFocusMode`)}\n </Anchor>\n </div>\n );\n}\n\n/** @internal */\nexport function UnknownInstanceFocusError({ base }: FilterEmptyTreeProps) {\n const { toggle } = useFocusedInstancesContext();\n return (\n <div className={\"tw-filter-empty-tree-container\"}>\n <Text variant={\"body-sm\"}>{TreeWidget.translate(`${base}.filtering.unknownInstanceFocusError`)}</Text>\n <Anchor\n style={{ textDecoration: \"underline\" }}\n onClick={(e) => {\n e.stopPropagation();\n toggle();\n }}\n >\n {TreeWidget.translate(`${base}.filtering.disableInstanceFocusMode`)}\n </Anchor>\n </div>\n );\n}\n\n\n\ninterface EmptyTreeContentProps {\n icon?: string;\n}\n\n/** @internal */\nexport function EmptyTreeContent({ icon }: EmptyTreeContentProps) {\n return (\n <div className={\"tw-empty-tree-container\"}>\n {icon ? <Icon size=\"large\" href={icon} /> : null}\n <Text variant={\"body-sm\"} style={{ textAlign: \"center\" }}>\n {TreeWidget.translate(\"baseTree.dataIsNotAvailable\")}\n </Text>\n </div>\n );\n}\n"]}
|
|
@@ -35,7 +35,7 @@ export type TreeProps = Pick<FunctionProps<typeof useIModelTree>, "getFilteredPa
|
|
|
35
35
|
};
|
|
36
36
|
/**
|
|
37
37
|
* Default tree component that manages tree state and renders using supplied `treeRenderer`.
|
|
38
|
-
* @
|
|
38
|
+
* @beta
|
|
39
39
|
*/
|
|
40
40
|
export declare function Tree({ getSchemaContext, hierarchyLevelSizeLimit, selectionStorage, imodelAccess: providedIModelAccess, ...props }: TreeProps): import("react/jsx-runtime").JSX.Element;
|
|
41
41
|
//# sourceMappingURL=Tree.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/*---------------------------------------------------------------------------------------------
|
|
3
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
@@ -8,7 +8,6 @@ import { BeEvent } from "@itwin/core-bentley";
|
|
|
8
8
|
import { Spinner } from "@itwin/itwinui-react/bricks";
|
|
9
9
|
import { SchemaMetadataContextProvider } from "@itwin/presentation-components";
|
|
10
10
|
import { useIModelUnifiedSelectionTree } from "@itwin/presentation-hierarchies-react";
|
|
11
|
-
import { UnifiedSelectionContextProvider } from "@itwin/unified-selection-react";
|
|
12
11
|
import { useHierarchiesLocalization } from "../UseHierarchiesLocalization.js";
|
|
13
12
|
import { useHierarchyLevelFiltering } from "../UseHierarchyFiltering.js";
|
|
14
13
|
import { useIModelChangeListener } from "../UseIModelChangeListener.js";
|
|
@@ -16,11 +15,11 @@ import { useNodeHighlighting } from "../UseNodeHighlighting.js";
|
|
|
16
15
|
import { useReportingAction, useTelemetryContext } from "../UseTelemetryContext.js";
|
|
17
16
|
import { createIModelAccess } from "../Utils.js";
|
|
18
17
|
import { Delayed } from "./Delayed.js";
|
|
19
|
-
import { EmptyTreeContent } from "./
|
|
18
|
+
import { EmptyTreeContent } from "./EmptyTree.js";
|
|
20
19
|
import { ProgressOverlay } from "./ProgressOverlay.js";
|
|
21
20
|
/**
|
|
22
21
|
* Default tree component that manages tree state and renders using supplied `treeRenderer`.
|
|
23
|
-
* @
|
|
22
|
+
* @beta
|
|
24
23
|
*/
|
|
25
24
|
export function Tree({ getSchemaContext, hierarchyLevelSizeLimit, selectionStorage, imodelAccess: providedIModelAccess, ...props }) {
|
|
26
25
|
const defaultHierarchyLevelSizeLimit = hierarchyLevelSizeLimit ?? 1000;
|
|
@@ -36,11 +35,11 @@ function TreeImpl({ imodel, imodelAccess, treeName, emptyTreeContent, getFiltere
|
|
|
36
35
|
const { rootNodes, getNode, isLoading, selectNodes: selectNodesAction, setFormatter: _setFormatter, expandNode, ...treeProps } = useIModelUnifiedSelectionTree({
|
|
37
36
|
imodelAccess,
|
|
38
37
|
imodelChanged,
|
|
39
|
-
selectionStorage,
|
|
40
38
|
getHierarchyDefinition,
|
|
41
39
|
getFilteredPaths,
|
|
42
40
|
sourceName: treeName,
|
|
43
41
|
localizedStrings,
|
|
42
|
+
selectionStorage,
|
|
44
43
|
onPerformanceMeasured: (action, duration) => {
|
|
45
44
|
if (action === "reload") {
|
|
46
45
|
onReload?.();
|
|
@@ -71,7 +70,7 @@ function TreeImpl({ imodel, imodelAccess, treeName, emptyTreeContent, getFiltere
|
|
|
71
70
|
return (_jsx("div", { style: { display: "flex", alignItems: "center", justifyContent: "center", flexDirection: "column", width: "100%", height: "100%" }, children: _jsx(Delayed, { show: true, children: _jsx(Spinner, {}) }) }));
|
|
72
71
|
}
|
|
73
72
|
if (rootNodes.length === 0 && !isLoading) {
|
|
74
|
-
return
|
|
73
|
+
return _jsx(_Fragment, { children: emptyTreeContent ? emptyTreeContent : _jsx(EmptyTreeContent, {}) });
|
|
75
74
|
}
|
|
76
75
|
const treeRendererProps = {
|
|
77
76
|
...treeProps,
|
|
@@ -82,7 +81,7 @@ function TreeImpl({ imodel, imodelAccess, treeName, emptyTreeContent, getFiltere
|
|
|
82
81
|
onFilterClick: reportingOnFilterClicked,
|
|
83
82
|
getLabel,
|
|
84
83
|
};
|
|
85
|
-
return (
|
|
84
|
+
return (_jsxs("div", { style: { position: "relative", height: "100%", overflow: "hidden" }, children: [_jsxs("div", { id: "tw-tree-renderer-container", style: { overflow: "auto", height: "100%" }, children: [treeRenderer(treeRendererProps), filteringDialog] }), _jsx(Delayed, { show: isLoading, children: _jsx(ProgressOverlay, {}) })] }));
|
|
86
85
|
}
|
|
87
86
|
function useSelectionPredicate({ action, predicate, getNode, }) {
|
|
88
87
|
return useCallback((nodeIds, changeType) => action(nodeIds.filter((nodeId) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/Tree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,+BAA+B,EAAE,MAAM,gCAAgC,CAAC;AACjF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAwDvD;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,KAAK,EAAa;IAC3I,MAAM,8BAA8B,GAAG,uBAAuB,IAAI,IAAI,CAAC;IAEvE,MAAM,YAAY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AC,EAC7B,MAAM,EACN,SAAS,EACT,OAAO,GAKR;IACC,OAAO,WAAW,CAChB,CAAC,OAAO,EAAE,UAAU,EAAE,EAAE,CACtB,MAAM,CACJ,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE;QACxB,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAC7B,OAAO,IAAI,IAAI,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,EACF,UAAU,CACX,EACH,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAC7B,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useMemo, useState } from \"react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { Spinner } from \"@itwin/itwinui-react/bricks\";\nimport { SchemaMetadataContextProvider } from \"@itwin/presentation-components\";\nimport { useIModelUnifiedSelectionTree } from \"@itwin/presentation-hierarchies-react\";\nimport { UnifiedSelectionContextProvider } from \"@itwin/unified-selection-react\";\nimport { useHierarchiesLocalization } from \"../UseHierarchiesLocalization.js\";\nimport { useHierarchyLevelFiltering } from \"../UseHierarchyFiltering.js\";\nimport { useIModelChangeListener } from \"../UseIModelChangeListener.js\";\nimport { useNodeHighlighting } from \"../UseNodeHighlighting.js\";\nimport { useReportingAction, useTelemetryContext } from \"../UseTelemetryContext.js\";\nimport { createIModelAccess } from \"../Utils.js\";\nimport { Delayed } from \"./Delayed.js\";\nimport { EmptyTreeContent } from \"./EmptyTreeContent.js\";\nimport { ProgressOverlay } from \"./ProgressOverlay.js\";\n\nimport type { BaseTreeRendererProps } from \"./BaseTreeRenderer.js\";\nimport type { MarkRequired } from \"@itwin/core-bentley\";\nimport type { FunctionProps } from \"../Utils.js\";\nimport type { ReactNode } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { SchemaContext } from \"@itwin/ecschema-metadata\";\nimport type { PresentationHierarchyNode, SelectionStorage, useIModelTree, useSelectionHandler } from \"@itwin/presentation-hierarchies-react\";\nimport type { HighlightInfo } from \"../UseNodeHighlighting.js\";\n\n/** @beta */\nexport type TreeProps = Pick<FunctionProps<typeof useIModelTree>, \"getFilteredPaths\" | \"getHierarchyDefinition\"> &\n Partial<Pick<FunctionProps<typeof useSelectionHandler>, \"selectionMode\">> & {\n /** iModel connection that should be used to pull data from. */\n imodel: IModelConnection;\n /** Callback for getting `SchemaContext` for specific iModel. */\n getSchemaContext: (imodel: IModelConnection) => SchemaContext;\n /** Unique tree component name that will be used as unified selection change event source when selecting node. */\n treeName: string;\n /** Unified selection storage that should be used by tree to handle tree selection changes. */\n selectionStorage: SelectionStorage;\n /**\n * An optional predicate to allow or prohibit selection of a node.\n * When not supplied, all nodes are selectable.\n */\n selectionPredicate?: (node: PresentationHierarchyNode) => boolean;\n /** Tree renderer that should be used to render tree data. */\n treeRenderer: (\n treeProps: Required<\n Pick<\n BaseTreeRendererProps,\n | \"rootNodes\"\n | \"expandNode\"\n | \"getLabel\"\n | \"onFilterClick\"\n | \"selectNodes\"\n | \"selectionMode\"\n | \"isNodeSelected\"\n | \"getHierarchyLevelDetails\"\n | \"getLabel\"\n >\n >,\n ) => ReactNode;\n /** Custom iModel access that is stored outside tree component. If not provided it new iModel access will be created using `imodel` prop. */\n imodelAccess?: FunctionProps<typeof useIModelTree>[\"imodelAccess\"];\n /** Size limit that should be applied on each hierarchy level. Default to `1000`. */\n hierarchyLevelSizeLimit?: number;\n /** Component that should be renderer if there are no tree nodes. */\n emptyTreeContent?: ReactNode;\n /** Callback that this invoked when tree reloads. */\n onReload?: () => void;\n /** Options for highlighting node labels. */\n highlight?: HighlightInfo;\n };\n\n/**\n * Default tree component that manages tree state and renders using supplied `treeRenderer`.\n * @Beta\n */\nexport function Tree({ getSchemaContext, hierarchyLevelSizeLimit, selectionStorage, imodelAccess: providedIModelAccess, ...props }: TreeProps) {\n const defaultHierarchyLevelSizeLimit = hierarchyLevelSizeLimit ?? 1000;\n\n const imodelAccess = useMemo(() => {\n return providedIModelAccess ?? createIModelAccess({ getSchemaContext, imodel: props.imodel });\n }, [providedIModelAccess, getSchemaContext, props.imodel]);\n\n return (\n <SchemaMetadataContextProvider imodel={props.imodel} schemaContextProvider={getSchemaContext}>\n <TreeImpl {...props} selectionStorage={selectionStorage} imodelAccess={imodelAccess} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />\n </SchemaMetadataContextProvider>\n );\n}\n\nfunction TreeImpl({\n imodel,\n imodelAccess,\n treeName,\n emptyTreeContent,\n getFilteredPaths,\n defaultHierarchyLevelSizeLimit,\n getHierarchyDefinition,\n selectionPredicate,\n selectionMode,\n onReload,\n treeRenderer,\n selectionStorage,\n highlight,\n}: MarkRequired<Omit<TreeProps, \"getSchemaContext\">, \"imodelAccess\"> & { defaultHierarchyLevelSizeLimit: number }) {\n const localizedStrings = useHierarchiesLocalization();\n const { onFeatureUsed, onPerformanceMeasured } = useTelemetryContext();\n const [imodelChanged] = useState(new BeEvent<() => void>());\n const {\n rootNodes,\n getNode,\n isLoading,\n selectNodes: selectNodesAction,\n setFormatter: _setFormatter,\n expandNode,\n ...treeProps\n } = useIModelUnifiedSelectionTree({\n imodelAccess,\n imodelChanged,\n selectionStorage,\n getHierarchyDefinition,\n getFilteredPaths,\n sourceName: treeName,\n localizedStrings,\n onPerformanceMeasured: (action, duration) => {\n if (action === \"reload\") {\n onReload?.();\n }\n onPerformanceMeasured(action, duration);\n },\n onHierarchyLimitExceeded: () => onFeatureUsed({ featureId: \"hierarchy-level-size-limit-hit\", reportInteraction: false }),\n onHierarchyLoadError: ({ type, error }) => {\n // eslint-disable-next-line no-console\n console.error(error);\n onFeatureUsed({ featureId: `error-${type}`, reportInteraction: false });\n },\n });\n useIModelChangeListener({ imodel, action: useCallback(() => imodelChanged.raiseEvent(), [imodelChanged]) });\n\n const selectNodes = useSelectionPredicate({\n action: useReportingAction({ action: selectNodesAction }),\n predicate: selectionPredicate,\n getNode,\n });\n const { filteringDialog, onFilterClick } = useHierarchyLevelFiltering({\n imodel,\n defaultHierarchyLevelSizeLimit,\n });\n const reportingExpandNode = useReportingAction({ action: expandNode });\n const reportingOnFilterClicked = useReportingAction({ action: onFilterClick });\n const { getLabel } = useNodeHighlighting({ rootNodes, highlight });\n\n if (rootNodes === undefined) {\n return (\n <div style={{ display: \"flex\", alignItems: \"center\", justifyContent: \"center\", flexDirection: \"column\", width: \"100%\", height: \"100%\" }}>\n <Delayed show={true}>\n <Spinner />\n </Delayed>\n </div>\n );\n }\n\n if (rootNodes.length === 0 && !isLoading) {\n return (\n <div style={{ display: \"flex\", alignItems: \"center\", justifyContent: \"center\", flexDirection: \"column\", width: \"100%\", height: \"100%\" }}>\n {emptyTreeContent ? emptyTreeContent : <EmptyTreeContent />}\n </div>\n );\n }\n\n const treeRendererProps: FunctionProps<TreeProps[\"treeRenderer\"]> = {\n ...treeProps,\n rootNodes,\n selectionMode: selectionMode ?? \"single\",\n selectNodes,\n expandNode: reportingExpandNode,\n onFilterClick: reportingOnFilterClicked,\n getLabel,\n };\n\n return (\n <UnifiedSelectionContextProvider storage={selectionStorage}>\n <div style={{ position: \"relative\", height: \"100%\", overflow: \"hidden\" }}>\n <div id=\"tw-tree-renderer-container\" style={{ overflow: \"auto\", height: \"100%\" }}>\n {treeRenderer(treeRendererProps)}\n {filteringDialog}\n </div>\n <Delayed show={isLoading}>\n <ProgressOverlay />\n </Delayed>\n </div>\n </UnifiedSelectionContextProvider>\n );\n}\n\nfunction useSelectionPredicate({\n action,\n predicate,\n getNode,\n}: {\n action: (...args: any[]) => void;\n predicate?: (node: PresentationHierarchyNode) => boolean;\n getNode: (nodeId: string) => PresentationHierarchyNode | undefined;\n}): ReturnType<typeof useIModelUnifiedSelectionTree>[\"selectNodes\"] {\n return useCallback(\n (nodeIds, changeType) =>\n action(\n nodeIds.filter((nodeId) => {\n const node = getNode(nodeId);\n return node && (!predicate || predicate(node));\n }),\n changeType,\n ),\n [action, getNode, predicate],\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/Tree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,EAAE,0BAA0B,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAuDvD;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,YAAY,EAAE,oBAAoB,EAAE,GAAG,KAAK,EAAa;IAC3I,MAAM,8BAA8B,GAAG,uBAAuB,IAAI,IAAI,CAAC;IAEvE,MAAM,YAA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AAO,IAAI,IAAI,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACjD,CAAC,CAAC,EACF,UAAU,CACX,EACH,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,CAC7B,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useCallback, useMemo, useState } from \"react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\nimport { Spinner } from \"@itwin/itwinui-react/bricks\";\nimport { SchemaMetadataContextProvider } from \"@itwin/presentation-components\";\nimport { useIModelUnifiedSelectionTree } from \"@itwin/presentation-hierarchies-react\";\nimport { useHierarchiesLocalization } from \"../UseHierarchiesLocalization.js\";\nimport { useHierarchyLevelFiltering } from \"../UseHierarchyFiltering.js\";\nimport { useIModelChangeListener } from \"../UseIModelChangeListener.js\";\nimport { useNodeHighlighting } from \"../UseNodeHighlighting.js\";\nimport { useReportingAction, useTelemetryContext } from \"../UseTelemetryContext.js\";\nimport { createIModelAccess } from \"../Utils.js\";\nimport { Delayed } from \"./Delayed.js\";\nimport { EmptyTreeContent } from \"./EmptyTree.js\";\nimport { ProgressOverlay } from \"./ProgressOverlay.js\";\n\nimport type { BaseTreeRendererProps } from \"./BaseTreeRenderer.js\";\nimport type { MarkRequired } from \"@itwin/core-bentley\";\nimport type { FunctionProps } from \"../Utils.js\";\nimport type { ReactNode } from \"react\";\nimport type { IModelConnection } from \"@itwin/core-frontend\";\nimport type { SchemaContext } from \"@itwin/ecschema-metadata\";\nimport type { PresentationHierarchyNode, SelectionStorage, useIModelTree, useSelectionHandler } from \"@itwin/presentation-hierarchies-react\";\nimport type { HighlightInfo } from \"../UseNodeHighlighting.js\";\n/** @beta */\nexport type TreeProps = Pick<FunctionProps<typeof useIModelTree>, \"getFilteredPaths\" | \"getHierarchyDefinition\"> &\n Partial<Pick<FunctionProps<typeof useSelectionHandler>, \"selectionMode\">> & {\n /** iModel connection that should be used to pull data from. */\n imodel: IModelConnection;\n /** Callback for getting `SchemaContext` for specific iModel. */\n getSchemaContext: (imodel: IModelConnection) => SchemaContext;\n /** Unique tree component name that will be used as unified selection change event source when selecting node. */\n treeName: string;\n /** Unified selection storage that should be used by tree to handle tree selection changes. */\n selectionStorage: SelectionStorage;\n /**\n * An optional predicate to allow or prohibit selection of a node.\n * When not supplied, all nodes are selectable.\n */\n selectionPredicate?: (node: PresentationHierarchyNode) => boolean;\n /** Tree renderer that should be used to render tree data. */\n treeRenderer: (\n treeProps: Required<\n Pick<\n BaseTreeRendererProps,\n | \"rootNodes\"\n | \"expandNode\"\n | \"getLabel\"\n | \"onFilterClick\"\n | \"selectNodes\"\n | \"selectionMode\"\n | \"isNodeSelected\"\n | \"getHierarchyLevelDetails\"\n | \"getLabel\"\n >\n >,\n ) => ReactNode;\n /** Custom iModel access that is stored outside tree component. If not provided it new iModel access will be created using `imodel` prop. */\n imodelAccess?: FunctionProps<typeof useIModelTree>[\"imodelAccess\"];\n /** Size limit that should be applied on each hierarchy level. Default to `1000`. */\n hierarchyLevelSizeLimit?: number;\n /** Component that should be renderer if there are no tree nodes. */\n emptyTreeContent?: ReactNode;\n /** Callback that this invoked when tree reloads. */\n onReload?: () => void;\n /** Options for highlighting node labels. */\n highlight?: HighlightInfo;\n };\n\n/**\n * Default tree component that manages tree state and renders using supplied `treeRenderer`.\n * @beta\n */\nexport function Tree({ getSchemaContext, hierarchyLevelSizeLimit, selectionStorage, imodelAccess: providedIModelAccess, ...props }: TreeProps) {\n const defaultHierarchyLevelSizeLimit = hierarchyLevelSizeLimit ?? 1000;\n\n const imodelAccess = useMemo(() => {\n return providedIModelAccess ?? createIModelAccess({ getSchemaContext, imodel: props.imodel });\n }, [providedIModelAccess, getSchemaContext, props.imodel]);\n\n return (\n <SchemaMetadataContextProvider imodel={props.imodel} schemaContextProvider={getSchemaContext}>\n <TreeImpl {...props} selectionStorage={selectionStorage} imodelAccess={imodelAccess} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />\n </SchemaMetadataContextProvider>\n );\n}\n\nfunction TreeImpl({\n imodel,\n imodelAccess,\n treeName,\n emptyTreeContent,\n getFilteredPaths,\n defaultHierarchyLevelSizeLimit,\n getHierarchyDefinition,\n selectionPredicate,\n selectionMode,\n onReload,\n treeRenderer,\n selectionStorage,\n highlight,\n}: MarkRequired<Omit<TreeProps, \"getSchemaContext\">, \"imodelAccess\"> & { defaultHierarchyLevelSizeLimit: number }) {\n const localizedStrings = useHierarchiesLocalization();\n const { onFeatureUsed, onPerformanceMeasured } = useTelemetryContext();\n const [imodelChanged] = useState(new BeEvent<() => void>());\n const {\n rootNodes,\n getNode,\n isLoading,\n selectNodes: selectNodesAction,\n setFormatter: _setFormatter,\n expandNode,\n ...treeProps\n } = useIModelUnifiedSelectionTree({\n imodelAccess,\n imodelChanged,\n getHierarchyDefinition,\n getFilteredPaths,\n sourceName: treeName,\n localizedStrings,\n selectionStorage,\n onPerformanceMeasured: (action, duration) => {\n if (action === \"reload\") {\n onReload?.();\n }\n onPerformanceMeasured(action, duration);\n },\n onHierarchyLimitExceeded: () => onFeatureUsed({ featureId: \"hierarchy-level-size-limit-hit\", reportInteraction: false }),\n onHierarchyLoadError: ({ type, error }) => {\n // eslint-disable-next-line no-console\n console.error(error);\n onFeatureUsed({ featureId: `error-${type}`, reportInteraction: false });\n },\n });\n useIModelChangeListener({ imodel, action: useCallback(() => imodelChanged.raiseEvent(), [imodelChanged]) });\n\n const selectNodes = useSelectionPredicate({\n action: useReportingAction({ action: selectNodesAction }),\n predicate: selectionPredicate,\n getNode,\n });\n const { filteringDialog, onFilterClick } = useHierarchyLevelFiltering({\n imodel,\n defaultHierarchyLevelSizeLimit,\n });\n const reportingExpandNode = useReportingAction({ action: expandNode });\n const reportingOnFilterClicked = useReportingAction({ action: onFilterClick });\n const { getLabel } = useNodeHighlighting({ rootNodes, highlight });\n\n if (rootNodes === undefined) {\n return (\n <div style={{ display: \"flex\", alignItems: \"center\", justifyContent: \"center\", flexDirection: \"column\", width: \"100%\", height: \"100%\" }}>\n <Delayed show={true}>\n <Spinner />\n </Delayed>\n </div>\n );\n }\n\n if (rootNodes.length === 0 && !isLoading) {\n return <>{emptyTreeContent ? emptyTreeContent : <EmptyTreeContent />}</>;\n }\n\n const treeRendererProps: FunctionProps<TreeProps[\"treeRenderer\"]> = {\n ...treeProps,\n rootNodes,\n selectionMode: selectionMode ?? \"single\",\n selectNodes,\n expandNode: reportingExpandNode,\n onFilterClick: reportingOnFilterClicked,\n getLabel,\n };\n\n return (\n <div style={{ position: \"relative\", height: \"100%\", overflow: \"hidden\" }}>\n <div id=\"tw-tree-renderer-container\" style={{ overflow: \"auto\", height: \"100%\" }}>\n {treeRenderer(treeRendererProps)}\n {filteringDialog}\n </div>\n <Delayed show={isLoading}>\n <ProgressOverlay />\n </Delayed>\n </div>\n );\n}\n\nfunction useSelectionPredicate({\n action,\n predicate,\n getNode,\n}: {\n action: (...args: any[]) => void;\n predicate?: (node: PresentationHierarchyNode) => boolean;\n getNode: (nodeId: string) => PresentationHierarchyNode | undefined;\n}): ReturnType<typeof useIModelUnifiedSelectionTree>[\"selectNodes\"] {\n return useCallback(\n (nodeIds, changeType) =>\n action(\n nodeIds.filter((nodeId) => {\n const node = getNode(nodeId);\n return node && (!predicate || predicate(node));\n }),\n changeType,\n ),\n [action, getNode, predicate],\n );\n}\n"]}
|
package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.css
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
|
|
6
|
-
.tw-tree-node-visibility-button-hidden,
|
|
6
|
+
.tw-tree-node-visibility-button-hidden,
|
|
7
|
+
.tw-tree-node-visibility-button-partial {
|
|
7
8
|
visibility: visible;
|
|
8
9
|
}
|
package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
5
|
import "./TreeNodeVisibilityButton.css";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
import visibilityHideSvg from "@itwin/itwinui-icons/visibility-hide.svg";
|
|
7
|
+
import visibilityPartialSvg from "@itwin/itwinui-icons/visibility-partial.svg";
|
|
8
|
+
import visibilityShowSvg from "@itwin/itwinui-icons/visibility-show.svg";
|
|
9
9
|
/** @internal */
|
|
10
10
|
export function createVisibilityAction({ getVisibilityButtonState, onVisibilityButtonClick, }) {
|
|
11
11
|
return (node) => {
|
|
@@ -13,11 +13,11 @@ export function createVisibilityAction({ getVisibilityButtonState, onVisibilityB
|
|
|
13
13
|
const getIcon = () => {
|
|
14
14
|
switch (state.state) {
|
|
15
15
|
case "visible":
|
|
16
|
-
return
|
|
16
|
+
return visibilityShowSvg;
|
|
17
17
|
case "hidden":
|
|
18
|
-
return
|
|
18
|
+
return visibilityHideSvg;
|
|
19
19
|
case "partial":
|
|
20
|
-
return
|
|
20
|
+
return visibilityPartialSvg;
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
23
|
return {
|
package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeVisibilityButton.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"TreeNodeVisibilityButton.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.tsx"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,gCAAgC,CAAC;AACxC,OAAO,iBAAiB,MAAM,0CAA0C,CAAC;AACzE,OAAO,oBAAoB,MAAM,6CAA6C,CAAC;AAC/E,OAAO,iBAAiB,MAAM,0CAA0C,CAAC;AAsBzE,gBAAgB;AAChB,MAAM,UAAU,sBAAsB,CAAC,EACrC,wBAAwB,EACxB,uBAAuB,GACO;IAC9B,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,KAAK,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAE7C,MAAM,OAAO,GAAG,GAAG,EAAE;YACnB,QAAQ,KAAK,CAAC,KAAK,EAAE;gBACnB,KAAK,SAAS;oBACZ,OAAO,iBAAiB,CAAC;gBAC3B,KAAK,QAAQ;oBACX,OAAO,iBAAiB,CAAC;gBAC3B,KAAK,SAAS;oBACZ,OAAO,oBAAoB,CAAC;aAC/B;QACH,CAAC,CAAC;QACF,OAAO;YACL,KAAK,EAAE,KAAK,CAAC,OAAO,IAAI,2BAA2B;YACnD,MAAM,EAAE,GAAG,EAAE;gBACX,uBAAuB,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;YAC7C,CAAC;YACD,IAAI,EAAE,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;YAClD,IAAI,EAAE,OAAO,EAAE;SAChB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport \"./TreeNodeVisibilityButton.css\";\nimport visibilityHideSvg from \"@itwin/itwinui-icons/visibility-hide.svg\";\nimport visibilityPartialSvg from \"@itwin/itwinui-icons/visibility-partial.svg\";\nimport visibilityShowSvg from \"@itwin/itwinui-icons/visibility-show.svg\";\n\nimport type { PresentationHierarchyNode, TreeItemAction } from \"@itwin/presentation-hierarchies-react\";\n\n/**\n * Data structure that describes tree node checkbox state.\n * @beta\n */\ninterface TreeItemVisibilityButtonState {\n state: \"visible\" | \"partial\" | \"hidden\";\n isDisabled?: boolean;\n tooltip?: string;\n}\n\n/** @beta */\nexport interface TreeItemVisibilityButtonProps {\n /** Callback that should be invoked when checkbox is clicked. */\n onVisibilityButtonClick: (node: PresentationHierarchyNode, state: TreeItemVisibilityButtonState[\"state\"]) => void;\n /** Callback that should be used to determine current checkbox state. */\n getVisibilityButtonState: (node: PresentationHierarchyNode) => TreeItemVisibilityButtonState;\n}\n\n/** @internal */\nexport function createVisibilityAction({\n getVisibilityButtonState,\n onVisibilityButtonClick,\n}: TreeItemVisibilityButtonProps): (node: PresentationHierarchyNode) => TreeItemAction {\n return (node) => {\n const state = getVisibilityButtonState(node);\n\n const getIcon = () => {\n switch (state.state) {\n case \"visible\":\n return visibilityShowSvg;\n case \"hidden\":\n return visibilityHideSvg;\n case \"partial\":\n return visibilityPartialSvg;\n }\n };\n return {\n label: state.tooltip ?? \"Determining visibility...\",\n action: () => {\n onVisibilityButtonClick(node, state.state);\n },\n show: state.state !== \"visible\" ? true : undefined,\n icon: getIcon(),\n };\n };\n}\n"]}
|
|
@@ -4,13 +4,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
/* eslint-disable @itwin/no-internal */
|
|
7
|
-
import {
|
|
7
|
+
import { useFilterAction } from "@itwin/presentation-hierarchies-react";
|
|
8
8
|
import { BaseTreeRenderer } from "./BaseTreeRenderer.js";
|
|
9
9
|
/**
|
|
10
10
|
* Default renderer for rendering tree data.
|
|
11
11
|
* @beta
|
|
12
12
|
*/
|
|
13
13
|
export function TreeRenderer({ actions, ...props }) {
|
|
14
|
-
|
|
14
|
+
const filterAction = useFilterAction({ onFilter: props.onFilterClick, getHierarchyLevelDetails: props.getHierarchyLevelDetails });
|
|
15
|
+
return _jsx(BaseTreeRenderer, { ...props, actions: [filterAction, ...(actions ? actions : [])] });
|
|
15
16
|
}
|
|
16
17
|
//# sourceMappingURL=TreeRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,uCAAuC;AAEvC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,uCAAuC;AAEvC,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAIzD;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,KAAK,EAAyB;IACvE,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,wBAAwB,EAAE,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAClI,OAAO,KAAC,gBAAgB,OAAK,KAAK,EAAE,OAAO,EAAE,CAAC,YAAY,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAAI,CAAC;AAC/F,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/* eslint-disable @itwin/no-internal */\n\nimport { useFilterAction } from \"@itwin/presentation-hierarchies-react\";\nimport { BaseTreeRenderer } from \"./BaseTreeRenderer.js\";\n\nimport type { BaseTreeRendererProps } from \"./BaseTreeRenderer.js\";\n\n/**\n * Default renderer for rendering tree data.\n * @beta\n */\nexport function TreeRenderer({ actions, ...props }: BaseTreeRendererProps) {\n const filterAction = useFilterAction({ onFilter: props.onFilterClick, getHierarchyLevelDetails: props.getHierarchyLevelDetails });\n return <BaseTreeRenderer {...props} actions={[filterAction, ...(actions ? actions : [])]} />;\n}\n"]}
|
package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js
CHANGED
|
@@ -5,7 +5,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
6
|
/* eslint-disable @itwin/no-internal */
|
|
7
7
|
import { useMemo } from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { useFilterAction } from "@itwin/presentation-hierarchies-react";
|
|
9
9
|
import { BaseTreeRenderer } from "./BaseTreeRenderer.js";
|
|
10
10
|
import { createVisibilityAction } from "./TreeNodeVisibilityButton.js";
|
|
11
11
|
import { useVisibilityButtonHandler } from "./UseVisibilityButtonHandler.js";
|
|
@@ -20,10 +20,7 @@ export function VisibilityTreeRenderer({ getVisibilityButtonState, onVisibilityB
|
|
|
20
20
|
getVisibilityButtonState,
|
|
21
21
|
onVisibilityButtonClick,
|
|
22
22
|
}), [getVisibilityButtonState, onVisibilityButtonClick]);
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
createFilterAction({ onFilter: props.onFilterClick, getHierarchyLevelDetails: props.getHierarchyLevelDetails }),
|
|
26
|
-
...(actions ? actions : []),
|
|
27
|
-
] }));
|
|
23
|
+
const filterAction = useFilterAction({ onFilter: props.onFilterClick, getHierarchyLevelDetails: props.getHierarchyLevelDetails });
|
|
24
|
+
return (_jsx(BaseTreeRenderer, { ...props, actions: [...(visibilityButtonProps ? [createVisibilityAction(visibilityButtonProps)] : []), filterAction, ...(actions ? actions : [])] }));
|
|
28
25
|
}
|
|
29
26
|
//# sourceMappingURL=VisibilityTreeRenderer.js.map
|
package/lib/esm/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisibilityTreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,uCAAuC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"VisibilityTreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/VisibilityTreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAChG,uCAAuC;AAEvC,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,uCAAuC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAO7E;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CAAC,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,KAAK,EAA+B;IACnJ,MAAM,EAAE,uBAAuB,EAAE,GAAG,0BAA0B,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,cAAc,EAAE,KAAK,CAAC,cAAc,EAAE,OAAO,EAAE,CAAC,CAAC;IAC9I,MAAM,qBAAqB,GAAkC,OAAO,CAClE,GAAG,EAAE,CAAC,CAAC;QACL,OAAO,EAAE,SAAS;QAClB,wBAAwB;QACxB,uBAAuB;KACxB,CAAC,EACF,CAAC,wBAAwB,EAAE,uBAAuB,CAAC,CACpD,CAAC;IAEF,MAAM,YAAY,GAAG,eAAe,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,aAAa,EAAE,wBAAwB,EAAE,KAAK,CAAC,wBAAwB,EAAE,CAAC,CAAC;IAElI,OAAO,CACL,KAAC,gBAAgB,OACX,KAAK,EACT,OAAO,EAAE,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,YAAY,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GACvI,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 *--------------------------------------------------------------------------------------------*/\n/* eslint-disable @itwin/no-internal */\n\nimport { useMemo } from \"react\";\nimport { useFilterAction } from \"@itwin/presentation-hierarchies-react\";\nimport { BaseTreeRenderer } from \"./BaseTreeRenderer.js\";\nimport { createVisibilityAction } from \"./TreeNodeVisibilityButton.js\";\nimport { useVisibilityButtonHandler } from \"./UseVisibilityButtonHandler.js\";\n\nimport type { BaseTreeRendererProps } from \"./BaseTreeRenderer.js\";\nimport type { TreeItemVisibilityButtonProps } from \"./TreeNodeVisibilityButton.js\";\n/** @beta */\nexport type VisibilityTreeRendererProps = BaseTreeRendererProps & TreeItemVisibilityButtonProps;\n\n/**\n * Tree renderer that renders tree nodes with eye checkboxes for controlling visibility of instances represented by tree nodes.\n * @beta\n */\nexport function VisibilityTreeRenderer({ getVisibilityButtonState, onVisibilityButtonClick: onClick, actions, ...props }: VisibilityTreeRendererProps) {\n const { onVisibilityButtonClick } = useVisibilityButtonHandler({ rootNodes: props.rootNodes, isNodeSelected: props.isNodeSelected, onClick });\n const visibilityButtonProps: TreeItemVisibilityButtonProps = useMemo(\n () => ({\n variant: \"eyeball\",\n getVisibilityButtonState,\n onVisibilityButtonClick,\n }),\n [getVisibilityButtonState, onVisibilityButtonClick],\n );\n\n const filterAction = useFilterAction({ onFilter: props.onFilterClick, getHierarchyLevelDetails: props.getHierarchyLevelDetails });\n\n return (\n <BaseTreeRenderer\n {...props}\n actions={[...(visibilityButtonProps ? [createVisibilityAction(visibilityButtonProps)] : []), filterAction, ...(actions ? actions : [])]}\n />\n );\n}\n"]}
|
package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js
CHANGED
|
@@ -3,35 +3,35 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import
|
|
6
|
+
import classSvg from "@itwin/itwinui-icons/bis-class.svg";
|
|
7
|
+
import elementSvg from "@itwin/itwinui-icons/bis-element.svg";
|
|
8
|
+
import documentSvg from "@itwin/itwinui-icons/document.svg";
|
|
9
|
+
import ecSchemaSvg from "@itwin/itwinui-icons/selection-children.svg";
|
|
10
|
+
import { EmptyTreeContent } from "../common/components/EmptyTree.js";
|
|
7
11
|
import { Tree } from "../common/components/Tree.js";
|
|
8
12
|
import { TreeRenderer } from "../common/components/TreeRenderer.js";
|
|
9
13
|
import { ExternalSourcesTreeComponent } from "./ExternalSourcesTreeComponent.js";
|
|
10
14
|
import { ExternalSourcesTreeDefinition } from "./ExternalSourcesTreeDefinition.js";
|
|
11
15
|
/** @beta */
|
|
12
16
|
export function ExternalSourcesTree(props) {
|
|
13
|
-
return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon:
|
|
17
|
+
return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: documentSvg }), ...props, treeName: ExternalSourcesTreeComponent.id, getHierarchyDefinition: getDefinitionsProvider, selectionMode: props.selectionMode ?? "none", treeRenderer: (treeProps) => _jsx(TreeRenderer, { ...treeProps, getIcon: getIcon }) }));
|
|
14
18
|
}
|
|
15
19
|
const getDefinitionsProvider = (props) => {
|
|
16
20
|
return new ExternalSourcesTreeDefinition(props);
|
|
17
21
|
};
|
|
18
|
-
const ecSchemaIcon = new URL("@itwin/itwinui-icons/selection-children.svg", import.meta.url).href;
|
|
19
|
-
const elementIcon = new URL("@itwin/itwinui-icons/bis-element.svg", import.meta.url).href;
|
|
20
|
-
const documentIcon = new URL("@itwin/itwinui-icons/document.svg", import.meta.url).href;
|
|
21
|
-
const classIcon = new URL("@itwin/itwinui-icons/bis-class.svg", import.meta.url).href;
|
|
22
22
|
function getIcon(node) {
|
|
23
23
|
if (node.extendedData?.imageId === undefined) {
|
|
24
24
|
return undefined;
|
|
25
25
|
}
|
|
26
26
|
switch (node.extendedData.imageId) {
|
|
27
27
|
case "icon-item":
|
|
28
|
-
return
|
|
28
|
+
return elementSvg;
|
|
29
29
|
case "icon-ec-class":
|
|
30
|
-
return
|
|
30
|
+
return classSvg;
|
|
31
31
|
case "icon-document":
|
|
32
|
-
return
|
|
32
|
+
return documentSvg;
|
|
33
33
|
case "icon-ec-schema":
|
|
34
|
-
return
|
|
34
|
+
return ecSchemaSvg;
|
|
35
35
|
}
|
|
36
36
|
return undefined;
|
|
37
37
|
}
|
package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;
|
|
1
|
+
{"version":3,"file":"ExternalSourcesTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,QAAQ,MAAM,oCAAoC,CAAC;AAC1D,OAAO,UAAU,MAAM,sCAAsC,CAAC;AAC9D,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ACnB,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 classSvg from \"@itwin/itwinui-icons/bis-class.svg\";\nimport elementSvg from \"@itwin/itwinui-icons/bis-element.svg\";\nimport documentSvg from \"@itwin/itwinui-icons/document.svg\";\nimport ecSchemaSvg from \"@itwin/itwinui-icons/selection-children.svg\";\nimport { EmptyTreeContent } from \"../common/components/EmptyTree.js\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { ExternalSourcesTreeComponent } from \"./ExternalSourcesTreeComponent.js\";\nimport { ExternalSourcesTreeDefinition } from \"./ExternalSourcesTreeDefinition.js\";\n\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { BaseTreeRendererProps } from \"../common/components/BaseTreeRenderer.js\";\nimport type { TreeProps } from \"../common/components/Tree.js\";\n/** @beta */\nexport type ExternalSourcesTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<BaseTreeRendererProps, \"actions\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function ExternalSourcesTree(props: ExternalSourcesTreeProps) {\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={documentSvg} />}\n {...props}\n treeName={ExternalSourcesTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={props.selectionMode ?? \"none\"}\n treeRenderer={(treeProps) => <TreeRenderer {...treeProps} getIcon={getIcon} />}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = (props) => {\n return new ExternalSourcesTreeDefinition(props);\n};\n\nfunction getIcon(node: PresentationHierarchyNode): string | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-item\":\n return elementSvg;\n case \"icon-ec-class\":\n return classSvg;\n case \"icon-document\":\n return documentSvg;\n case \"icon-ec-schema\":\n return ecSchemaSvg;\n }\n\n return undefined;\n}\n"]}
|
|
@@ -3,7 +3,14 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
4
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import
|
|
6
|
+
import categorySvg from "@itwin/itwinui-icons/bis-category-3d.svg";
|
|
7
|
+
import classSvg from "@itwin/itwinui-icons/bis-class.svg";
|
|
8
|
+
import elementSvg from "@itwin/itwinui-icons/bis-element.svg";
|
|
9
|
+
import subjectSvg from "@itwin/itwinui-icons/bis-subject.svg";
|
|
10
|
+
import groupSvg from "@itwin/itwinui-icons/group.svg";
|
|
11
|
+
import modelSvg from "@itwin/itwinui-icons/model-cube.svg";
|
|
12
|
+
import hierarchyTreeSvg from "@itwin/itwinui-icons/selection-children.svg";
|
|
13
|
+
import { EmptyTreeContent } from "../common/components/EmptyTree.js";
|
|
7
14
|
import { Tree } from "../common/components/Tree.js";
|
|
8
15
|
import { TreeRenderer } from "../common/components/TreeRenderer.js";
|
|
9
16
|
import { IModelContentTreeComponent } from "./IModelContentTreeComponent.js";
|
|
@@ -11,7 +18,7 @@ import { IModelContentTreeDefinition } from "./IModelContentTreeDefinition.js";
|
|
|
11
18
|
import { IModelContentTreeIdsCache } from "./internal/IModelContentTreeIdsCache.js";
|
|
12
19
|
/** @beta */
|
|
13
20
|
export function IModelContentTree(props) {
|
|
14
|
-
return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon:
|
|
21
|
+
return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: modelSvg }), ...props, treeName: IModelContentTreeComponent.id, getHierarchyDefinition: getDefinitionsProvider, selectionMode: props.selectionMode ?? "extended", treeRenderer: (treeProps) => _jsx(TreeRenderer, { ...treeProps, getIcon: getIcon }) }));
|
|
15
22
|
}
|
|
16
23
|
const getDefinitionsProvider = ({ imodelAccess }) => {
|
|
17
24
|
return new IModelContentTreeDefinition({
|
|
@@ -19,32 +26,25 @@ const getDefinitionsProvider = ({ imodelAccess }) => {
|
|
|
19
26
|
idsCache: new IModelContentTreeIdsCache(imodelAccess),
|
|
20
27
|
});
|
|
21
28
|
};
|
|
22
|
-
const subjectIcon = new URL("@itwin/itwinui-icons/bis-subject.svg", import.meta.url).href;
|
|
23
|
-
const classIcon = new URL("@itwin/itwinui-icons/bis-class.svg", import.meta.url).href;
|
|
24
|
-
const modelIcon = new URL("@itwin/itwinui-icons/model-cube.svg", import.meta.url).href;
|
|
25
|
-
const categoryIcon = new URL("@itwin/itwinui-icons/bis-category-3d.svg", import.meta.url).href;
|
|
26
|
-
const elementIcon = new URL("@itwin/itwinui-icons/bis-element.svg", import.meta.url).href;
|
|
27
|
-
const hierarchyTreeIcon = new URL("@itwin/itwinui-icons/selection-children.svg", import.meta.url).href;
|
|
28
|
-
const groupIcon = new URL("@itwin/itwinui-icons/group.svg", import.meta.url).href;
|
|
29
29
|
function getIcon(node) {
|
|
30
30
|
if (node.extendedData?.imageId === undefined) {
|
|
31
31
|
return undefined;
|
|
32
32
|
}
|
|
33
33
|
switch (node.extendedData.imageId) {
|
|
34
34
|
case "icon-layers":
|
|
35
|
-
return
|
|
35
|
+
return categorySvg;
|
|
36
36
|
case "icon-item":
|
|
37
|
-
return
|
|
37
|
+
return elementSvg;
|
|
38
38
|
case "icon-ec-class":
|
|
39
|
-
return
|
|
39
|
+
return classSvg;
|
|
40
40
|
case "icon-folder":
|
|
41
|
-
return
|
|
41
|
+
return subjectSvg;
|
|
42
42
|
case "icon-model":
|
|
43
|
-
return
|
|
43
|
+
return modelSvg;
|
|
44
44
|
case "icon-hierarchy-tree":
|
|
45
|
-
return
|
|
45
|
+
return hierarchyTreeSvg;
|
|
46
46
|
case "icon-group":
|
|
47
|
-
return
|
|
47
|
+
return groupSvg;
|
|
48
48
|
}
|
|
49
49
|
return undefined;
|
|
50
50
|
}
|
package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;
|
|
1
|
+
{"version":3,"file":"IModelContentTree.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,WAAW,MAAM,0CAA0C,CAAC;AACnE,OAAO,QAAQ,MAAM,oCAAoC,CAAC;AAC1D,OAAO,UAAU,MAAM,sCAAsC,CAAC;AAC9D,OAAO,UAAU,MAAM,sCAAsC,CAAC;AAC9D,OAAO,QAAQ,MAAM,gCAAgC,CAAC;AACtD,OAAO,QAAQ,MAAM,qCAAqC,CAAC;AAC3D,OAAO,gBAAgB,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACpE,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAapF,YAAY;AACZ,MAAM,UAAU,iBAAiB,CAAC,KAA6B;IAC7D,OAAO,CACL,KAAC,IAAI,IACH,gBAAgB,EAAE,KAAC,gBAAgB,IAAC,IAAI,EAAE,QAAQ,GAAI,KAClD,KAAK,EACT,QAAQ,EAAE,0BAA0B,CAAC,EAAE,EACvC,sBAAsB,EAAE,sBAAsB,EAC9C,aAAa,EAAE,KAAK,CAAC,aAAa,IAAI,UAAU,EAChD,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,KAAC,YAAY,OAAK,SAAS,EAAE,OAAO,EAAE,OAAO,GAAI,GAC9E,CACH,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAAwC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;IACvF,OAAO,IAAI,2BAA2B,CAAC;QACrC,YAAY;QACZ,QAAQ,EAAE,IAAI,yBAAyB,CAAC,YAAY,CAAC;KACtD,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,SAAS,OAAO,CAAC,IAA+B;IAC9C,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IAED,QAAQ,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;QACjC,KAAK,aAAa;YAChB,OAAO,WAAW,CAAC;QACrB,KAAK,WAAW;YACd,OAAO,UAAU,CAAC;QACpB,KAAK,eAAe;YAClB,OAAO,QAAQ,CAAC;QAClB,KAAK,aAAa;YAChB,OAAO,UAAU,CAAC;QACpB,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC;QAClB,KAAK,qBAAqB;YACxB,OAAO,gBAAgB,CAAC;QAC1B,KAAK,YAAY;YACf,OAAO,QAAQ,CAAC;KACnB;IAED,OAAO,SAAS,CAAC;AACnB,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 categorySvg from \"@itwin/itwinui-icons/bis-category-3d.svg\";\nimport classSvg from \"@itwin/itwinui-icons/bis-class.svg\";\nimport elementSvg from \"@itwin/itwinui-icons/bis-element.svg\";\nimport subjectSvg from \"@itwin/itwinui-icons/bis-subject.svg\";\nimport groupSvg from \"@itwin/itwinui-icons/group.svg\";\nimport modelSvg from \"@itwin/itwinui-icons/model-cube.svg\";\nimport hierarchyTreeSvg from \"@itwin/itwinui-icons/selection-children.svg\";\nimport { EmptyTreeContent } from \"../common/components/EmptyTree.js\";\nimport { Tree } from \"../common/components/Tree.js\";\nimport { TreeRenderer } from \"../common/components/TreeRenderer.js\";\nimport { IModelContentTreeComponent } from \"./IModelContentTreeComponent.js\";\nimport { IModelContentTreeDefinition } from \"./IModelContentTreeDefinition.js\";\nimport { IModelContentTreeIdsCache } from \"./internal/IModelContentTreeIdsCache.js\";\n\nimport type { PresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { BaseTreeRendererProps } from \"../common/components/BaseTreeRenderer.js\";\nimport type { TreeProps } from \"../common/components/Tree.js\";\n/** @beta */\nexport type IModelContentTreeProps = Pick<TreeProps, \"imodel\" | \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"emptyTreeContent\"> &\n Pick<BaseTreeRendererProps, \"actions\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function IModelContentTree(props: IModelContentTreeProps) {\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={modelSvg} />}\n {...props}\n treeName={IModelContentTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={props.selectionMode ?? \"extended\"}\n treeRenderer={(treeProps) => <TreeRenderer {...treeProps} getIcon={getIcon} />}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = ({ imodelAccess }) => {\n return new IModelContentTreeDefinition({\n imodelAccess,\n idsCache: new IModelContentTreeIdsCache(imodelAccess),\n });\n};\n\nfunction getIcon(node: PresentationHierarchyNode): string | undefined {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n switch (node.extendedData.imageId) {\n case \"icon-layers\":\n return categorySvg;\n case \"icon-item\":\n return elementSvg;\n case \"icon-ec-class\":\n return classSvg;\n case \"icon-folder\":\n return subjectSvg;\n case \"icon-model\":\n return modelSvg;\n case \"icon-hierarchy-tree\":\n return hierarchyTreeSvg;\n case \"icon-group\":\n return groupSvg;\n }\n\n return undefined;\n}\n"]}
|
|
@@ -7,6 +7,7 @@ export { useCategoriesTree } from "./categories-tree/UseCategoriesTree.js";
|
|
|
7
7
|
export { useModelsTreeButtonProps } from "./models-tree/ModelsTreeButtons.js";
|
|
8
8
|
export { useCategoriesTreeButtonProps } from "./categories-tree/CategoriesTreeButtons.js";
|
|
9
9
|
export { BaseTreeRendererProps } from "./common/components/BaseTreeRenderer.js";
|
|
10
|
+
export { FocusedInstancesContextProvider, useFocusedInstancesContext } from "./common/FocusedInstancesContext.js";
|
|
10
11
|
export { Tree } from "./common/components/Tree.js";
|
|
11
12
|
export { VisibilityTree } from "./common/components/VisibilityTree.js";
|
|
12
13
|
export { TreeRenderer } from "./common/components/TreeRenderer.js";
|
|
@@ -10,6 +10,7 @@ export { useModelsTree } from "./models-tree/UseModelsTree.js";
|
|
|
10
10
|
export { useCategoriesTree } from "./categories-tree/UseCategoriesTree.js";
|
|
11
11
|
export { useModelsTreeButtonProps } from "./models-tree/ModelsTreeButtons.js";
|
|
12
12
|
export { useCategoriesTreeButtonProps } from "./categories-tree/CategoriesTreeButtons.js";
|
|
13
|
+
export { FocusedInstancesContextProvider, useFocusedInstancesContext } from "./common/FocusedInstancesContext.js";
|
|
13
14
|
export { Tree } from "./common/components/Tree.js";
|
|
14
15
|
export { VisibilityTree } from "./common/components/VisibilityTree.js";
|
|
15
16
|
export { TreeRenderer } from "./common/components/TreeRenderer.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tree-widget-react/components/trees/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AAEvG,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAG1F,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,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\nexport { ModelsTreeComponent } from \"./models-tree/ModelsTreeComponent.js\";\nexport { CategoriesTreeComponent } from \"./categories-tree/CategoriesTreeComponent.js\";\nexport { IModelContentTreeComponent } from \"./imodel-content-tree/IModelContentTreeComponent.js\";\nexport { ExternalSourcesTreeComponent } from \"./external-sources-tree/ExternalSourcesTreeComponent.js\";\n\nexport { useModelsTree } from \"./models-tree/UseModelsTree.js\";\nexport { useCategoriesTree } from \"./categories-tree/UseCategoriesTree.js\";\n\nexport { useModelsTreeButtonProps } from \"./models-tree/ModelsTreeButtons.js\";\nexport { useCategoriesTreeButtonProps } from \"./categories-tree/CategoriesTreeButtons.js\";\n\nexport { BaseTreeRendererProps } from \"./common/components/BaseTreeRenderer.js\";\nexport { Tree } from \"./common/components/Tree.js\";\nexport { VisibilityTree } from \"./common/components/VisibilityTree.js\";\nexport { TreeRenderer } from \"./common/components/TreeRenderer.js\";\nexport { VisibilityTreeRenderer } from \"./common/components/VisibilityTreeRenderer.js\";\nexport { HierarchyVisibilityHandler, VisibilityStatus } from \"./common/UseHierarchyVisibility.js\";\nexport { TelemetryContextProvider } from \"./common/UseTelemetryContext.js\";\nexport { FilterLimitExceededError } from \"./common/TreeErrors.js\";\n\nexport { ModelsTreeVisibilityHandlerOverrides } from \"./models-tree/internal/ModelsTreeVisibilityHandler.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/tree-widget-react/components/trees/index.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,8CAA8C,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AAEvG,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,MAAM,4CAA4C,CAAC;AAG1F,OAAO,EAAE,+BAA+B,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAElH,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AAEvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,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\nexport { ModelsTreeComponent } from \"./models-tree/ModelsTreeComponent.js\";\nexport { CategoriesTreeComponent } from \"./categories-tree/CategoriesTreeComponent.js\";\nexport { IModelContentTreeComponent } from \"./imodel-content-tree/IModelContentTreeComponent.js\";\nexport { ExternalSourcesTreeComponent } from \"./external-sources-tree/ExternalSourcesTreeComponent.js\";\n\nexport { useModelsTree } from \"./models-tree/UseModelsTree.js\";\nexport { useCategoriesTree } from \"./categories-tree/UseCategoriesTree.js\";\n\nexport { useModelsTreeButtonProps } from \"./models-tree/ModelsTreeButtons.js\";\nexport { useCategoriesTreeButtonProps } from \"./categories-tree/CategoriesTreeButtons.js\";\n\nexport { BaseTreeRendererProps } from \"./common/components/BaseTreeRenderer.js\";\nexport { FocusedInstancesContextProvider, useFocusedInstancesContext } from \"./common/FocusedInstancesContext.js\";\n\nexport { Tree } from \"./common/components/Tree.js\";\nexport { VisibilityTree } from \"./common/components/VisibilityTree.js\";\nexport { TreeRenderer } from \"./common/components/TreeRenderer.js\";\nexport { VisibilityTreeRenderer } from \"./common/components/VisibilityTreeRenderer.js\";\nexport { HierarchyVisibilityHandler, VisibilityStatus } from \"./common/UseHierarchyVisibility.js\";\nexport { TelemetryContextProvider } from \"./common/UseTelemetryContext.js\";\nexport { FilterLimitExceededError } from \"./common/TreeErrors.js\";\n\nexport { ModelsTreeVisibilityHandlerOverrides } from \"./models-tree/internal/ModelsTreeVisibilityHandler.js\";\n"]}
|