@itwin/tree-widget-react 4.0.0-alpha.4 → 4.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js +1 -1
- package/lib/esm/tree-widget-react/components/TreeWidgetUiItemsProvider.js.map +1 -1
- package/lib/esm/tree-widget-react/components/tree-header/ErrorState.js +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 +2 -2
- 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 +0 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js +3 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js +3 -3
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.d.ts +13 -0
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js +59 -41
- package/lib/esm/tree-widget-react/components/trees/categories-tree/CategoriesTreeDefinition.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.d.ts +9 -2
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js +44 -25
- package/lib/esm/tree-widget-react/components/trees/categories-tree/UseCategoriesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/EmptyTree.css +25 -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/ProgressOverlay.js +3 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/ProgressOverlay.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.css +16 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.d.ts +4 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js +16 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/SkeletonTree.js.map +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.css +10 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.d.ts +1 -0
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +7 -6
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeVisibilityButton.js +3 -3
- 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.d.ts +7 -2
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js +25 -19
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts +7 -2
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js +34 -28
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/index.d.ts +4 -2
- package/lib/esm/tree-widget-react/components/trees/index.js +4 -2
- package/lib/esm/tree-widget-react/components/trees/index.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.d.ts +2 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js +2 -2
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTree.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js +6 -6
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeButtons.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.d.ts +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/ModelsTreeComponent.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.d.ts +5 -1
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js +37 -42
- package/lib/esm/tree-widget-react/components/trees/models-tree/UseModelsTree.js.map +1 -1
- package/lib/public/locales/en/TreeWidget.json +15 -6
- package/package.json +4 -4
- 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
|
@@ -1,11 +1,11 @@
|
|
|
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.
|
|
5
5
|
*--------------------------------------------------------------------------------------------*/
|
|
6
|
+
import "./Tree.css";
|
|
6
7
|
import { useCallback, useMemo, useState } from "react";
|
|
7
8
|
import { BeEvent } from "@itwin/core-bentley";
|
|
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
11
|
import { useHierarchiesLocalization } from "../UseHierarchiesLocalization.js";
|
|
@@ -15,8 +15,9 @@ import { useNodeHighlighting } from "../UseNodeHighlighting.js";
|
|
|
15
15
|
import { useReportingAction, useTelemetryContext } from "../UseTelemetryContext.js";
|
|
16
16
|
import { createIModelAccess } from "../Utils.js";
|
|
17
17
|
import { Delayed } from "./Delayed.js";
|
|
18
|
-
import { EmptyTreeContent } from "./
|
|
18
|
+
import { EmptyTreeContent } from "./EmptyTree.js";
|
|
19
19
|
import { ProgressOverlay } from "./ProgressOverlay.js";
|
|
20
|
+
import { SkeletonTree } from "./SkeletonTree.js";
|
|
20
21
|
/**
|
|
21
22
|
* Default tree component that manages tree state and renders using supplied `treeRenderer`.
|
|
22
23
|
* @beta
|
|
@@ -67,10 +68,10 @@ function TreeImpl({ imodel, imodelAccess, treeName, emptyTreeContent, getFiltere
|
|
|
67
68
|
const reportingOnFilterClicked = useReportingAction({ action: onFilterClick });
|
|
68
69
|
const { getLabel } = useNodeHighlighting({ rootNodes, highlight });
|
|
69
70
|
if (rootNodes === undefined) {
|
|
70
|
-
return
|
|
71
|
+
return _jsx(SkeletonTree, {});
|
|
71
72
|
}
|
|
72
73
|
if (rootNodes.length === 0 && !isLoading) {
|
|
73
|
-
return
|
|
74
|
+
return _jsx(_Fragment, { children: emptyTreeContent ? emptyTreeContent : _jsx(EmptyTreeContent, {}) });
|
|
74
75
|
}
|
|
75
76
|
const treeRendererProps = {
|
|
76
77
|
...treeProps,
|
|
@@ -81,7 +82,7 @@ function TreeImpl({ imodel, imodelAccess, treeName, emptyTreeContent, getFiltere
|
|
|
81
82
|
onFilterClick: reportingOnFilterClicked,
|
|
82
83
|
getLabel,
|
|
83
84
|
};
|
|
84
|
-
return (_jsxs("div", { style: { position: "relative", height: "100%", overflow: "hidden" }, children: [_jsxs("div", {
|
|
85
|
+
return (_jsxs("div", { style: { position: "relative", height: "100%", overflow: "hidden" }, children: [_jsxs("div", { className: "tw-tree-renderer-container", id: "tw-tree-renderer-container", children: [treeRenderer(treeRendererProps), filteringDialog] }), _jsx(Delayed, { show: isLoading, children: _jsx(ProgressOverlay, {}) })] }));
|
|
85
86
|
}
|
|
86
87
|
function useSelectionPredicate({ action, predicate, getNode, }) {
|
|
87
88
|
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,0BAA0B,EAAE,MAAM,k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,GACvD,CACP,CAAC;KACH;IAED,MAAM,iBAAiB,GAA6C;QAClE,GAAG,SAAS;QACZ,SAAS;QACT,aAAa,EAAE,aAAa,IAAI,QAAQ;QACxC,WAAW;QACX,UAAU,EAAE,mBAAmB;QAC/B,aAAa,EAAE,wBAAwB;QACvC,QAAQ;KACT,CAAC;IAEF,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aACtE,eAAK,EAAE,EAAC,4BAA4B,EAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAC7E,YAAY,CAAC,iBAAiB,CAAC,EAC/B,eAAe,IACZ,EACN,KAAC,OAAO,IAAC,IAAI,EAAE,SAAS,YACtB,KAAC,eAAe,KAAG,GACX,IACN,CACP,CAAC;AACJ,CAAC;AAED,SAAS,qBAAqB,CAAC,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 { 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 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 (\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 <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"]}
|
|
1
|
+
{"version":3,"file":"Tree.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/Tree.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,YAAY,CAAC;AACpB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,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,OA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B,CAAC,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 \"./Tree.css\";\nimport { useCallback, useMemo, useState } from \"react\";\nimport { BeEvent } from \"@itwin/core-bentley\";\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\";\nimport { SkeletonTree } from \"./SkeletonTree.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 <SkeletonTree />;\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 className={\"tw-tree-renderer-container\"} id=\"tw-tree-renderer-container\">\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.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
|
+
const visibilityHideSvg = new URL("@itwin/itwinui-icons/visibility-hide.svg", import.meta.url).href;
|
|
7
|
+
const visibilityPartialSvg = new URL("@itwin/itwinui-icons/visibility-partial.svg", import.meta.url).href;
|
|
8
|
+
const visibilityShowSvg = new URL("@itwin/itwinui-icons/visibility-show.svg", import.meta.url).href;
|
|
9
9
|
/** @internal */
|
|
10
10
|
export function createVisibilityAction({ getVisibilityButtonState, onVisibilityButtonClick, }) {
|
|
11
11
|
return (node) => {
|
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;AAsBxC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACpG,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAC,6CAA6C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAC1G,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,0CAA0C,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAEpG,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\";\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\nconst visibilityHideSvg = new URL(\"@itwin/itwinui-icons/visibility-hide.svg\", import.meta.url).href;\nconst visibilityPartialSvg = new URL(\"@itwin/itwinui-icons/visibility-partial.svg\", import.meta.url).href;\nconst visibilityShowSvg = new URL(\"@itwin/itwinui-icons/visibility-show.svg\", import.meta.url).href;\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.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import type { PresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
|
|
1
2
|
import type { BaseTreeRendererProps } from "../common/components/BaseTreeRenderer.js";
|
|
2
3
|
import type { TreeProps } from "../common/components/Tree.js";
|
|
3
4
|
/** @beta */
|
|
4
|
-
export type ExternalSourcesTreeProps = Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<BaseTreeRendererProps, "actions"> & {
|
|
5
|
+
export type ExternalSourcesTreeProps = Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<BaseTreeRendererProps, "actions" | "getDecorations"> & {
|
|
5
6
|
hierarchyLevelConfig?: {
|
|
6
7
|
sizeLimit?: number;
|
|
7
8
|
};
|
|
8
9
|
};
|
|
9
10
|
/** @beta */
|
|
10
|
-
export declare function ExternalSourcesTree(
|
|
11
|
+
export declare function ExternalSourcesTree({ actions, getDecorations, selectionMode, ...rest }: ExternalSourcesTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/** @beta */
|
|
13
|
+
export declare function ExternalSourcesTreeIcon({ node }: {
|
|
14
|
+
node: PresentationHierarchyNode;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element | undefined;
|
|
11
16
|
//# sourceMappingURL=ExternalSourcesTree.d.ts.map
|
package/lib/esm/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTree.js
CHANGED
|
@@ -3,36 +3,42 @@ 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
|
|
7
|
-
import
|
|
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/EmptyTreeContent.js";
|
|
6
|
+
import { Icon } from "@itwin/itwinui-react/bricks";
|
|
7
|
+
import { EmptyTreeContent } from "../common/components/EmptyTree.js";
|
|
11
8
|
import { Tree } from "../common/components/Tree.js";
|
|
12
9
|
import { TreeRenderer } from "../common/components/TreeRenderer.js";
|
|
13
10
|
import { ExternalSourcesTreeComponent } from "./ExternalSourcesTreeComponent.js";
|
|
14
11
|
import { ExternalSourcesTreeDefinition } from "./ExternalSourcesTreeDefinition.js";
|
|
15
12
|
/** @beta */
|
|
16
|
-
export function ExternalSourcesTree(
|
|
17
|
-
return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: documentSvg }), ...
|
|
13
|
+
export function ExternalSourcesTree({ actions, getDecorations, selectionMode, ...rest }) {
|
|
14
|
+
return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: documentSvg }), ...rest, treeName: ExternalSourcesTreeComponent.id, getHierarchyDefinition: getDefinitionsProvider, selectionMode: selectionMode ?? "none", treeRenderer: (treeProps) => (_jsx(TreeRenderer, { ...treeProps, actions: actions, getDecorations: getDecorations ?? ((node) => _jsx(ExternalSourcesTreeIcon, { node: node })) })) }));
|
|
18
15
|
}
|
|
19
16
|
const getDefinitionsProvider = (props) => {
|
|
20
17
|
return new ExternalSourcesTreeDefinition(props);
|
|
21
18
|
};
|
|
22
|
-
|
|
19
|
+
const classSvg = new URL("@itwin/itwinui-icons/bis-class.svg", import.meta.url).href;
|
|
20
|
+
const elementSvg = new URL("@itwin/itwinui-icons/bis-element.svg", import.meta.url).href;
|
|
21
|
+
const documentSvg = new URL("@itwin/itwinui-icons/document.svg", import.meta.url).href;
|
|
22
|
+
const ecSchemaSvg = new URL("@itwin/itwinui-icons/selection-children.svg", import.meta.url).href;
|
|
23
|
+
/** @beta */
|
|
24
|
+
export function ExternalSourcesTreeIcon({ node }) {
|
|
23
25
|
if (node.extendedData?.imageId === undefined) {
|
|
24
26
|
return undefined;
|
|
25
27
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
const getIcon = () => {
|
|
29
|
+
switch (node.extendedData.imageId) {
|
|
30
|
+
case "icon-item":
|
|
31
|
+
return elementSvg;
|
|
32
|
+
case "icon-ec-class":
|
|
33
|
+
return classSvg;
|
|
34
|
+
case "icon-document":
|
|
35
|
+
return documentSvg;
|
|
36
|
+
case "icon-ec-schema":
|
|
37
|
+
return ecSchemaSvg;
|
|
38
|
+
default:
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
return _jsx(Icon, { href: getIcon() });
|
|
37
43
|
}
|
|
38
44
|
//# sourceMappingURL=ExternalSourcesTree.js.map
|
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;AAEhG,OAAO,
|
|
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,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAA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AAC,IAAI,CAAC;AAEjG,YAAY;AACZ,MAAM,UAAU,uBAAuB,CAAC,EAAE,IAAI,EAAuC;IACnF,IAAI,IAAI,CAAC,YAAY,EAAE,OAAO,KAAK,SAAS,EAAE;QAC5C,OAAO,SAAS,CAAC;KAClB;IACD,MAAM,OAAO,GAAG,GAAG,EAAE;QACnB,QAAQ,IAAI,CAAC,YAAa,CAAC,OAAO,EAAE;YAClC,KAAK,WAAW;gBACd,OAAO,UAAU,CAAC;YACpB,KAAK,eAAe;gBAClB,OAAO,QAAQ,CAAC;YAClB,KAAK,eAAe;gBAClB,OAAO,WAAW,CAAC;YACrB,KAAK,gBAAgB;gBACnB,OAAO,WAAW,CAAC;YACrB;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC,CAAC;IAEF,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,GAAI,CAAC;AACnC,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 { Icon } from \"@itwin/itwinui-react/bricks\";\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\" | \"getDecorations\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function ExternalSourcesTree({ actions, getDecorations, selectionMode, ...rest }: ExternalSourcesTreeProps) {\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={documentSvg} />}\n {...rest}\n treeName={ExternalSourcesTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={selectionMode ?? \"none\"}\n treeRenderer={(treeProps) => (\n <TreeRenderer {...treeProps} actions={actions} getDecorations={getDecorations ?? ((node) => <ExternalSourcesTreeIcon node={node} />)} />\n )}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = (props) => {\n return new ExternalSourcesTreeDefinition(props);\n};\n\nconst classSvg = new URL(\"@itwin/itwinui-icons/bis-class.svg\", import.meta.url).href;\nconst elementSvg = new URL(\"@itwin/itwinui-icons/bis-element.svg\", import.meta.url).href;\nconst documentSvg = new URL(\"@itwin/itwinui-icons/document.svg\", import.meta.url).href;\nconst ecSchemaSvg = new URL(\"@itwin/itwinui-icons/selection-children.svg\", import.meta.url).href;\n\n/** @beta */\nexport function ExternalSourcesTreeIcon({ node }: { node: PresentationHierarchyNode }) {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n const getIcon = () => {\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 default:\n return undefined;\n }\n };\n\n return <Icon href={getIcon()} />;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ExternalSourcesTreeProps } from "./ExternalSourcesTree.js";
|
|
2
2
|
/** @beta */
|
|
3
|
-
interface ExternalSourcesTreeComponentProps extends Pick<ExternalSourcesTreeProps, "getSchemaContext" | "selectionStorage" | "selectionMode" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions"> {
|
|
3
|
+
interface ExternalSourcesTreeComponentProps extends Pick<ExternalSourcesTreeProps, "getSchemaContext" | "selectionStorage" | "selectionMode" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions" | "getDecorations"> {
|
|
4
4
|
onPerformanceMeasured?: (featureId: string, duration: number) => void;
|
|
5
5
|
onFeatureUsed?: (feature: string) => void;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExternalSourcesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAa/D;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAqC,EAAE,EAAE;IACpI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,4BAA4B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACxJ,KAAC,cAAc,cACb,KAAC,mBAAmB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACnC,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,4BAA4B,CAAC,EAAE,GAAG,0BAA0B,CAAC;AAE7D;;;GAGG;AACH,4BAA4B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { ExternalSourcesTree } from \"./ExternalSourcesTree.js\";\n\nimport type { ExternalSourcesTreeProps } from \"./ExternalSourcesTree.js\";\n/** @beta */\ninterface ExternalSourcesTreeComponentProps\n extends Pick<\n ExternalSourcesTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\"\n > {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `ExternalSourcesTree`.\n * @beta\n */\nexport const ExternalSourcesTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: ExternalSourcesTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={ExternalSourcesTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <ExternalSourcesTree {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.id = \"external-sources-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.getLabel = () => TreeWidget.translate(\"externalSourcesTree.label\");\n"]}
|
|
1
|
+
{"version":3,"file":"ExternalSourcesTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/external-sources-tree/ExternalSourcesTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAa/D;;;GAGG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAqC,EAAE,EAAE;IACpI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,4BAA4B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACxJ,KAAC,cAAc,cACb,KAAC,mBAAmB,OAAK,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACnC,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,4BAA4B,CAAC,EAAE,GAAG,0BAA0B,CAAC;AAE7D;;;GAGG;AACH,4BAA4B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,2BAA2B,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { ExternalSourcesTree } from \"./ExternalSourcesTree.js\";\n\nimport type { ExternalSourcesTreeProps } from \"./ExternalSourcesTree.js\";\n/** @beta */\ninterface ExternalSourcesTreeComponentProps\n extends Pick<\n ExternalSourcesTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"selectionMode\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\" | \"getDecorations\"\n > {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `ExternalSourcesTree`.\n * @beta\n */\nexport const ExternalSourcesTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: ExternalSourcesTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={ExternalSourcesTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <ExternalSourcesTree {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.id = \"external-sources-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nExternalSourcesTreeComponent.getLabel = () => TreeWidget.translate(\"externalSourcesTree.label\");\n"]}
|
package/lib/esm/tree-widget-react/components/trees/imodel-content-tree/IModelContentTree.d.ts
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import type { PresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
|
|
1
2
|
import type { BaseTreeRendererProps } from "../common/components/BaseTreeRenderer.js";
|
|
2
3
|
import type { TreeProps } from "../common/components/Tree.js";
|
|
3
4
|
/** @beta */
|
|
4
|
-
export type IModelContentTreeProps = Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<BaseTreeRendererProps, "actions"> & {
|
|
5
|
+
export type IModelContentTreeProps = Pick<TreeProps, "imodel" | "getSchemaContext" | "selectionStorage" | "selectionMode" | "emptyTreeContent"> & Pick<BaseTreeRendererProps, "actions" | "getDecorations"> & {
|
|
5
6
|
hierarchyLevelConfig?: {
|
|
6
7
|
sizeLimit?: number;
|
|
7
8
|
};
|
|
8
9
|
};
|
|
9
10
|
/** @beta */
|
|
10
|
-
export declare function IModelContentTree(
|
|
11
|
+
export declare function IModelContentTree({ actions, getDecorations, selectionMode, ...rest }: IModelContentTreeProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/** @beta */
|
|
13
|
+
export declare function IModelContentTreeIcon({ node }: {
|
|
14
|
+
node: PresentationHierarchyNode;
|
|
15
|
+
}): import("react/jsx-runtime").JSX.Element | undefined;
|
|
11
16
|
//# sourceMappingURL=IModelContentTree.d.ts.map
|
|
@@ -3,22 +3,16 @@ 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
|
|
7
|
-
import
|
|
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/EmptyTreeContent.js";
|
|
6
|
+
import { Icon } from "@itwin/itwinui-react/bricks";
|
|
7
|
+
import { EmptyTreeContent } from "../common/components/EmptyTree.js";
|
|
14
8
|
import { Tree } from "../common/components/Tree.js";
|
|
15
9
|
import { TreeRenderer } from "../common/components/TreeRenderer.js";
|
|
16
10
|
import { IModelContentTreeComponent } from "./IModelContentTreeComponent.js";
|
|
17
11
|
import { IModelContentTreeDefinition } from "./IModelContentTreeDefinition.js";
|
|
18
12
|
import { IModelContentTreeIdsCache } from "./internal/IModelContentTreeIdsCache.js";
|
|
19
13
|
/** @beta */
|
|
20
|
-
export function IModelContentTree(
|
|
21
|
-
return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: modelSvg }), ...
|
|
14
|
+
export function IModelContentTree({ actions, getDecorations, selectionMode, ...rest }) {
|
|
15
|
+
return (_jsx(Tree, { emptyTreeContent: _jsx(EmptyTreeContent, { icon: modelSvg }), ...rest, treeName: IModelContentTreeComponent.id, getHierarchyDefinition: getDefinitionsProvider, selectionMode: selectionMode ?? "extended", treeRenderer: (treeProps) => (_jsx(TreeRenderer, { ...treeProps, actions: actions, getDecorations: getDecorations ?? ((node) => _jsx(IModelContentTreeIcon, { node: node })) })) }));
|
|
22
16
|
}
|
|
23
17
|
const getDefinitionsProvider = ({ imodelAccess }) => {
|
|
24
18
|
return new IModelContentTreeDefinition({
|
|
@@ -26,26 +20,38 @@ const getDefinitionsProvider = ({ imodelAccess }) => {
|
|
|
26
20
|
idsCache: new IModelContentTreeIdsCache(imodelAccess),
|
|
27
21
|
});
|
|
28
22
|
};
|
|
29
|
-
|
|
23
|
+
const categorySvg = new URL("@itwin/itwinui-icons/bis-category-3d.svg", import.meta.url).href;
|
|
24
|
+
const classSvg = new URL("@itwin/itwinui-icons/bis-class.svg", import.meta.url).href;
|
|
25
|
+
const elementSvg = new URL("@itwin/itwinui-icons/bis-element.svg", import.meta.url).href;
|
|
26
|
+
const subjectSvg = new URL("@itwin/itwinui-icons/bis-subject.svg", import.meta.url).href;
|
|
27
|
+
const groupSvg = new URL("@itwin/itwinui-icons/group.svg", import.meta.url).href;
|
|
28
|
+
const modelSvg = new URL("@itwin/itwinui-icons/model-cube.svg", import.meta.url).href;
|
|
29
|
+
const hierarchyTreeSvg = new URL("@itwin/itwinui-icons/selection-children.svg", import.meta.url).href;
|
|
30
|
+
/** @beta */
|
|
31
|
+
export function IModelContentTreeIcon({ node }) {
|
|
30
32
|
if (node.extendedData?.imageId === undefined) {
|
|
31
33
|
return undefined;
|
|
32
34
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
35
|
+
const getIcon = () => {
|
|
36
|
+
switch (node.extendedData.imageId) {
|
|
37
|
+
case "icon-layers":
|
|
38
|
+
return categorySvg;
|
|
39
|
+
case "icon-item":
|
|
40
|
+
return elementSvg;
|
|
41
|
+
case "icon-ec-class":
|
|
42
|
+
return classSvg;
|
|
43
|
+
case "icon-folder":
|
|
44
|
+
return subjectSvg;
|
|
45
|
+
case "icon-model":
|
|
46
|
+
return modelSvg;
|
|
47
|
+
case "icon-hierarchy-tree":
|
|
48
|
+
return hierarchyTreeSvg;
|
|
49
|
+
case "icon-group":
|
|
50
|
+
return groupSvg;
|
|
51
|
+
default:
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
return _jsx(Icon, { href: getIcon() });
|
|
50
56
|
}
|
|
51
57
|
//# sourceMappingURL=IModelContentTree.js.map
|
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;AAEhG,OAAO,
|
|
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,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,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,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,GAAG,IAAI,EAA0B;IAC3G,OAAO,CACL,KAAC,IAAI,IACH,gBAAgB,EAAE,KAAC,gBAAgB,IAAC,IAAI,EAAE,QAAQ,GAAI,KAClD,IAAI,EACR,QAAQ,EAAE,0BAA0B,CAAC,EAAE,EACvC,sBAAsB,EAAE,sBAAsB,EAC9C,aAAa,EAAE,aAAa,IAAI,UAAU,EAC1C,YAAY,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,CAC3B,KAAC,YAAY,OAAK,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,KAAC,qBAAqB,IAAC,IAAI,EAAE,IAAI,GAAI,CAAC,GAAI,CACvI,GACD,CACH,CAAC;AACJ,CAAC;AAED,MAAM,sBAAsB,GAAwC,CAAC,EAAE,YAAY,EAAE,EAAE,EAAE;IACvF,OAAO,IAAI,2BAA2B,CAAC;QACrC,YAAY;QACZ,Q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YAClB,KAAK,aAAa;gBAChB,OAAO,UAAU,CAAC;YACpB,KAAK,YAAY;gBACf,OAAO,QAAQ,CAAC;YAClB,KAAK,qBAAqB;gBACxB,OAAO,gBAAgB,CAAC;YAC1B,KAAK,YAAY;gBACf,OAAO,QAAQ,CAAC;YAClB;gBACE,OAAO,SAAS,CAAC;SACpB;IACH,CAAC,CAAC;IAEF,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,EAAE,GAAI,CAAC;AACnC,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 { Icon } from \"@itwin/itwinui-react/bricks\";\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\" | \"getDecorations\"> & {\n hierarchyLevelConfig?: {\n sizeLimit?: number;\n };\n };\n\n/** @beta */\nexport function IModelContentTree({ actions, getDecorations, selectionMode, ...rest }: IModelContentTreeProps) {\n return (\n <Tree\n emptyTreeContent={<EmptyTreeContent icon={modelSvg} />}\n {...rest}\n treeName={IModelContentTreeComponent.id}\n getHierarchyDefinition={getDefinitionsProvider}\n selectionMode={selectionMode ?? \"extended\"}\n treeRenderer={(treeProps) => (\n <TreeRenderer {...treeProps} actions={actions} getDecorations={getDecorations ?? ((node) => <IModelContentTreeIcon node={node} />)} />\n )}\n />\n );\n}\n\nconst getDefinitionsProvider: TreeProps[\"getHierarchyDefinition\"] = ({ imodelAccess }) => {\n return new IModelContentTreeDefinition({\n imodelAccess,\n idsCache: new IModelContentTreeIdsCache(imodelAccess),\n });\n};\n\nconst categorySvg = new URL(\"@itwin/itwinui-icons/bis-category-3d.svg\", import.meta.url).href;\nconst classSvg = new URL(\"@itwin/itwinui-icons/bis-class.svg\", import.meta.url).href;\nconst elementSvg = new URL(\"@itwin/itwinui-icons/bis-element.svg\", import.meta.url).href;\nconst subjectSvg = new URL(\"@itwin/itwinui-icons/bis-subject.svg\", import.meta.url).href;\nconst groupSvg = new URL(\"@itwin/itwinui-icons/group.svg\", import.meta.url).href;\nconst modelSvg = new URL(\"@itwin/itwinui-icons/model-cube.svg\", import.meta.url).href;\nconst hierarchyTreeSvg = new URL(\"@itwin/itwinui-icons/selection-children.svg\", import.meta.url).href;\n\n/** @beta */\nexport function IModelContentTreeIcon({ node }: { node: PresentationHierarchyNode }) {\n if (node.extendedData?.imageId === undefined) {\n return undefined;\n }\n\n const getIcon = () => {\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 default:\n return undefined;\n }\n };\n\n return <Icon href={getIcon()} />;\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IModelContentTreeProps } from "./IModelContentTree.js";
|
|
2
2
|
/** @beta */
|
|
3
|
-
interface IModelContentTreeComponentProps extends Pick<IModelContentTreeProps, "getSchemaContext" | "selectionStorage" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions"> {
|
|
3
|
+
interface IModelContentTreeComponentProps extends Pick<IModelContentTreeProps, "getSchemaContext" | "selectionStorage" | "hierarchyLevelConfig" | "selectionMode" | "emptyTreeContent" | "actions" | "getDecorations"> {
|
|
4
4
|
onPerformanceMeasured?: (featureId: string, duration: number) => void;
|
|
5
5
|
onFeatureUsed?: (feature: string) => void;
|
|
6
6
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IModelContentTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"IModelContentTreeComponent.js","sourceRoot":"","sources":["../../../../../../src/tree-widget-react/components/trees/imodel-content-tree/IModelContentTreeComponent.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAa3D;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,EAAE,aAAa,EAAE,qBAAqB,EAAE,GAAG,KAAK,EAAmC,EAAE,EAAE;IAChI,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAE3C,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,IAAI,CAAC;KACb;IAED,OAAO,CACL,KAAC,wBAAwB,IAAC,mBAAmB,EAAE,0BAA0B,CAAC,EAAE,EAAE,aAAa,EAAE,aAAa,EAAE,qBAAqB,EAAE,qBAAqB,YACtJ,KAAC,cAAc,cACb,KAAC,iBAAiB,IAAC,OAAO,EAAE,SAAS,KAAM,KAAK,EAAE,MAAM,EAAE,MAAM,GAAI,GACrD,GACQ,CAC5B,CAAC;AACJ,CAAC,CAAC;AAEF;;;GAGG;AACH,0BAA0B,CAAC,EAAE,GAAG,wBAAwB,CAAC;AAEzD;;;GAGG;AACH,0BAA0B,CAAC,QAAQ,GAAG,GAAG,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,yBAAyB,CAAC,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useActiveIModelConnection } from \"@itwin/appui-react\";\nimport { TreeWidget } from \"../../../TreeWidget.js\";\nimport { SelectableTree } from \"../../tree-header/SelectableTree.js\";\nimport { TelemetryContextProvider } from \"../common/UseTelemetryContext.js\";\nimport { IModelContentTree } from \"./IModelContentTree.js\";\n\nimport type { IModelContentTreeProps } from \"./IModelContentTree.js\";\n/** @beta */\ninterface IModelContentTreeComponentProps\n extends Pick<\n IModelContentTreeProps,\n \"getSchemaContext\" | \"selectionStorage\" | \"hierarchyLevelConfig\" | \"selectionMode\" | \"emptyTreeContent\" | \"actions\" | \"getDecorations\"\n > {\n onPerformanceMeasured?: (featureId: string, duration: number) => void;\n onFeatureUsed?: (feature: string) => void;\n}\n\n/**\n * A component that renders `IModelContentTree`.\n * @beta\n */\nexport const IModelContentTreeComponent = ({ onFeatureUsed, onPerformanceMeasured, ...props }: IModelContentTreeComponentProps) => {\n const imodel = useActiveIModelConnection();\n\n if (!imodel) {\n return null;\n }\n\n return (\n <TelemetryContextProvider componentIdentifier={IModelContentTreeComponent.id} onFeatureUsed={onFeatureUsed} onPerformanceMeasured={onPerformanceMeasured}>\n <SelectableTree>\n <IModelContentTree actions={undefined} {...props} imodel={imodel} />\n </SelectableTree>\n </TelemetryContextProvider>\n );\n};\n\n/**\n * Id of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.id = \"imodel-content-tree-v2\";\n\n/**\n * Label of the component. May be used when a creating a `TreeDefinition` for `SelectableTree`.\n * @beta\n */\nIModelContentTreeComponent.getLabel = () => TreeWidget.translate(\"imodelContentTree.label\");\n"]}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
export { ModelsTreeComponent } from "./models-tree/ModelsTreeComponent.js";
|
|
2
2
|
export { CategoriesTreeComponent } from "./categories-tree/CategoriesTreeComponent.js";
|
|
3
3
|
export { IModelContentTreeComponent } from "./imodel-content-tree/IModelContentTreeComponent.js";
|
|
4
|
+
export { IModelContentTreeIcon } from "./imodel-content-tree/IModelContentTree.js";
|
|
4
5
|
export { ExternalSourcesTreeComponent } from "./external-sources-tree/ExternalSourcesTreeComponent.js";
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
6
|
+
export { ExternalSourcesTreeIcon } from "./external-sources-tree/ExternalSourcesTree.js";
|
|
7
|
+
export { useModelsTree, ModelsTreeIcon } from "./models-tree/UseModelsTree.js";
|
|
8
|
+
export { useCategoriesTree, CategoriesTreeIcon } from "./categories-tree/UseCategoriesTree.js";
|
|
7
9
|
export { useModelsTreeButtonProps } from "./models-tree/ModelsTreeButtons.js";
|
|
8
10
|
export { useCategoriesTreeButtonProps } from "./categories-tree/CategoriesTreeButtons.js";
|
|
9
11
|
export { BaseTreeRendererProps } from "./common/components/BaseTreeRenderer.js";
|
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
export { ModelsTreeComponent } from "./models-tree/ModelsTreeComponent.js";
|
|
6
6
|
export { CategoriesTreeComponent } from "./categories-tree/CategoriesTreeComponent.js";
|
|
7
7
|
export { IModelContentTreeComponent } from "./imodel-content-tree/IModelContentTreeComponent.js";
|
|
8
|
+
export { IModelContentTreeIcon } from "./imodel-content-tree/IModelContentTree.js";
|
|
8
9
|
export { ExternalSourcesTreeComponent } from "./external-sources-tree/ExternalSourcesTreeComponent.js";
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
10
|
+
export { ExternalSourcesTreeIcon } from "./external-sources-tree/ExternalSourcesTree.js";
|
|
11
|
+
export { useModelsTree, ModelsTreeIcon } from "./models-tree/UseModelsTree.js";
|
|
12
|
+
export { useCategoriesTree, CategoriesTreeIcon } from "./categories-tree/UseCategoriesTree.js";
|
|
11
13
|
export { useModelsTreeButtonProps } from "./models-tree/ModelsTreeButtons.js";
|
|
12
14
|
export { useCategoriesTreeButtonProps } from "./categories-tree/CategoriesTreeButtons.js";
|
|
13
15
|
export { FocusedInstancesContextProvider, useFocusedInstancesContext } from "./common/FocusedInstancesContext.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;
|
|
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,qBAAqB,EAAE,MAAM,4CAA4C,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,yDAAyD,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAEzF,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE/F,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 { IModelContentTreeIcon } from \"./imodel-content-tree/IModelContentTree.js\";\nexport { ExternalSourcesTreeComponent } from \"./external-sources-tree/ExternalSourcesTreeComponent.js\";\nexport { ExternalSourcesTreeIcon } from \"./external-sources-tree/ExternalSourcesTree.js\";\n\nexport { useModelsTree, ModelsTreeIcon } from \"./models-tree/UseModelsTree.js\";\nexport { useCategoriesTree, CategoriesTreeIcon } 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"]}
|