@itwin/presentation-hierarchies-react 2.0.0-alpha.4 → 2.0.0-alpha.41
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 +693 -7
- package/README.md +25 -27
- 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/Renderers.js +6 -0
- package/lib/esm/presentation-hierarchies-react/Renderers.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +27 -28
- 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/UseNodeHighlighting.d.ts +24 -0
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js +52 -0
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -0
- 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 +29 -33
- 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/internal/Utils.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts +26 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +75 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.d.ts +19 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FilterAction.js +23 -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 +77 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +123 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/{itwinui → stratakit}/LocalizationContext.js +15 -5
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.d.ts +21 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/RenameAction.js +36 -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/TreeAction.d.ts +45 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js +36 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +47 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +28 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +56 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +147 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +70 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js +116 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react.d.ts +15 -9
- package/lib/esm/presentation-hierarchies-react.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react.js +12 -8
- package/lib/esm/presentation-hierarchies-react.js.map +1 -1
- package/package.json +55 -47
- 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/FlatTreeNode.d.ts +0 -20
- package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js +0 -30
- package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts +0 -73
- 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 -25
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js +0 -40
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts +0 -13
- 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/TreeNodeRenderer.d.ts +0 -46
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js +0 -80
- 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 -30
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js.map +0 -1
|
@@ -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,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAC9F,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,cAAc,EAAE,wBAAwB,EAAE,MAAM,0DAA0D,CAAC;AACpH,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,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,15 +2,19 @@
|
|
|
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";
|
|
7
|
+
export { useNodeHighlighting } from "./presentation-hierarchies-react/UseNodeHighlighting.js";
|
|
9
8
|
export { useIModelTree, useIModelUnifiedSelectionTree } from "./presentation-hierarchies-react/UseIModelTree.js";
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
9
|
+
export { StrataKitTreeNodeRenderer } from "./presentation-hierarchies-react/stratakit/TreeNodeRenderer.js";
|
|
10
|
+
export { TreeActionBase } from "./presentation-hierarchies-react/stratakit/TreeAction.js";
|
|
11
|
+
export { FilterAction } from "./presentation-hierarchies-react/stratakit/FilterAction.js";
|
|
12
|
+
export { RenameAction, RenameContextProvider } from "./presentation-hierarchies-react/stratakit/RenameAction.js";
|
|
13
|
+
export { StrataKitTreeRenderer } from "./presentation-hierarchies-react/stratakit/TreeRenderer.js";
|
|
14
|
+
export { StrataKitRootErrorRenderer } from "./presentation-hierarchies-react/stratakit/RootErrorRenderer.js";
|
|
15
|
+
export { TreeErrorRenderer } from "./presentation-hierarchies-react/stratakit/TreeErrorRenderer.js";
|
|
16
|
+
export { ErrorItemRenderer } from "./presentation-hierarchies-react/stratakit/ErrorItemRenderer.js";
|
|
17
|
+
export { useFlatTreeItems, useErrorList } from "./presentation-hierarchies-react/stratakit/FlatTreeNode.js";
|
|
18
|
+
export { LocalizationContextProvider } from "./presentation-hierarchies-react/stratakit/LocalizationContext.js";
|
|
19
|
+
export { GenericInstanceFilter, HierarchyNode, getLogger, setLogger } from "@itwin/presentation-hierarchies";
|
|
16
20
|
//# 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;AAC/F,OAAO,EAAE,mBAAmB,EAAE,MAAM,yDAAyD,CAAC;AAE9F,OAAO,EAAE,aAAa,EAAE,6BAA6B,EAAE,MAAM,mDAAmD,CAAC;AACjH,OAAO,EAAE,yBAAyB,EAAE,MAAM,gEAAgE,CAAC;AAC3G,OAAO,EAAE,cAAc,EAA4B,MAAM,0DAA0D,CAAC;AACpH,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,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 { useNodeHighlighting } from \"./presentation-hierarchies-react/UseNodeHighlighting.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 { TreeActionBase, TreeActionBaseAttributes } from \"./presentation-hierarchies-react/stratakit/TreeAction.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 { ErrorItemRenderer } from \"./presentation-hierarchies-react/stratakit/ErrorItemRenderer.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.41",
|
|
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.3.2",
|
|
41
|
+
"@tanstack/react-virtual": "^3.13.12",
|
|
42
42
|
"classnames": "^2.5.1",
|
|
43
|
-
"immer": "^10.
|
|
44
|
-
"react-error-boundary": "^4.
|
|
45
|
-
"rxjs": "^7.8.
|
|
46
|
-
"@itwin/presentation-
|
|
47
|
-
"@itwin/unified-selection": "^1.
|
|
48
|
-
"@itwin/presentation-
|
|
43
|
+
"immer": "^10.2.0",
|
|
44
|
+
"react-error-boundary": "^4.1.2",
|
|
45
|
+
"rxjs": "^7.8.2",
|
|
46
|
+
"@itwin/presentation-shared": "^2.0.0-alpha.3",
|
|
47
|
+
"@itwin/unified-selection": "^1.6.2-alpha.0",
|
|
48
|
+
"@itwin/presentation-hierarchies": "^2.0.0-alpha.5"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
54
|
-
"
|
|
51
|
+
"@stratakit/bricks": "^0.5",
|
|
52
|
+
"@stratakit/foundations": "^0.4",
|
|
53
|
+
"@stratakit/icons": "^0.2",
|
|
54
|
+
"@stratakit/structures": "^0.5",
|
|
55
|
+
"react": "^17.0 || ^18.0",
|
|
56
|
+
"react-dom": "^17.0 || ^18.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.3.2",
|
|
74
|
+
"@itwin/eslint-plugin": "5.1.0",
|
|
75
|
+
"@stratakit/bricks": "^0.5.1",
|
|
76
|
+
"@stratakit/foundations": "^0.4.1",
|
|
77
|
+
"@stratakit/icons": "^0.2.1",
|
|
78
|
+
"@stratakit/structures": "^0.5.1",
|
|
79
|
+
"@testing-library/dom": "^10.4.1",
|
|
80
|
+
"@testing-library/react": "^16.3.0",
|
|
81
|
+
"@testing-library/user-event": "^14.6.1",
|
|
82
|
+
"@types/chai": "^5.2.3",
|
|
83
|
+
"@types/chai-as-promised": "^8.0.2",
|
|
74
84
|
"@types/jsdom": "^21.1.7",
|
|
75
|
-
"@types/mocha": "^10.0.
|
|
76
|
-
"@types/
|
|
77
|
-
"@types/react
|
|
78
|
-
"@types/
|
|
79
|
-
"@types/sinon
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"chai
|
|
83
|
-
"chai-
|
|
84
|
-
"cpx2": "^7.0.
|
|
85
|
+
"@types/mocha": "^10.0.10",
|
|
86
|
+
"@types/node": "^22.19.1",
|
|
87
|
+
"@types/react": "^18.3.27",
|
|
88
|
+
"@types/react-dom": "^18.3.7",
|
|
89
|
+
"@types/sinon": "^17.0.4",
|
|
90
|
+
"@types/sinon-chai": "^4.0.0",
|
|
91
|
+
"c8": "^10.1.3",
|
|
92
|
+
"chai": "^5.3.3",
|
|
93
|
+
"chai-as-promised": "^8.0.2",
|
|
94
|
+
"cpx2": "^7.0.2",
|
|
85
95
|
"cross-env": "^7.0.3",
|
|
86
|
-
"eslint": "^9.
|
|
87
|
-
"eslint-plugin-react": "^7.37.
|
|
88
|
-
"global-jsdom": "^
|
|
96
|
+
"eslint": "^9.39.1",
|
|
97
|
+
"eslint-plugin-react": "^7.37.5",
|
|
98
|
+
"global-jsdom": "^26.0.0",
|
|
89
99
|
"ignore-styles": "^5.0.1",
|
|
90
|
-
"jsdom": "^
|
|
91
|
-
"mocha": "^
|
|
100
|
+
"jsdom": "^26.1.0",
|
|
101
|
+
"mocha": "^11.7.5",
|
|
92
102
|
"react": "^18.3.1",
|
|
93
103
|
"react-dom": "^18.3.1",
|
|
94
|
-
"rimraf": "^6.0
|
|
95
|
-
"sinon": "^
|
|
96
|
-
"sinon-chai": "^
|
|
97
|
-
"
|
|
98
|
-
"typescript": "~5.6.3",
|
|
99
|
-
"presentation-build-tools": "^0.0.0",
|
|
104
|
+
"rimraf": "^6.1.0",
|
|
105
|
+
"sinon": "^19.0.5",
|
|
106
|
+
"sinon-chai": "^4.0.1",
|
|
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,20 +0,0 @@
|
|
|
1
|
-
import { PresentationTreeNode } from "../TreeNode.js";
|
|
2
|
-
interface PlaceholderNode {
|
|
3
|
-
id: string;
|
|
4
|
-
level: number;
|
|
5
|
-
placeholder: true;
|
|
6
|
-
}
|
|
7
|
-
/** @internal */
|
|
8
|
-
export type FlatNode<TNode extends PresentationTreeNode = PresentationTreeNode> = {
|
|
9
|
-
level: number;
|
|
10
|
-
levelSize: number;
|
|
11
|
-
posInLevel: number;
|
|
12
|
-
} & TNode;
|
|
13
|
-
/** @alpha */
|
|
14
|
-
export type FlatTreeNode<TNode extends PresentationTreeNode = PresentationTreeNode> = FlatNode<TNode> | PlaceholderNode;
|
|
15
|
-
/** @alpha */
|
|
16
|
-
export declare function isPlaceholderNode(node: FlatTreeNode): node is PlaceholderNode;
|
|
17
|
-
/** @alpha */
|
|
18
|
-
export declare function flattenNodes(rootNodes: PresentationTreeNode[]): FlatTreeNode<PresentationTreeNode>[];
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=FlatTreeNode.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlatTreeNode.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/FlatTreeNode.ts"],"names":[],"mappings":"AAKA,OAAO,EAA+B,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAEnF,UAAU,eAAe;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,IAAI,CAAC;CACnB;AAED,gBAAgB;AAChB,MAAM,MAAM,QAAQ,CAAC,KAAK,SAAS,oBAAoB,GAAG,oBAAoB,IAAI;IAChF,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;CACpB,GAAG,KAAK,CAAC;AAEV,aAAa;AACb,MAAM,MAAM,YAAY,CAAC,KAAK,SAAS,oBAAoB,GAAG,oBAAoB,IAAI,QAAQ,CAAC,KAAK,CAAC,GAAG,eAAe,CAAC;AAExH,aAAa;AACb,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI,IAAI,eAAe,CAE7E;AAED,aAAa;AACb,wBAAgB,YAAY,CAAC,SAAS,EAAE,oBAAoB,EAAE,wCAE7D"}
|
|
@@ -1,30 +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
|
-
import { isPresentationHierarchyNode } from "../TreeNode.js";
|
|
6
|
-
/** @alpha */
|
|
7
|
-
export function isPlaceholderNode(node) {
|
|
8
|
-
return "placeholder" in node;
|
|
9
|
-
}
|
|
10
|
-
/** @alpha */
|
|
11
|
-
export function flattenNodes(rootNodes) {
|
|
12
|
-
return getFlatNodes(rootNodes, 0);
|
|
13
|
-
}
|
|
14
|
-
function getFlatNodes(nodes, level) {
|
|
15
|
-
const flatNodes = [];
|
|
16
|
-
nodes.forEach((node, index) => {
|
|
17
|
-
flatNodes.push({ ...node, level, levelSize: nodes.length, posInLevel: index + 1 });
|
|
18
|
-
if (!isPresentationHierarchyNode(node) || !node.isExpanded) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
if (node.children !== true) {
|
|
22
|
-
const childNodes = getFlatNodes(node.children, level + 1);
|
|
23
|
-
flatNodes.push(...childNodes);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
flatNodes.push({ id: `${node.id}-children-placeholder`, level: level + 1, placeholder: true });
|
|
27
|
-
});
|
|
28
|
-
return flatNodes;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=FlatTreeNode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FlatTreeNode.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/FlatTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,2BAA2B,EAAwB,MAAM,gBAAgB,CAAC;AAkBnF,aAAa;AACb,MAAM,UAAU,iBAAiB,CAAC,IAAkB;IAClD,OAAO,aAAa,IAAI,IAAI,CAAC;AAC/B,CAAC;AAED,aAAa;AACb,MAAM,UAAU,YAAY,CAAC,SAAiC;IAC5D,OAAO,YAAY,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,YAAY,CAAC,KAA6B,EAAE,KAAa;IAChE,MAAM,SAAS,GAAmB,EAAE,CAAC;IACrC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;QAC5B,SAAS,CAAC,IAAI,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,EAAE,UAAU,EAAE,KAAK,GAAG,CAAC,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,CAAC;YAC3D,OAAO;QACT,CAAC;QACD,IAAI,IAAI,CAAC,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC3B,MAAM,UAAU,GAAG,YAAY,CAAC,IAAI,CAAC,QAAQ,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC;YAC1D,SAAS,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,CAAC;YAC9B,OAAO;QACT,CAAC;QAED,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,GAAG,IAAI,CAAC,EAAE,uBAAuB,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,WAAW,EAAE,IAAI,EAA4B,CAAC,CAAC;IAC3H,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { isPresentationHierarchyNode, PresentationTreeNode } from \"../TreeNode.js\";\n\ninterface PlaceholderNode {\n id: string;\n level: number;\n placeholder: true;\n}\n\n/** @internal */\nexport type FlatNode<TNode extends PresentationTreeNode = PresentationTreeNode> = {\n level: number;\n levelSize: number;\n posInLevel: number;\n} & TNode;\n\n/** @alpha */\nexport type FlatTreeNode<TNode extends PresentationTreeNode = PresentationTreeNode> = FlatNode<TNode> | PlaceholderNode;\n\n/** @alpha */\nexport function isPlaceholderNode(node: FlatTreeNode): node is PlaceholderNode {\n return \"placeholder\" in node;\n}\n\n/** @alpha */\nexport function flattenNodes(rootNodes: PresentationTreeNode[]) {\n return getFlatNodes(rootNodes, 0);\n}\n\nfunction getFlatNodes(nodes: PresentationTreeNode[], level: number) {\n const flatNodes: FlatTreeNode[] = [];\n nodes.forEach((node, index) => {\n flatNodes.push({ ...node, level, levelSize: nodes.length, posInLevel: index + 1 });\n if (!isPresentationHierarchyNode(node) || !node.isExpanded) {\n return;\n }\n if (node.children !== true) {\n const childNodes = getFlatNodes(node.children, level + 1);\n flatNodes.push(...childNodes);\n return;\n }\n\n flatNodes.push({ id: `${node.id}-children-placeholder`, level: level + 1, placeholder: true } satisfies PlaceholderNode);\n });\n return flatNodes;\n}\n"]}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
|
-
/**
|
|
3
|
-
* Localized strings used in the components.
|
|
4
|
-
* @public
|
|
5
|
-
*/
|
|
6
|
-
export interface LocalizedStrings {
|
|
7
|
-
/**
|
|
8
|
-
* Message displayed when nodes are loading.
|
|
9
|
-
* Default value: `Loading...`.
|
|
10
|
-
*/
|
|
11
|
-
loading: string;
|
|
12
|
-
/**
|
|
13
|
-
* Title for apply hierarchy filter button.
|
|
14
|
-
* Default value: `Apply filter`.
|
|
15
|
-
*/
|
|
16
|
-
filterHierarchyLevel: string;
|
|
17
|
-
/**
|
|
18
|
-
* Title for clear hierarchy filter button.
|
|
19
|
-
* Default value: `Clear active filter`.
|
|
20
|
-
*/
|
|
21
|
-
clearHierarchyLevelFilter: string;
|
|
22
|
-
/**
|
|
23
|
-
* Message displayed when no nodes matching filter are found.
|
|
24
|
-
* Default value: `No child nodes match current filter`.
|
|
25
|
-
*/
|
|
26
|
-
noFilteredChildren: string;
|
|
27
|
-
/**
|
|
28
|
-
* Message displayed when result limit exceeds hierarchy size limit.
|
|
29
|
-
* Default value: `There are more items than allowed limit of {{limit}}.`.
|
|
30
|
-
*/
|
|
31
|
-
resultLimitExceeded: string;
|
|
32
|
-
/**
|
|
33
|
-
* Message displayed when result limit exceeds hierarchy size limit and hierarchy filtering is enabled.
|
|
34
|
-
* Default value: `Please provide <link>additional filtering</link> - there are more items than allowed limit of {{limit}}.`.
|
|
35
|
-
*/
|
|
36
|
-
resultLimitExceededWithFiltering: string;
|
|
37
|
-
/**
|
|
38
|
-
* Message displayed when hierarchy size limit can be overridden.
|
|
39
|
-
* Default value: `<link>Increase the hierarchy level size limit to {{limit}}.</link>`.
|
|
40
|
-
*/
|
|
41
|
-
increaseHierarchyLimit: string;
|
|
42
|
-
/**
|
|
43
|
-
* Message displayed when hierarchy size limit can be overridden and hierarchy filtering is enabled.
|
|
44
|
-
* Default value: `Or, <link>increase the hierarchy level size limit to {{limit}}.</link>`.
|
|
45
|
-
*/
|
|
46
|
-
increaseHierarchyLimitWithFiltering: string;
|
|
47
|
-
/**
|
|
48
|
-
* Label for retry action.
|
|
49
|
-
* Default value: `Retry`.
|
|
50
|
-
*/
|
|
51
|
-
retry: string;
|
|
52
|
-
}
|
|
53
|
-
/** @internal */
|
|
54
|
-
export interface LocalizationContext {
|
|
55
|
-
localizedStrings: LocalizedStrings;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Properties for `LocalizationContextProvider`.
|
|
59
|
-
* @public
|
|
60
|
-
*/
|
|
61
|
-
interface LocalizationContextProviderProps {
|
|
62
|
-
/** Localized strings used in the components. */
|
|
63
|
-
localizedStrings?: Partial<LocalizedStrings>;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Context provider for localized strings used in the components.
|
|
67
|
-
* @public
|
|
68
|
-
*/
|
|
69
|
-
export declare function LocalizationContextProvider({ localizedStrings, children }: PropsWithChildren<LocalizationContextProviderProps>): import("react/jsx-runtime").JSX.Element;
|
|
70
|
-
/** @internal */
|
|
71
|
-
export declare function useLocalizationContext(): LocalizationContext;
|
|
72
|
-
export {};
|
|
73
|
-
//# sourceMappingURL=LocalizationContext.d.ts.map
|
|
@@ -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,25 +0,0 @@
|
|
|
1
|
-
import { PresentationHierarchyNode } from "../TreeNode.js";
|
|
2
|
-
import { HierarchyLevelDetails, useTree } from "../UseTree.js";
|
|
3
|
-
/** @alpha */
|
|
4
|
-
export interface TreeItemAction {
|
|
5
|
-
label: string;
|
|
6
|
-
action: () => void;
|
|
7
|
-
/**
|
|
8
|
-
* Determines action items visibility:
|
|
9
|
-
* - `False` - action item is hidden.
|
|
10
|
-
* - `True` - action item is visible at all times.
|
|
11
|
-
* - `Undefined` - action item is visible on hover/focus.
|
|
12
|
-
*/
|
|
13
|
-
show?: boolean;
|
|
14
|
-
icon?: string;
|
|
15
|
-
}
|
|
16
|
-
/** @alpha */
|
|
17
|
-
export type FilterActionProps = {
|
|
18
|
-
/** Action to perform when the filter button is clicked for this node. */
|
|
19
|
-
onFilter?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;
|
|
20
|
-
} & Partial<Pick<ReturnType<typeof useTree>, "getHierarchyLevelDetails">>;
|
|
21
|
-
/** @internal */
|
|
22
|
-
export declare function TreeActionButton({ show, label, action, icon }: TreeItemAction): import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
/** @alpha */
|
|
24
|
-
export declare function createFilterAction({ onFilter, getHierarchyLevelDetails }: FilterActionProps): (node: PresentationHierarchyNode) => TreeItemAction;
|
|
25
|
-
//# 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":"AAMA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAM/D,aAAa;AACb,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,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;CACnE,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,EAAE,iBAAiB,GAAG,CAAC,IAAI,EAAE,yBAAyB,KAAK,cAAc,CAuBjJ"}
|
|
@@ -1,40 +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 { Tree } from "@itwin/itwinui-react/bricks";
|
|
7
|
-
import { useLocalizationContext } from "./LocalizationContext.js";
|
|
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
|
-
const { localizedStrings } = useLocalizationContext();
|
|
13
|
-
const localizedLabel = localizedStrings[label];
|
|
14
|
-
return _jsx(Tree.ItemAction, { visible: show, onClick: action, label: localizedLabel ?? label, icon: icon ?? placeholderIcon });
|
|
15
|
-
}
|
|
16
|
-
/** @alpha */
|
|
17
|
-
export function createFilterAction({ onFilter, getHierarchyLevelDetails }) {
|
|
18
|
-
return (node) => {
|
|
19
|
-
const handleVisibility = () => {
|
|
20
|
-
if (!onFilter || !node.isFilterable) {
|
|
21
|
-
return false;
|
|
22
|
-
}
|
|
23
|
-
if (node.isFiltered) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
return undefined;
|
|
27
|
-
};
|
|
28
|
-
return {
|
|
29
|
-
label: "filterHierarchyLevel",
|
|
30
|
-
action: () => {
|
|
31
|
-
const hierarchyLevelDetails = getHierarchyLevelDetails?.(node.id);
|
|
32
|
-
hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);
|
|
33
|
-
},
|
|
34
|
-
show: handleVisibility(),
|
|
35
|
-
isDropdownAction: false,
|
|
36
|
-
icon: node.isFiltered ? placeholderIcon : filterIcon,
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
//# 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,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGnD,OAAO,EAAoB,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAEpF,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;AAsB3K,gBAAgB;AAChB,MAAM,UAAU,gBAAgB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAkB;IAC5E,MAAM,EAAE,gBAAgB,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACtD,MAAM,cAAc,GAAuB,gBAAgB,CAAC,KAAsC,CAAC,CAAC;IACpG,OAAO,KAAC,IAAI,CAAC,UAAU,IAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,IAAI,KAAK,EAAE,IAAI,EAAE,IAAI,IAAI,eAAe,GAAI,CAAC;AAC5H,CAAC;AAED,aAAa;AACb,MAAM,UAAU,kBAAkB,CAAC,EAAE,QAAQ,EAAE,wBAAwB,EAAqB;IAC1F,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,gBAAgB,GAAG,GAAG,EAAE;YAC5B,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;gBACpC,OAAO,KAAK,CAAC;YACf,CAAC;YACD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;gBACpB,OAAO,IAAI,CAAC;YACd,CAAC;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC;QAEF,OAAO;YACL,KAAK,EAAE,sBAAuD;YAC9D,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,gBAAgB,EAAE;YACxB,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 { Tree } from \"@itwin/itwinui-react/bricks\";\nimport { PresentationHierarchyNode } from \"../TreeNode.js\";\nimport { HierarchyLevelDetails, useTree } from \"../UseTree.js\";\nimport { LocalizedStrings, useLocalizationContext } from \"./LocalizationContext.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 /**\n * Determines action items visibility:\n * - `False` - action item is hidden.\n * - `True` - action item is visible at all times.\n * - `Undefined` - action item is visible on hover/focus.\n */\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} & Partial<Pick<ReturnType<typeof useTree>, \"getHierarchyLevelDetails\">>;\n\n/** @internal */\nexport function TreeActionButton({ show, label, action, icon }: TreeItemAction) {\n const { localizedStrings } = useLocalizationContext();\n const localizedLabel: string | undefined = localizedStrings[label as keyof typeof localizedStrings];\n return <Tree.ItemAction visible={show} onClick={action} label={localizedLabel ?? label} icon={icon ?? placeholderIcon} />;\n}\n\n/** @alpha */\nexport function createFilterAction({ onFilter, getHierarchyLevelDetails }: FilterActionProps): (node: PresentationHierarchyNode) => TreeItemAction {\n return (node) => {\n const handleVisibility = () => {\n if (!onFilter || !node.isFilterable) {\n return false;\n }\n if (node.isFiltered) {\n return true;\n }\n return undefined;\n };\n\n return {\n label: \"filterHierarchyLevel\" satisfies keyof LocalizedStrings,\n action: () => {\n const hierarchyLevelDetails = getHierarchyLevelDetails?.(node.id);\n hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);\n },\n show: handleVisibility(),\n isDropdownAction: false,\n icon: node.isFiltered ? placeholderIcon : filterIcon,\n };\n };\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, RefAttributes } from "react";
|
|
2
|
-
import { PresentationInfoNode } from "../TreeNode.js";
|
|
3
|
-
import { useTree } from "../UseTree.js";
|
|
4
|
-
import { FlatNode } from "./FlatTreeNode.js";
|
|
5
|
-
import { TreeNodeRenderer } from "./TreeNodeRenderer.js";
|
|
6
|
-
interface TreeErrorRendererOwnProps {
|
|
7
|
-
node: FlatNode<PresentationInfoNode>;
|
|
8
|
-
}
|
|
9
|
-
type TreeErrorRendererProps = TreeErrorRendererOwnProps & Pick<ComponentPropsWithoutRef<typeof TreeNodeRenderer>, "onFilterClick" | "reloadTree"> & Partial<Pick<ReturnType<typeof useTree>, "getHierarchyLevelDetails">>;
|
|
10
|
-
/** @internal */
|
|
11
|
-
export declare const TreeErrorRenderer: React.ForwardRefExoticComponent<TreeErrorRendererProps & RefAttributes<HTMLDivElement>>;
|
|
12
|
-
export {};
|
|
13
|
-
//# 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,EAAE,wBAAwB,EAAc,aAAa,EAAE,MAAM,OAAO,CAAC;AAG5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,UAAU,yBAAyB;IACjC,IAAI,EAAE,QAAQ,CAAC,oBAAoB,CAAC,CAAC;CACtC;AAED,KAAK,sBAAsB,GAAG,yBAAyB,GACrD,IAAI,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,EAAE,eAAe,GAAG,YAAY,CAAC,GACvF,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAExE,gBAAgB;AAChB,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,yBAAyB,CAAC,sBAAsB,GAAG,aAAa,CAAC,cAAc,CAAC,CAiDrH,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
|
-
/** @internal */
|
|
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, "aria-level": node.level, "aria-posinset": node.posInLevel, "aria-setsize": node.levelSize }));
|
|
20
|
-
}
|
|
21
|
-
if (node.type === "NoFilterMatches") {
|
|
22
|
-
return (_jsx(Tree.Item, { "aria-level": node.level, "aria-posinset": node.posInLevel, "aria-setsize": node.levelSize, 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, { "aria-level": node.level, "aria-posinset": node.posInLevel, "aria-setsize": node.levelSize, 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
|