@itwin/presentation-hierarchies-react 2.0.0-alpha.3 → 2.0.0-alpha.30
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 +520 -0
- package/README.md +24 -24
- package/lib/esm/presentation-hierarchies-react/Renderers.d.ts +85 -0
- package/lib/esm/presentation-hierarchies-react/Renderers.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/{itwinui/TreeActionButton.css → Renderers.js} +2 -4
- package/lib/esm/presentation-hierarchies-react/Renderers.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +14 -29
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/TreeNode.js +1 -7
- package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts +2 -0
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.js +1 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts +3 -3
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js +1 -8
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +32 -70
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.js +48 -49
- package/lib/esm/presentation-hierarchies-react/UseTree.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/Utils.d.ts +5 -0
- package/lib/esm/presentation-hierarchies-react/Utils.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/Utils.js +23 -0
- package/lib/esm/presentation-hierarchies-react/Utils.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +2 -2
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +31 -16
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +24 -6
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +28 -32
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts +6 -29
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js +31 -27
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +23 -9
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +16 -29
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.d.ts +34 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.js +26 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts +58 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js +74 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/{itwinui → stratakit}/LocalizationContext.d.ts +47 -7
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/{itwinui → stratakit}/LocalizationContext.js +13 -5
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.d.ts +33 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.js +39 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +16 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +42 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +43 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +70 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +49 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +116 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +40 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js +93 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react.d.ts +12 -10
- package/lib/esm/presentation-hierarchies-react.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react.js +9 -9
- package/lib/esm/presentation-hierarchies-react.js.map +1 -1
- package/package.json +46 -38
- package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts +0 -15
- package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js +0 -22
- package/lib/esm/presentation-hierarchies-react/UnifiedSelectionContext.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts +0 -21
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js +0 -29
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts +0 -12
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js +0 -72
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeLevelRenderer.d.ts +0 -12
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeLevelRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeLevelRenderer.js +0 -10
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeLevelRenderer.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts +0 -45
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js +0 -71
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts +0 -30
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js +0 -22
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js.map +0 -1
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { UnifiedSelectionProvider } from "./presentation-hierarchies-react/UnifiedSelectionContext.js";
|
|
1
|
+
export { GenericErrorInfo, PresentationHierarchyNode, ErrorInfo, ResultSetTooLargeErrorInfo } from "./presentation-hierarchies-react/TreeNode.js";
|
|
3
2
|
export { useSelectionHandler } from "./presentation-hierarchies-react/UseSelectionHandler.js";
|
|
4
|
-
export {
|
|
3
|
+
export { useTree, useUnifiedSelectionTree } from "./presentation-hierarchies-react/UseTree.js";
|
|
4
|
+
export { HierarchyLevelDetails, TreeRendererProps } from "./presentation-hierarchies-react/Renderers.js";
|
|
5
5
|
export { useIModelTree, useIModelUnifiedSelectionTree } from "./presentation-hierarchies-react/UseIModelTree.js";
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
6
|
+
export { StrataKitTreeNodeRenderer } from "./presentation-hierarchies-react/stratakit/TreeNodeRenderer.js";
|
|
7
|
+
export { FilterAction } from "./presentation-hierarchies-react/stratakit/FilterAction.js";
|
|
8
|
+
export { RenameAction, RenameContextProvider } from "./presentation-hierarchies-react/stratakit/RenameAction.js";
|
|
9
|
+
export { StrataKitTreeRenderer } from "./presentation-hierarchies-react/stratakit/TreeRenderer.js";
|
|
10
|
+
export { StrataKitRootErrorRenderer } from "./presentation-hierarchies-react/stratakit/RootErrorRenderer.js";
|
|
11
|
+
export { TreeErrorRenderer } from "./presentation-hierarchies-react/stratakit/TreeErrorRenderer.js";
|
|
12
|
+
export { useFlatTreeItems, useErrorList, FlatTreeItem } from "./presentation-hierarchies-react/stratakit/FlatTreeNode.js";
|
|
13
|
+
export { LocalizationContextProvider } from "./presentation-hierarchies-react/stratakit/LocalizationContext.js";
|
|
14
|
+
export { GenericInstanceFilter, HierarchyNode, HierarchyProvider, getLogger, setLogger } from "@itwin/presentation-hierarchies";
|
|
13
15
|
export { SelectionStorage } from "@itwin/unified-selection";
|
|
14
16
|
//# sourceMappingURL=presentation-hierarchies-react.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation-hierarchies-react.d.ts","sourceRoot":"","sources":["../../src/presentation-hierarchies-react.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"presentation-hierarchies-react.d.ts","sourceRoot":"","sources":["../../src/presentation-hierarchies-react.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,8CAA8C,CAAC;AAClJ,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAC/F,OAAO,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,+CAA+C,CAAC;AACzG,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gEAAgE,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,4DAA4D,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACjH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,iEAAiE,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,iEAAiE,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,4DAA4D,CAAC;AAC1H,OAAO,EAAE,2BAA2B,EAAE,MAAM,mEAAmE,CAAC;AAEhH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AAChI,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -2,16 +2,16 @@
|
|
|
2
2
|
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
3
3
|
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
4
4
|
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
export { isPresentationHierarchyNode, } from "./presentation-hierarchies-react/TreeNode.js";
|
|
6
|
-
export { UnifiedSelectionProvider } from "./presentation-hierarchies-react/UnifiedSelectionContext.js";
|
|
7
5
|
export { useSelectionHandler } from "./presentation-hierarchies-react/UseSelectionHandler.js";
|
|
8
6
|
export { useTree, useUnifiedSelectionTree } from "./presentation-hierarchies-react/UseTree.js";
|
|
9
7
|
export { useIModelTree, useIModelUnifiedSelectionTree } from "./presentation-hierarchies-react/UseIModelTree.js";
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
8
|
+
export { StrataKitTreeNodeRenderer } from "./presentation-hierarchies-react/stratakit/TreeNodeRenderer.js";
|
|
9
|
+
export { FilterAction } from "./presentation-hierarchies-react/stratakit/FilterAction.js";
|
|
10
|
+
export { RenameAction, RenameContextProvider } from "./presentation-hierarchies-react/stratakit/RenameAction.js";
|
|
11
|
+
export { StrataKitTreeRenderer } from "./presentation-hierarchies-react/stratakit/TreeRenderer.js";
|
|
12
|
+
export { StrataKitRootErrorRenderer } from "./presentation-hierarchies-react/stratakit/RootErrorRenderer.js";
|
|
13
|
+
export { TreeErrorRenderer } from "./presentation-hierarchies-react/stratakit/TreeErrorRenderer.js";
|
|
14
|
+
export { useFlatTreeItems, useErrorList } from "./presentation-hierarchies-react/stratakit/FlatTreeNode.js";
|
|
15
|
+
export { LocalizationContextProvider } from "./presentation-hierarchies-react/stratakit/LocalizationContext.js";
|
|
16
|
+
export { GenericInstanceFilter, HierarchyNode, getLogger, setLogger } from "@itwin/presentation-hierarchies";
|
|
17
17
|
//# sourceMappingURL=presentation-hierarchies-react.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"presentation-hierarchies-react.js","sourceRoot":"","sources":["../../src/presentation-hierarchies-react.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;
|
|
1
|
+
{"version":3,"file":"presentation-hierarchies-react.js","sourceRoot":"","sources":["../../src/presentation-hierarchies-react.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAGhG,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE,MAAM,6CAA6C,CAAC;AAE/F,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gEAAgE,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,4DAA4D,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACjH,OAAO,EAAE,qBAAqB,EAAE,MAAM,4DAA4D,CAAC;AACnG,OAAO,EAAE,0BAA0B,EAAE,MAAM,iEAAiE,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,iEAAiE,CAAC;AACpG,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAgB,MAAM,4DAA4D,CAAC;AAC1H,OAAO,EAAE,2BAA2B,EAAE,MAAM,mEAAmE,CAAC;AAEhH,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAqB,SAAS,EAAE,SAAS,EAAE,MAAM,iCAAiC,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 { GenericErrorInfo, PresentationHierarchyNode, ErrorInfo, ResultSetTooLargeErrorInfo } from \"./presentation-hierarchies-react/TreeNode.js\";\nexport { useSelectionHandler } from \"./presentation-hierarchies-react/UseSelectionHandler.js\";\nexport { useTree, useUnifiedSelectionTree } from \"./presentation-hierarchies-react/UseTree.js\";\nexport { HierarchyLevelDetails, TreeRendererProps } from \"./presentation-hierarchies-react/Renderers.js\";\nexport { useIModelTree, useIModelUnifiedSelectionTree } from \"./presentation-hierarchies-react/UseIModelTree.js\";\nexport { StrataKitTreeNodeRenderer } from \"./presentation-hierarchies-react/stratakit/TreeNodeRenderer.js\";\nexport { FilterAction } from \"./presentation-hierarchies-react/stratakit/FilterAction.js\";\nexport { RenameAction, RenameContextProvider } from \"./presentation-hierarchies-react/stratakit/RenameAction.js\";\nexport { StrataKitTreeRenderer } from \"./presentation-hierarchies-react/stratakit/TreeRenderer.js\";\nexport { StrataKitRootErrorRenderer } from \"./presentation-hierarchies-react/stratakit/RootErrorRenderer.js\";\nexport { TreeErrorRenderer } from \"./presentation-hierarchies-react/stratakit/TreeErrorRenderer.js\";\nexport { useFlatTreeItems, useErrorList, FlatTreeItem } from \"./presentation-hierarchies-react/stratakit/FlatTreeNode.js\";\nexport { LocalizationContextProvider } from \"./presentation-hierarchies-react/stratakit/LocalizationContext.js\";\n\nexport { GenericInstanceFilter, HierarchyNode, HierarchyProvider, getLogger, setLogger } from \"@itwin/presentation-hierarchies\";\nexport { SelectionStorage } from \"@itwin/unified-selection\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/presentation-hierarchies-react",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.30",
|
|
4
4
|
"description": "React components based on `@itwin/presentation-hierarchies`",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -37,66 +37,74 @@
|
|
|
37
37
|
"./package.json": "./package.json"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@itwin/core-bentley": "^
|
|
41
|
-
"@
|
|
40
|
+
"@itwin/core-bentley": "^5.0.0",
|
|
41
|
+
"@tanstack/react-virtual": "^3.13.0",
|
|
42
42
|
"classnames": "^2.5.1",
|
|
43
43
|
"immer": "^10.1.1",
|
|
44
44
|
"react-error-boundary": "^4.0.13",
|
|
45
45
|
"rxjs": "^7.8.1",
|
|
46
|
-
"@itwin/
|
|
47
|
-
"@itwin/
|
|
48
|
-
"@itwin/presentation-
|
|
46
|
+
"@itwin/unified-selection": "^1.5.1-alpha.0",
|
|
47
|
+
"@itwin/presentation-shared": "^2.0.0-alpha.1",
|
|
48
|
+
"@itwin/presentation-hierarchies": "^2.0.0-alpha.3"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
51
|
+
"@stratakit/bricks": "^0.3.3",
|
|
52
|
+
"@stratakit/foundations": "^0.2.2",
|
|
53
|
+
"@stratakit/structures": "^0.3.1",
|
|
54
|
+
"@stratakit/icons": "^0.1.0",
|
|
53
55
|
"react": "^17.0.0 || ^18.0.0",
|
|
54
56
|
"react-dom": "^17.0.0 || ^18.0.0"
|
|
55
57
|
},
|
|
56
58
|
"peerDependenciesMeta": {
|
|
57
|
-
"@
|
|
59
|
+
"@stratakit/bricks": {
|
|
58
60
|
"optional": true
|
|
59
61
|
},
|
|
60
|
-
"@
|
|
62
|
+
"@stratakit/foundations": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"@stratakit/structures": {
|
|
66
|
+
"optional": true
|
|
67
|
+
},
|
|
68
|
+
"@stratakit/icons": {
|
|
61
69
|
"optional": true
|
|
62
70
|
}
|
|
63
71
|
},
|
|
64
72
|
"devDependencies": {
|
|
65
|
-
"@itwin/build-tools": "^
|
|
66
|
-
"@itwin/
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"@
|
|
73
|
-
"@
|
|
73
|
+
"@itwin/build-tools": "^5.0.0",
|
|
74
|
+
"@itwin/eslint-plugin": "5.1.0",
|
|
75
|
+
"@stratakit/bricks": "^0.3.3",
|
|
76
|
+
"@stratakit/foundations": "^0.2.2",
|
|
77
|
+
"@stratakit/structures": "^0.3.1",
|
|
78
|
+
"@stratakit/icons": "^0.1.0",
|
|
79
|
+
"@testing-library/dom": "^10.4.0",
|
|
80
|
+
"@testing-library/react": "^16.2.0",
|
|
81
|
+
"@testing-library/user-event": "^14.6.1",
|
|
82
|
+
"@types/chai": "^5.2.0",
|
|
83
|
+
"@types/chai-as-promised": "^8.0.2",
|
|
74
84
|
"@types/jsdom": "^21.1.7",
|
|
75
|
-
"@types/mocha": "^10.0.
|
|
85
|
+
"@types/mocha": "^10.0.10",
|
|
86
|
+
"@types/node": "^22.13.9",
|
|
76
87
|
"@types/react": "^18.3.3",
|
|
77
88
|
"@types/react-dom": "^18.3.0",
|
|
78
|
-
"@types/sinon": "^17.0.
|
|
79
|
-
"@types/sinon-chai": "^
|
|
80
|
-
"c8": "^10.1.
|
|
81
|
-
"chai": "^
|
|
82
|
-
"chai-as-promised": "^
|
|
83
|
-
"chai-subset": "^1.6.0",
|
|
89
|
+
"@types/sinon": "^17.0.4",
|
|
90
|
+
"@types/sinon-chai": "^4.0.0",
|
|
91
|
+
"c8": "^10.1.3",
|
|
92
|
+
"chai": "^5.2.0",
|
|
93
|
+
"chai-as-promised": "^8.0.1",
|
|
84
94
|
"cpx2": "^7.0.1",
|
|
85
95
|
"cross-env": "^7.0.3",
|
|
86
|
-
"eslint": "^9.
|
|
87
|
-
"eslint-plugin-react": "^7.37.
|
|
88
|
-
"global-jsdom": "^
|
|
96
|
+
"eslint": "^9.25.1",
|
|
97
|
+
"eslint-plugin-react": "^7.37.4",
|
|
98
|
+
"global-jsdom": "^26.0.0",
|
|
89
99
|
"ignore-styles": "^5.0.1",
|
|
90
|
-
"jsdom": "^
|
|
91
|
-
"mocha": "^
|
|
100
|
+
"jsdom": "^26.0.0",
|
|
101
|
+
"mocha": "^11.1.0",
|
|
92
102
|
"react": "^18.3.1",
|
|
93
103
|
"react-dom": "^18.3.1",
|
|
94
104
|
"rimraf": "^6.0.1",
|
|
95
|
-
"sinon": "^
|
|
96
|
-
"sinon-chai": "^
|
|
97
|
-
"
|
|
98
|
-
"typescript": "~5.6.3",
|
|
99
|
-
"presentation-build-tools": "^0.0.0",
|
|
105
|
+
"sinon": "^19.0.4",
|
|
106
|
+
"sinon-chai": "^4.0.0",
|
|
107
|
+
"typescript": "~5.7.3",
|
|
100
108
|
"presentation-test-utilities": "^0.0.0"
|
|
101
109
|
},
|
|
102
110
|
"scripts": {
|
|
@@ -106,9 +114,9 @@
|
|
|
106
114
|
"clean": "rimraf lib build",
|
|
107
115
|
"cover": "c8 npm -s test",
|
|
108
116
|
"lint": "eslint ./src/**/*.{ts,tsx}",
|
|
109
|
-
"test:dev": "
|
|
117
|
+
"test:dev": "node --experimental-test-module-mocks --enable-source-maps --import presentation-test-utilities/node-hooks/ignore-styles ./node_modules/mocha/bin/mocha.js --config ./.mocharc.json",
|
|
110
118
|
"test": "npm run test:dev -- --parallel --jobs=4",
|
|
111
|
-
"extract-api": "betools extract-api --entry=lib/esm/presentation-hierarchies-react --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api",
|
|
119
|
+
"extract-api": "betools extract-api --entry=lib/esm/presentation-hierarchies-react --apiReportFolder=./api --apiReportTempFolder=./api/temp --apiSummaryFolder=./api --includeUnexportedApis",
|
|
112
120
|
"check-internal": "node ../../scripts/checkInternal.js --apiSummary ./api/presentation-hierarchies-react.api.md",
|
|
113
121
|
"update-extractions": "node ../../scripts/updateExtractions.js --targets=./README.md",
|
|
114
122
|
"check-extractions": "node ../../scripts/updateExtractions.js --targets=./README.md --check",
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
import { SelectionStorage } from "@itwin/unified-selection";
|
|
3
|
-
/**
|
|
4
|
-
* A React context provider that makes given selection storage available to all child components. This
|
|
5
|
-
* is a requirement for `useUnifiedSelectionTree` to work with unified selection.
|
|
6
|
-
*
|
|
7
|
-
* @public
|
|
8
|
-
* @deprecated in 1.5.0. Use `UnifiedSelectionContextProvider` from `@itwin/unified-selection-react` instead.
|
|
9
|
-
*/
|
|
10
|
-
export declare function UnifiedSelectionProvider({ storage, children }: PropsWithChildren<{
|
|
11
|
-
storage: SelectionStorage;
|
|
12
|
-
}>): import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
/** @internal */
|
|
14
|
-
export declare function useUnifiedSelectionStorage(): SelectionStorage | undefined;
|
|
15
|
-
//# sourceMappingURL=UnifiedSelectionContext.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UnifiedSelectionContext.d.ts","sourceRoot":"","sources":["../../../src/presentation-hierarchies-react/UnifiedSelectionContext.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAiB,iBAAiB,EAAc,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC;IAAE,OAAO,EAAE,gBAAgB,CAAA;CAAE,CAAC,2CAE/G;AAED,gBAAgB;AAChB,wBAAgB,0BAA0B,iCAEzC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import { createContext, useContext } from "react";
|
|
7
|
-
const deprecatedUnifiedSelectionContext = createContext(undefined);
|
|
8
|
-
/**
|
|
9
|
-
* A React context provider that makes given selection storage available to all child components. This
|
|
10
|
-
* is a requirement for `useUnifiedSelectionTree` to work with unified selection.
|
|
11
|
-
*
|
|
12
|
-
* @public
|
|
13
|
-
* @deprecated in 1.5.0. Use `UnifiedSelectionContextProvider` from `@itwin/unified-selection-react` instead.
|
|
14
|
-
*/
|
|
15
|
-
export function UnifiedSelectionProvider({ storage, children }) {
|
|
16
|
-
return _jsx(deprecatedUnifiedSelectionContext.Provider, { value: storage, children: children });
|
|
17
|
-
}
|
|
18
|
-
/** @internal */
|
|
19
|
-
export function useUnifiedSelectionStorage() {
|
|
20
|
-
return useContext(deprecatedUnifiedSelectionContext);
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=UnifiedSelectionContext.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UnifiedSelectionContext.js","sourceRoot":"","sources":["../../../src/presentation-hierarchies-react/UnifiedSelectionContext.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,aAAa,EAAqB,UAAU,EAAE,MAAM,OAAO,CAAC;AAGrE,MAAM,iCAAiC,GAAG,aAAa,CAA+B,SAAS,CAAC,CAAC;AAEjG;;;;;;GAMG;AACH,MAAM,UAAU,wBAAwB,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAoD;IAC9G,OAAO,KAAC,iCAAiC,CAAC,QAAQ,IAAC,KAAK,EAAE,OAAO,YAAG,QAAQ,GAA8C,CAAC;AAC7H,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,0BAA0B;IACxC,OAAO,UAAU,CAAC,iCAAiC,CAAC,CAAC;AACvD,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 { createContext, PropsWithChildren, useContext } from \"react\";\nimport { SelectionStorage } from \"@itwin/unified-selection\";\n\nconst deprecatedUnifiedSelectionContext = createContext<SelectionStorage | undefined>(undefined);\n\n/**\n * A React context provider that makes given selection storage available to all child components. This\n * is a requirement for `useUnifiedSelectionTree` to work with unified selection.\n *\n * @public\n * @deprecated in 1.5.0. Use `UnifiedSelectionContextProvider` from `@itwin/unified-selection-react` instead.\n */\nexport function UnifiedSelectionProvider({ storage, children }: PropsWithChildren<{ storage: SelectionStorage }>) {\n return <deprecatedUnifiedSelectionContext.Provider value={storage}>{children}</deprecatedUnifiedSelectionContext.Provider>;\n}\n\n/** @internal */\nexport function useUnifiedSelectionStorage() {\n return useContext(deprecatedUnifiedSelectionContext);\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationContext.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/LocalizationContext.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAiB,iBAAiB,EAAmC,MAAM,OAAO,CAAC;AAE1F;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;;OAGG;IACH,yBAAyB,EAAE,MAAM,CAAC;IAClC;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,gCAAgC,EAAE,MAAM,CAAC;IACzC;;;OAGG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,mCAAmC,EAAE,MAAM,CAAC;IAC5C;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gBAAgB;AAChB,MAAM,WAAW,mBAAmB;IAClC,gBAAgB,EAAE,gBAAgB,CAAC;CACpC;AAgBD;;;GAGG;AACH,UAAU,gCAAgC;IACxC,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;CAC9C;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,EAAE,gBAAgB,EAAE,QAAQ,EAAE,EAAE,iBAAiB,CAAC,gCAAgC,CAAC,2CAQ9H;AAED,gBAAgB;AAChB,wBAAgB,sBAAsB,wBAErC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationContext.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/LocalizationContext.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,aAAa,EAAqB,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA2D1F,MAAM,uBAAuB,GAAqB;IAChD,OAAO,EAAE,YAAY;IACrB,oBAAoB,EAAE,cAAc;IACpC,yBAAyB,EAAE,qBAAqB;IAChD,kBAAkB,EAAE,qCAAqC;IACzD,mBAAmB,EAAE,uDAAuD;IAC5E,gCAAgC,EAAE,0GAA0G;IAC5I,sBAAsB,EAAE,oEAAoE;IAC5F,mCAAmC,EAAE,wEAAwE;IAC7G,KAAK,EAAE,OAAO;CACf,CAAC;AAEF,MAAM,mBAAmB,GAAG,aAAa,CAAsB,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,CAAC,CAAC;AAW9G;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,EAAE,gBAAgB,EAAE,QAAQ,EAAuD;IAC7H,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,gBAAgB,EAAE,EAAE,GAAG,uBAAuB,EAAE,GAAG,gBAAgB,EAAE,EAAE,CAAC,CAAC;IAE9G,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,EAAE,gBAAgB,EAAE,EAAE,GAAG,uBAAuB,EAAE,GAAG,gBAAgB,EAAE,EAAE,CAAC,CAAC;IACtF,CAAC,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC;IAEvB,OAAO,KAAC,mBAAmB,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAgC,CAAC;AAC/F,CAAC;AAED,gBAAgB;AAChB,MAAM,UAAU,sBAAsB;IACpC,OAAO,UAAU,CAAC,mBAAmB,CAAC,CAAC;AACzC,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 { createContext, PropsWithChildren, useContext, useEffect, useState } from \"react\";\n\n/**\n * Localized strings used in the components.\n * @public\n */\nexport interface LocalizedStrings {\n /**\n * Message displayed when nodes are loading.\n * Default value: `Loading...`.\n */\n loading: string;\n /**\n * Title for apply hierarchy filter button.\n * Default value: `Apply filter`.\n */\n filterHierarchyLevel: string;\n /**\n * Title for clear hierarchy filter button.\n * Default value: `Clear active filter`.\n */\n clearHierarchyLevelFilter: string;\n /**\n * Message displayed when no nodes matching filter are found.\n * Default value: `No child nodes match current filter`.\n */\n noFilteredChildren: string;\n /**\n * Message displayed when result limit exceeds hierarchy size limit.\n * Default value: `There are more items than allowed limit of {{limit}}.`.\n */\n resultLimitExceeded: string;\n /**\n * Message displayed when result limit exceeds hierarchy size limit and hierarchy filtering is enabled.\n * Default value: `Please provide <link>additional filtering</link> - there are more items than allowed limit of {{limit}}.`.\n */\n resultLimitExceededWithFiltering: string;\n /**\n * Message displayed when hierarchy size limit can be overridden.\n * Default value: `<link>Increase the hierarchy level size limit to {{limit}}.</link>`.\n */\n increaseHierarchyLimit: string;\n /**\n * Message displayed when hierarchy size limit can be overridden and hierarchy filtering is enabled.\n * Default value: `Or, <link>increase the hierarchy level size limit to {{limit}}.</link>`.\n */\n increaseHierarchyLimitWithFiltering: string;\n /**\n * Label for retry action.\n * Default value: `Retry`.\n */\n retry: string;\n}\n\n/** @internal */\nexport interface LocalizationContext {\n localizedStrings: LocalizedStrings;\n}\n\nconst defaultLocalizedStrings: LocalizedStrings = {\n loading: \"Loading...\",\n filterHierarchyLevel: \"Apply filter\",\n clearHierarchyLevelFilter: \"Clear active filter\",\n noFilteredChildren: \"No child nodes match current filter\",\n resultLimitExceeded: \"There are more items than allowed limit of {{limit}}.\",\n resultLimitExceededWithFiltering: \"Please provide <link>additional filtering</link> - there are more items than allowed limit of {{limit}}.\",\n increaseHierarchyLimit: \"<link>Increase the hierarchy level size limit to {{limit}}.</link>\",\n increaseHierarchyLimitWithFiltering: \"Or, <link>increase the hierarchy level size limit to {{limit}}.</link>\",\n retry: \"Retry\",\n};\n\nconst localizationContext = createContext<LocalizationContext>({ localizedStrings: defaultLocalizedStrings });\n\n/**\n * Properties for `LocalizationContextProvider`.\n * @public\n */\ninterface LocalizationContextProviderProps {\n /** Localized strings used in the components. */\n localizedStrings?: Partial<LocalizedStrings>;\n}\n\n/**\n * Context provider for localized strings used in the components.\n * @public\n */\nexport function LocalizationContextProvider({ localizedStrings, children }: PropsWithChildren<LocalizationContextProviderProps>) {\n const [state, setState] = useState({ localizedStrings: { ...defaultLocalizedStrings, ...localizedStrings } });\n\n useEffect(() => {\n setState({ localizedStrings: { ...defaultLocalizedStrings, ...localizedStrings } });\n }, [localizedStrings]);\n\n return <localizationContext.Provider value={state}>{children}</localizationContext.Provider>;\n}\n\n/** @internal */\nexport function useLocalizationContext() {\n return useContext(localizationContext);\n}\n"]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import "./TreeActionButton.css";
|
|
2
|
-
import { PresentationHierarchyNode } from "../TreeNode.js";
|
|
3
|
-
import { HierarchyLevelDetails, useTree } from "../UseTree.js";
|
|
4
|
-
/** @alpha */
|
|
5
|
-
export interface TreeItemAction {
|
|
6
|
-
label: string;
|
|
7
|
-
action: () => void;
|
|
8
|
-
show: boolean;
|
|
9
|
-
icon?: string;
|
|
10
|
-
}
|
|
11
|
-
/** @alpha */
|
|
12
|
-
export type FilterActionProps = {
|
|
13
|
-
/** Action to perform when the filter button is clicked for this node. */
|
|
14
|
-
onFilter?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;
|
|
15
|
-
label: string;
|
|
16
|
-
} & Partial<Pick<ReturnType<typeof useTree>, "getHierarchyLevelDetails">>;
|
|
17
|
-
/** @internal */
|
|
18
|
-
export declare function TreeActionButton({ show, label, action, icon }: TreeItemAction): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
/** @alpha */
|
|
20
|
-
export declare function createFilterAction({ onFilter, getHierarchyLevelDetails, label }: FilterActionProps): (node: PresentationHierarchyNode) => TreeItemAction;
|
|
21
|
-
//# sourceMappingURL=TreeActionButton.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeActionButton.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeActionButton.tsx"],"names":[],"mappings":"AAKA,OAAO,wBAAwB,CAAC;AAEhC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAK/D,aAAa;AACb,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,aAAa;AACb,MAAM,MAAM,iBAAiB,GAAG;IAC9B,yEAAyE;IACzE,QAAQ,CAAC,EAAE,CAAC,qBAAqB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAElE,KAAK,EAAE,MAAM,CAAC;CACf,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAE1E,gBAAgB;AAChB,wBAAgB,gBAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,cAAc,2CAI7E;AAED,aAAa;AACb,wBAAgB,kBAAkB,CAAC,EAAE,QAAQ,EAAE,wBAAwB,EAAE,KAAK,EAAE,EAAE,iBAAiB,GAAG,CAAC,IAAI,EAAE,yBAAyB,KAAK,cAAc,CAaxJ"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import "./TreeActionButton.css";
|
|
7
|
-
import { IconButton } from "@itwin/itwinui-react/bricks";
|
|
8
|
-
const filterIcon = new URL("@itwin/itwinui-icons/filter.svg", import.meta.url).href;
|
|
9
|
-
const placeholderIcon = new URL("@itwin/itwinui-icons/placeholder.svg", import.meta.url).href; // TODO: active filter icon/placeholder icon if button was not given an icon
|
|
10
|
-
/** @internal */
|
|
11
|
-
export function TreeActionButton({ show, label, action, icon }) {
|
|
12
|
-
return (_jsx(IconButton, { className: `tree-action-item${!show ? "-invisible" : ""}`, variant: "ghost", onClick: action, label: label, icon: icon ?? placeholderIcon }));
|
|
13
|
-
}
|
|
14
|
-
/** @alpha */
|
|
15
|
-
export function createFilterAction({ onFilter, getHierarchyLevelDetails, label }) {
|
|
16
|
-
return (node) => {
|
|
17
|
-
return {
|
|
18
|
-
label,
|
|
19
|
-
action: () => {
|
|
20
|
-
const hierarchyLevelDetails = getHierarchyLevelDetails?.(node.id);
|
|
21
|
-
hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);
|
|
22
|
-
},
|
|
23
|
-
show: !!onFilter && node.isFilterable,
|
|
24
|
-
isDropdownAction: false,
|
|
25
|
-
icon: node.isFiltered ? placeholderIcon : filterIcon,
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=TreeActionButton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeActionButton.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeActionButton.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,wBAAwB,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAIzD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,iCAAiC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AACpF,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC,sCAAsC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,4EAA4E;AAkB3K,gBAAgB;AAChB,MAAM,UAAU,gBAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAkB;IAC5E,OAAO,CACL,KAAC,UAAU,IAAC,SAAS,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,IAAI,eAAe,GAAI,CAC1J,CAAC;AACJ,CAAC;AAED,aAAa;AACb,MAAM,UAAU,kBAAkB,CAAC,EAAE,QAAQ,EAAE,wBAAwB,EAAE,KAAK,EAAqB;IACjG,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,OAAO;YACL,KAAK;YACL,MAAM,EAAE,GAAG,EAAE;gBACX,MAAM,qBAAqB,GAAG,wBAAwB,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;gBAClE,qBAAqB,IAAI,QAAQ,EAAE,CAAC,qBAAqB,CAAC,CAAC;YAC7D,CAAC;YACD,IAAI,EAAE,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,YAAY;YACrC,gBAAgB,EAAE,KAAK;YACvB,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,UAAU;SACrD,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 \"./TreeActionButton.css\";\nimport { IconButton } from \"@itwin/itwinui-react/bricks\";\nimport { PresentationHierarchyNode } from \"../TreeNode.js\";\nimport { HierarchyLevelDetails, useTree } from \"../UseTree.js\";\n\nconst filterIcon = new URL(\"@itwin/itwinui-icons/filter.svg\", import.meta.url).href;\nconst placeholderIcon = new URL(\"@itwin/itwinui-icons/placeholder.svg\", import.meta.url).href; // TODO: active filter icon/placeholder icon if button was not given an icon\n\n/** @alpha */\nexport interface TreeItemAction {\n label: string;\n action: () => void;\n show: boolean;\n icon?: string;\n}\n\n/** @alpha */\nexport type FilterActionProps = {\n /** Action to perform when the filter button is clicked for this node. */\n onFilter?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;\n\n label: string;\n} & Partial<Pick<ReturnType<typeof useTree>, \"getHierarchyLevelDetails\">>;\n\n/** @internal */\nexport function TreeActionButton({ show, label, action, icon }: TreeItemAction) {\n return (\n <IconButton className={`tree-action-item${!show ? \"-invisible\" : \"\"}`} variant={\"ghost\"} onClick={action} label={label} icon={icon ?? placeholderIcon} />\n );\n}\n\n/** @alpha */\nexport function createFilterAction({ onFilter, getHierarchyLevelDetails, label }: FilterActionProps): (node: PresentationHierarchyNode) => TreeItemAction {\n return (node) => {\n return {\n label,\n action: () => {\n const hierarchyLevelDetails = getHierarchyLevelDetails?.(node.id);\n hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);\n },\n show: !!onFilter && node.isFilterable,\n isDropdownAction: false,\n icon: node.isFiltered ? placeholderIcon : filterIcon,\n };\n };\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { RefAttributes } from "react";
|
|
2
|
-
import { PresentationInfoNode } from "../TreeNode.js";
|
|
3
|
-
import { useTree } from "../UseTree.js";
|
|
4
|
-
import { TreeNodeRendererOwnProps } from "./TreeNodeRenderer.js";
|
|
5
|
-
interface TreeErrorRendererOwnProps {
|
|
6
|
-
node: PresentationInfoNode;
|
|
7
|
-
}
|
|
8
|
-
type TreeErrorRendererProps = TreeErrorRendererOwnProps & Pick<TreeNodeRendererOwnProps, "onFilterClick" | "reloadTree"> & Partial<Pick<ReturnType<typeof useTree>, "getHierarchyLevelDetails">>;
|
|
9
|
-
/** @alpha */
|
|
10
|
-
export declare const TreeErrorRenderer: React.ForwardRefExoticComponent<TreeErrorRendererProps & RefAttributes<HTMLDivElement>>;
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=TreeErrorRenderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeErrorRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeErrorRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAwC,aAAa,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,wBAAwB,EAAE,MAAM,uBAAuB,CAAC;AAEjE,UAAU,yBAAyB;IACjC,IAAI,EAAE,oBAAoB,CAAC;CAC5B;AAED,KAAK,sBAAsB,GAAG,yBAAyB,GACrD,IAAI,CAAC,wBAAwB,EAAE,eAAe,GAAG,YAAY,CAAC,GAC9D,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAExE,aAAa;AACb,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,yBAAyB,CAAC,sBAAsB,GAAG,aAAa,CAAC,cAAc,CAAC,CA4BrH,CAAC"}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import { forwardRef } from "react";
|
|
7
|
-
import { Anchor, Text, Tree } from "@itwin/itwinui-react/bricks";
|
|
8
|
-
import { MAX_LIMIT_OVERRIDE } from "../internal/Utils.js";
|
|
9
|
-
import { useLocalizationContext } from "./LocalizationContext.js";
|
|
10
|
-
/** @alpha */
|
|
11
|
-
export const TreeErrorRenderer = forwardRef(({ node, getHierarchyLevelDetails, onFilterClick, reloadTree }, forwardedRef) => {
|
|
12
|
-
const { localizedStrings } = useLocalizationContext();
|
|
13
|
-
if (node.type === "ResultSetTooLarge") {
|
|
14
|
-
return (_jsx(ResultSetTooLargeNode, { ref: forwardedRef, limit: node.resultSetSizeLimit, onOverrideLimit: getHierarchyLevelDetails ? (limit) => getHierarchyLevelDetails(node.parentNodeId)?.setSizeLimit(limit) : undefined, onFilterClick: onFilterClick
|
|
15
|
-
? () => {
|
|
16
|
-
const hierarchyLevelDetails = getHierarchyLevelDetails?.(node.parentNodeId);
|
|
17
|
-
hierarchyLevelDetails && onFilterClick(hierarchyLevelDetails);
|
|
18
|
-
}
|
|
19
|
-
: undefined }));
|
|
20
|
-
}
|
|
21
|
-
if (node.type === "NoFilterMatches") {
|
|
22
|
-
return _jsx(Tree.Item, { ref: forwardedRef, label: localizedStrings.noFilteredChildren, "aria-disabled": true });
|
|
23
|
-
}
|
|
24
|
-
const onRetry = reloadTree ? () => reloadTree({ parentNodeId: node.parentNodeId, state: "reset" }) : undefined;
|
|
25
|
-
return _jsx(Tree.Item, { ref: forwardedRef, label: _jsx(ErrorNodeLabel, { message: node.message, onRetry: onRetry }), "aria-disabled": true });
|
|
26
|
-
});
|
|
27
|
-
TreeErrorRenderer.displayName = "TreeErrorRenderer";
|
|
28
|
-
const ResultSetTooLargeNode = forwardRef(({ onFilterClick, onOverrideLimit, limit, ...props }, forwardedRef) => {
|
|
29
|
-
return (_jsx(Tree.Item, { ...props, ref: forwardedRef, className: "stateless-tree-node", label: _jsx(ResultSetTooLargeNodeLabel, { limit: limit, onFilterClick: onFilterClick, onOverrideLimit: onOverrideLimit }) }));
|
|
30
|
-
});
|
|
31
|
-
ResultSetTooLargeNode.displayName = "ResultSetTooLargeNode";
|
|
32
|
-
function ResultSetTooLargeNodeLabel({ onFilterClick, onOverrideLimit, limit }) {
|
|
33
|
-
const { localizedStrings } = useLocalizationContext();
|
|
34
|
-
const supportsFiltering = !!onFilterClick;
|
|
35
|
-
const supportsLimitOverride = !!onOverrideLimit && limit < MAX_LIMIT_OVERRIDE;
|
|
36
|
-
const limitExceededMessage = createLocalizedMessage(supportsFiltering ? localizedStrings.resultLimitExceededWithFiltering : localizedStrings.resultLimitExceeded, limit, onFilterClick);
|
|
37
|
-
const increaseLimitMessage = supportsLimitOverride
|
|
38
|
-
? createLocalizedMessage(supportsFiltering ? localizedStrings.increaseHierarchyLimitWithFiltering : localizedStrings.increaseHierarchyLimit, MAX_LIMIT_OVERRIDE, () => onOverrideLimit(MAX_LIMIT_OVERRIDE))
|
|
39
|
-
: { title: "", element: null };
|
|
40
|
-
const title = `${limitExceededMessage.title} ${increaseLimitMessage.title}`;
|
|
41
|
-
return (_jsxs("div", { style: { display: "flex", alignItems: "start" }, title: title, children: [limitExceededMessage.element, increaseLimitMessage.element] }));
|
|
42
|
-
}
|
|
43
|
-
function ErrorNodeLabel({ message, onRetry }) {
|
|
44
|
-
const { localizedStrings } = useLocalizationContext();
|
|
45
|
-
return (_jsxs("div", { style: { display: "flex" }, children: [_jsx(Text, { children: message }), onRetry ? _jsx(Anchor, { onClick: onRetry, children: localizedStrings?.retry }) : null] }));
|
|
46
|
-
}
|
|
47
|
-
function createLocalizedMessage(message, limit, onClick) {
|
|
48
|
-
const limitStr = limit.toLocaleString(undefined, { useGrouping: true });
|
|
49
|
-
const messageWithLimit = message.replace("{{limit}}", limitStr);
|
|
50
|
-
const exp = new RegExp("<link>(.*)</link>");
|
|
51
|
-
const match = messageWithLimit.match(exp);
|
|
52
|
-
if (!match) {
|
|
53
|
-
return {
|
|
54
|
-
title: messageWithLimit,
|
|
55
|
-
element: (_jsx("div", { style: { display: "flex" }, children: _jsx(Text, { children: messageWithLimit }) })),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
const [fullText, innerText] = match;
|
|
59
|
-
const [textBefore, textAfter] = messageWithLimit.split(fullText);
|
|
60
|
-
return {
|
|
61
|
-
title: messageWithLimit.replace(fullText, innerText),
|
|
62
|
-
element: (_jsxs("div", { style: { display: "flex" }, children: [textBefore ? _jsx(Text, { children: textBefore }) : null, _jsx(Anchor
|
|
63
|
-
// underline props does not exist in v5
|
|
64
|
-
, {
|
|
65
|
-
// underline props does not exist in v5
|
|
66
|
-
onClick: (e) => {
|
|
67
|
-
e.stopPropagation();
|
|
68
|
-
onClick?.();
|
|
69
|
-
}, children: innerText }), textAfter ? _jsx(Text, { children: textAfter }) : null] })),
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
//# sourceMappingURL=TreeErrorRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeErrorRenderer.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeErrorRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAA4B,UAAU,EAAiB,MAAM,OAAO,CAAC;AAC5E,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAWlE,aAAa;AACb,MAAM,CAAC,MAAM,iBAAiB,GAA4F,UAAU,CAClI,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,YAAY,EAAE,EAAE;IAC9E,MAAM,EAAE,gBAAgB,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACtD,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACtC,OAAO,CACL,KAAC,qBAAqB,IACpB,GAAG,EAAE,YAAY,EACjB,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAC9B,eAAe,EAAE,wBAAwB,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,wBAAwB,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,EACnI,aAAa,EACX,aAAa;gBACX,CAAC,CAAC,GAAG,EAAE;oBACH,MAAM,qBAAqB,GAAG,wBAAwB,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;oBAC5E,qBAAqB,IAAI,aAAa,CAAC,qBAAqB,CAAC,CAAC;gBAChE,CAAC;gBACH,CAAC,CAAC,SAAS,GAEf,CACH,CAAC;IACJ,CAAC;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACpC,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["/*---------------------------------------------------------------------------------------------\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 { ComponentPropsWithoutRef, forwardRef, RefAttributes } from \"react\";\nimport { Anchor, Text, Tree } from \"@itwin/itwinui-react/bricks\";\nimport { MAX_LIMIT_OVERRIDE } from \"../internal/Utils.js\";\nimport { PresentationInfoNode } from \"../TreeNode.js\";\nimport { useTree } from \"../UseTree.js\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\nimport { TreeNodeRendererOwnProps } from \"./TreeNodeRenderer.js\";\n\ninterface TreeErrorRendererOwnProps {\n node: PresentationInfoNode;\n}\n\ntype TreeErrorRendererProps = TreeErrorRendererOwnProps &\n Pick<TreeNodeRendererOwnProps, \"onFilterClick\" | \"reloadTree\"> &\n Partial<Pick<ReturnType<typeof useTree>, \"getHierarchyLevelDetails\">>;\n\n/** @alpha */\nexport const TreeErrorRenderer: React.ForwardRefExoticComponent<TreeErrorRendererProps & RefAttributes<HTMLDivElement>> = forwardRef(\n ({ node, getHierarchyLevelDetails, onFilterClick, reloadTree }, forwardedRef) => {\n const { localizedStrings } = useLocalizationContext();\n if (node.type === \"ResultSetTooLarge\") {\n return (\n <ResultSetTooLargeNode\n ref={forwardedRef}\n limit={node.resultSetSizeLimit}\n onOverrideLimit={getHierarchyLevelDetails ? (limit) => getHierarchyLevelDetails(node.parentNodeId)?.setSizeLimit(limit) : undefined}\n onFilterClick={\n onFilterClick\n ? () => {\n const hierarchyLevelDetails = getHierarchyLevelDetails?.(node.parentNodeId);\n hierarchyLevelDetails && onFilterClick(hierarchyLevelDetails);\n }\n : undefined\n }\n />\n );\n }\n\n if (node.type === \"NoFilterMatches\") {\n return <Tree.Item ref={forwardedRef} label={localizedStrings.noFilteredChildren} aria-disabled={true} />;\n }\n\n const onRetry = reloadTree ? () => reloadTree({ parentNodeId: node.parentNodeId, state: \"reset\" }) : undefined;\n return <Tree.Item ref={forwardedRef} label={<ErrorNodeLabel message={node.message} onRetry={onRetry} />} aria-disabled={true} />;\n },\n);\nTreeErrorRenderer.displayName = \"TreeErrorRenderer\";\n\nconst ResultSetTooLargeNode = forwardRef<\n HTMLDivElement,\n Omit<ComponentPropsWithoutRef<typeof Tree.Item>, \"onExpanded\" | \"label\"> & ResultSetTooLargeNodeLabelProps\n>(({ onFilterClick, onOverrideLimit, limit, ...props }, forwardedRef) => {\n return (\n <Tree.Item\n {...props}\n ref={forwardedRef}\n className=\"stateless-tree-node\"\n label={<ResultSetTooLargeNodeLabel limit={limit} onFilterClick={onFilterClick} onOverrideLimit={onOverrideLimit} />}\n />\n );\n});\nResultSetTooLargeNode.displayName = \"ResultSetTooLargeNode\";\n\ninterface ResultSetTooLargeNodeLabelProps {\n limit: number;\n onFilterClick?: () => void;\n onOverrideLimit?: (limit: number) => void;\n}\n\nfunction ResultSetTooLargeNodeLabel({ onFilterClick, onOverrideLimit, limit }: ResultSetTooLargeNodeLabelProps) {\n const { localizedStrings } = useLocalizationContext();\n const supportsFiltering = !!onFilterClick;\n const supportsLimitOverride = !!onOverrideLimit && limit < MAX_LIMIT_OVERRIDE;\n\n const limitExceededMessage = createLocalizedMessage(\n supportsFiltering ? localizedStrings.resultLimitExceededWithFiltering : localizedStrings.resultLimitExceeded,\n limit,\n onFilterClick,\n );\n const increaseLimitMessage = supportsLimitOverride\n ? createLocalizedMessage(\n supportsFiltering ? localizedStrings.increaseHierarchyLimitWithFiltering : localizedStrings.increaseHierarchyLimit,\n MAX_LIMIT_OVERRIDE,\n () => onOverrideLimit(MAX_LIMIT_OVERRIDE),\n )\n : { title: \"\", element: null };\n\n const title = `${limitExceededMessage.title} ${increaseLimitMessage.title}`;\n\n return (\n <div style={{ display: \"flex\", alignItems: \"start\" }} title={title}>\n {limitExceededMessage.element}\n {increaseLimitMessage.element}\n </div>\n );\n}\n\nfunction ErrorNodeLabel({ message, onRetry }: { message: string; onRetry?: () => void }) {\n const { localizedStrings } = useLocalizationContext();\n return (\n <div style={{ display: \"flex\" }}>\n <Text>{message}</Text>\n {onRetry ? <Anchor onClick={onRetry}>{localizedStrings?.retry}</Anchor> : null}\n </div>\n );\n}\n\nfunction createLocalizedMessage(message: string, limit: number, onClick?: () => void) {\n const limitStr = limit.toLocaleString(undefined, { useGrouping: true });\n const messageWithLimit = message.replace(\"{{limit}}\", limitStr);\n const exp = new RegExp(\"<link>(.*)</link>\");\n const match = messageWithLimit.match(exp);\n\n if (!match) {\n return {\n title: messageWithLimit,\n element: (\n <div style={{ display: \"flex\" }}>\n <Text>{messageWithLimit}</Text>\n </div>\n ),\n };\n }\n\n const [fullText, innerText] = match;\n const [textBefore, textAfter] = messageWithLimit.split(fullText);\n\n return {\n title: messageWithLimit.replace(fullText, innerText),\n element: (\n <div style={{ display: \"flex\" }}>\n {textBefore ? <Text>{textBefore}</Text> : null}\n <Anchor\n // underline props does not exist in v5\n onClick={(e) => {\n e.stopPropagation();\n onClick?.();\n }}\n >\n {innerText}\n </Anchor>\n {textAfter ? <Text>{textAfter}</Text> : null}\n </div>\n ),\n };\n}\n"]}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ReactElement } from "react";
|
|
2
|
-
import { PresentationTreeNode } from "../TreeNode.js";
|
|
3
|
-
import { useTree } from "../UseTree.js";
|
|
4
|
-
import { TreeNodeRendererProps } from "./TreeRenderer.js";
|
|
5
|
-
type TreeNodesRendererProps = Omit<TreeNodeRendererProps, "node"> & Partial<Pick<ReturnType<typeof useTree>, "isNodeSelected">> & TreeLevelRendererOwnProps;
|
|
6
|
-
interface TreeLevelRendererOwnProps {
|
|
7
|
-
nodes: PresentationTreeNode[];
|
|
8
|
-
}
|
|
9
|
-
/** @alpha */
|
|
10
|
-
export declare const TreeLevelRenderer: ({ nodes, isNodeSelected, ...rest }: TreeNodesRendererProps) => ReactElement[];
|
|
11
|
-
export {};
|
|
12
|
-
//# sourceMappingURL=TreeLevelRenderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeLevelRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeLevelRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAA0D,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC9G,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,KAAK,sBAAsB,GAAG,IAAI,CAAC,qBAAqB,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC,GAAG,yBAAyB,CAAC;AAE5J,UAAU,yBAAyB;IACjC,KAAK,EAAE,oBAAoB,EAAE,CAAC;CAC/B;AAED,aAAa;AACb,eAAO,MAAM,iBAAiB,uCAAwC,sBAAsB,KAAG,YAAY,EAKvG,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { createElement as _createElement } from "react";
|
|
3
|
-
import { isPresentationHierarchyNode } from "../TreeNode.js";
|
|
4
|
-
import { TreeNodeRenderer } from "./TreeNodeRenderer.js";
|
|
5
|
-
/** @alpha */
|
|
6
|
-
export const TreeLevelRenderer = ({ nodes, isNodeSelected, ...rest }) => nodes.map((node) => (_createElement(TreeNodeRenderer, { ...rest, node: node, key: node.id, selected: isNodeSelected?.(node.id) }, renderChildren(node) && _jsx(TreeLevelRenderer, { ...rest, nodes: node.children, isNodeSelected: isNodeSelected }))));
|
|
7
|
-
function renderChildren(node) {
|
|
8
|
-
return isPresentationHierarchyNode(node) && node.children !== true && node.isExpanded === true;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=TreeLevelRenderer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeLevelRenderer.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeLevelRenderer.tsx"],"names":[],"mappings":";;AAMA,OAAO,EAAE,2BAA2B,EAAmD,MAAM,gBAAgB,CAAC;AAE9G,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AASzD,aAAa;AACb,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,EAA0B,EAAkB,EAAE,CAC9G,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAClB,eAAC,gBAAgB,OAAK,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,IACtF,cAAc,CAAC,IAAI,CAAC,IAAI,KAAC,iBAAiB,OAAK,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,EAAE,cAAc,EAAE,cAAc,GAAI,CAC7F,CACpB,CAAC,CAAC;AAEL,SAAS,cAAc,CAAC,IAA0B;IAChD,OAAO,2BAA2B,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,CAAC;AACjG,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 { ReactElement } from \"react\";\nimport { isPresentationHierarchyNode, PresentationHierarchyNode, PresentationTreeNode } from \"../TreeNode.js\";\nimport { useTree } from \"../UseTree.js\";\nimport { TreeNodeRenderer } from \"./TreeNodeRenderer.js\";\nimport { TreeNodeRendererProps } from \"./TreeRenderer.js\";\n\ntype TreeNodesRendererProps = Omit<TreeNodeRendererProps, \"node\"> & Partial<Pick<ReturnType<typeof useTree>, \"isNodeSelected\">> & TreeLevelRendererOwnProps;\n\ninterface TreeLevelRendererOwnProps {\n nodes: PresentationTreeNode[];\n}\n\n/** @alpha */\nexport const TreeLevelRenderer = ({ nodes, isNodeSelected, ...rest }: TreeNodesRendererProps): ReactElement[] =>\n nodes.map((node) => (\n <TreeNodeRenderer {...rest} node={node} key={node.id} selected={isNodeSelected?.(node.id)}>\n {renderChildren(node) && <TreeLevelRenderer {...rest} nodes={node.children} isNodeSelected={isNodeSelected} />}\n </TreeNodeRenderer>\n ));\n\nfunction renderChildren(node: PresentationTreeNode): node is PresentationHierarchyNode & { children: PresentationTreeNode[] } {\n return isPresentationHierarchyNode(node) && node.children !== true && node.isExpanded === true;\n}\n"]}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactElement, RefAttributes } from "react";
|
|
2
|
-
import { Tree } from "@itwin/itwinui-react/bricks";
|
|
3
|
-
import { PresentationHierarchyNode, PresentationTreeNode } from "../TreeNode.js";
|
|
4
|
-
import { HierarchyLevelDetails, useTree } from "../UseTree.js";
|
|
5
|
-
import { TreeItemAction } from "./TreeActionButton.js";
|
|
6
|
-
/** @alpha */
|
|
7
|
-
type TreeNodeProps = Omit<ComponentPropsWithoutRef<typeof Tree.Item>, "actions">;
|
|
8
|
-
/** @alpha */
|
|
9
|
-
export interface TreeNodeRendererOwnProps {
|
|
10
|
-
/** Node that is rendered. */
|
|
11
|
-
node: PresentationTreeNode;
|
|
12
|
-
/** Action to perform when the filter button is clicked for this node. */
|
|
13
|
-
onFilterClick?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;
|
|
14
|
-
/** Returns an icon or icon href for a given node. */
|
|
15
|
-
getIcon?: (node: PresentationHierarchyNode) => string | ReactElement | undefined;
|
|
16
|
-
/** Returns a label for a given node. */
|
|
17
|
-
getLabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
18
|
-
/** Returns sublabel for a given node. */
|
|
19
|
-
getSublabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
20
|
-
/** Action to perform when the node is clicked. */
|
|
21
|
-
onNodeClick?: (node: PresentationHierarchyNode, isSelected: boolean, event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
22
|
-
/** Action to perform when a key is pressed when the node is hovered on. */
|
|
23
|
-
onNodeKeyDown?: (node: PresentationHierarchyNode, isSelected: boolean, event: React.KeyboardEvent<HTMLElement>) => void;
|
|
24
|
-
/** A callback to reload a hierarchy level when an error occurs and `retry` button is clicked. */
|
|
25
|
-
reloadTree?: (options: {
|
|
26
|
-
parentNodeId: string | undefined;
|
|
27
|
-
state: "reset";
|
|
28
|
-
}) => void;
|
|
29
|
-
/**
|
|
30
|
-
* Actions for tree item.
|
|
31
|
-
*/
|
|
32
|
-
actions?: Array<(node: PresentationHierarchyNode) => TreeItemAction>;
|
|
33
|
-
}
|
|
34
|
-
/** @alpha */
|
|
35
|
-
type TreeNodeRendererProps = Pick<ReturnType<typeof useTree>, "expandNode"> & Partial<Pick<ReturnType<typeof useTree>, "getHierarchyLevelDetails">> & Omit<TreeNodeProps, "label" | "icon"> & TreeNodeRendererOwnProps;
|
|
36
|
-
/**
|
|
37
|
-
* A component that renders `RenderedTreeNode` using the `TreeNode` component from `@itwin/itwinui-react`.
|
|
38
|
-
*
|
|
39
|
-
* @see `TreeRenderer`
|
|
40
|
-
* @see https://itwinui.bentley.com/docs/tree
|
|
41
|
-
* @public
|
|
42
|
-
*/
|
|
43
|
-
export declare const TreeNodeRenderer: React.ForwardRefExoticComponent<TreeNodeRendererProps & RefAttributes<HTMLDivElement>>;
|
|
44
|
-
export {};
|
|
45
|
-
//# sourceMappingURL=TreeNodeRenderer.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeNodeRenderer.tsx"],"names":[],"mappings":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