@itwin/presentation-hierarchies-react 2.0.0-alpha.4 → 2.0.0-alpha.40
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 +656 -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 +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 +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 +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 +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 +51 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +117 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +45 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js +94 -0
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react.d.ts +14 -9
- package/lib/esm/presentation-hierarchies-react.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react.js +11 -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
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.40",
|
|
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-hierarchies": "^
|
|
47
|
-
"@itwin/
|
|
48
|
-
"@itwin/
|
|
43
|
+
"immer": "^10.2.0",
|
|
44
|
+
"react-error-boundary": "^4.1.2",
|
|
45
|
+
"rxjs": "^7.8.2",
|
|
46
|
+
"@itwin/presentation-hierarchies": "^2.0.0-alpha.5",
|
|
47
|
+
"@itwin/presentation-shared": "^2.0.0-alpha.3",
|
|
48
|
+
"@itwin/unified-selection": "^1.6.2-alpha.0"
|
|
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;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AAC,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
|
|
@@ -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;AAI1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAWlE,gBAAgB;AAChB,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,CA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OAAO,EAAE,MAAM,EAAE,aAC5B,UAAU,CAAC,CAAC,CAAC,KAAC,IAAI,cAAE,UAAU,GAAQ,CAAC,CAAC,CAAC,IAAI,EAC9C,KAAC,MAAM;gBACL,uCAAuC;;oBAAvC,uCAAuC;oBACvC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;wBACb,CAAC,CAAC,eAAe,EAAE,CAAC;wBACpB,OAAO,EAAE,EAAE,CAAC;oBACd,CAAC,YAEA,SAAS,GACH,EACR,SAAS,CAAC,CAAC,CAAC,KAAC,IAAI,cAAE,SAAS,GAAQ,CAAC,CAAC,CAAC,IAAI,IACxC,CACP;KACF,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 { 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 { FlatNode } from \"./FlatTreeNode.js\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\nimport { TreeNodeRenderer } from \"./TreeNodeRenderer.js\";\n\ninterface TreeErrorRendererOwnProps {\n node: FlatNode<PresentationInfoNode>;\n}\n\ntype TreeErrorRendererProps = TreeErrorRendererOwnProps &\n Pick<ComponentPropsWithoutRef<typeof TreeNodeRenderer>, \"onFilterClick\" | \"reloadTree\"> &\n Partial<Pick<ReturnType<typeof useTree>, \"getHierarchyLevelDetails\">>;\n\n/** @internal */\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 aria-level={node.level}\n aria-posinset={node.posInLevel}\n aria-setsize={node.levelSize}\n />\n );\n }\n\n if (node.type === \"NoFilterMatches\") {\n return (\n <Tree.Item\n aria-level={node.level}\n aria-posinset={node.posInLevel}\n aria-setsize={node.levelSize}\n ref={forwardedRef}\n label={localizedStrings.noFilteredChildren}\n aria-disabled={true}\n />\n );\n }\n\n const onRetry = reloadTree ? () => reloadTree({ parentNodeId: node.parentNodeId, state: \"reset\" }) : undefined;\n return (\n <Tree.Item\n aria-level={node.level}\n aria-posinset={node.posInLevel}\n aria-setsize={node.levelSize}\n ref={forwardedRef}\n label={<ErrorNodeLabel message={node.message} onRetry={onRetry} />}\n aria-disabled={true}\n />\n );\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,46 +0,0 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef, ReactElement, RefAttributes } from "react";
|
|
2
|
-
import { Tree } from "@itwin/itwinui-react/bricks";
|
|
3
|
-
import { PresentationHierarchyNode } from "../TreeNode.js";
|
|
4
|
-
import { HierarchyLevelDetails, useTree } from "../UseTree.js";
|
|
5
|
-
import { FlatTreeNode } from "./FlatTreeNode.js";
|
|
6
|
-
import { TreeItemAction } from "./TreeActionButton.js";
|
|
7
|
-
/** @alpha */
|
|
8
|
-
type TreeNodeProps = ComponentPropsWithoutRef<typeof Tree.Item>;
|
|
9
|
-
/** @alpha */
|
|
10
|
-
export interface TreeNodeRendererOwnProps {
|
|
11
|
-
/** Node that is rendered. */
|
|
12
|
-
node: FlatTreeNode;
|
|
13
|
-
/** Action to perform when the filter button is clicked for this node. */
|
|
14
|
-
onFilterClick?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;
|
|
15
|
-
/** Returns an icon or icon href for a given node. */
|
|
16
|
-
getIcon?: (node: PresentationHierarchyNode) => string | ReactElement | undefined;
|
|
17
|
-
/** Returns a label for a given node. */
|
|
18
|
-
getLabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
19
|
-
/** Returns sublabel for a given node. */
|
|
20
|
-
getSublabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
21
|
-
/** Action to perform when the node is clicked. */
|
|
22
|
-
onNodeClick?: (node: PresentationHierarchyNode, isSelected: boolean, event: React.MouseEvent<HTMLElement, MouseEvent>) => void;
|
|
23
|
-
/** Action to perform when a key is pressed when the node is hovered on. */
|
|
24
|
-
onNodeKeyDown?: (node: PresentationHierarchyNode, isSelected: boolean, event: React.KeyboardEvent<HTMLElement>) => void;
|
|
25
|
-
/** A callback to reload a hierarchy level when an error occurs and `retry` button is clicked. */
|
|
26
|
-
reloadTree?: (options: {
|
|
27
|
-
parentNodeId: string | undefined;
|
|
28
|
-
state: "reset";
|
|
29
|
-
}) => void;
|
|
30
|
-
/**
|
|
31
|
-
* Actions for tree item.
|
|
32
|
-
*/
|
|
33
|
-
actions?: Array<(node: PresentationHierarchyNode) => TreeItemAction>;
|
|
34
|
-
}
|
|
35
|
-
/** @alpha */
|
|
36
|
-
type TreeNodeRendererProps = Pick<ReturnType<typeof useTree>, "expandNode" | "isNodeSelected"> & Partial<Pick<ReturnType<typeof useTree>, "getHierarchyLevelDetails">> & Omit<TreeNodeProps, "actions" | "aria-level" | "aria-posinset" | "aria-setsize" | "label" | "icon" | "expanded" | "selected"> & TreeNodeRendererOwnProps;
|
|
37
|
-
/**
|
|
38
|
-
* A component that renders `RenderedTreeNode` using the `TreeNode` component from `@itwin/itwinui-react`.
|
|
39
|
-
*
|
|
40
|
-
* @see `TreeRenderer`
|
|
41
|
-
* @see https://itwinui.bentley.com/docs/tree
|
|
42
|
-
* @public
|
|
43
|
-
*/
|
|
44
|
-
export declare const TreeNodeRenderer: React.ForwardRefExoticComponent<TreeNodeRendererProps & RefAttributes<HTMLDivElement>>;
|
|
45
|
-
export {};
|
|
46
|
-
//# 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":"AAKA,OAAO,EAAE,wBAAwB,EAA2C,YAAY,EAAO,aAAa,EAAuB,MAAM,OAAO,CAAC;AACjJ,OAAO,EAAyB,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAA+B,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AACxF,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,Y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