@itwin/tree-widget-react 3.4.0 → 3.4.1
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 +10 -2
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.js +4 -3
- package/lib/cjs/tree-widget-react/components/trees/common/components/Tree.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js +1 -5
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js +3 -5
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js.map +1 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +0 -1
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js +2 -3
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/Tree.js +5 -4
- 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/TreeNodeCheckbox.js +1 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js +3 -2
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js.map +1 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.d.ts +0 -1
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js +2 -3
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.js.map +1 -1
- package/package.json +5 -5
- package/lib/cjs/tree-widget-react/components/trees/common/components/TreeRenderer.scss +0 -48
- package/lib/esm/tree-widget-react/components/trees/common/components/TreeRenderer.scss +0 -48
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,20 @@
|
|
|
1
1
|
# Change Log - @itwin/tree-widget-react
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Thu, 06 Feb 2025 13:36:08 GMT and should not be manually modified.
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
+
## 3.4.1
|
|
8
|
+
|
|
9
|
+
Thu, 06 Feb 2025 13:36:08 GMT
|
|
10
|
+
|
|
11
|
+
### Patches
|
|
12
|
+
|
|
13
|
+
- Removed horizontal scroll from trees. ([#1180](https://github.com/iTwin/viewer-components-react/pull/1180))
|
|
14
|
+
|
|
7
15
|
## 3.4.0
|
|
8
16
|
|
|
9
|
-
Tue, 04 Feb 2025 15:29:
|
|
17
|
+
Tue, 04 Feb 2025 15:29:52 GMT
|
|
10
18
|
|
|
11
19
|
### Minor changes
|
|
12
20
|
|
|
@@ -29,10 +29,10 @@ function Tree({ getSchemaContext, hierarchyLevelSizeLimit, selectionStorage, imo
|
|
|
29
29
|
const imodelAccess = (0, react_1.useMemo)(() => {
|
|
30
30
|
return providedIModelAccess ?? (0, Utils_js_1.createIModelAccess)({ getSchemaContext, imodel: props.imodel });
|
|
31
31
|
}, [providedIModelAccess, getSchemaContext, props.imodel]);
|
|
32
|
-
return ((0, jsx_runtime_1.jsx)(presentation_components_1.SchemaMetadataContextProvider, { imodel: props.imodel, schemaContextProvider: getSchemaContext, children: (0, jsx_runtime_1.jsx)(
|
|
32
|
+
return ((0, jsx_runtime_1.jsx)(presentation_components_1.SchemaMetadataContextProvider, { imodel: props.imodel, schemaContextProvider: getSchemaContext, children: (0, jsx_runtime_1.jsx)(TreeImpl, { ...props, selectionStorage: selectionStorage, imodelAccess: imodelAccess, defaultHierarchyLevelSizeLimit: defaultHierarchyLevelSizeLimit }) }));
|
|
33
33
|
}
|
|
34
34
|
exports.Tree = Tree;
|
|
35
|
-
function TreeImpl({ imodel, imodelAccess, treeName, noDataMessage, getFilteredPaths, defaultHierarchyLevelSizeLimit, getHierarchyDefinition, selectionPredicate, selectionMode, onReload, treeRenderer, density, highlight, }) {
|
|
35
|
+
function TreeImpl({ imodel, imodelAccess, treeName, noDataMessage, getFilteredPaths, defaultHierarchyLevelSizeLimit, getHierarchyDefinition, selectionPredicate, selectionMode, onReload, treeRenderer, density, highlight, selectionStorage, }) {
|
|
36
36
|
const localizedStrings = (0, UseHierarchiesLocalization_js_1.useHierarchiesLocalization)();
|
|
37
37
|
const { onFeatureUsed, onPerformanceMeasured } = (0, UseTelemetryContext_js_1.useTelemetryContext)();
|
|
38
38
|
const [imodelChanged] = (0, react_1.useState)(new core_bentley_1.BeEvent());
|
|
@@ -43,6 +43,7 @@ function TreeImpl({ imodel, imodelAccess, treeName, noDataMessage, getFilteredPa
|
|
|
43
43
|
getFilteredPaths,
|
|
44
44
|
sourceName: treeName,
|
|
45
45
|
localizedStrings,
|
|
46
|
+
selectionStorage,
|
|
46
47
|
onPerformanceMeasured: (action, duration) => {
|
|
47
48
|
if (action === "reload") {
|
|
48
49
|
onReload?.();
|
|
@@ -86,7 +87,7 @@ function TreeImpl({ imodel, imodelAccess, treeName, noDataMessage, getFilteredPa
|
|
|
86
87
|
getLabel,
|
|
87
88
|
size: density === "enlarged" ? "default" : "small",
|
|
88
89
|
};
|
|
89
|
-
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: "relative", height: "100%", overflow: "hidden" }, children: [(0, jsx_runtime_1.jsxs)("div", { id: "tw-tree-renderer-container", style: {
|
|
90
|
+
return ((0, jsx_runtime_1.jsxs)("div", { style: { position: "relative", height: "100%", overflow: "hidden" }, children: [(0, jsx_runtime_1.jsxs)("div", { id: "tw-tree-renderer-container", style: { height: "100%" }, children: [treeRenderer(treeRendererProps), filteringDialog] }), (0, jsx_runtime_1.jsx)(Delayed_js_1.Delayed, { show: isLoading, children: (0, jsx_runtime_1.jsx)(ProgressOverlay_js_1.ProgressOverlay, {}) })] }));
|
|
90
91
|
}
|
|
91
92
|
function useSelectionPredicate({ action, predicate, getNode, }) {
|
|
92
93
|
return (0, react_1.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,iCAAuD;AACvD,sDAA8C;AAC9C,wDAAkE;AAClE,4EAA+E;AAC/E,0FAAqI;AACrI,6DAAuD;AACvD,oFAA8E;AAC9E,0EAAyE;AACzE,8EAAwE;AACxE,sEAAgE;AAChE,sEAAoF;AACpF,0CAAiD;AACjD,6CAAuC;AACvC,6DAAuD;AAkDvD;;;GAGG;AACH,SAAgB,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,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAChC,OAAO,oBAAoB,IAAI,IAAA,6BAAkB,EAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAChG,CAAC,EAAE,CAAC,oBAAoB,EAAE,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAE3D,OAAO,CACL,uBAAC,uDAA6B,IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,qBAAqB,EAAE,gBAAgB,YAC1F,uBAAC,yDAAwB,IAAC,OAAO,EAAE,gBAAgB,YACjD,uBAAC,QAAQ,OAAK,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,8BAA8B,EAAE,8BAA8B,GAAI,GAC1F,GACG,CACjC,CAAC;AACJ,CAAC;AAdD,oBAcC;AAED,SAAS,QAAQ,CAAC,EAChB,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,aAAa,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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 { Flex, ProgressRadial, Text } from \"@itwin/itwinui-react\";\nimport { SchemaMetadataContextProvider } from \"@itwin/presentation-components\";\nimport { UnifiedSelectionProvider, useIModelUnifiedSelectionTree, useSelectionHandler } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeWidget } from \"../../../../TreeWidget.js\";\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 { ProgressOverlay } from \"./ProgressOverlay.js\";\n\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 } from \"@itwin/presentation-hierarchies-react\";\nimport type { HighlightInfo } from \"../UseNodeHighlighting.js\";\nimport type { TreeRendererProps } from \"./TreeRenderer.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 TreeRendererProps,\n \"rootNodes\" | \"expandNode\" | \"onNodeClick\" | \"onNodeKeyDown\" | \"onFilterClick\" | \"isNodeSelected\" | \"getHierarchyLevelDetails\" | \"size\" | \"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 /** Modifies the density of tree nodes. `enlarged` tree nodes have bigger button hit boxes. */\n density?: \"default\" | \"enlarged\";\n /** Message that should be renderer if there are no tree nodes. */\n noDataMessage?: 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 <UnifiedSelectionProvider storage={selectionStorage}>\n <TreeImpl {...props} imodelAccess={imodelAccess} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />\n </UnifiedSelectionProvider>\n </SchemaMetadataContextProvider>\n );\n}\n\nfunction TreeImpl({\n imodel,\n imodelAccess,\n treeName,\n noDataMessage,\n getFilteredPaths,\n defaultHierarchyLevelSizeLimit,\n getHierarchyDefinition,\n selectionPredicate,\n selectionMode,\n onReload,\n treeRenderer,\n density,\n highlight,\n}: MarkRequired<Omit<TreeProps, \"getSchemaContext\" | \"selectionStorage\">, \"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 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 { onNodeClick, onNodeKeyDown } = useSelectionHandler({ rootNodes, selectNodes, selectionMode: selectionMode ?? \"single\" });\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 <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width: \"100%\", height: \"100%\" }}>\n <Delayed show={true}>\n <ProgressRadial size=\"large\" />\n </Delayed>\n </Flex>\n );\n }\n\n if (rootNodes.length === 0 && !isLoading) {\n return (\n <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width: \"100%\", height: \"100%\" }}>\n {noDataMessage ? noDataMessage : <Text>{TreeWidget.translate(\"baseTree.dataIsNotAvailable\")}</Text>}\n </Flex>\n );\n }\n\n const treeRendererProps: FunctionProps<TreeProps[\"treeRenderer\"]> = {\n ...treeProps,\n rootNodes,\n onNodeClick,\n onNodeKeyDown,\n expandNode: reportingExpandNode,\n onFilterClick: reportingOnFilterClicked,\n getLabel,\n size: density === \"enlarged\" ? \"default\" : \"small\",\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,iCAAuD;AACvD,sDAA8C;AAC9C,wDAAkE;AAClE,4EAA+E;AAC/E,0FAA2G;AAC3G,6DAAuD;AACvD,oFAA8E;AAC9E,0EAAyE;AACzE,8EAAwE;AACxE,sEAAgE;AAChE,sEAAoF;AACpF,0CAAiD;AACjD,6CAAuC;AACvC,6DAAuD;AAkDvD;;;GAGG;AACH,SAAgB,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,GAAG,IAAA,eAAO,EAAC,GAAG,EAAE;QAChC,OAAO,oBAAoB,IAAI,IAAA,6BAAkB,EAAC,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IAChG,CAAC,EAAE,CAAC,oBAAoB,EAAE,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAE3D,OAAO,CACL,uBAAC,uDAA6B,IAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,qBAAqB,EAAE,gBAAgB,YAC1F,uBAAC,QAAQ,OAAK,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,8BAA8B,EAAE,8BAA8B,GAAI,GACzH,CACjC,CAAC;AACJ,CAAC;AAZD,oBAYC;AAED,SAAS,QAAQ,CAAC,EAChB,MAAM,EACN,YAAY,EACZ,QAAQ,EACR,aAAa,EACb,gBAAgB,EAChB,8BAA8B,EAC9B,sBAAsB,EACtB,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,OAAO,EACP,SAAS,EACT,gBAAgB,GAC+F;IAC/G,M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Content":["/*---------------------------------------------------------------------------------------------\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 { Flex, ProgressRadial, Text } from \"@itwin/itwinui-react\";\nimport { SchemaMetadataContextProvider } from \"@itwin/presentation-components\";\nimport { useIModelUnifiedSelectionTree, useSelectionHandler } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeWidget } from \"../../../../TreeWidget.js\";\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 { ProgressOverlay } from \"./ProgressOverlay.js\";\n\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 } from \"@itwin/presentation-hierarchies-react\";\nimport type { HighlightInfo } from \"../UseNodeHighlighting.js\";\nimport type { TreeRendererProps } from \"./TreeRenderer.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 TreeRendererProps,\n \"rootNodes\" | \"expandNode\" | \"onNodeClick\" | \"onNodeKeyDown\" | \"onFilterClick\" | \"isNodeSelected\" | \"getHierarchyLevelDetails\" | \"size\" | \"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 /** Modifies the density of tree nodes. `enlarged` tree nodes have bigger button hit boxes. */\n density?: \"default\" | \"enlarged\";\n /** Message that should be renderer if there are no tree nodes. */\n noDataMessage?: 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 noDataMessage,\n getFilteredPaths,\n defaultHierarchyLevelSizeLimit,\n getHierarchyDefinition,\n selectionPredicate,\n selectionMode,\n onReload,\n treeRenderer,\n density,\n highlight,\n selectionStorage,\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 { onNodeClick, onNodeKeyDown } = useSelectionHandler({ rootNodes, selectNodes, selectionMode: selectionMode ?? \"single\" });\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 <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width: \"100%\", height: \"100%\" }}>\n <Delayed show={true}>\n <ProgressRadial size=\"large\" />\n </Delayed>\n </Flex>\n );\n }\n\n if (rootNodes.length === 0 && !isLoading) {\n return (\n <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width: \"100%\", height: \"100%\" }}>\n {noDataMessage ? noDataMessage : <Text>{TreeWidget.translate(\"baseTree.dataIsNotAvailable\")}</Text>}\n </Flex>\n );\n }\n\n const treeRendererProps: FunctionProps<TreeProps[\"treeRenderer\"]> = {\n ...treeProps,\n rootNodes,\n onNodeClick,\n onNodeKeyDown,\n expandNode: reportingExpandNode,\n onFilterClick: reportingOnFilterClicked,\n getLabel,\n size: density === \"enlarged\" ? \"default\" : \"small\",\n };\n\n return (\n <div style={{ position: \"relative\", height: \"100%\", overflow: \"hidden\" }}>\n <div id=\"tw-tree-renderer-container\" style={{ 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,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.TreeNodeCheckbox = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -9,7 +6,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
9
6
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
10
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
11
8
|
*--------------------------------------------------------------------------------------------*/
|
|
12
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
13
9
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
14
10
|
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
15
11
|
/** @internal */
|
|
@@ -18,7 +14,7 @@ function TreeNodeCheckbox({ node, onCheckboxClicked, getCheckboxState, ...props
|
|
|
18
14
|
return null;
|
|
19
15
|
}
|
|
20
16
|
const checkboxState = getCheckboxState(node);
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(TooltipWrapper, { content: checkboxState.tooltip, children: (0, jsx_runtime_1.jsx)(itwinui_react_1.Checkbox, { ...props,
|
|
17
|
+
return ((0, jsx_runtime_1.jsx)(TooltipWrapper, { content: checkboxState.tooltip, children: (0, jsx_runtime_1.jsx)(itwinui_react_1.Checkbox, { ...props, checked: checkboxState.state === "on", onClick: (e) => {
|
|
22
18
|
e.stopPropagation();
|
|
23
19
|
}, onChange: (e) => {
|
|
24
20
|
onCheckboxClicked(node, e.currentTarget.checked);
|
package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeCheckbox.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TreeNodeCheckbox.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,wDAAyD;AACzD,0FAAoF;AA2BpF,gBAAgB;AAChB,SAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,GAAG,KAAK,EAAsD;IAC1I,IAAI,MAAM,IAAI,IAAI,IAAI,CAAC,IAAA,4DAA2B,EAAC,IAAI,CAAC,EAAE;QACxD,OAAO,IAAI,CAAC;KACb;IAED,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7C,OAAO,CACL,uBAAC,cAAc,IAAC,OAAO,EAAE,aAAa,CAAC,OAAO,YAC5C,uBAAC,wBAAQ,OACH,KAAK,EACT,OAAO,EAAE,aAAa,CAAC,KAAK,KAAK,IAAI,EACrC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,CAAC,CAAC,eAAe,EAAE,CAAC;YACtB,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;gBACd,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACnD,CAAC,EACD,aAAa,EAAE,aAAa,CAAC,KAAK,KAAK,SAAS,EAChD,QAAQ,EAAE,aAAa,CAAC,UAAU,gBACtB,aAAa,CAAC,OAAO,GACjC,GACa,CAClB,CAAC;AACJ,CAAC;AAvBD,4CAuBC;AAED,SAAS,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAoD;IAC7F,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACjB,uBAAC,uBAAO,IAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,YACxC,QAAQ,GACD,CACX,CAAC,CAAC,CAAC,CACF,2DAAG,QAAQ,GAAI,CAChB,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 { Checkbox, Tooltip } from \"@itwin/itwinui-react\";\nimport { isPresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\nimport type { PresentationHierarchyNode, RenderedTreeNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\n/**\n * Data structure that describes tree node checkbox state.\n * @beta\n */\ninterface TreeNodeCheckboxState {\n state: \"on\" | \"off\" | \"partial\";\n isDisabled?: boolean;\n tooltip?: string;\n}\n\n/** @beta */\nexport interface TreeCheckboxProps {\n /** Callback that should be invoked when checkbox is clicked. */\n onCheckboxClicked: (node: PresentationHierarchyNode, checked: boolean) => void;\n /** Callback that should be used to determine current checkbox state. */\n getCheckboxState: (node: PresentationHierarchyNode) => TreeNodeCheckboxState;\n}\n\n/** @internal */\ntype TreeNodeCheckboxProps = TreeCheckboxProps &\n Omit<ComponentPropsWithoutRef<typeof Checkbox>, \"onClick\" | \"checked\" | \"onChange\" | \"indeterminate\" | \"disabled\" | \"title\">;\n\n/** @internal */\nexport function TreeNodeCheckbox({ node, onCheckboxClicked, getCheckboxState, ...props }: TreeNodeCheckboxProps & { node: RenderedTreeNode }) {\n if (\"type\" in node || !isPresentationHierarchyNode(node)) {\n return null;\n }\n\n const checkboxState = getCheckboxState(node);\n return (\n <TooltipWrapper content={checkboxState.tooltip}>\n <Checkbox\n {...props}\n checked={checkboxState.state === \"on\"}\n onClick={(e) => {\n e.stopPropagation();\n }}\n onChange={(e) => {\n onCheckboxClicked(node, e.currentTarget.checked);\n }}\n indeterminate={checkboxState.state === \"partial\"}\n disabled={checkboxState.isDisabled}\n aria-label={checkboxState.tooltip}\n />\n </TooltipWrapper>\n );\n}\n\nfunction TooltipWrapper({ content, children }: { content?: string; children?: React.ReactNode }) {\n return !!content ? (\n <Tooltip content={content} placement=\"left\">\n {children}\n </Tooltip>\n ) : (\n <>{children}</>\n );\n}\n"]}
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.TreeNodeRenderer = void 0;
|
|
7
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
@@ -9,13 +6,14 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
9
6
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
10
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
11
8
|
*--------------------------------------------------------------------------------------------*/
|
|
12
|
-
const classnames_1 = __importDefault(require("classnames"));
|
|
13
9
|
const react_1 = require("react");
|
|
14
10
|
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
15
11
|
const TreeNodeCheckbox_js_1 = require("./TreeNodeCheckbox.js");
|
|
16
12
|
/** @beta */
|
|
17
13
|
exports.TreeNodeRenderer = (0, react_1.forwardRef)(({ checkboxProps, ...props }, forwardedRef) => {
|
|
18
|
-
return ((0, jsx_runtime_1.jsx)(presentation_hierarchies_react_1.TreeNodeRenderer, { ...props, ref: forwardedRef, nodeProps: { className:
|
|
14
|
+
return ((0, jsx_runtime_1.jsx)(presentation_hierarchies_react_1.TreeNodeRenderer, { ...props, ref: forwardedRef, nodeProps: { className: props.className }, checkboxProps: {
|
|
15
|
+
style: { paddingInline: 1 }, // add padding to make sure that checkbox is aligned with first header button}}
|
|
16
|
+
}, checkbox: checkboxProps ? (0, jsx_runtime_1.jsx)(TreeNodeCheckbox_js_1.TreeNodeCheckbox, { ...checkboxProps, node: props.node }) : null }));
|
|
19
17
|
});
|
|
20
18
|
exports.TreeNodeRenderer.displayName = "TreeNodeRenderer";
|
|
21
19
|
//# sourceMappingURL=TreeNodeRenderer.js.map
|
package/lib/cjs/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TreeNodeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeRenderer.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAAmC;AACnC,0FAAiG;AACjG,+DAAyD;AAWzD,YAAY;AACC,QAAA,gBAAgB,GAAqF,IAAA,kBAAU,EAC1H,CAAC,EAAE,aAAa,EAAE,GAAG,KAAK,EAAyB,EAAE,YAAY,EAAE,EAAE;IACnE,OAAO,CACL,uBAAC,iDAAoB,OACf,KAAK,EACT,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,EACzC,aAAa,EAAE;YACb,KAAK,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,EAAE,+EAA+E;SAC7G,EACD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,uBAAC,sCAAgB,OAAK,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,GAAI,CAAC,CAAC,CAAC,IAAI,GAC1F,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,wBAAgB,CAAC,WAAW,GAAG,kBAAkB,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 { forwardRef } from \"react\";\nimport { TreeNodeRenderer as CoreTreeNodeRenderer } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeNodeCheckbox } from \"./TreeNodeCheckbox.js\";\n\nimport type { ComponentPropsWithoutRef, ForwardRefExoticComponent, RefAttributes } from \"react\";\nimport type { TreeCheckboxProps } from \"./TreeNodeCheckbox.js\";\n\n/** @beta */\nexport type TreeNodeRendererProps = ComponentPropsWithoutRef<typeof CoreTreeNodeRenderer> & {\n /** Props for rendering tree node checkbox. If not provided, checkbox is not rendered. */\n checkboxProps?: TreeCheckboxProps;\n};\n\n/** @beta */\nexport const TreeNodeRenderer: ForwardRefExoticComponent<TreeNodeRendererProps & RefAttributes<HTMLDivElement>> = forwardRef(\n ({ checkboxProps, ...props }: TreeNodeRendererProps, forwardedRef) => {\n return (\n <CoreTreeNodeRenderer\n {...props}\n ref={forwardedRef}\n nodeProps={{ className: props.className }}\n checkboxProps={{\n style: { paddingInline: 1 }, // add padding to make sure that checkbox is aligned with first header button}}\n }}\n checkbox={checkboxProps ? <TreeNodeCheckbox {...checkboxProps} node={props.node} /> : null}\n />\n );\n },\n);\nTreeNodeRenderer.displayName = \"TreeNodeRenderer\";\n"]}
|
|
@@ -6,7 +6,6 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
6
6
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
7
7
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
8
8
|
*--------------------------------------------------------------------------------------------*/
|
|
9
|
-
require("./TreeRenderer.scss");
|
|
10
9
|
const react_1 = require("react");
|
|
11
10
|
const itwinui_react_1 = require("@itwin/itwinui-react");
|
|
12
11
|
const presentation_hierarchies_react_1 = require("@itwin/presentation-hierarchies-react");
|
|
@@ -26,7 +25,7 @@ function TreeRenderer({ rootNodes, expandNode, onNodeClick, onNodeKeyDown, onNod
|
|
|
26
25
|
return onNodeClick?.(node, true, event);
|
|
27
26
|
}
|
|
28
27
|
onNodeClick?.(node, isSelected, event);
|
|
29
|
-
}, expandNode: expandNode, onNodeKeyDown: onNodeKeyDown, getIcon: getIcon, getLabel: getLabel, getSublabel: getSublabel, onFilterClick: onFilterClick, getHierarchyLevelDetails: getHierarchyLevelDetails, checkboxProps: checkboxProps, reloadTree: reloadTree,
|
|
28
|
+
}, expandNode: expandNode, onNodeKeyDown: onNodeKeyDown, getIcon: getIcon, getLabel: getLabel, getSublabel: getSublabel, onFilterClick: onFilterClick, getHierarchyLevelDetails: getHierarchyLevelDetails, checkboxProps: checkboxProps, reloadTree: reloadTree, size: size, filterButtonsVisibility: filterButtonsVisibility }));
|
|
30
29
|
}, [
|
|
31
30
|
expandNode,
|
|
32
31
|
onNodeClick,
|
|
@@ -43,7 +42,7 @@ function TreeRenderer({ rootNodes, expandNode, onNodeClick, onNodeKeyDown, onNod
|
|
|
43
42
|
size,
|
|
44
43
|
]);
|
|
45
44
|
const getNode = (0, react_1.useCallback)((node) => (0, presentation_hierarchies_react_1.createRenderedTreeNodeData)(node, isNodeSelected), [isNodeSelected]);
|
|
46
|
-
return ((0, jsx_runtime_1.jsx)(presentation_hierarchies_react_1.LocalizationContextProvider, { localizedStrings: localizedStrings, children: (0, jsx_runtime_1.jsx)(itwinui_react_1.Tree, { ...props,
|
|
45
|
+
return ((0, jsx_runtime_1.jsx)(presentation_hierarchies_react_1.LocalizationContextProvider, { localizedStrings: localizedStrings, children: (0, jsx_runtime_1.jsx)(itwinui_react_1.Tree, { ...props, data: rootNodes, nodeRenderer: nodeRenderer, getNode: getNode, enableVirtualization: enableVirtualization ?? true, style: { height: "100%" }, size: size }) }));
|
|
47
46
|
}
|
|
48
47
|
exports.TreeRenderer = TreeRenderer;
|
|
49
48
|
//# 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;AAEhG
|
|
1
|
+
{"version":3,"file":"TreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeRenderer.tsx"],"names":[],"mappings":";;;;AAAA;;;gGAGgG;AAEhG,iCAAoC;AACpC,wDAA4C;AAC5C,0FAAgH;AAChH,+DAAyD;AACzD,oFAA8E;AA8B9E;;;GAGG;AACH,SAAgB,YAAY,CAAC,E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,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,IAAA,mBAAW,EACzB,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,2DAA0B,EAAC,IAAI,EAAE,cAAc,CAAC,EAC1D,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CACL,uBAAC,4DAA2B,IAAC,gBAAgB,EAAE,gBAAgB,YAC7D,uBAAC,oBAAI,OACC,KAAK,EACT,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,oBAAoB,EAAE,oBAAoB,IAAI,IAAI,EAClD,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EACzB,IAAI,EAAE,IAAI,GACV,GAC0B,CAC/B,CAAC;AACJ,CAAC;AAlFD,oCAkFC","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 } from \"react\";\nimport { Tree } from \"@itwin/itwinui-react\";\nimport { createRenderedTreeNodeData, LocalizationContextProvider } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeNodeRenderer } from \"./TreeNodeRenderer.js\";\nimport { useHierarchiesLocalization } from \"../UseHierarchiesLocalization.js\";\n\nimport type { TreeNodeRendererProps } from \"./TreeNodeRenderer.js\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { PresentationHierarchyNode, PresentationTreeNode, RenderedTreeNode } from \"@itwin/presentation-hierarchies-react\";\n\n/** @beta */\nexport type TreeRendererProps = Pick<\n TreeNodeRendererProps,\n | \"expandNode\"\n | \"onNodeClick\"\n | \"onNodeKeyDown\"\n | \"onFilterClick\"\n | \"getIcon\"\n | \"getLabel\"\n | \"getSublabel\"\n | \"getHierarchyLevelDetails\"\n | \"checkboxProps\"\n | \"reloadTree\"\n | \"filterButtonsVisibility\"\n> &\n Omit<ComponentPropsWithoutRef<typeof Tree<RenderedTreeNode>>, \"data\" | \"nodeRenderer\" | \"getNode\"> & {\n /** Tree nodes to render. */\n rootNodes: PresentationTreeNode[];\n /** Callback to check if specific node is selected. */\n isNodeSelected: (nodeId: string) => boolean;\n /** Callback that is invoked when node is double clicked. */\n onNodeDoubleClick?: (node: PresentationHierarchyNode, isSelected: boolean) => void;\n };\n\n/**\n * Default renderer for rendering tree data.\n * @beta\n */\nexport function TreeRenderer({\n rootNodes,\n expandNode,\n onNodeClick,\n onNodeKeyDown,\n onNodeDoubleClick,\n isNodeSelected,\n onFilterClick,\n getIcon,\n getLabel,\n getSublabel,\n getHierarchyLevelDetails,\n checkboxProps,\n filterButtonsVisibility,\n reloadTree,\n size,\n enableVirtualization,\n ...props\n}: TreeRendererProps) {\n const localizedStrings = useHierarchiesLocalization();\n const nodeRenderer = useCallback<ComponentPropsWithoutRef<typeof Tree<RenderedTreeNode>>[\"nodeRenderer\"]>(\n (nodeProps) => {\n return (\n <TreeNodeRenderer\n {...nodeProps}\n onNodeClick={(node, isSelected, event) => {\n if (onNodeDoubleClick && event.detail === 2) {\n onNodeDoubleClick?.(node, !!nodeProps.isSelected);\n // Click node to not lose selection\n return onNodeClick?.(node, true, event);\n }\n onNodeClick?.(node, isSelected, event);\n }}\n expandNode={expandNode}\n onNodeKeyDown={onNodeKeyDown}\n getIcon={getIcon}\n getLabel={getLabel}\n getSublabel={getSublabel}\n onFilterClick={onFilterClick}\n getHierarchyLevelDetails={getHierarchyLevelDetails}\n checkboxProps={checkboxProps}\n reloadTree={reloadTree}\n size={size}\n filterButtonsVisibility={filterButtonsVisibility}\n />\n );\n },\n [\n expandNode,\n onNodeClick,\n onNodeKeyDown,\n onNodeDoubleClick,\n getHierarchyLevelDetails,\n getIcon,\n getLabel,\n getSublabel,\n onFilterClick,\n checkboxProps,\n filterButtonsVisibility,\n reloadTree,\n size,\n ],\n );\n\n const getNode = useCallback<ComponentPropsWithoutRef<typeof Tree<RenderedTreeNode>>[\"getNode\"]>(\n (node) => createRenderedTreeNodeData(node, isNodeSelected),\n [isNodeSelected],\n );\n\n return (\n <LocalizationContextProvider localizedStrings={localizedStrings}>\n <Tree<RenderedTreeNode>\n {...props}\n data={rootNodes}\n nodeRenderer={nodeRenderer}\n getNode={getNode}\n enableVirtualization={enableVirtualization ?? true}\n style={{ height: \"100%\" }}\n size={size}\n />\n </LocalizationContextProvider>\n );\n}\n"]}
|
|
@@ -7,7 +7,7 @@ import { useCallback, useMemo, useState } from "react";
|
|
|
7
7
|
import { BeEvent } from "@itwin/core-bentley";
|
|
8
8
|
import { Flex, ProgressRadial, Text } from "@itwin/itwinui-react";
|
|
9
9
|
import { SchemaMetadataContextProvider } from "@itwin/presentation-components";
|
|
10
|
-
import {
|
|
10
|
+
import { useIModelUnifiedSelectionTree, useSelectionHandler } from "@itwin/presentation-hierarchies-react";
|
|
11
11
|
import { TreeWidget } from "../../../../TreeWidget.js";
|
|
12
12
|
import { useHierarchiesLocalization } from "../UseHierarchiesLocalization.js";
|
|
13
13
|
import { useHierarchyLevelFiltering } from "../UseHierarchyFiltering.js";
|
|
@@ -26,9 +26,9 @@ export function Tree({ getSchemaContext, hierarchyLevelSizeLimit, selectionStora
|
|
|
26
26
|
const imodelAccess = useMemo(() => {
|
|
27
27
|
return providedIModelAccess ?? createIModelAccess({ getSchemaContext, imodel: props.imodel });
|
|
28
28
|
}, [providedIModelAccess, getSchemaContext, props.imodel]);
|
|
29
|
-
return (_jsx(SchemaMetadataContextProvider, { imodel: props.imodel, schemaContextProvider: getSchemaContext, children: _jsx(
|
|
29
|
+
return (_jsx(SchemaMetadataContextProvider, { imodel: props.imodel, schemaContextProvider: getSchemaContext, children: _jsx(TreeImpl, { ...props, selectionStorage: selectionStorage, imodelAccess: imodelAccess, defaultHierarchyLevelSizeLimit: defaultHierarchyLevelSizeLimit }) }));
|
|
30
30
|
}
|
|
31
|
-
function TreeImpl({ imodel, imodelAccess, treeName, noDataMessage, getFilteredPaths, defaultHierarchyLevelSizeLimit, getHierarchyDefinition, selectionPredicate, selectionMode, onReload, treeRenderer, density, highlight, }) {
|
|
31
|
+
function TreeImpl({ imodel, imodelAccess, treeName, noDataMessage, getFilteredPaths, defaultHierarchyLevelSizeLimit, getHierarchyDefinition, selectionPredicate, selectionMode, onReload, treeRenderer, density, highlight, selectionStorage, }) {
|
|
32
32
|
const localizedStrings = useHierarchiesLocalization();
|
|
33
33
|
const { onFeatureUsed, onPerformanceMeasured } = useTelemetryContext();
|
|
34
34
|
const [imodelChanged] = useState(new BeEvent());
|
|
@@ -39,6 +39,7 @@ function TreeImpl({ imodel, imodelAccess, treeName, noDataMessage, getFilteredPa
|
|
|
39
39
|
getFilteredPaths,
|
|
40
40
|
sourceName: treeName,
|
|
41
41
|
localizedStrings,
|
|
42
|
+
selectionStorage,
|
|
42
43
|
onPerformanceMeasured: (action, duration) => {
|
|
43
44
|
if (action === "reload") {
|
|
44
45
|
onReload?.();
|
|
@@ -82,7 +83,7 @@ function TreeImpl({ imodel, imodelAccess, treeName, noDataMessage, getFilteredPa
|
|
|
82
83
|
getLabel,
|
|
83
84
|
size: density === "enlarged" ? "default" : "small",
|
|
84
85
|
};
|
|
85
|
-
return (_jsxs("div", { style: { position: "relative", height: "100%", overflow: "hidden" }, children: [_jsxs("div", { id: "tw-tree-renderer-container", style: {
|
|
86
|
+
return (_jsxs("div", { style: { position: "relative", height: "100%", overflow: "hidden" }, children: [_jsxs("div", { id: "tw-tree-renderer-container", style: { height: "100%" }, children: [treeRenderer(treeRendererProps), filteringDialog] }), _jsx(Delayed, { show: isLoading, children: _jsx(ProgressOverlay, {}) })] }));
|
|
86
87
|
}
|
|
87
88
|
function useSelectionPredicate({ action, predicate, getNode, }) {
|
|
88
89
|
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":";A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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 { Flex, ProgressRadial, Text } from \"@itwin/itwinui-react\";\nimport { SchemaMetadataContextProvider } from \"@itwin/presentation-components\";\nimport { UnifiedSelectionProvider, useIModelUnifiedSelectionTree, useSelectionHandler } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeWidget } from \"../../../../TreeWidget.js\";\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 { ProgressOverlay } from \"./ProgressOverlay.js\";\n\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 } from \"@itwin/presentation-hierarchies-react\";\nimport type { HighlightInfo } from \"../UseNodeHighlighting.js\";\nimport type { TreeRendererProps } from \"./TreeRenderer.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 TreeRendererProps,\n \"rootNodes\" | \"expandNode\" | \"onNodeClick\" | \"onNodeKeyDown\" | \"onFilterClick\" | \"isNodeSelected\" | \"getHierarchyLevelDetails\" | \"size\" | \"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 /** Modifies the density of tree nodes. `enlarged` tree nodes have bigger button hit boxes. */\n density?: \"default\" | \"enlarged\";\n /** Message that should be renderer if there are no tree nodes. */\n noDataMessage?: 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 <UnifiedSelectionProvider storage={selectionStorage}>\n <TreeImpl {...props} imodelAccess={imodelAccess} defaultHierarchyLevelSizeLimit={defaultHierarchyLevelSizeLimit} />\n </UnifiedSelectionProvider>\n </SchemaMetadataContextProvider>\n );\n}\n\nfunction TreeImpl({\n imodel,\n imodelAccess,\n treeName,\n noDataMessage,\n getFilteredPaths,\n defaultHierarchyLevelSizeLimit,\n getHierarchyDefinition,\n selectionPredicate,\n selectionMode,\n onReload,\n treeRenderer,\n density,\n highlight,\n}: MarkRequired<Omit<TreeProps, \"getSchemaContext\" | \"selectionStorage\">, \"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 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 { onNodeClick, onNodeKeyDown } = useSelectionHandler({ rootNodes, selectNodes, selectionMode: selectionMode ?? \"single\" });\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 <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width: \"100%\", height: \"100%\" }}>\n <Delayed show={true}>\n <ProgressRadial size=\"large\" />\n </Delayed>\n </Flex>\n );\n }\n\n if (rootNodes.length === 0 && !isLoading) {\n return (\n <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width: \"100%\", height: \"100%\" }}>\n {noDataMessage ? noDataMessage : <Text>{TreeWidget.translate(\"baseTree.dataIsNotAvailable\")}</Text>}\n </Flex>\n );\n }\n\n const treeRendererProps: FunctionProps<TreeProps[\"treeRenderer\"]> = {\n ...treeProps,\n rootNodes,\n onNodeClick,\n onNodeKeyDown,\n expandNode: reportingExpandNode,\n onFilterClick: reportingOnFilterClicked,\n getLabel,\n size: density === \"enlarged\" ? \"default\" : \"small\",\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,EAAE,WAAW,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,6BAA6B,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,6BAA6B,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AAC3G,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,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,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAkDvD;;;GAGG;AACH,MAAM,UAAU,IAAI,CAAC,EAAE,gB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AAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,aACtE,eAAK,EAAE,EAAC,4BAA4B,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,aAC3D,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 { Flex, ProgressRadial, Text } from \"@itwin/itwinui-react\";\nimport { SchemaMetadataContextProvider } from \"@itwin/presentation-components\";\nimport { useIModelUnifiedSelectionTree, useSelectionHandler } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeWidget } from \"../../../../TreeWidget.js\";\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 { ProgressOverlay } from \"./ProgressOverlay.js\";\n\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 } from \"@itwin/presentation-hierarchies-react\";\nimport type { HighlightInfo } from \"../UseNodeHighlighting.js\";\nimport type { TreeRendererProps } from \"./TreeRenderer.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 TreeRendererProps,\n \"rootNodes\" | \"expandNode\" | \"onNodeClick\" | \"onNodeKeyDown\" | \"onFilterClick\" | \"isNodeSelected\" | \"getHierarchyLevelDetails\" | \"size\" | \"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 /** Modifies the density of tree nodes. `enlarged` tree nodes have bigger button hit boxes. */\n density?: \"default\" | \"enlarged\";\n /** Message that should be renderer if there are no tree nodes. */\n noDataMessage?: 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 noDataMessage,\n getFilteredPaths,\n defaultHierarchyLevelSizeLimit,\n getHierarchyDefinition,\n selectionPredicate,\n selectionMode,\n onReload,\n treeRenderer,\n density,\n highlight,\n selectionStorage,\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 { onNodeClick, onNodeKeyDown } = useSelectionHandler({ rootNodes, selectNodes, selectionMode: selectionMode ?? \"single\" });\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 <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width: \"100%\", height: \"100%\" }}>\n <Delayed show={true}>\n <ProgressRadial size=\"large\" />\n </Delayed>\n </Flex>\n );\n }\n\n if (rootNodes.length === 0 && !isLoading) {\n return (\n <Flex alignItems=\"center\" justifyContent=\"center\" flexDirection=\"column\" style={{ width: \"100%\", height: \"100%\" }}>\n {noDataMessage ? noDataMessage : <Text>{TreeWidget.translate(\"baseTree.dataIsNotAvailable\")}</Text>}\n </Flex>\n );\n }\n\n const treeRendererProps: FunctionProps<TreeProps[\"treeRenderer\"]> = {\n ...treeProps,\n rootNodes,\n onNodeClick,\n onNodeKeyDown,\n expandNode: reportingExpandNode,\n onFilterClick: reportingOnFilterClicked,\n getLabel,\n size: density === \"enlarged\" ? \"default\" : \"small\",\n };\n\n return (\n <div style={{ position: \"relative\", height: \"100%\", overflow: \"hidden\" }}>\n <div id=\"tw-tree-renderer-container\" style={{ 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"]}
|
|
@@ -3,7 +3,6 @@ import { jsx as _jsx, Fragment as _Fragment } 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 cx from "classnames";
|
|
7
6
|
import { Checkbox, Tooltip } from "@itwin/itwinui-react";
|
|
8
7
|
import { isPresentationHierarchyNode } from "@itwin/presentation-hierarchies-react";
|
|
9
8
|
/** @internal */
|
|
@@ -12,7 +11,7 @@ export function TreeNodeCheckbox({ node, onCheckboxClicked, getCheckboxState, ..
|
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
14
13
|
const checkboxState = getCheckboxState(node);
|
|
15
|
-
return (_jsx(TooltipWrapper, { content: checkboxState.tooltip, children: _jsx(Checkbox, { ...props,
|
|
14
|
+
return (_jsx(TooltipWrapper, { content: checkboxState.tooltip, children: _jsx(Checkbox, { ...props, checked: checkboxState.state === "on", onClick: (e) => {
|
|
16
15
|
e.stopPropagation();
|
|
17
16
|
}, onChange: (e) => {
|
|
18
17
|
onCheckboxClicked(node, e.currentTarget.checked);
|
package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeCheckbox.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TreeNodeCheckbox.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeCheckbox.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AA2BpF,gBAAgB;AAChB,MAAM,UAAU,gBAAgB,CAAC,EAAE,IAAI,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,GAAG,KAAK,EAAsD;IAC1I,IAAI,MAAM,IAAI,IAAI,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,EAAE;QACxD,OAAO,IAAI,CAAC;KACb;IAED,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IAC7C,OAAO,CACL,KAAC,cAAc,IAAC,OAAO,EAAE,aAAa,CAAC,OAAO,YAC5C,KAAC,QAAQ,OACH,KAAK,EACT,OAAO,EAAE,aAAa,CAAC,KAAK,KAAK,IAAI,EACrC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,CAAC,CAAC,eAAe,EAAE,CAAC;YACtB,CAAC,EACD,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE;gBACd,iBAAiB,CAAC,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;YACnD,CAAC,EACD,aAAa,EAAE,aAAa,CAAC,KAAK,KAAK,SAAS,EAChD,QAAQ,EAAE,aAAa,CAAC,UAAU,gBACtB,aAAa,CAAC,OAAO,GACjC,GACa,CAClB,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAoD;IAC7F,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CACjB,KAAC,OAAO,IAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAC,MAAM,YACxC,QAAQ,GACD,CACX,CAAC,CAAC,CAAC,CACF,4BAAG,QAAQ,GAAI,CAChB,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 { Checkbox, Tooltip } from \"@itwin/itwinui-react\";\nimport { isPresentationHierarchyNode } from \"@itwin/presentation-hierarchies-react\";\n\nimport type { PresentationHierarchyNode, RenderedTreeNode } from \"@itwin/presentation-hierarchies-react\";\nimport type { ComponentPropsWithoutRef } from \"react\";\n\n/**\n * Data structure that describes tree node checkbox state.\n * @beta\n */\ninterface TreeNodeCheckboxState {\n state: \"on\" | \"off\" | \"partial\";\n isDisabled?: boolean;\n tooltip?: string;\n}\n\n/** @beta */\nexport interface TreeCheckboxProps {\n /** Callback that should be invoked when checkbox is clicked. */\n onCheckboxClicked: (node: PresentationHierarchyNode, checked: boolean) => void;\n /** Callback that should be used to determine current checkbox state. */\n getCheckboxState: (node: PresentationHierarchyNode) => TreeNodeCheckboxState;\n}\n\n/** @internal */\ntype TreeNodeCheckboxProps = TreeCheckboxProps &\n Omit<ComponentPropsWithoutRef<typeof Checkbox>, \"onClick\" | \"checked\" | \"onChange\" | \"indeterminate\" | \"disabled\" | \"title\">;\n\n/** @internal */\nexport function TreeNodeCheckbox({ node, onCheckboxClicked, getCheckboxState, ...props }: TreeNodeCheckboxProps & { node: RenderedTreeNode }) {\n if (\"type\" in node || !isPresentationHierarchyNode(node)) {\n return null;\n }\n\n const checkboxState = getCheckboxState(node);\n return (\n <TooltipWrapper content={checkboxState.tooltip}>\n <Checkbox\n {...props}\n checked={checkboxState.state === \"on\"}\n onClick={(e) => {\n e.stopPropagation();\n }}\n onChange={(e) => {\n onCheckboxClicked(node, e.currentTarget.checked);\n }}\n indeterminate={checkboxState.state === \"partial\"}\n disabled={checkboxState.isDisabled}\n aria-label={checkboxState.tooltip}\n />\n </TooltipWrapper>\n );\n}\n\nfunction TooltipWrapper({ content, children }: { content?: string; children?: React.ReactNode }) {\n return !!content ? (\n <Tooltip content={content} placement=\"left\">\n {children}\n </Tooltip>\n ) : (\n <>{children}</>\n );\n}\n"]}
|
|
@@ -3,13 +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 cx from "classnames";
|
|
7
6
|
import { forwardRef } from "react";
|
|
8
7
|
import { TreeNodeRenderer as CoreTreeNodeRenderer } from "@itwin/presentation-hierarchies-react";
|
|
9
8
|
import { TreeNodeCheckbox } from "./TreeNodeCheckbox.js";
|
|
10
9
|
/** @beta */
|
|
11
10
|
export const TreeNodeRenderer = forwardRef(({ checkboxProps, ...props }, forwardedRef) => {
|
|
12
|
-
return (_jsx(CoreTreeNodeRenderer, { ...props, ref: forwardedRef, nodeProps: { className:
|
|
11
|
+
return (_jsx(CoreTreeNodeRenderer, { ...props, ref: forwardedRef, nodeProps: { className: props.className }, checkboxProps: {
|
|
12
|
+
style: { paddingInline: 1 }, // add padding to make sure that checkbox is aligned with first header button}}
|
|
13
|
+
}, checkbox: checkboxProps ? _jsx(TreeNodeCheckbox, { ...checkboxProps, node: props.node }) : null }));
|
|
13
14
|
});
|
|
14
15
|
TreeNodeRenderer.displayName = "TreeNodeRenderer";
|
|
15
16
|
//# sourceMappingURL=TreeNodeRenderer.js.map
|
package/lib/esm/tree-widget-react/components/trees/common/components/TreeNodeRenderer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"TreeNodeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeNodeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AACjG,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAWzD,YAAY;AACZ,MAAM,CAAC,MAAM,gBAAgB,GAAqF,UAAU,CAC1H,CAAC,EAAE,aAAa,EAAE,GAAG,KAAK,EAAyB,EAAE,YAAY,EAAE,EAAE;IACnE,OAAO,CACL,KAAC,oBAAoB,OACf,KAAK,EACT,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,EACzC,aAAa,EAAE;YACb,KAAK,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,EAAE,+EAA+E;SAC7G,EACD,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC,KAAC,gBAAgB,OAAK,aAAa,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,GAAI,CAAC,CAAC,CAAC,IAAI,GAC1F,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,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 { forwardRef } from \"react\";\nimport { TreeNodeRenderer as CoreTreeNodeRenderer } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeNodeCheckbox } from \"./TreeNodeCheckbox.js\";\n\nimport type { ComponentPropsWithoutRef, ForwardRefExoticComponent, RefAttributes } from \"react\";\nimport type { TreeCheckboxProps } from \"./TreeNodeCheckbox.js\";\n\n/** @beta */\nexport type TreeNodeRendererProps = ComponentPropsWithoutRef<typeof CoreTreeNodeRenderer> & {\n /** Props for rendering tree node checkbox. If not provided, checkbox is not rendered. */\n checkboxProps?: TreeCheckboxProps;\n};\n\n/** @beta */\nexport const TreeNodeRenderer: ForwardRefExoticComponent<TreeNodeRendererProps & RefAttributes<HTMLDivElement>> = forwardRef(\n ({ checkboxProps, ...props }: TreeNodeRendererProps, forwardedRef) => {\n return (\n <CoreTreeNodeRenderer\n {...props}\n ref={forwardedRef}\n nodeProps={{ className: props.className }}\n checkboxProps={{\n style: { paddingInline: 1 }, // add padding to make sure that checkbox is aligned with first header button}}\n }}\n checkbox={checkboxProps ? <TreeNodeCheckbox {...checkboxProps} node={props.node} /> : null}\n />\n );\n },\n);\nTreeNodeRenderer.displayName = \"TreeNodeRenderer\";\n"]}
|
|
@@ -3,7 +3,6 @@ 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 "./TreeRenderer.scss";
|
|
7
6
|
import { useCallback } from "react";
|
|
8
7
|
import { Tree } from "@itwin/itwinui-react";
|
|
9
8
|
import { createRenderedTreeNodeData, LocalizationContextProvider } from "@itwin/presentation-hierarchies-react";
|
|
@@ -23,7 +22,7 @@ export function TreeRenderer({ rootNodes, expandNode, onNodeClick, onNodeKeyDown
|
|
|
23
22
|
return onNodeClick?.(node, true, event);
|
|
24
23
|
}
|
|
25
24
|
onNodeClick?.(node, isSelected, event);
|
|
26
|
-
}, expandNode: expandNode, onNodeKeyDown: onNodeKeyDown, getIcon: getIcon, getLabel: getLabel, getSublabel: getSublabel, onFilterClick: onFilterClick, getHierarchyLevelDetails: getHierarchyLevelDetails, checkboxProps: checkboxProps, reloadTree: reloadTree,
|
|
25
|
+
}, expandNode: expandNode, onNodeKeyDown: onNodeKeyDown, getIcon: getIcon, getLabel: getLabel, getSublabel: getSublabel, onFilterClick: onFilterClick, getHierarchyLevelDetails: getHierarchyLevelDetails, checkboxProps: checkboxProps, reloadTree: reloadTree, size: size, filterButtonsVisibility: filterButtonsVisibility }));
|
|
27
26
|
}, [
|
|
28
27
|
expandNode,
|
|
29
28
|
onNodeClick,
|
|
@@ -40,6 +39,6 @@ export function TreeRenderer({ rootNodes, expandNode, onNodeClick, onNodeKeyDown
|
|
|
40
39
|
size,
|
|
41
40
|
]);
|
|
42
41
|
const getNode = useCallback((node) => createRenderedTreeNodeData(node, isNodeSelected), [isNodeSelected]);
|
|
43
|
-
return (_jsx(LocalizationContextProvider, { localizedStrings: localizedStrings, children: _jsx(Tree, { ...props,
|
|
42
|
+
return (_jsx(LocalizationContextProvider, { localizedStrings: localizedStrings, children: _jsx(Tree, { ...props, data: rootNodes, nodeRenderer: nodeRenderer, getNode: getNode, enableVirtualization: enableVirtualization ?? true, style: { height: "100%" }, size: size }) }));
|
|
44
43
|
}
|
|
45
44
|
//# 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;AAEhG,OAAO,
|
|
1
|
+
{"version":3,"file":"TreeRenderer.js","sourceRoot":"","sources":["../../../../../../../src/tree-widget-react/components/trees/common/components/TreeRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,WAAW,E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,EAAE,aAAa,EAC5B,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,IAAI,EACV,uBAAuB,EAAE,uBAAuB,GAChD,CACH,CAAC;IACJ,CAAC,EACD;QACE,UAAU;QACV,WAAW;QACX,aAAa;QACb,iBAAiB;QACjB,wBAAwB;QACxB,OAAO;QACP,QAAQ;QACR,WAAW;QACX,aAAa;QACb,aAAa;QACb,uBAAuB;QACvB,UAAU;QACV,IAAI;KACL,CACF,CAAC;IAEF,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,IAAI,EAAE,EAAE,CAAC,0BAA0B,CAAC,IAAI,EAAE,cAAc,CAAC,EAC1D,CAAC,cAAc,CAAC,CACjB,CAAC;IAEF,OAAO,CACL,KAAC,2BAA2B,IAAC,gBAAgB,EAAE,gBAAgB,YAC7D,KAAC,IAAI,OACC,KAAK,EACT,IAAI,EAAE,SAAS,EACf,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,OAAO,EAChB,oBAAoB,EAAE,oBAAoB,IAAI,IAAI,EAClD,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,EACzB,IAAI,EAAE,IAAI,GACV,GAC0B,CAC/B,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 } from \"react\";\nimport { Tree } from \"@itwin/itwinui-react\";\nimport { createRenderedTreeNodeData, LocalizationContextProvider } from \"@itwin/presentation-hierarchies-react\";\nimport { TreeNodeRenderer } from \"./TreeNodeRenderer.js\";\nimport { useHierarchiesLocalization } from \"../UseHierarchiesLocalization.js\";\n\nimport type { TreeNodeRendererProps } from \"./TreeNodeRenderer.js\";\nimport type { ComponentPropsWithoutRef } from \"react\";\nimport type { PresentationHierarchyNode, PresentationTreeNode, RenderedTreeNode } from \"@itwin/presentation-hierarchies-react\";\n\n/** @beta */\nexport type TreeRendererProps = Pick<\n TreeNodeRendererProps,\n | \"expandNode\"\n | \"onNodeClick\"\n | \"onNodeKeyDown\"\n | \"onFilterClick\"\n | \"getIcon\"\n | \"getLabel\"\n | \"getSublabel\"\n | \"getHierarchyLevelDetails\"\n | \"checkboxProps\"\n | \"reloadTree\"\n | \"filterButtonsVisibility\"\n> &\n Omit<ComponentPropsWithoutRef<typeof Tree<RenderedTreeNode>>, \"data\" | \"nodeRenderer\" | \"getNode\"> & {\n /** Tree nodes to render. */\n rootNodes: PresentationTreeNode[];\n /** Callback to check if specific node is selected. */\n isNodeSelected: (nodeId: string) => boolean;\n /** Callback that is invoked when node is double clicked. */\n onNodeDoubleClick?: (node: PresentationHierarchyNode, isSelected: boolean) => void;\n };\n\n/**\n * Default renderer for rendering tree data.\n * @beta\n */\nexport function TreeRenderer({\n rootNodes,\n expandNode,\n onNodeClick,\n onNodeKeyDown,\n onNodeDoubleClick,\n isNodeSelected,\n onFilterClick,\n getIcon,\n getLabel,\n getSublabel,\n getHierarchyLevelDetails,\n checkboxProps,\n filterButtonsVisibility,\n reloadTree,\n size,\n enableVirtualization,\n ...props\n}: TreeRendererProps) {\n const localizedStrings = useHierarchiesLocalization();\n const nodeRenderer = useCallback<ComponentPropsWithoutRef<typeof Tree<RenderedTreeNode>>[\"nodeRenderer\"]>(\n (nodeProps) => {\n return (\n <TreeNodeRenderer\n {...nodeProps}\n onNodeClick={(node, isSelected, event) => {\n if (onNodeDoubleClick && event.detail === 2) {\n onNodeDoubleClick?.(node, !!nodeProps.isSelected);\n // Click node to not lose selection\n return onNodeClick?.(node, true, event);\n }\n onNodeClick?.(node, isSelected, event);\n }}\n expandNode={expandNode}\n onNodeKeyDown={onNodeKeyDown}\n getIcon={getIcon}\n getLabel={getLabel}\n getSublabel={getSublabel}\n onFilterClick={onFilterClick}\n getHierarchyLevelDetails={getHierarchyLevelDetails}\n checkboxProps={checkboxProps}\n reloadTree={reloadTree}\n size={size}\n filterButtonsVisibility={filterButtonsVisibility}\n />\n );\n },\n [\n expandNode,\n onNodeClick,\n onNodeKeyDown,\n onNodeDoubleClick,\n getHierarchyLevelDetails,\n getIcon,\n getLabel,\n getSublabel,\n onFilterClick,\n checkboxProps,\n filterButtonsVisibility,\n reloadTree,\n size,\n ],\n );\n\n const getNode = useCallback<ComponentPropsWithoutRef<typeof Tree<RenderedTreeNode>>[\"getNode\"]>(\n (node) => createRenderedTreeNodeData(node, isNodeSelected),\n [isNodeSelected],\n );\n\n return (\n <LocalizationContextProvider localizedStrings={localizedStrings}>\n <Tree<RenderedTreeNode>\n {...props}\n data={rootNodes}\n nodeRenderer={nodeRenderer}\n getNode={getNode}\n enableVirtualization={enableVirtualization ?? true}\n style={{ height: \"100%\" }}\n size={size}\n />\n </LocalizationContextProvider>\n );\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/tree-widget-react",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.1",
|
|
4
4
|
"description": "Tree Widget React",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Bentley",
|
|
@@ -69,13 +69,13 @@
|
|
|
69
69
|
"dependencies": {
|
|
70
70
|
"@itwin/itwinui-icons-react": "^2.9.0",
|
|
71
71
|
"@itwin/itwinui-illustrations-react": "^2.1.0",
|
|
72
|
-
"@itwin/presentation-core-interop": "^1.
|
|
72
|
+
"@itwin/presentation-core-interop": "^1.3.0",
|
|
73
73
|
"@itwin/presentation-hierarchies": "^1.4.1",
|
|
74
|
-
"@itwin/presentation-hierarchies-react": "^1.
|
|
74
|
+
"@itwin/presentation-hierarchies-react": "^1.6.1",
|
|
75
75
|
"@itwin/presentation-shared": "^1.2.0",
|
|
76
|
-
"@itwin/unified-selection": "^1.
|
|
76
|
+
"@itwin/unified-selection": "^1.3.0",
|
|
77
77
|
"classnames": "^2.5.1",
|
|
78
|
-
"react-error-boundary": "^
|
|
78
|
+
"react-error-boundary": "^5.0.0",
|
|
79
79
|
"rxjs": "^7.8.1"
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
.tw-tree-renderer {
|
|
7
|
-
width: fit-content;
|
|
8
|
-
min-width: 100%;
|
|
9
|
-
|
|
10
|
-
.tw-tree-node-checkbox-container {
|
|
11
|
-
position: sticky;
|
|
12
|
-
left: 0;
|
|
13
|
-
z-index: 1;
|
|
14
|
-
background-color: var(--iui-color-background);
|
|
15
|
-
padding-left: calc(var(--iui-size-2xs) + var(--iui-size-3xs));
|
|
16
|
-
height: calc(100% - var(--iui-size-2xs));
|
|
17
|
-
display: flex;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
align-items: center;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.tw-tree-node-action-buttons {
|
|
23
|
-
position: sticky;
|
|
24
|
-
right: 0;
|
|
25
|
-
z-index: 1;
|
|
26
|
-
background-color: var(--iui-color-background);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.tw-tree-node-content {
|
|
30
|
-
overflow: visible;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.tw-tree-node.selected {
|
|
34
|
-
.tw-tree-node-checkbox-container,
|
|
35
|
-
.tw-tree-node-checkbox::before,
|
|
36
|
-
.tw-tree-node-action-buttons {
|
|
37
|
-
background-color: var(--iui-color-background-accent-muted);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.tw-tree-node:not(.selected):hover {
|
|
42
|
-
.tw-tree-node-checkbox-container,
|
|
43
|
-
.tw-tree-node-checkbox::before,
|
|
44
|
-
.tw-tree-node-action-buttons {
|
|
45
|
-
background-color: var(--iui-color-background-hover);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
.tw-tree-renderer {
|
|
7
|
-
width: fit-content;
|
|
8
|
-
min-width: 100%;
|
|
9
|
-
|
|
10
|
-
.tw-tree-node-checkbox-container {
|
|
11
|
-
position: sticky;
|
|
12
|
-
left: 0;
|
|
13
|
-
z-index: 1;
|
|
14
|
-
background-color: var(--iui-color-background);
|
|
15
|
-
padding-left: calc(var(--iui-size-2xs) + var(--iui-size-3xs));
|
|
16
|
-
height: calc(100% - var(--iui-size-2xs));
|
|
17
|
-
display: flex;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
align-items: center;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.tw-tree-node-action-buttons {
|
|
23
|
-
position: sticky;
|
|
24
|
-
right: 0;
|
|
25
|
-
z-index: 1;
|
|
26
|
-
background-color: var(--iui-color-background);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.tw-tree-node-content {
|
|
30
|
-
overflow: visible;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.tw-tree-node.selected {
|
|
34
|
-
.tw-tree-node-checkbox-container,
|
|
35
|
-
.tw-tree-node-checkbox::before,
|
|
36
|
-
.tw-tree-node-action-buttons {
|
|
37
|
-
background-color: var(--iui-color-background-accent-muted);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.tw-tree-node:not(.selected):hover {
|
|
42
|
-
.tw-tree-node-checkbox-container,
|
|
43
|
-
.tw-tree-node-checkbox::before,
|
|
44
|
-
.tw-tree-node-action-buttons {
|
|
45
|
-
background-color: var(--iui-color-background-hover);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}
|