@itwin/presentation-hierarchies-react 2.0.0-alpha.13 → 2.0.0-alpha.15
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 +117 -0
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +0 -4
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.js +1 -8
- 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/UseUnifiedSelection.d.ts +1 -5
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +0 -11
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/FilterAction.d.ts +18 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/FilterAction.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/FilterAction.js +32 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/FilterAction.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts +36 -7
- package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js +18 -6
- package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts +15 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js +3 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/LocalizationContext.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/RootErrorRenderer.d.ts +16 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/RootErrorRenderer.d.ts.map +1 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/RootErrorRenderer.js +41 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/RootErrorRenderer.js.map +1 -0
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts +29 -9
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js +52 -33
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeErrorRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts +13 -15
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js +26 -38
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeNodeRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts +9 -4
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js +51 -24
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react.d.ts +3 -3
- package/lib/esm/presentation-hierarchies-react.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react.js +3 -3
- package/lib/esm/presentation-hierarchies-react.js.map +1 -1
- package/package.json +5 -5
- 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/TreeActionButton.d.ts +0 -31
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js +0 -38
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeActionButton.js.map +0 -1
|
@@ -2,14 +2,21 @@
|
|
|
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
|
+
import { useMemo } from "react";
|
|
5
6
|
import { isPresentationHierarchyNode } from "../TreeNode.js";
|
|
6
7
|
/** @alpha */
|
|
7
8
|
export function isPlaceholderNode(node) {
|
|
8
9
|
return "placeholder" in node;
|
|
9
10
|
}
|
|
10
|
-
/**
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Used to get a list of `FlatTreeNode` objects for the given list of `PresentationTreeNode` objects that represent
|
|
13
|
+
* a hierarchical structure. The resulting nodes can be used to render the hierarchy in a flat manner, e.g. using a
|
|
14
|
+
* virtualized list.
|
|
15
|
+
*
|
|
16
|
+
* @alpha
|
|
17
|
+
*/
|
|
18
|
+
export function useFlatTreeNodeList(rootNodes) {
|
|
19
|
+
return useMemo(() => getFlatNodes(rootNodes, 1), [rootNodes]);
|
|
13
20
|
}
|
|
14
21
|
function getFlatNodes(nodes, level) {
|
|
15
22
|
const flatNodes = [];
|
|
@@ -30,8 +37,13 @@ function getFlatNodes(nodes, level) {
|
|
|
30
37
|
});
|
|
31
38
|
return flatNodes;
|
|
32
39
|
}
|
|
33
|
-
|
|
34
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Finds and returns all error nodes in a given hierarchy in the form of `PresentationTreeNode[]`.
|
|
42
|
+
*
|
|
43
|
+
* @alpha
|
|
44
|
+
*/
|
|
45
|
+
export function useErrorList(rootNodes) {
|
|
46
|
+
return useMemo(() => rootNodes.flatMap((rootNode) => {
|
|
35
47
|
if (!isPresentationHierarchyNode(rootNode)) {
|
|
36
48
|
return [{ parent: undefined, error: rootNode, expandTo: (expandNode) => expandTo(expandNode, []) }];
|
|
37
49
|
}
|
|
@@ -39,7 +51,7 @@ export function getErrors(rootNodes) {
|
|
|
39
51
|
return [];
|
|
40
52
|
}
|
|
41
53
|
return getErrorNodes(rootNode, !rootNode.isExpanded ? [rootNode.id] : []);
|
|
42
|
-
});
|
|
54
|
+
}), [rootNodes]);
|
|
43
55
|
}
|
|
44
56
|
function getErrorNodes(parent, path) {
|
|
45
57
|
const errorList = [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatTreeNode.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/FlatTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,2BAA2B,EAAyE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"FlatTreeNode.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/FlatTreeNode.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,2BAA2B,EAAyE,MAAM,gBAAgB,CAAC;AA4CpI,aAAa;AACb,MAAM,UAAU,iBAAiB,CAAC,IAAkB;IAClD,OAAO,aAAa,IAAI,IAAI,CAAC;AAC/B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,mBAAmB,CAAC,SAAiC;IACnE,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC,YAAY,C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AC,IAAI,CAAC,GAAG,cAAc,CAAC,CAAC;YAClC,OAAO;QACT,CAAC;IACH,CAAC,CAAC,CAAC;IACH,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,SAAS,QAAQ,CAAC,UAAoC,EAAE,IAAc;IACpE,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;AAC/C,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 { useMemo } from \"react\";\nimport { isPresentationHierarchyNode, PresentationHierarchyNode, PresentationInfoNode, PresentationTreeNode } from \"../TreeNode.js\";\n\n/**\n * Placeholder node that is added to hierarchy as a child for a parent node while its child nodes are loading.\n *\n * @alpha\n * */\ninterface PlaceholderNode {\n id: string;\n level: number;\n placeholder: true;\n}\n\n/**\n * An extended `PresentationHierarchyNode` node with properties needed for a flat tree structure.\n *\n * @alpha\n */\nexport type FlatNode = {\n level: number;\n levelSize: number;\n posInLevel: number;\n} & PresentationHierarchyNode;\n\n/**\n * A node used to build an error message.\n * Returned by `useErrorList`.\n *\n * @alpha\n * */\nexport interface ErrorNode {\n error: PresentationInfoNode;\n parent?: PresentationHierarchyNode;\n expandTo: (expandNode: (nodeId: string) => void) => void;\n}\n\n/**\n * A node describing single tree item position and its content inside tree.\n * Returned by `useFlatTreeNodeList` hook.\n *\n * @alpha\n */\nexport type FlatTreeNode = FlatNode | PlaceholderNode;\n\n/** @alpha */\nexport function isPlaceholderNode(node: FlatTreeNode): node is PlaceholderNode {\n return \"placeholder\" in node;\n}\n\n/**\n * Used to get a list of `FlatTreeNode` objects for the given list of `PresentationTreeNode` objects that represent\n * a hierarchical structure. The resulting nodes can be used to render the hierarchy in a flat manner, e.g. using a\n * virtualized list.\n *\n * @alpha\n */\nexport function useFlatTreeNodeList(rootNodes: PresentationTreeNode[]) {\n return useMemo(() => getFlatNodes(rootNodes, 1), [rootNodes]);\n}\n\nfunction getFlatNodes(nodes: PresentationTreeNode[], level: number) {\n const flatNodes: FlatTreeNode[] = [];\n nodes.forEach((node, index) => {\n if (!isPresentationHierarchyNode(node)) {\n return;\n }\n flatNodes.push({ ...node, level, levelSize: nodes.length, posInLevel: index + 1 });\n if (!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\n/**\n * Finds and returns all error nodes in a given hierarchy in the form of `PresentationTreeNode[]`.\n *\n * @alpha\n */\nexport function useErrorList(rootNodes: PresentationTreeNode[]): ErrorNode[] {\n return useMemo(\n () =>\n rootNodes.flatMap((rootNode) => {\n if (!isPresentationHierarchyNode(rootNode)) {\n return [{ parent: undefined, error: rootNode, expandTo: (expandNode) => expandTo(expandNode, []) }];\n }\n if (rootNode.children === true) {\n return [];\n }\n return getErrorNodes(rootNode, !rootNode.isExpanded ? [rootNode.id] : []);\n }),\n [rootNodes],\n );\n}\n\nfunction getErrorNodes(parent: PresentationHierarchyNode, path: string[]) {\n const errorList: ErrorNode[] = [];\n\n if (parent.children === true) {\n return [];\n }\n\n const pathToChild = [...path, ...(!parent.isExpanded ? [parent.id] : [])];\n parent.children.forEach((node) => {\n if (!isPresentationHierarchyNode(node)) {\n errorList.push({ parent, error: node, expandTo: (expandNode) => expandTo(expandNode, path) });\n return;\n }\n\n if (node.children !== true) {\n const childErrorList = getErrorNodes(node, pathToChild);\n errorList.push(...childErrorList);\n return;\n }\n });\n return errorList;\n}\n\nfunction expandTo(expandNode: (nodeId: string) => void, path: string[]) {\n path.forEach((nodeId) => expandNode(nodeId));\n}\n"]}
|
|
@@ -39,11 +39,21 @@ export interface LocalizedStrings {
|
|
|
39
39
|
* Default value: `Failed to create hierarchy for {{node}}.`.
|
|
40
40
|
*/
|
|
41
41
|
failedToCreateHierarchy: string;
|
|
42
|
+
/**
|
|
43
|
+
* Message displayed when hierarchy creation for a node failed.
|
|
44
|
+
* Default value: `Failed to load tree.`.
|
|
45
|
+
*/
|
|
46
|
+
failedToCreateRootHierarchy: string;
|
|
42
47
|
/**
|
|
43
48
|
* Message displayed when result limit exceeds hierarchy size limit.
|
|
44
49
|
* Default value: `The hierarchy for {{node}} contains {{limit}}+ items. Try using filters or increase the limit.`.
|
|
45
50
|
*/
|
|
46
51
|
resultLimitExceeded: string;
|
|
52
|
+
/**
|
|
53
|
+
* Message displayed when result limit exceeds hierarchy size limit.
|
|
54
|
+
* Default value: `The root item hierarchy contains {{limit}}+ items. Try increasing the limit.`.
|
|
55
|
+
*/
|
|
56
|
+
rootResultLimitExceeded: string;
|
|
47
57
|
/**
|
|
48
58
|
* Label displayed on error dropdown.
|
|
49
59
|
* Default value: `issues found`.
|
|
@@ -54,6 +64,11 @@ export interface LocalizedStrings {
|
|
|
54
64
|
* Default value: `Increase limit to {{limit}}`.
|
|
55
65
|
*/
|
|
56
66
|
increaseHierarchyLimit: string;
|
|
67
|
+
/**
|
|
68
|
+
* Message displayed when hierarchy size limit can be overridden.
|
|
69
|
+
* Default value: `Remove limit`.
|
|
70
|
+
*/
|
|
71
|
+
increaseHierarchyLimitToUnlimited: string;
|
|
57
72
|
/**
|
|
58
73
|
* Message displayed when hierarchy size limit can be overridden and hierarchy filtering is enabled.
|
|
59
74
|
* Default value: `Add Filter`.
|
|
@@ -1 +1 @@
|
|
|
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,qCAAqC,EAAE,MAAM,CAAC;IAC9C;;;OAGG;IACH,yBAAyB,EAAE,MAAM,CAAC;IAClC;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,8BAA8B,EAAE,MAAM,CAAC;IACvC;;;OAGG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;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;
|
|
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,qCAAqC,EAAE,MAAM,CAAC;IAC9C;;;OAGG;IACH,yBAAyB,EAAE,MAAM,CAAC;IAClC;;;OAGG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,8BAA8B,EAAE,MAAM,CAAC;IACvC;;;OAGG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,2BAA2B,EAAE,MAAM,CAAC;IACpC;;;OAGG;IACH,mBAAmB,EAAE,MAAM,CAAC;IAC5B;;;OAGG;IACH,uBAAuB,EAAE,MAAM,CAAC;IAChC;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,sBAAsB,EAAE,MAAM,CAAC;IAC/B;;;OAGG;IACH,iCAAiC,EAAE,MAAM,CAAC;IAC1C;;;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;AAsBD;;;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"}
|
|
@@ -12,9 +12,12 @@ const defaultLocalizedStrings = {
|
|
|
12
12
|
noFilteredChildren: "No matches for current filter for {{node}}.",
|
|
13
13
|
noFilteredChildrenChangeFilter: "Change filter",
|
|
14
14
|
failedToCreateHierarchy: "Failed to create hierarchy for {{node}}.",
|
|
15
|
+
failedToCreateRootHierarchy: "Failed to load tree.",
|
|
15
16
|
resultLimitExceeded: "The hierarchy for {{node}} contains {{limit}}+ items. Try using filters or increase the limit.",
|
|
17
|
+
rootResultLimitExceeded: "The root item hierarchy contains {{limit}}+ items. Try increasing the limit.",
|
|
16
18
|
issuesFound: "issues found",
|
|
17
19
|
increaseHierarchyLimit: "Increase limit to {{limit}}",
|
|
20
|
+
increaseHierarchyLimitToUnlimited: "Remove limit",
|
|
18
21
|
increaseHierarchyLimitWithFiltering: "Add Filter",
|
|
19
22
|
retry: "Retry",
|
|
20
23
|
};
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAyF1F,MAAM,uBAAuB,GAAqB;IAChD,OAAO,EAAE,YAAY;IACrB,oBAAoB,EAAE,cAAc;IACpC,qCAAqC,EAAE,mBAAmB;IAC1D,yBAAyB,EAAE,qBAAqB;IAChD,kBAAkB,EAAE,6CAA6C;IACjE,8BAA8B,EAAE,eAAe;IAC/C,uBAAuB,EAAE,0CAA0C;IACnE,2BAA2B,EAAE,sBAAsB;IACnD,mBAAmB,EAAE,gGAAgG;IACrH,uBAAuB,EAAE,8EAA8E;IACvG,WAAW,EAAE,cAAc;IAC3B,sBAAsB,EAAE,6BAA6B;IACrD,iCAAiC,EAAE,cAAc;IACjD,mCAAmC,EAAE,YAAY;IACjD,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 * Accesible description for applied hierarchy filter button.\n * Default value: `Filter is applied`.\n */\n filterHierarchyLevelActiveDescription: 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 matches for current filter for {{node}}.`.\n */\n noFilteredChildren: string;\n /**\n * Label for change filter action.\n * Default value: `Change filter`.\n */\n noFilteredChildrenChangeFilter: string;\n /**\n * Message displayed when hierarchy creation for a node failed.\n * Default value: `Failed to create hierarchy for {{node}}.`.\n */\n failedToCreateHierarchy: string;\n /**\n * Message displayed when hierarchy creation for a node failed.\n * Default value: `Failed to load tree.`.\n */\n failedToCreateRootHierarchy: string;\n /**\n * Message displayed when result limit exceeds hierarchy size limit.\n * Default value: `The hierarchy for {{node}} contains {{limit}}+ items. Try using filters or increase the limit.`.\n */\n resultLimitExceeded: string;\n /**\n * Message displayed when result limit exceeds hierarchy size limit.\n * Default value: `The root item hierarchy contains {{limit}}+ items. Try increasing the limit.`.\n */\n rootResultLimitExceeded: string;\n /**\n * Label displayed on error dropdown.\n * Default value: `issues found`.\n */\n issuesFound: string;\n /**\n * Message displayed when hierarchy size limit can be overridden.\n * Default value: `Increase limit to {{limit}}`.\n */\n increaseHierarchyLimit: string;\n /**\n * Message displayed when hierarchy size limit can be overridden.\n * Default value: `Remove limit`.\n */\n increaseHierarchyLimitToUnlimited: string;\n /**\n * Message displayed when hierarchy size limit can be overridden and hierarchy filtering is enabled.\n * Default value: `Add Filter`.\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 filterHierarchyLevelActiveDescription: \"Filter is applied\",\n clearHierarchyLevelFilter: \"Clear active filter\",\n noFilteredChildren: \"No matches for current filter for {{node}}.\",\n noFilteredChildrenChangeFilter: \"Change filter\",\n failedToCreateHierarchy: \"Failed to create hierarchy for {{node}}.\",\n failedToCreateRootHierarchy: \"Failed to load tree.\",\n resultLimitExceeded: \"The hierarchy for {{node}} contains {{limit}}+ items. Try using filters or increase the limit.\",\n rootResultLimitExceeded: \"The root item hierarchy contains {{limit}}+ items. Try increasing the limit.\",\n issuesFound: \"issues found\",\n increaseHierarchyLimit: \"Increase limit to {{limit}}\",\n increaseHierarchyLimitToUnlimited: \"Remove limit\",\n increaseHierarchyLimitWithFiltering: \"Add Filter\",\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"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { useTree } from "../UseTree.js";
|
|
2
|
+
import { ErrorNode } from "./FlatTreeNode.js";
|
|
3
|
+
/**
|
|
4
|
+
* @alpha
|
|
5
|
+
*/
|
|
6
|
+
export type RootErrorRendererProps = {
|
|
7
|
+
/** Root error to be displayed */
|
|
8
|
+
errorNode: ErrorNode;
|
|
9
|
+
} & Pick<ReturnType<typeof useTree>, "getHierarchyLevelDetails" | "reloadTree">;
|
|
10
|
+
/**
|
|
11
|
+
* A component that renders root node error state.
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare function RootErrorRenderer({ errorNode, getHierarchyLevelDetails, reloadTree }: RootErrorRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=RootErrorRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootErrorRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/RootErrorRenderer.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C;;GAEG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,iCAAiC;IACjC,SAAS,EAAE,SAAS,CAAC;CACtB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,EAAE,0BAA0B,GAAG,YAAY,CAAC,CAAC;AAEhF;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE,UAAU,EAAE,EAAE,sBAAsB,2CA+B5G"}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 { Button, Icon, Text } from "@itwin/itwinui-react/bricks";
|
|
7
|
+
import { useLocalizationContext } from "./LocalizationContext.js";
|
|
8
|
+
const errorSvg = new URL("@itwin/itwinui-icons/status-error.svg", import.meta.url).href;
|
|
9
|
+
/**
|
|
10
|
+
* A component that renders root node error state.
|
|
11
|
+
*
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export function RootErrorRenderer({ errorNode, getHierarchyLevelDetails, reloadTree }) {
|
|
15
|
+
const { localizedStrings } = useLocalizationContext();
|
|
16
|
+
if (errorNode.error.type === "ResultSetTooLarge") {
|
|
17
|
+
const onOverrideLimit = () => getHierarchyLevelDetails(undefined)?.setSizeLimit("unbounded");
|
|
18
|
+
return (_jsx(RootErrorContainer, { message: localizedStrings.rootResultLimitExceeded.replace("{{limit}}", errorNode.error.resultSetSizeLimit.toString()), actions: [
|
|
19
|
+
{
|
|
20
|
+
action: onOverrideLimit,
|
|
21
|
+
label: localizedStrings.increaseHierarchyLimitToUnlimited,
|
|
22
|
+
condition: () => true,
|
|
23
|
+
},
|
|
24
|
+
] }));
|
|
25
|
+
}
|
|
26
|
+
return (_jsx(RootErrorContainer, { message: localizedStrings.failedToCreateRootHierarchy, actions: [
|
|
27
|
+
{
|
|
28
|
+
action: () => reloadTree({ parentNodeId: undefined, state: "reset" }),
|
|
29
|
+
label: localizedStrings.retry,
|
|
30
|
+
condition: () => true,
|
|
31
|
+
},
|
|
32
|
+
] }));
|
|
33
|
+
}
|
|
34
|
+
function RootErrorContainer({ actions, message }) {
|
|
35
|
+
return (_jsxs("div", { style: { height: "100%", display: "flex", flexDirection: "column", justifyContent: "center", alignItems: "center", gap: "0.5rem" }, children: [_jsx(Icon, { href: errorSvg, size: "large" }), _jsx(Text, { variant: "body-sm", style: { textAlign: "center" }, children: message }), actions
|
|
36
|
+
?.filter(({ condition }) => condition())
|
|
37
|
+
.map((action) => {
|
|
38
|
+
return (_jsx(Button, { onClick: () => action.action(), children: action.label }, action.label));
|
|
39
|
+
})] }));
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=RootErrorRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootErrorRenderer.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/RootErrorRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAGjE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC,uCAAuC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;AAUxF;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,wBAAwB,EAAE,UAAU,EAA0B;IAC3G,MAAM,EAAE,gBAAgB,EAAE,GAAG,sBAAsB,EAAE,CAAC;IAEtD,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACjD,MAAM,eAAe,GAAG,GAAG,EAAE,CAAC,wBAAwB,CAAC,SAAS,CAAC,EAAE,YAAY,CAAC,WAAW,CAAC,CAAC;QAC7F,OAAO,CACL,KAAC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,IAAoB,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,YACtD,MAAM,CAAC,KAAK,IADF,MAAM,CAAC,KAAK,CAEhB,CACV,CAAC;YACJ,CAAC,CAAC,IACA,CACP,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 { Button, Icon, Text } from \"@itwin/itwinui-react/bricks\";\nimport { useTree } from \"../UseTree.js\";\nimport { ErrorNode } from \"./FlatTreeNode.js\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\n\nconst errorSvg = new URL(\"@itwin/itwinui-icons/status-error.svg\", import.meta.url).href;\n\n/**\n * @alpha\n */\nexport type RootErrorRendererProps = {\n /** Root error to be displayed */\n errorNode: ErrorNode;\n} & Pick<ReturnType<typeof useTree>, \"getHierarchyLevelDetails\" | \"reloadTree\">;\n\n/**\n * A component that renders root node error state.\n *\n * @internal\n */\nexport function RootErrorRenderer({ errorNode, getHierarchyLevelDetails, reloadTree }: RootErrorRendererProps) {\n const { localizedStrings } = useLocalizationContext();\n\n if (errorNode.error.type === \"ResultSetTooLarge\") {\n const onOverrideLimit = () => getHierarchyLevelDetails(undefined)?.setSizeLimit(\"unbounded\");\n return (\n <RootErrorContainer\n message={localizedStrings.rootResultLimitExceeded.replace(\"{{limit}}\", errorNode.error.resultSetSizeLimit.toString())}\n actions={[\n {\n action: onOverrideLimit,\n label: localizedStrings.increaseHierarchyLimitToUnlimited,\n condition: () => true,\n },\n ]}\n />\n );\n }\n\n return (\n <RootErrorContainer\n message={localizedStrings.failedToCreateRootHierarchy}\n actions={[\n {\n action: () => reloadTree({ parentNodeId: undefined, state: \"reset\" }),\n label: localizedStrings.retry,\n condition: () => true,\n },\n ]}\n />\n );\n}\n\ninterface RootErrorContainerProps {\n message: string;\n actions?: { action: () => void; label: string; condition: () => boolean }[];\n}\n\nfunction RootErrorContainer({ actions, message }: RootErrorContainerProps) {\n return (\n <div style={{ height: \"100%\", display: \"flex\", flexDirection: \"column\", justifyContent: \"center\", alignItems: \"center\", gap: \"0.5rem\" }}>\n <Icon href={errorSvg} size=\"large\" />\n <Text variant={\"body-sm\"} style={{ textAlign: \"center\" }}>\n {message}\n </Text>\n {actions\n ?.filter(({ condition }) => condition())\n .map((action) => {\n return (\n <Button key={action.label} onClick={() => action.action()}>\n {action.label}\n </Button>\n );\n })}\n </div>\n );\n}\n"]}
|
|
@@ -1,23 +1,43 @@
|
|
|
1
|
+
import { ReactElement } from "react";
|
|
1
2
|
import { HierarchyLevelDetails, useTree } from "../UseTree.js";
|
|
2
3
|
import { ErrorNode } from "./FlatTreeNode.js";
|
|
3
|
-
/**
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Interface containing error item related actions.
|
|
6
|
+
*
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
interface TreeErrorItemProps {
|
|
5
10
|
/** A callback to reload a hierarchy level when an error occurs and `retry` button is clicked. */
|
|
6
|
-
reloadTree
|
|
11
|
+
reloadTree: (options: {
|
|
7
12
|
parentNodeId: string | undefined;
|
|
8
13
|
state: "reset";
|
|
9
14
|
}) => void;
|
|
10
15
|
/** Action to perform when the filter button is clicked for this node. */
|
|
11
16
|
onFilterClick?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;
|
|
17
|
+
/** Action to perform when an error accurs and node label is clicked in the error message */
|
|
18
|
+
scrollToElement: (errorNode: ErrorNode) => void;
|
|
12
19
|
}
|
|
20
|
+
/**
|
|
21
|
+
* Interface containing building blocks for `TreeErrorRenderer`.
|
|
22
|
+
*
|
|
23
|
+
* @alpha
|
|
24
|
+
*/
|
|
13
25
|
interface TreeErrorRendererOwnProps {
|
|
26
|
+
/** List of errors to be displayed */
|
|
14
27
|
errorList: ErrorNode[];
|
|
28
|
+
renderError?: ({ errorNode, scrollToElement }: {
|
|
29
|
+
errorNode: ErrorNode;
|
|
30
|
+
scrollToElement: () => void;
|
|
31
|
+
}) => ReactElement;
|
|
15
32
|
}
|
|
16
|
-
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
33
|
+
/** @alpha */
|
|
34
|
+
export type TreeErrorRendererProps = TreeErrorRendererOwnProps & TreeErrorItemProps & Partial<Pick<ReturnType<typeof useTree>, "getHierarchyLevelDetails">>;
|
|
35
|
+
/**
|
|
36
|
+
* A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@itwin/itwinui-react`.
|
|
37
|
+
* As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorList` hook.
|
|
38
|
+
*
|
|
39
|
+
* @alpha
|
|
40
|
+
*/
|
|
41
|
+
export declare function TreeErrorRenderer({ errorList, reloadTree, scrollToElement, getHierarchyLevelDetails, onFilterClick, renderError }: TreeErrorRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
22
42
|
export {};
|
|
23
43
|
//# sourceMappingURL=TreeErrorRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeErrorRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeErrorRenderer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TreeErrorRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeErrorRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAGrC,OAAO,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C;;;;GAIG;AACH,UAAU,kBAAkB;IAC1B,iGAAiG;IACjG,UAAU,EAAE,CAAC,OAAO,EAAE;QAAE,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACpF,yEAAyE;IACzE,aAAa,CAAC,EAAE,CAAC,qBAAqB,EAAE,qBAAqB,KAAK,IAAI,CAAC;IACvE,4FAA4F;IAC5F,eAAe,EAAE,CAAC,SAAS,EAAE,SAAS,KAAK,IAAI,CAAC;CACjD;AACD;;;;GAIG;AACH,UAAU,yBAAyB;IACjC,qCAAqC;IACrC,SAAS,EAAE,SAAS,EAAE,CAAC;IAEvB,WAAW,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,EAAE;QAAE,SAAS,EAAE,SAAS,CAAC;QAAC,eAAe,EAAE,MAAM,IAAI,CAAA;KAAE,KAAK,YAAY,CAAC;CACvH;AAED,aAAa;AACb,MAAM,MAAM,sBAAsB,GAAG,yBAAyB,GAAG,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,OAAO,CAAC,EAAE,0BAA0B,CAAC,CAAC,CAAC;AAE5J;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,wBAAwB,EAAE,aAAa,EAAE,WAAW,EAAE,EAAE,sBAAsB,2CAgFzJ"}
|
|
@@ -1,50 +1,69 @@
|
|
|
1
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
2
|
import { Anchor, unstable_ErrorRegion as ErrorRegion, Text } from "@itwin/itwinui-react/bricks";
|
|
7
3
|
import { MAX_LIMIT_OVERRIDE } from "../internal/Utils.js";
|
|
8
4
|
import { useLocalizationContext } from "./LocalizationContext.js";
|
|
9
|
-
|
|
5
|
+
/**
|
|
6
|
+
* A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@itwin/itwinui-react`.
|
|
7
|
+
* As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorList` hook.
|
|
8
|
+
*
|
|
9
|
+
* @alpha
|
|
10
|
+
*/
|
|
11
|
+
export function TreeErrorRenderer({ errorList, reloadTree, scrollToElement, getHierarchyLevelDetails, onFilterClick, renderError }) {
|
|
10
12
|
const { localizedStrings } = useLocalizationContext();
|
|
11
13
|
const errorItems = errorList.map((errorNode) => {
|
|
14
|
+
if (renderError) {
|
|
15
|
+
return renderError({ errorNode, scrollToElement: () => scrollToElement(errorNode) });
|
|
16
|
+
}
|
|
12
17
|
if (errorNode.error.type === "ResultSetTooLarge") {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
const limit = errorNode.error.resultSetSizeLimit;
|
|
19
|
+
const onOverrideLimit = getHierarchyLevelDetails ? () => getHierarchyLevelDetails(errorNode.parent?.id)?.setSizeLimit(MAX_LIMIT_OVERRIDE) : undefined;
|
|
20
|
+
return (_jsx(ErrorItemContainer, { errorNode: errorNode, actions: [
|
|
21
|
+
{
|
|
22
|
+
action: () => {
|
|
23
|
+
onOverrideLimit?.();
|
|
24
|
+
},
|
|
25
|
+
label: localizedStrings.increaseHierarchyLimit.replace("{{limit}}", MAX_LIMIT_OVERRIDE.toString()),
|
|
26
|
+
condition: () => !!onOverrideLimit && limit < MAX_LIMIT_OVERRIDE,
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
action: () => {
|
|
30
|
+
const hierarchyLevelDetails = getHierarchyLevelDetails?.(errorNode.parent?.id);
|
|
31
|
+
hierarchyLevelDetails && onFilterClick?.(hierarchyLevelDetails);
|
|
32
|
+
},
|
|
33
|
+
label: localizedStrings.increaseHierarchyLimitWithFiltering,
|
|
34
|
+
condition: () => !!onFilterClick && !!errorNode.parent?.isFilterable,
|
|
35
|
+
},
|
|
36
|
+
], message: localizedStrings.resultLimitExceeded.replace("{{limit}}", limit.toString()), scrollToElement: () => scrollToElement(errorNode) }, errorNode.error.id));
|
|
17
37
|
}
|
|
18
38
|
if (errorNode.error.type === "NoFilterMatches") {
|
|
19
|
-
return (_jsx(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
39
|
+
return (_jsx(ErrorItemContainer, { errorNode: errorNode, actions: [
|
|
40
|
+
{
|
|
41
|
+
action: () => {
|
|
42
|
+
const hierarchyLevelDetails = getHierarchyLevelDetails?.(errorNode.parent?.id);
|
|
43
|
+
hierarchyLevelDetails && onFilterClick?.(hierarchyLevelDetails);
|
|
44
|
+
},
|
|
45
|
+
label: localizedStrings.noFilteredChildrenChangeFilter,
|
|
46
|
+
condition: () => true,
|
|
47
|
+
},
|
|
48
|
+
], message: localizedStrings.noFilteredChildren, scrollToElement: () => scrollToElement(errorNode) }, errorNode.error.id));
|
|
23
49
|
}
|
|
24
|
-
return _jsx(
|
|
50
|
+
return (_jsx(ErrorItemContainer, { errorNode: errorNode, actions: [
|
|
51
|
+
{
|
|
52
|
+
action: () => reloadTree({ parentNodeId: errorNode.parent?.id, state: "reset" }),
|
|
53
|
+
label: localizedStrings.retry,
|
|
54
|
+
condition: () => true,
|
|
55
|
+
},
|
|
56
|
+
], message: localizedStrings.failedToCreateHierarchy, scrollToElement: () => scrollToElement(errorNode) }, errorNode.error.id));
|
|
25
57
|
});
|
|
26
58
|
return (_jsx(ErrorRegion.Root, { style: { width: "100%" }, label: errorList.length !== 0 ? `${errorList.length} ${localizedStrings?.issuesFound}` : undefined, items: errorItems }));
|
|
27
59
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
function DefaultErrorContainer({ reloadTree, errorNode, scrollToElement }) {
|
|
33
|
-
const { localizedStrings } = useLocalizationContext();
|
|
34
|
-
return (_jsx(ErrorRegion.Item, { message: _jsx(MessageWithNode, { errorNode: errorNode, scrollToElement: scrollToElement, message: localizedStrings.failedToCreateHierarchy }), actions: _jsx(Anchor, { onClick: () => reloadTree?.({ parentNodeId: errorNode.parent?.id, state: "reset" }), children: localizedStrings.retry }) }));
|
|
35
|
-
}
|
|
36
|
-
function ResultSetTooLarge({ errorNode, onFilterClick, limit, onOverrideLimit, scrollToElement }) {
|
|
37
|
-
const { localizedStrings } = useLocalizationContext();
|
|
38
|
-
const supportsFiltering = !!onFilterClick;
|
|
39
|
-
const supportsLimitOverride = !!onOverrideLimit && limit < MAX_LIMIT_OVERRIDE;
|
|
40
|
-
const messageWithLimit = localizedStrings.resultLimitExceeded.replace("{{limit}}", limit.toString());
|
|
41
|
-
return (_jsx(ErrorRegion.Item, { message: _jsx(MessageWithNode, { errorNode: errorNode, scrollToElement: scrollToElement, message: messageWithLimit }), actions: _jsxs("div", { style: { display: "flex", flexDirection: "column" }, children: [supportsLimitOverride && (_jsx(Anchor, { onClick: () => onOverrideLimit(MAX_LIMIT_OVERRIDE), children: localizedStrings.increaseHierarchyLimit.replace("{{limit}}", MAX_LIMIT_OVERRIDE.toString()) })), supportsFiltering && _jsx(Anchor, { onClick: onFilterClick, children: localizedStrings.increaseHierarchyLimitWithFiltering })] }) }));
|
|
42
|
-
}
|
|
43
|
-
function LinkedNode({ errorNode, scrollToElement }) {
|
|
44
|
-
return _jsx(Anchor, { onClick: () => scrollToElement(errorNode), children: errorNode.parent?.label });
|
|
60
|
+
function ErrorItemContainer({ errorNode, message, actions, scrollToElement }) {
|
|
61
|
+
return (_jsx(ErrorRegion.Item, { message: _jsx(MessageWithLink, { linkLabel: errorNode.parent?.label, scrollToElement: scrollToElement, message: message }), messageId: errorNode.error.id, actions: _jsx("div", { style: { display: "flex", flexDirection: "column" }, children: actions
|
|
62
|
+
?.filter(({ condition }) => condition())
|
|
63
|
+
.map(({ label, action }) => (_jsx(Anchor, { onClick: action, children: label }, label))) }) }));
|
|
45
64
|
}
|
|
46
|
-
function
|
|
65
|
+
function MessageWithLink({ linkLabel, scrollToElement, message }) {
|
|
47
66
|
const splitMessage = message.split("{{node}}", 2);
|
|
48
|
-
return (_jsxs("div", { style: { display: "flex", whiteSpace: "pre", flexWrap: "wrap" }, children: [_jsx(Text, { variant: "body-sm", children: splitMessage[0] }), _jsx(
|
|
67
|
+
return (_jsxs("div", { style: { display: "flex", whiteSpace: "pre", flexWrap: "wrap" }, children: [_jsx(Text, { variant: "body-sm", children: splitMessage[0] }), _jsx(Anchor, { onClick: scrollToElement, children: linkLabel }), splitMessage[1] ? _jsx(Text, { variant: "body-sm", children: splitMessage[1] }) : null] }));
|
|
49
68
|
}
|
|
50
69
|
//# sourceMappingURL=TreeErrorRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeErrorRenderer.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeErrorRenderer.tsx"],"names":[],"mappings":";AAAA;;;gGAGgG;AAEhG,OAAO,EAAE,MAAM,EAAE,oBAAoB,IAAI,WAAW,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAChG,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG1D,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAmBlE,MAAM,UAAU,iBAAiB,CAAC,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,EAAE,wBAAwB,EAAE,aAAa,EAA0B;IAC3I,MAAM,EAAE,gBAAgB,EAAE,GAAG,sBAAsB,EAAE,CAAC;IACtD,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QAC7C,IAAI,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;YACjD,OAAO,CACL,KAAC,iBAAiB,IAEhB,aAAa,EAAE,GAAG,EAAE;oBAClB,MAAM,qBAAqB,GAAG,wBAAwB,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;oBAC/E,qBAAqB,IAAI,aAAa,EAAE,CAAC,qBAAqB,CAA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AS,EAAE,SAAS,EAAE,eAAe,EAAE,eAAe,GAAI,EACrE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,OAAO,EAAE,SAAS,YAAG,YAAY,CAAC,CAAC,CAAC,GAAQ,CAAC,CAAC,CAAC,IAAI,IACxE,CACP,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 { Anchor, unstable_ErrorRegion as ErrorRegion, Text } from \"@itwin/itwinui-react/bricks\";\nimport { MAX_LIMIT_OVERRIDE } from \"../internal/Utils.js\";\nimport { HierarchyLevelDetails, useTree } from \"../UseTree.js\";\nimport { ErrorNode } from \"./FlatTreeNode.js\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\n\n/** @alpha */\nexport interface TreeErrorItemProps {\n /** A callback to reload a hierarchy level when an error occurs and `retry` button is clicked. */\n reloadTree?: (options: { parentNodeId: string | undefined; state: \"reset\" }) => void;\n /** Action to perform when the filter button is clicked for this node. */\n onFilterClick?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;\n}\n\ninterface TreeErrorRendererOwnProps {\n errorList: ErrorNode[];\n}\n\ntype TreeErrorRendererProps = TreeErrorRendererOwnProps &\n TreeErrorItemProps &\n Partial<Pick<ReturnType<typeof useTree>, \"getHierarchyLevelDetails\">> &\n Pick<LinkedNodeProps, \"scrollToElement\">;\n\nexport function TreeErrorRenderer({ errorList, reloadTree, scrollToElement, getHierarchyLevelDetails, onFilterClick }: TreeErrorRendererProps) {\n const { localizedStrings } = useLocalizationContext();\n const errorItems = errorList.map((errorNode) => {\n if (errorNode.error.type === \"ResultSetTooLarge\") {\n return (\n <ResultSetTooLarge\n key={errorNode.error.id}\n onFilterClick={() => {\n const hierarchyLevelDetails = getHierarchyLevelDetails?.(errorNode.parent?.id);\n hierarchyLevelDetails && onFilterClick?.(hierarchyLevelDetails);\n }}\n onOverrideLimit={getHierarchyLevelDetails ? (limit) => getHierarchyLevelDetails(errorNode.parent?.id)?.setSizeLimit(limit) : undefined}\n scrollToElement={scrollToElement}\n limit={errorNode.error.resultSetSizeLimit}\n errorNode={errorNode}\n />\n );\n }\n if (errorNode.error.type === \"NoFilterMatches\") {\n return (\n <NoFilterMatches\n key={errorNode.error.id}\n scrollToElement={scrollToElement}\n onFilterClick={() => {\n const hierarchyLevelDetails = getHierarchyLevelDetails?.(errorNode.parent?.id);\n hierarchyLevelDetails && onFilterClick?.(hierarchyLevelDetails);\n }}\n errorNode={errorNode}\n />\n );\n }\n return <DefaultErrorContainer key={errorNode.error.id} scrollToElement={scrollToElement} reloadTree={reloadTree} errorNode={errorNode} />;\n });\n\n return (\n <ErrorRegion.Root\n style={{ width: \"100%\" }}\n label={errorList.length !== 0 ? `${errorList.length} ${localizedStrings?.issuesFound}` : undefined}\n items={errorItems}\n />\n );\n}\n\nfunction NoFilterMatches({ onFilterClick, errorNode, scrollToElement }: LinkedNodeProps & { onFilterClick?: () => void }) {\n const { localizedStrings } = useLocalizationContext();\n\n return (\n <ErrorRegion.Item\n message={<MessageWithNode errorNode={errorNode} scrollToElement={scrollToElement} message={localizedStrings.noFilteredChildren} />}\n actions={<Anchor onClick={onFilterClick}>{localizedStrings.noFilteredChildrenChangeFilter}</Anchor>}\n />\n );\n}\n\nfunction DefaultErrorContainer({ reloadTree, errorNode, scrollToElement }: LinkedNodeProps & Pick<TreeErrorItemProps, \"reloadTree\">) {\n const { localizedStrings } = useLocalizationContext();\n\n return (\n <ErrorRegion.Item\n message={<MessageWithNode errorNode={errorNode} scrollToElement={scrollToElement} message={localizedStrings.failedToCreateHierarchy} />}\n actions={<Anchor onClick={() => reloadTree?.({ parentNodeId: errorNode.parent?.id, state: \"reset\" })}>{localizedStrings.retry}</Anchor>}\n />\n );\n}\n\ntype ResultSetTooLargeProps = {\n limit: number;\n onFilterClick?: () => void;\n onOverrideLimit?: (limit: number) => void;\n} & LinkedNodeProps;\n\nfunction ResultSetTooLarge({ errorNode, onFilterClick, limit, onOverrideLimit, scrollToElement }: ResultSetTooLargeProps) {\n const { localizedStrings } = useLocalizationContext();\n const supportsFiltering = !!onFilterClick;\n const supportsLimitOverride = !!onOverrideLimit && limit < MAX_LIMIT_OVERRIDE;\n const messageWithLimit = localizedStrings.resultLimitExceeded.replace(\"{{limit}}\", limit.toString());\n\n return (\n <ErrorRegion.Item\n message={<MessageWithNode errorNode={errorNode} scrollToElement={scrollToElement} message={messageWithLimit} />}\n actions={\n <div style={{ display: \"flex\", flexDirection: \"column\" }}>\n {supportsLimitOverride && (\n <Anchor onClick={() => onOverrideLimit(MAX_LIMIT_OVERRIDE)}>\n {localizedStrings.increaseHierarchyLimit.replace(\"{{limit}}\", MAX_LIMIT_OVERRIDE.toString())}\n </Anchor>\n )}\n {supportsFiltering && <Anchor onClick={onFilterClick}>{localizedStrings.increaseHierarchyLimitWithFiltering}</Anchor>}\n </div>\n }\n />\n );\n}\n\ninterface LinkedNodeProps {\n errorNode: ErrorNode;\n scrollToElement: (node: ErrorNode) => void;\n}\n\nfunction LinkedNode({ errorNode, scrollToElement }: LinkedNodeProps) {\n return <Anchor onClick={() => scrollToElement(errorNode)}>{errorNode.parent?.label}</Anchor>;\n}\n\nfunction MessageWithNode({ errorNode, scrollToElement, message }: LinkedNodeProps & { message: string }) {\n const splitMessage = message.split(\"{{node}}\", 2);\n return (\n <div style={{ display: \"flex\", whiteSpace: \"pre\", flexWrap: \"wrap\" }}>\n <Text variant={\"body-sm\"}>{splitMessage[0]}</Text>\n <LinkedNode errorNode={errorNode} scrollToElement={scrollToElement} />\n {splitMessage[1] ? <Text variant={\"body-sm\"}>{splitMessage[1]}</Text> : null}\n </div>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TreeErrorRenderer.js","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeErrorRenderer.tsx"],"names":[],"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E,SAAS,EAAE,EAAE,EAAE,CAAC,SAAS,EAAE,CAAC;iBACvC,GAAG,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CAC1B,KAAC,MAAM,IAAa,OAAO,EAAE,MAAM,YAChC,KAAK,IADK,KAAK,CAET,CACV,CAAC,GACA,GAER,CACH,CAAC;AACJ,CAAC;AAQD,SAAS,eAAe,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAwB;IACpF,MAAM,YAAY,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC;IAClD,OAAO,CACL,eAAK,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,aAClE,KAAC,IAAI,IAAC,OAAO,EAAE,SAAS,YAAG,YAAY,CAAC,CAAC,CAAC,GAAQ,EAClD,KAAC,MAAM,IAAC,OAAO,EAAE,eAAe,YAAG,SAAS,GAAU,EACrD,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,OAAO,EAAE,SAAS,YAAG,YAAY,CAAC,CAAC,CAAC,GAAQ,CAAC,CAAC,CAAC,IAAI,IACxE,CACP,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 { ReactElement } from \"react\";\nimport { Anchor, unstable_ErrorRegion as ErrorRegion, Text } from \"@itwin/itwinui-react/bricks\";\nimport { MAX_LIMIT_OVERRIDE } from \"../internal/Utils.js\";\nimport { HierarchyLevelDetails, useTree } from \"../UseTree.js\";\nimport { ErrorNode } from \"./FlatTreeNode.js\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\n\n/**\n * Interface containing error item related actions.\n *\n * @alpha\n */\ninterface TreeErrorItemProps {\n /** A callback to reload a hierarchy level when an error occurs and `retry` button is clicked. */\n reloadTree: (options: { parentNodeId: string | undefined; state: \"reset\" }) => void;\n /** Action to perform when the filter button is clicked for this node. */\n onFilterClick?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;\n /** Action to perform when an error accurs and node label is clicked in the error message */\n scrollToElement: (errorNode: ErrorNode) => void;\n}\n/**\n * Interface containing building blocks for `TreeErrorRenderer`.\n *\n * @alpha\n */\ninterface TreeErrorRendererOwnProps {\n /** List of errors to be displayed */\n errorList: ErrorNode[];\n // Callback to render custom error messages. Component should be wrapped in `ErrorRegion.Item` from `@itwin/itwinui-react` package.\n renderError?: ({ errorNode, scrollToElement }: { errorNode: ErrorNode; scrollToElement: () => void }) => ReactElement;\n}\n\n/** @alpha */\nexport type TreeErrorRendererProps = TreeErrorRendererOwnProps & TreeErrorItemProps & Partial<Pick<ReturnType<typeof useTree>, \"getHierarchyLevelDetails\">>;\n\n/**\n * A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@itwin/itwinui-react`.\n * As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorList` hook.\n *\n * @alpha\n */\nexport function TreeErrorRenderer({ errorList, reloadTree, scrollToElement, getHierarchyLevelDetails, onFilterClick, renderError }: TreeErrorRendererProps) {\n const { localizedStrings } = useLocalizationContext();\n const errorItems = errorList.map((errorNode) => {\n if (renderError) {\n return renderError({ errorNode, scrollToElement: () => scrollToElement(errorNode) });\n }\n\n if (errorNode.error.type === \"ResultSetTooLarge\") {\n const limit = errorNode.error.resultSetSizeLimit;\n const onOverrideLimit = getHierarchyLevelDetails ? () => getHierarchyLevelDetails(errorNode.parent?.id)?.setSizeLimit(MAX_LIMIT_OVERRIDE) : undefined;\n return (\n <ErrorItemContainer\n key={errorNode.error.id}\n errorNode={errorNode}\n actions={[\n {\n action: () => {\n onOverrideLimit?.();\n },\n label: localizedStrings.increaseHierarchyLimit.replace(\"{{limit}}\", MAX_LIMIT_OVERRIDE.toString()),\n condition: () => !!onOverrideLimit && limit < MAX_LIMIT_OVERRIDE,\n },\n {\n action: () => {\n const hierarchyLevelDetails = getHierarchyLevelDetails?.(errorNode.parent?.id);\n hierarchyLevelDetails && onFilterClick?.(hierarchyLevelDetails);\n },\n label: localizedStrings.increaseHierarchyLimitWithFiltering,\n condition: () => !!onFilterClick && !!errorNode.parent?.isFilterable,\n },\n ]}\n message={localizedStrings.resultLimitExceeded.replace(\"{{limit}}\", limit.toString())}\n scrollToElement={() => scrollToElement(errorNode)}\n />\n );\n }\n if (errorNode.error.type === \"NoFilterMatches\") {\n return (\n <ErrorItemContainer\n key={errorNode.error.id}\n errorNode={errorNode}\n actions={[\n {\n action: () => {\n const hierarchyLevelDetails = getHierarchyLevelDetails?.(errorNode.parent?.id);\n hierarchyLevelDetails && onFilterClick?.(hierarchyLevelDetails);\n },\n label: localizedStrings.noFilteredChildrenChangeFilter,\n condition: () => true,\n },\n ]}\n message={localizedStrings.noFilteredChildren}\n scrollToElement={() => scrollToElement(errorNode)}\n />\n );\n }\n return (\n <ErrorItemContainer\n key={errorNode.error.id}\n errorNode={errorNode}\n actions={[\n {\n action: () => reloadTree({ parentNodeId: errorNode.parent?.id, state: \"reset\" }),\n label: localizedStrings.retry,\n condition: () => true,\n },\n ]}\n message={localizedStrings.failedToCreateHierarchy}\n scrollToElement={() => scrollToElement(errorNode)}\n />\n );\n });\n\n return (\n <ErrorRegion.Root\n style={{ width: \"100%\" }}\n label={errorList.length !== 0 ? `${errorList.length} ${localizedStrings?.issuesFound}` : undefined}\n items={errorItems}\n />\n );\n}\n\ntype ErrorItemContainerProps = {\n errorNode: ErrorNode;\n message: string;\n actions?: { action: () => void; label: string; condition: () => boolean }[];\n} & Pick<MessageWithLinkProps, \"scrollToElement\">;\n\nfunction ErrorItemContainer({ errorNode, message, actions, scrollToElement }: ErrorItemContainerProps) {\n return (\n <ErrorRegion.Item\n message={<MessageWithLink linkLabel={errorNode.parent?.label} scrollToElement={scrollToElement} message={message} />}\n messageId={errorNode.error.id}\n actions={\n <div style={{ display: \"flex\", flexDirection: \"column\" }}>\n {actions\n ?.filter(({ condition }) => condition())\n .map(({ label, action }) => (\n <Anchor key={label} onClick={action}>\n {label}\n </Anchor>\n ))}\n </div>\n }\n />\n );\n}\n\ninterface MessageWithLinkProps {\n scrollToElement: () => void;\n message: string;\n linkLabel?: string;\n}\n\nfunction MessageWithLink({ linkLabel, scrollToElement, message }: MessageWithLinkProps) {\n const splitMessage = message.split(\"{{node}}\", 2);\n return (\n <div style={{ display: \"flex\", whiteSpace: \"pre\", flexWrap: \"wrap\" }}>\n <Text variant={\"body-sm\"}>{splitMessage[0]}</Text>\n <Anchor onClick={scrollToElement}>{linkLabel}</Anchor>\n {splitMessage[1] ? <Text variant={\"body-sm\"}>{splitMessage[1]}</Text> : null}\n </div>\n );\n}\n"]}
|
|
@@ -1,47 +1,45 @@
|
|
|
1
|
-
import { ComponentPropsWithoutRef,
|
|
1
|
+
import { ComponentPropsWithoutRef, FC, PropsWithRef, ReactElement, ReactNode, RefAttributes } from "react";
|
|
2
2
|
import { Tree } from "@itwin/itwinui-react/bricks";
|
|
3
3
|
import { PresentationHierarchyNode } from "../TreeNode.js";
|
|
4
4
|
import { useTree, UseTreeResult } from "../UseTree.js";
|
|
5
|
-
import { ErrorNode
|
|
6
|
-
import { TreeItemAction } from "./TreeActionButton.js";
|
|
5
|
+
import { ErrorNode } from "./FlatTreeNode.js";
|
|
7
6
|
/** @alpha */
|
|
8
7
|
type TreeNodeProps = ComponentPropsWithoutRef<typeof Tree.Item>;
|
|
9
8
|
/** @alpha */
|
|
10
9
|
export interface TreeNodeRendererOwnProps {
|
|
11
10
|
/** Node that is rendered. */
|
|
12
|
-
node:
|
|
11
|
+
node: PresentationHierarchyNode;
|
|
13
12
|
/** Returns a label for a given node. */
|
|
14
13
|
getLabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
15
14
|
/** Returns sublabel for a given node. */
|
|
16
15
|
getSublabel?: (node: PresentationHierarchyNode) => ReactElement | undefined;
|
|
17
16
|
/** Action to perform when the node is clicked. */
|
|
18
|
-
onNodeClick?: (node: PresentationHierarchyNode, isSelected: boolean, event: React.MouseEvent<HTMLElement
|
|
17
|
+
onNodeClick?: (node: PresentationHierarchyNode, isSelected: boolean, event: React.MouseEvent<HTMLElement>) => void;
|
|
19
18
|
/** Action to perform when a key is pressed when the node is hovered on. */
|
|
20
19
|
onNodeKeyDown?: (node: PresentationHierarchyNode, isSelected: boolean, event: React.KeyboardEvent<HTMLElement>) => void;
|
|
21
|
-
/**
|
|
22
|
-
* Actions for tree item.
|
|
23
|
-
*/
|
|
24
|
-
actions?: Array<(node: PresentationHierarchyNode) => TreeItemAction>;
|
|
25
20
|
/**
|
|
26
21
|
* Used to render elements between expander and label.
|
|
27
22
|
* E.g. icons, color picker, etc.
|
|
28
23
|
*/
|
|
29
24
|
getDecorations?: (node: PresentationHierarchyNode) => ReactNode;
|
|
30
25
|
/**
|
|
31
|
-
*
|
|
32
|
-
* Returns an error if node contains one, otherwise returns undefined.
|
|
26
|
+
* Callback that returns actions for tree item. Must return an array of `Tree.ItemAction` elements.
|
|
33
27
|
*/
|
|
34
|
-
|
|
28
|
+
getActions?: (node: PresentationHierarchyNode) => ReactNode[];
|
|
29
|
+
/** Specifies if tree item has error. */
|
|
30
|
+
error?: ErrorNode;
|
|
35
31
|
}
|
|
36
32
|
/** @alpha */
|
|
37
|
-
type TreeNodeRendererProps = Pick<ReturnType<typeof useTree>, "expandNode"
|
|
33
|
+
type TreeNodeRendererProps = Pick<ReturnType<typeof useTree>, "expandNode"> & Partial<Pick<ReturnType<typeof useTree>, "getHierarchyLevelDetails">> & Omit<TreeNodeProps, "actions" | "label" | "expanded" | "unstable_decorations" | "error"> & Pick<UseTreeResult, "reloadTree"> & TreeNodeRendererOwnProps;
|
|
38
34
|
/**
|
|
39
|
-
* A component that renders `
|
|
35
|
+
* A component that renders given `FlatTreeNode` using the `Tree.Item` component from `@itwin/itwinui-react`. The
|
|
36
|
+
* `FlatTreeNode` objects for this renderer are generally created using the `useFlatTreeNodeList` hook.
|
|
40
37
|
*
|
|
41
38
|
* @see `TreeRenderer`
|
|
42
39
|
* @see https://itwinui.bentley.com/docs/tree
|
|
43
40
|
* @public
|
|
44
41
|
*/
|
|
45
|
-
export declare const TreeNodeRenderer:
|
|
42
|
+
export declare const TreeNodeRenderer: FC<PropsWithRef<TreeNodeRendererProps & RefAttributes<HTMLElement>>>;
|
|
43
|
+
export declare const PlaceholderNode: FC<PropsWithRef<Omit<TreeNodeProps, "onExpanded" | "label" | "actions" | "icon" | "error"> & RefAttributes<HTMLElement>>>;
|
|
46
44
|
export {};
|
|
47
45
|
//# sourceMappingURL=TreeNodeRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeNodeRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,wBAAwB,
|
|
1
|
+
{"version":3,"file":"TreeNodeRenderer.d.ts","sourceRoot":"","sources":["../../../../src/presentation-hierarchies-react/itwinui/TreeNodeRenderer.tsx"],"names":[],"mappings":"AAKA,OAAO,EACL,wBAAwB,EACxB,EAAE,EAKF,YAAY,EACZ,YAAY,EACZ,SAAS,EAET,aAAa,EAId,MAAM,OAAO,CAAC;AACf,OAAO,EAAW,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAK9C,aAAa;AACb,KAAK,aAAa,GAAG,wBAAwB,CAAC,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC;AAEhE,aAAa;AACb,MAAM,WAAW,wBAAwB;IACvC,6BAA6B;IAC7B,IAAI,EAAE,yBA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