@itwin/presentation-hierarchies-react 2.0.0-alpha.6 → 2.0.0-alpha.61
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 +1151 -11
- package/README.md +93 -160
- package/lib/presentation-hierarchies-react/FlatTreeNode.d.ts +49 -0
- package/lib/presentation-hierarchies-react/FlatTreeNode.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/FlatTreeNode.js +96 -0
- package/lib/presentation-hierarchies-react/FlatTreeNode.js.map +1 -0
- package/lib/presentation-hierarchies-react/LocalizationContext.d.ts +24 -0
- package/lib/presentation-hierarchies-react/LocalizationContext.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/LocalizationContext.js +40 -0
- package/lib/presentation-hierarchies-react/LocalizationContext.js.map +1 -0
- package/lib/presentation-hierarchies-react/Renderers.d.ts +92 -0
- package/lib/presentation-hierarchies-react/Renderers.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/TreeNode.d.ts +80 -0
- package/lib/presentation-hierarchies-react/TreeNode.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseIModelTree.d.ts +28 -15
- package/lib/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/UseIModelTree.js +183 -0
- package/lib/presentation-hierarchies-react/UseIModelTree.js.map +1 -0
- package/lib/presentation-hierarchies-react/UseNodeHighlighting.d.ts +30 -0
- package/lib/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/UseNodeHighlighting.js +57 -0
- package/lib/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -0
- package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts +23 -0
- package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/UseSelectionHandler.js +124 -0
- package/lib/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -0
- package/lib/presentation-hierarchies-react/UseTree.d.ts +112 -0
- package/lib/presentation-hierarchies-react/UseTree.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/UseTree.js +298 -0
- package/lib/presentation-hierarchies-react/UseTree.js.map +1 -0
- package/lib/presentation-hierarchies-react/Utils.js +56 -0
- package/lib/presentation-hierarchies-react/Utils.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/DisposePolyfill.js +10 -0
- package/lib/presentation-hierarchies-react/internal/DisposePolyfill.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/LocalizedStrings.d.ts +9 -0
- package/lib/presentation-hierarchies-react/internal/LocalizedStrings.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js +12 -0
- package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/TreeActions.js +294 -0
- package/lib/presentation-hierarchies-react/internal/TreeActions.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/TreeLoader.js +98 -0
- package/lib/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/TreeModel.d.ts +1 -0
- package/lib/presentation-hierarchies-react/internal/TreeModel.js +115 -0
- package/lib/presentation-hierarchies-react/internal/TreeModel.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +35 -0
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js +141 -0
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/Utils.js +42 -0
- package/lib/presentation-hierarchies-react/internal/Utils.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts +40 -0
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +387 -0
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +21 -0
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +185 -0
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeAction.d.ts +49 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeAction.js +88 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +38 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +77 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts +29 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js +91 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts +31 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js +155 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.css +25 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +14 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +540 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +75 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js +417 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
- package/lib/presentation-hierarchies-react-extract.d.ts +17 -0
- package/lib/presentation-hierarchies-react-extract.js +16 -0
- package/lib/presentation-hierarchies-react-stratakit.d.ts +8 -0
- package/lib/presentation-hierarchies-react-stratakit.js +8 -0
- package/lib/presentation-hierarchies-react.d.ts +11 -0
- package/lib/presentation-hierarchies-react.js +8 -0
- package/lib/public/locales/en/PresentationHierarchies_1.0.json +26 -0
- package/package.json +78 -56
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +0 -75
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/TreeNode.js +0 -12
- package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +0 -1
- 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/UseIModelTree.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.js +0 -62
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts +0 -46
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js +0 -98
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +0 -132
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.js +0 -242
- package/lib/esm/presentation-hierarchies-react/UseTree.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts +0 -2
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js +0 -11
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +0 -53
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +0 -307
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +0 -44
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +0 -94
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts +0 -70
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js +0 -153
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +0 -28
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +0 -128
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts +0 -23
- package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js +0 -58
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/itwinui/FlatTreeNode.d.ts +0 -21
- 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 +0 -34
- 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 -23
- 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 -40
- 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 -48
- package/lib/esm/presentation-hierarchies-react/itwinui/TreeRenderer.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react.d.ts +0 -13
- package/lib/esm/presentation-hierarchies-react.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react.js +0 -16
- package/lib/esm/presentation-hierarchies-react.js.map +0 -1
|
@@ -0,0 +1,387 @@
|
|
|
1
|
+
import { MAX_LIMIT_OVERRIDE } from "../internal/Utils.js";
|
|
2
|
+
import { useTranslation } from "../LocalizationContext.js";
|
|
3
|
+
import { c } from "react-compiler-runtime";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { unstable_ErrorRegion } from "@stratakit/structures";
|
|
6
|
+
import { Anchor, Text } from "@stratakit/bricks";
|
|
7
|
+
//#region src/presentation-hierarchies-react/stratakit/ErrorItemRenderer.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Renders StrataKit `<ErrorRegion.Item />` for all supported error types:
|
|
10
|
+
* - `ResultSetTooLarge` - renders `resultLimitExceeded` message with actions to increase limit or apply filtering
|
|
11
|
+
* - `NoFilterMatches` - renders `noFilteredChildren` message with action to change filter
|
|
12
|
+
* - `ChildrenLoad` - renders `failedToCreateHierarchy` message with action to retry loading
|
|
13
|
+
* - `Unknown` - renders message set on error object.
|
|
14
|
+
*
|
|
15
|
+
* @alpha
|
|
16
|
+
*/
|
|
17
|
+
function ErrorItemRenderer(t0) {
|
|
18
|
+
const $ = c(87);
|
|
19
|
+
const { treeNode, error, getHierarchyLevelDetails, filterHierarchyLevel, reloadTree, scrollToNode } = t0;
|
|
20
|
+
const translate = useTranslation();
|
|
21
|
+
if (error.type === "ResultSetTooLarge") {
|
|
22
|
+
const limit = error.resultSetSizeLimit;
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[0] !== getHierarchyLevelDetails || $[1] !== treeNode) {
|
|
25
|
+
t1 = () => getHierarchyLevelDetails(treeNode.id)?.setSizeLimit(MAX_LIMIT_OVERRIDE);
|
|
26
|
+
$[0] = getHierarchyLevelDetails;
|
|
27
|
+
$[1] = treeNode;
|
|
28
|
+
$[2] = t1;
|
|
29
|
+
} else t1 = $[2];
|
|
30
|
+
const onOverrideLimit = t1;
|
|
31
|
+
let t2;
|
|
32
|
+
if ($[3] !== onOverrideLimit) {
|
|
33
|
+
t2 = () => {
|
|
34
|
+
onOverrideLimit();
|
|
35
|
+
};
|
|
36
|
+
$[3] = onOverrideLimit;
|
|
37
|
+
$[4] = t2;
|
|
38
|
+
} else t2 = $[4];
|
|
39
|
+
let t3;
|
|
40
|
+
if ($[5] !== translate) {
|
|
41
|
+
t3 = translate("increaseHierarchyLimit").replace("{{limit}}", MAX_LIMIT_OVERRIDE.toString());
|
|
42
|
+
$[5] = translate;
|
|
43
|
+
$[6] = t3;
|
|
44
|
+
} else t3 = $[6];
|
|
45
|
+
let t4;
|
|
46
|
+
if ($[7] !== limit) {
|
|
47
|
+
t4 = () => limit < MAX_LIMIT_OVERRIDE;
|
|
48
|
+
$[7] = limit;
|
|
49
|
+
$[8] = t4;
|
|
50
|
+
} else t4 = $[8];
|
|
51
|
+
let t5;
|
|
52
|
+
if ($[9] !== t2 || $[10] !== t3 || $[11] !== t4) {
|
|
53
|
+
t5 = {
|
|
54
|
+
action: t2,
|
|
55
|
+
label: t3,
|
|
56
|
+
condition: t4
|
|
57
|
+
};
|
|
58
|
+
$[9] = t2;
|
|
59
|
+
$[10] = t3;
|
|
60
|
+
$[11] = t4;
|
|
61
|
+
$[12] = t5;
|
|
62
|
+
} else t5 = $[12];
|
|
63
|
+
let t6;
|
|
64
|
+
if ($[13] !== filterHierarchyLevel || $[14] !== getHierarchyLevelDetails || $[15] !== treeNode) {
|
|
65
|
+
t6 = () => {
|
|
66
|
+
const hierarchyLevelDetails = getHierarchyLevelDetails(treeNode.id);
|
|
67
|
+
hierarchyLevelDetails && filterHierarchyLevel?.(hierarchyLevelDetails);
|
|
68
|
+
};
|
|
69
|
+
$[13] = filterHierarchyLevel;
|
|
70
|
+
$[14] = getHierarchyLevelDetails;
|
|
71
|
+
$[15] = treeNode;
|
|
72
|
+
$[16] = t6;
|
|
73
|
+
} else t6 = $[16];
|
|
74
|
+
let t7;
|
|
75
|
+
if ($[17] !== translate) {
|
|
76
|
+
t7 = translate("increaseHierarchyLimitWithFiltering");
|
|
77
|
+
$[17] = translate;
|
|
78
|
+
$[18] = t7;
|
|
79
|
+
} else t7 = $[18];
|
|
80
|
+
let t8;
|
|
81
|
+
if ($[19] !== filterHierarchyLevel || $[20] !== treeNode) {
|
|
82
|
+
t8 = () => !!filterHierarchyLevel && !!treeNode.isFilterable;
|
|
83
|
+
$[19] = filterHierarchyLevel;
|
|
84
|
+
$[20] = treeNode;
|
|
85
|
+
$[21] = t8;
|
|
86
|
+
} else t8 = $[21];
|
|
87
|
+
let t9;
|
|
88
|
+
if ($[22] !== t6 || $[23] !== t7 || $[24] !== t8) {
|
|
89
|
+
t9 = {
|
|
90
|
+
action: t6,
|
|
91
|
+
label: t7,
|
|
92
|
+
condition: t8
|
|
93
|
+
};
|
|
94
|
+
$[22] = t6;
|
|
95
|
+
$[23] = t7;
|
|
96
|
+
$[24] = t8;
|
|
97
|
+
$[25] = t9;
|
|
98
|
+
} else t9 = $[25];
|
|
99
|
+
let t10;
|
|
100
|
+
if ($[26] !== t5 || $[27] !== t9) {
|
|
101
|
+
t10 = [t5, t9];
|
|
102
|
+
$[26] = t5;
|
|
103
|
+
$[27] = t9;
|
|
104
|
+
$[28] = t10;
|
|
105
|
+
} else t10 = $[28];
|
|
106
|
+
let t11;
|
|
107
|
+
if ($[29] !== limit || $[30] !== translate) {
|
|
108
|
+
t11 = translate("resultLimitExceeded").replace("{{limit}}", limit.toString());
|
|
109
|
+
$[29] = limit;
|
|
110
|
+
$[30] = translate;
|
|
111
|
+
$[31] = t11;
|
|
112
|
+
} else t11 = $[31];
|
|
113
|
+
let t12;
|
|
114
|
+
if ($[32] !== scrollToNode || $[33] !== treeNode) {
|
|
115
|
+
t12 = () => scrollToNode(treeNode);
|
|
116
|
+
$[32] = scrollToNode;
|
|
117
|
+
$[33] = treeNode;
|
|
118
|
+
$[34] = t12;
|
|
119
|
+
} else t12 = $[34];
|
|
120
|
+
let t13;
|
|
121
|
+
if ($[35] !== error || $[36] !== t10 || $[37] !== t11 || $[38] !== t12 || $[39] !== treeNode) {
|
|
122
|
+
t13 = /* @__PURE__ */ jsx(ErrorItemContainer, {
|
|
123
|
+
treeNode,
|
|
124
|
+
error,
|
|
125
|
+
actions: t10,
|
|
126
|
+
message: t11,
|
|
127
|
+
scrollToElement: t12
|
|
128
|
+
});
|
|
129
|
+
$[35] = error;
|
|
130
|
+
$[36] = t10;
|
|
131
|
+
$[37] = t11;
|
|
132
|
+
$[38] = t12;
|
|
133
|
+
$[39] = treeNode;
|
|
134
|
+
$[40] = t13;
|
|
135
|
+
} else t13 = $[40];
|
|
136
|
+
return t13;
|
|
137
|
+
}
|
|
138
|
+
if (error.type === "NoFilterMatches") {
|
|
139
|
+
let t1;
|
|
140
|
+
if ($[41] !== filterHierarchyLevel || $[42] !== getHierarchyLevelDetails || $[43] !== treeNode) {
|
|
141
|
+
t1 = () => {
|
|
142
|
+
const hierarchyLevelDetails_0 = getHierarchyLevelDetails(treeNode.id);
|
|
143
|
+
hierarchyLevelDetails_0 && filterHierarchyLevel?.(hierarchyLevelDetails_0);
|
|
144
|
+
};
|
|
145
|
+
$[41] = filterHierarchyLevel;
|
|
146
|
+
$[42] = getHierarchyLevelDetails;
|
|
147
|
+
$[43] = treeNode;
|
|
148
|
+
$[44] = t1;
|
|
149
|
+
} else t1 = $[44];
|
|
150
|
+
let t2;
|
|
151
|
+
if ($[45] !== translate) {
|
|
152
|
+
t2 = translate("noFilteredChildrenChangeFilter");
|
|
153
|
+
$[45] = translate;
|
|
154
|
+
$[46] = t2;
|
|
155
|
+
} else t2 = $[46];
|
|
156
|
+
let t3;
|
|
157
|
+
if ($[47] !== t1 || $[48] !== t2) {
|
|
158
|
+
t3 = [{
|
|
159
|
+
action: t1,
|
|
160
|
+
label: t2,
|
|
161
|
+
condition: _temp
|
|
162
|
+
}];
|
|
163
|
+
$[47] = t1;
|
|
164
|
+
$[48] = t2;
|
|
165
|
+
$[49] = t3;
|
|
166
|
+
} else t3 = $[49];
|
|
167
|
+
let t4;
|
|
168
|
+
if ($[50] !== translate) {
|
|
169
|
+
t4 = translate("noFilteredChildren");
|
|
170
|
+
$[50] = translate;
|
|
171
|
+
$[51] = t4;
|
|
172
|
+
} else t4 = $[51];
|
|
173
|
+
let t5;
|
|
174
|
+
if ($[52] !== scrollToNode || $[53] !== treeNode) {
|
|
175
|
+
t5 = () => scrollToNode(treeNode);
|
|
176
|
+
$[52] = scrollToNode;
|
|
177
|
+
$[53] = treeNode;
|
|
178
|
+
$[54] = t5;
|
|
179
|
+
} else t5 = $[54];
|
|
180
|
+
let t6;
|
|
181
|
+
if ($[55] !== error || $[56] !== t3 || $[57] !== t4 || $[58] !== t5 || $[59] !== treeNode) {
|
|
182
|
+
t6 = /* @__PURE__ */ jsx(ErrorItemContainer, {
|
|
183
|
+
treeNode,
|
|
184
|
+
error,
|
|
185
|
+
actions: t3,
|
|
186
|
+
message: t4,
|
|
187
|
+
scrollToElement: t5
|
|
188
|
+
});
|
|
189
|
+
$[55] = error;
|
|
190
|
+
$[56] = t3;
|
|
191
|
+
$[57] = t4;
|
|
192
|
+
$[58] = t5;
|
|
193
|
+
$[59] = treeNode;
|
|
194
|
+
$[60] = t6;
|
|
195
|
+
} else t6 = $[60];
|
|
196
|
+
return t6;
|
|
197
|
+
}
|
|
198
|
+
if (error.type === "ChildrenLoad") {
|
|
199
|
+
let t1;
|
|
200
|
+
if ($[61] !== reloadTree || $[62] !== treeNode) {
|
|
201
|
+
t1 = () => reloadTree({ parentNodeId: treeNode.id });
|
|
202
|
+
$[61] = reloadTree;
|
|
203
|
+
$[62] = treeNode;
|
|
204
|
+
$[63] = t1;
|
|
205
|
+
} else t1 = $[63];
|
|
206
|
+
let t2;
|
|
207
|
+
if ($[64] !== translate) {
|
|
208
|
+
t2 = translate("retry");
|
|
209
|
+
$[64] = translate;
|
|
210
|
+
$[65] = t2;
|
|
211
|
+
} else t2 = $[65];
|
|
212
|
+
let t3;
|
|
213
|
+
if ($[66] !== t1 || $[67] !== t2) {
|
|
214
|
+
t3 = [{
|
|
215
|
+
action: t1,
|
|
216
|
+
label: t2,
|
|
217
|
+
condition: _temp2
|
|
218
|
+
}];
|
|
219
|
+
$[66] = t1;
|
|
220
|
+
$[67] = t2;
|
|
221
|
+
$[68] = t3;
|
|
222
|
+
} else t3 = $[68];
|
|
223
|
+
let t4;
|
|
224
|
+
if ($[69] !== translate) {
|
|
225
|
+
t4 = translate("failedToCreateHierarchy");
|
|
226
|
+
$[69] = translate;
|
|
227
|
+
$[70] = t4;
|
|
228
|
+
} else t4 = $[70];
|
|
229
|
+
let t5;
|
|
230
|
+
if ($[71] !== scrollToNode || $[72] !== treeNode) {
|
|
231
|
+
t5 = () => scrollToNode(treeNode);
|
|
232
|
+
$[71] = scrollToNode;
|
|
233
|
+
$[72] = treeNode;
|
|
234
|
+
$[73] = t5;
|
|
235
|
+
} else t5 = $[73];
|
|
236
|
+
let t6;
|
|
237
|
+
if ($[74] !== error || $[75] !== t3 || $[76] !== t4 || $[77] !== t5 || $[78] !== treeNode) {
|
|
238
|
+
t6 = /* @__PURE__ */ jsx(ErrorItemContainer, {
|
|
239
|
+
treeNode,
|
|
240
|
+
error,
|
|
241
|
+
actions: t3,
|
|
242
|
+
message: t4,
|
|
243
|
+
scrollToElement: t5
|
|
244
|
+
});
|
|
245
|
+
$[74] = error;
|
|
246
|
+
$[75] = t3;
|
|
247
|
+
$[76] = t4;
|
|
248
|
+
$[77] = t5;
|
|
249
|
+
$[78] = treeNode;
|
|
250
|
+
$[79] = t6;
|
|
251
|
+
} else t6 = $[79];
|
|
252
|
+
return t6;
|
|
253
|
+
}
|
|
254
|
+
let t1;
|
|
255
|
+
if ($[80] !== scrollToNode || $[81] !== treeNode) {
|
|
256
|
+
t1 = () => scrollToNode(treeNode);
|
|
257
|
+
$[80] = scrollToNode;
|
|
258
|
+
$[81] = treeNode;
|
|
259
|
+
$[82] = t1;
|
|
260
|
+
} else t1 = $[82];
|
|
261
|
+
let t2;
|
|
262
|
+
if ($[83] !== error.message || $[84] !== t1 || $[85] !== treeNode) {
|
|
263
|
+
t2 = /* @__PURE__ */ jsx(ErrorItemContainer, {
|
|
264
|
+
treeNode,
|
|
265
|
+
message: error.message,
|
|
266
|
+
scrollToElement: t1
|
|
267
|
+
});
|
|
268
|
+
$[83] = error.message;
|
|
269
|
+
$[84] = t1;
|
|
270
|
+
$[85] = treeNode;
|
|
271
|
+
$[86] = t2;
|
|
272
|
+
} else t2 = $[86];
|
|
273
|
+
return t2;
|
|
274
|
+
}
|
|
275
|
+
function _temp2() {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
function _temp() {
|
|
279
|
+
return true;
|
|
280
|
+
}
|
|
281
|
+
function ErrorItemContainer(t0) {
|
|
282
|
+
const $ = c(10);
|
|
283
|
+
const { treeNode, message, actions, scrollToElement } = t0;
|
|
284
|
+
let t1;
|
|
285
|
+
if ($[0] !== message || $[1] !== scrollToElement || $[2] !== treeNode.label) {
|
|
286
|
+
t1 = /* @__PURE__ */ jsx(MessageWithLink, {
|
|
287
|
+
linkLabel: treeNode.label,
|
|
288
|
+
scrollToElement,
|
|
289
|
+
message
|
|
290
|
+
});
|
|
291
|
+
$[0] = message;
|
|
292
|
+
$[1] = scrollToElement;
|
|
293
|
+
$[2] = treeNode.label;
|
|
294
|
+
$[3] = t1;
|
|
295
|
+
} else t1 = $[3];
|
|
296
|
+
let t2;
|
|
297
|
+
if ($[4] !== actions) {
|
|
298
|
+
t2 = actions?.filter(_temp3).map(_temp4);
|
|
299
|
+
$[4] = actions;
|
|
300
|
+
$[5] = t2;
|
|
301
|
+
} else t2 = $[5];
|
|
302
|
+
let t3;
|
|
303
|
+
if ($[6] !== t1 || $[7] !== t2 || $[8] !== treeNode.id) {
|
|
304
|
+
t3 = /* @__PURE__ */ jsx(unstable_ErrorRegion.Item, {
|
|
305
|
+
message: t1,
|
|
306
|
+
messageId: treeNode.id,
|
|
307
|
+
actions: t2
|
|
308
|
+
});
|
|
309
|
+
$[6] = t1;
|
|
310
|
+
$[7] = t2;
|
|
311
|
+
$[8] = treeNode.id;
|
|
312
|
+
$[9] = t3;
|
|
313
|
+
} else t3 = $[9];
|
|
314
|
+
return t3;
|
|
315
|
+
}
|
|
316
|
+
function _temp4(t0) {
|
|
317
|
+
const { label, action } = t0;
|
|
318
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
319
|
+
variant: "body-sm",
|
|
320
|
+
children: /* @__PURE__ */ jsx(Anchor, {
|
|
321
|
+
onClick: action,
|
|
322
|
+
render: /* @__PURE__ */ jsx("button", {}),
|
|
323
|
+
children: label
|
|
324
|
+
})
|
|
325
|
+
}, label);
|
|
326
|
+
}
|
|
327
|
+
function _temp3(t0) {
|
|
328
|
+
const { condition } = t0;
|
|
329
|
+
return condition();
|
|
330
|
+
}
|
|
331
|
+
function MessageWithLink(t0) {
|
|
332
|
+
const $ = c(11);
|
|
333
|
+
const { linkLabel, scrollToElement, message } = t0;
|
|
334
|
+
let t1;
|
|
335
|
+
if ($[0] !== message) {
|
|
336
|
+
t1 = message.split("{{node}}", 2);
|
|
337
|
+
$[0] = message;
|
|
338
|
+
$[1] = t1;
|
|
339
|
+
} else t1 = $[1];
|
|
340
|
+
const splitMessage = t1;
|
|
341
|
+
let t2;
|
|
342
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
343
|
+
t2 = {
|
|
344
|
+
display: "flex",
|
|
345
|
+
whiteSpace: "pre",
|
|
346
|
+
flexWrap: "wrap"
|
|
347
|
+
};
|
|
348
|
+
$[2] = t2;
|
|
349
|
+
} else t2 = $[2];
|
|
350
|
+
let t3;
|
|
351
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
352
|
+
t3 = /* @__PURE__ */ jsx("button", {});
|
|
353
|
+
$[3] = t3;
|
|
354
|
+
} else t3 = $[3];
|
|
355
|
+
let t4;
|
|
356
|
+
if ($[4] !== linkLabel || $[5] !== scrollToElement) {
|
|
357
|
+
t4 = /* @__PURE__ */ jsx(Anchor, {
|
|
358
|
+
onClick: scrollToElement,
|
|
359
|
+
render: t3,
|
|
360
|
+
children: linkLabel
|
|
361
|
+
});
|
|
362
|
+
$[4] = linkLabel;
|
|
363
|
+
$[5] = scrollToElement;
|
|
364
|
+
$[6] = t4;
|
|
365
|
+
} else t4 = $[6];
|
|
366
|
+
const t5 = splitMessage[1] ? splitMessage[1] : null;
|
|
367
|
+
let t6;
|
|
368
|
+
if ($[7] !== splitMessage[0] || $[8] !== t4 || $[9] !== t5) {
|
|
369
|
+
t6 = /* @__PURE__ */ jsxs("div", {
|
|
370
|
+
style: t2,
|
|
371
|
+
children: [
|
|
372
|
+
splitMessage[0],
|
|
373
|
+
t4,
|
|
374
|
+
t5
|
|
375
|
+
]
|
|
376
|
+
});
|
|
377
|
+
$[7] = splitMessage[0];
|
|
378
|
+
$[8] = t4;
|
|
379
|
+
$[9] = t5;
|
|
380
|
+
$[10] = t6;
|
|
381
|
+
} else t6 = $[10];
|
|
382
|
+
return t6;
|
|
383
|
+
}
|
|
384
|
+
//#endregion
|
|
385
|
+
export { ErrorItemRenderer };
|
|
386
|
+
|
|
387
|
+
//# sourceMappingURL=ErrorItemRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorItemRenderer.js","names":["Anchor","Text","unstable_ErrorRegion","ErrorRegion","MAX_LIMIT_OVERRIDE","useTranslation","JSX","HierarchyLevelDetails","TreeRendererProps","ErrorInfo","TreeNode","ErrorItemRendererProps","Pick","treeNode","Omit","error","reloadTree","options","parentNodeId","scrollToNode","filterHierarchyLevel","hierarchyLevelDetails","ErrorItemRenderer","t0","$","_c","getHierarchyLevelDetails","translate","type","limit","resultSetSizeLimit","t1","id","setSizeLimit","onOverrideLimit","t2","t3","replace","toString","t4","t5","action","label","condition","t6","t7","t8","isFilterable","t9","t10","t11","t12","t13","hierarchyLevelDetails_0","_temp","_temp2","message","ErrorItemContainerProps","actions","MessageWithLinkProps","ErrorItemContainer","scrollToElement","filter","_temp3","map","_temp4","linkLabel","MessageWithLink","split","splitMessage","Symbol","for","display","whiteSpace","flexWrap"],"sources":["../../../src/presentation-hierarchies-react/stratakit/ErrorItemRenderer.tsx"],"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, Text } from \"@stratakit/bricks\";\nimport { unstable_ErrorRegion as ErrorRegion } from \"@stratakit/structures\";\nimport { MAX_LIMIT_OVERRIDE } from \"../internal/Utils.js\";\nimport { useTranslation } from \"../LocalizationContext.js\";\n\nimport type { JSX } from \"react\";\nimport type { HierarchyLevelDetails, TreeRendererProps } from \"../Renderers.js\";\nimport type { ErrorInfo, TreeNode } from \"../TreeNode.js\";\n\n/** @alpha */\nexport interface ErrorItemRendererProps extends Pick<TreeRendererProps, \"getHierarchyLevelDetails\"> {\n /** The tree node associated with the error. Used for displaying the node label in error messages and for scrolling to the node. */\n treeNode: Omit<TreeNode, \"errors\">;\n /** The error to render. */\n error: ErrorInfo;\n /** A callback to reload a hierarchy level when an error occurs and `retry` button is clicked. */\n reloadTree: (options: { parentNodeId: string | undefined }) => void;\n /** A callback to scroll to the node associated with the error. */\n scrollToNode: (treeNode: Omit<TreeNode, \"errors\">) => void;\n /** A callback to initiate filtering of the given hierarchy level. */\n filterHierarchyLevel?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;\n}\n\n/**\n * Renders StrataKit `<ErrorRegion.Item />` for all supported error types:\n * - `ResultSetTooLarge` - renders `resultLimitExceeded` message with actions to increase limit or apply filtering\n * - `NoFilterMatches` - renders `noFilteredChildren` message with action to change filter\n * - `ChildrenLoad` - renders `failedToCreateHierarchy` message with action to retry loading\n * - `Unknown` - renders message set on error object.\n *\n * @alpha\n */\nexport function ErrorItemRenderer({\n treeNode,\n error,\n getHierarchyLevelDetails,\n filterHierarchyLevel,\n reloadTree,\n scrollToNode,\n}: ErrorItemRendererProps): JSX.Element {\n const translate = useTranslation();\n\n if (error.type === \"ResultSetTooLarge\") {\n const limit = error.resultSetSizeLimit;\n const onOverrideLimit = () => getHierarchyLevelDetails(treeNode.id)?.setSizeLimit(MAX_LIMIT_OVERRIDE);\n return (\n <ErrorItemContainer\n treeNode={treeNode}\n error={error}\n actions={[\n {\n action: () => {\n onOverrideLimit();\n },\n label: translate(\"increaseHierarchyLimit\").replace(\"{{limit}}\", MAX_LIMIT_OVERRIDE.toString()),\n condition: () => limit < MAX_LIMIT_OVERRIDE,\n },\n {\n action: () => {\n const hierarchyLevelDetails = getHierarchyLevelDetails(treeNode.id);\n hierarchyLevelDetails && filterHierarchyLevel?.(hierarchyLevelDetails);\n },\n label: translate(\"increaseHierarchyLimitWithFiltering\"),\n condition: () => !!filterHierarchyLevel && !!treeNode.isFilterable,\n },\n ]}\n message={translate(\"resultLimitExceeded\").replace(\"{{limit}}\", limit.toString())}\n scrollToElement={() => scrollToNode(treeNode)}\n />\n );\n }\n if (error.type === \"NoFilterMatches\") {\n return (\n <ErrorItemContainer\n treeNode={treeNode}\n error={error}\n actions={[\n {\n action: () => {\n const hierarchyLevelDetails = getHierarchyLevelDetails(treeNode.id);\n hierarchyLevelDetails && filterHierarchyLevel?.(hierarchyLevelDetails);\n },\n label: translate(\"noFilteredChildrenChangeFilter\"),\n condition: () => true,\n },\n ]}\n message={translate(\"noFilteredChildren\")}\n scrollToElement={() => scrollToNode(treeNode)}\n />\n );\n }\n if (error.type === \"ChildrenLoad\") {\n return (\n <ErrorItemContainer\n treeNode={treeNode}\n error={error}\n actions={[\n { action: () => reloadTree({ parentNodeId: treeNode.id }), label: translate(\"retry\"), condition: () => true },\n ]}\n message={translate(\"failedToCreateHierarchy\")}\n scrollToElement={() => scrollToNode(treeNode)}\n />\n );\n }\n return (\n <ErrorItemContainer treeNode={treeNode} message={error.message} scrollToElement={() => scrollToNode(treeNode)} />\n );\n}\n\ntype ErrorItemContainerProps = {\n treeNode: Omit<TreeNode, \"errors\">;\n message: string;\n actions?: { action: () => void; label: string; condition: () => boolean }[];\n} & Pick<MessageWithLinkProps, \"scrollToElement\">;\n\nfunction ErrorItemContainer({ treeNode, message, actions, scrollToElement }: ErrorItemContainerProps) {\n return (\n <ErrorRegion.Item\n message={<MessageWithLink linkLabel={treeNode.label} scrollToElement={scrollToElement} message={message} />}\n messageId={treeNode.id}\n actions={actions\n ?.filter(({ condition }) => condition())\n .map(({ label, action }) => (\n <Text key={label} variant=\"body-sm\">\n <Anchor onClick={action} render={<button />}>\n {label}\n </Anchor>\n </Text>\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 {splitMessage[0]}\n <Anchor onClick={scrollToElement} render={<button />}>\n {linkLabel}\n </Anchor>\n {splitMessage[1] ? splitMessage[1] : null}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAqCA,SAAOsB,kBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAA2B,MAAA,EAAAZ,UAAAE,OAAAW,0BAAAN,sBAAAJ,YAAAG,iBAAAI;CAQhC,MAAAI,YAAkBtB,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B;OAAAA,MAAApB,EAAA;AAAA,QANNoB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { RootErrorRendererProps } from "../Renderers.js";
|
|
2
|
+
import { JSX } from "react";
|
|
3
|
+
|
|
4
|
+
//#region src/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
type StrataKitRootErrorRendererProps = RootErrorRendererProps;
|
|
9
|
+
/**
|
|
10
|
+
* A component that renders root node error state.
|
|
11
|
+
*
|
|
12
|
+
* @alpha
|
|
13
|
+
*/
|
|
14
|
+
declare function StrataKitRootErrorRenderer({
|
|
15
|
+
error,
|
|
16
|
+
getHierarchyLevelDetails,
|
|
17
|
+
reloadTree
|
|
18
|
+
}: StrataKitRootErrorRendererProps): JSX.Element;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { StrataKitRootErrorRenderer };
|
|
21
|
+
//# sourceMappingURL=RootErrorRenderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootErrorRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/RootErrorRenderer.tsx"],"mappings":";;;;;;AAiBA;KAAY,+BAAA,GAAkC,sBAAA;;;;AAO9C;;iBAAgB,0BAAA,CAAA;EACd,KAAA;EACA,wBAAA;EACA;AAAA,GACC,+BAAA,GAAkC,GAAA,CAAI,OAAA"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { useTranslation } from "../LocalizationContext.js";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Button, Text } from "@stratakit/bricks";
|
|
5
|
+
import { Icon } from "@stratakit/foundations";
|
|
6
|
+
import errorSvg from "@stratakit/icons/status-error.svg";
|
|
7
|
+
//#region src/presentation-hierarchies-react/stratakit/RootErrorRenderer.tsx
|
|
8
|
+
/**
|
|
9
|
+
* A component that renders root node error state.
|
|
10
|
+
*
|
|
11
|
+
* @alpha
|
|
12
|
+
*/
|
|
13
|
+
function StrataKitRootErrorRenderer(t0) {
|
|
14
|
+
const $ = c(25);
|
|
15
|
+
const { error, getHierarchyLevelDetails, reloadTree } = t0;
|
|
16
|
+
const translate = useTranslation();
|
|
17
|
+
if (error.type === "ResultSetTooLarge") {
|
|
18
|
+
let t1;
|
|
19
|
+
if ($[0] !== getHierarchyLevelDetails) {
|
|
20
|
+
t1 = () => getHierarchyLevelDetails(void 0)?.setSizeLimit("unbounded");
|
|
21
|
+
$[0] = getHierarchyLevelDetails;
|
|
22
|
+
$[1] = t1;
|
|
23
|
+
} else t1 = $[1];
|
|
24
|
+
const onOverrideLimit = t1;
|
|
25
|
+
let t2;
|
|
26
|
+
if ($[2] !== error.resultSetSizeLimit || $[3] !== translate) {
|
|
27
|
+
t2 = translate("rootResultLimitExceeded").replace("{{limit}}", error.resultSetSizeLimit.toString());
|
|
28
|
+
$[2] = error.resultSetSizeLimit;
|
|
29
|
+
$[3] = translate;
|
|
30
|
+
$[4] = t2;
|
|
31
|
+
} else t2 = $[4];
|
|
32
|
+
let t3;
|
|
33
|
+
if ($[5] !== translate) {
|
|
34
|
+
t3 = translate("increaseHierarchyLimitToUnlimited");
|
|
35
|
+
$[5] = translate;
|
|
36
|
+
$[6] = t3;
|
|
37
|
+
} else t3 = $[6];
|
|
38
|
+
let t4;
|
|
39
|
+
if ($[7] !== onOverrideLimit || $[8] !== t3) {
|
|
40
|
+
t4 = [{
|
|
41
|
+
action: onOverrideLimit,
|
|
42
|
+
label: t3,
|
|
43
|
+
condition: _temp
|
|
44
|
+
}];
|
|
45
|
+
$[7] = onOverrideLimit;
|
|
46
|
+
$[8] = t3;
|
|
47
|
+
$[9] = t4;
|
|
48
|
+
} else t4 = $[9];
|
|
49
|
+
let t5;
|
|
50
|
+
if ($[10] !== t2 || $[11] !== t4) {
|
|
51
|
+
t5 = /* @__PURE__ */ jsx(RootErrorContainer, {
|
|
52
|
+
message: t2,
|
|
53
|
+
actions: t4
|
|
54
|
+
});
|
|
55
|
+
$[10] = t2;
|
|
56
|
+
$[11] = t4;
|
|
57
|
+
$[12] = t5;
|
|
58
|
+
} else t5 = $[12];
|
|
59
|
+
return t5;
|
|
60
|
+
}
|
|
61
|
+
let t1;
|
|
62
|
+
if ($[13] !== translate) {
|
|
63
|
+
t1 = translate("failedToCreateRootHierarchy");
|
|
64
|
+
$[13] = translate;
|
|
65
|
+
$[14] = t1;
|
|
66
|
+
} else t1 = $[14];
|
|
67
|
+
let t2;
|
|
68
|
+
if ($[15] !== reloadTree) {
|
|
69
|
+
t2 = () => reloadTree({
|
|
70
|
+
parentNodeId: void 0,
|
|
71
|
+
state: "reset"
|
|
72
|
+
});
|
|
73
|
+
$[15] = reloadTree;
|
|
74
|
+
$[16] = t2;
|
|
75
|
+
} else t2 = $[16];
|
|
76
|
+
let t3;
|
|
77
|
+
if ($[17] !== translate) {
|
|
78
|
+
t3 = translate("retry");
|
|
79
|
+
$[17] = translate;
|
|
80
|
+
$[18] = t3;
|
|
81
|
+
} else t3 = $[18];
|
|
82
|
+
let t4;
|
|
83
|
+
if ($[19] !== t2 || $[20] !== t3) {
|
|
84
|
+
t4 = [{
|
|
85
|
+
action: t2,
|
|
86
|
+
label: t3,
|
|
87
|
+
condition: _temp2
|
|
88
|
+
}];
|
|
89
|
+
$[19] = t2;
|
|
90
|
+
$[20] = t3;
|
|
91
|
+
$[21] = t4;
|
|
92
|
+
} else t4 = $[21];
|
|
93
|
+
let t5;
|
|
94
|
+
if ($[22] !== t1 || $[23] !== t4) {
|
|
95
|
+
t5 = /* @__PURE__ */ jsx(RootErrorContainer, {
|
|
96
|
+
message: t1,
|
|
97
|
+
actions: t4
|
|
98
|
+
});
|
|
99
|
+
$[22] = t1;
|
|
100
|
+
$[23] = t4;
|
|
101
|
+
$[24] = t5;
|
|
102
|
+
} else t5 = $[24];
|
|
103
|
+
return t5;
|
|
104
|
+
}
|
|
105
|
+
function _temp2() {
|
|
106
|
+
return true;
|
|
107
|
+
}
|
|
108
|
+
function _temp() {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
function RootErrorContainer(t0) {
|
|
112
|
+
const $ = c(10);
|
|
113
|
+
const { actions, message } = t0;
|
|
114
|
+
let t1;
|
|
115
|
+
let t2;
|
|
116
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
117
|
+
t1 = {
|
|
118
|
+
height: "100%",
|
|
119
|
+
display: "flex",
|
|
120
|
+
flexDirection: "column",
|
|
121
|
+
justifyContent: "center",
|
|
122
|
+
alignItems: "center",
|
|
123
|
+
gap: "0.5rem"
|
|
124
|
+
};
|
|
125
|
+
t2 = /* @__PURE__ */ jsx(Icon, {
|
|
126
|
+
href: errorSvg,
|
|
127
|
+
size: "large"
|
|
128
|
+
});
|
|
129
|
+
$[0] = t1;
|
|
130
|
+
$[1] = t2;
|
|
131
|
+
} else {
|
|
132
|
+
t1 = $[0];
|
|
133
|
+
t2 = $[1];
|
|
134
|
+
}
|
|
135
|
+
let t3;
|
|
136
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
137
|
+
t3 = { textAlign: "center" };
|
|
138
|
+
$[2] = t3;
|
|
139
|
+
} else t3 = $[2];
|
|
140
|
+
let t4;
|
|
141
|
+
if ($[3] !== message) {
|
|
142
|
+
t4 = /* @__PURE__ */ jsx(Text, {
|
|
143
|
+
variant: "body-sm",
|
|
144
|
+
style: t3,
|
|
145
|
+
children: message
|
|
146
|
+
});
|
|
147
|
+
$[3] = message;
|
|
148
|
+
$[4] = t4;
|
|
149
|
+
} else t4 = $[4];
|
|
150
|
+
let t5;
|
|
151
|
+
if ($[5] !== actions) {
|
|
152
|
+
t5 = actions?.filter(_temp3).map(_temp4);
|
|
153
|
+
$[5] = actions;
|
|
154
|
+
$[6] = t5;
|
|
155
|
+
} else t5 = $[6];
|
|
156
|
+
let t6;
|
|
157
|
+
if ($[7] !== t4 || $[8] !== t5) {
|
|
158
|
+
t6 = /* @__PURE__ */ jsxs("div", {
|
|
159
|
+
style: t1,
|
|
160
|
+
children: [
|
|
161
|
+
t2,
|
|
162
|
+
t4,
|
|
163
|
+
t5
|
|
164
|
+
]
|
|
165
|
+
});
|
|
166
|
+
$[7] = t4;
|
|
167
|
+
$[8] = t5;
|
|
168
|
+
$[9] = t6;
|
|
169
|
+
} else t6 = $[9];
|
|
170
|
+
return t6;
|
|
171
|
+
}
|
|
172
|
+
function _temp4(action) {
|
|
173
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
174
|
+
onClick: () => action.action(),
|
|
175
|
+
children: action.label
|
|
176
|
+
}, action.label);
|
|
177
|
+
}
|
|
178
|
+
function _temp3(t0) {
|
|
179
|
+
const { condition } = t0;
|
|
180
|
+
return condition();
|
|
181
|
+
}
|
|
182
|
+
//#endregion
|
|
183
|
+
export { StrataKitRootErrorRenderer };
|
|
184
|
+
|
|
185
|
+
//# sourceMappingURL=RootErrorRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootErrorRenderer.js","names":["Button","Text","Icon","useTranslation","errorSvg","JSX","RootErrorRendererProps","StrataKitRootErrorRendererProps","StrataKitRootErrorRenderer","t0","$","_c","error","getHierarchyLevelDetails","reloadTree","translate","type","t1","undefined","setSizeLimit","onOverrideLimit","t2","resultSetSizeLimit","replace","toString","t3","t4","action","label","condition","_temp","t5","parentNodeId","state","_temp2","RootErrorContainerProps","message","actions","RootErrorContainer","Symbol","for","height","display","flexDirection","justifyContent","alignItems","gap","textAlign","filter","_temp3","map","_temp4","t6"],"sources":["../../../src/presentation-hierarchies-react/stratakit/RootErrorRenderer.tsx"],"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, Text } from \"@stratakit/bricks\";\nimport { Icon } from \"@stratakit/foundations\";\nimport { useTranslation } from \"../LocalizationContext.js\";\n\nimport errorSvg from \"@stratakit/icons/status-error.svg\";\n\nimport type { JSX } from \"react\";\nimport type { RootErrorRendererProps } from \"../Renderers.js\";\n\n/**\n * @alpha\n */\nexport type StrataKitRootErrorRendererProps = RootErrorRendererProps;\n\n/**\n * A component that renders root node error state.\n *\n * @alpha\n */\nexport function StrataKitRootErrorRenderer({\n error,\n getHierarchyLevelDetails,\n reloadTree,\n}: StrataKitRootErrorRendererProps): JSX.Element {\n const translate = useTranslation();\n\n if (error.type === \"ResultSetTooLarge\") {\n const onOverrideLimit = () => getHierarchyLevelDetails(undefined)?.setSizeLimit(\"unbounded\");\n return (\n <RootErrorContainer\n message={translate(\"rootResultLimitExceeded\").replace(\"{{limit}}\", error.resultSetSizeLimit.toString())}\n actions={[\n { action: onOverrideLimit, label: translate(\"increaseHierarchyLimitToUnlimited\"), condition: () => true },\n ]}\n />\n );\n }\n\n return (\n <RootErrorContainer\n message={translate(\"failedToCreateRootHierarchy\")}\n actions={[\n {\n action: () => reloadTree({ parentNodeId: undefined, state: \"reset\" }),\n label: translate(\"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\n style={{\n height: \"100%\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n gap: \"0.5rem\",\n }}\n >\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"],"mappings":";;;;;;;;;;;;AAwBA,SAAOQ,2BAAAC,IAAA;CAAA,MAAAC,IAAAC,EAA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;GAAe,MAAA;GAAU,CAAA;AAAAM,IAAA,KAAAO;AAAAP,IAAA,KAAAW;QAAA;AAAAJ,OAAAP,EAAA;AAAAW,OAAAX,EAAA;;CAAA,IAAAe;AAAA,KAAAf,EAAA,OAAA6B,OAAAC,IAAA,4BAAA,EAAA;AACJf,OAAA,EAAAsB,WAAa,UAAU;AAAArC,IAAA,KAAAe;OAAAA,MAAAf,EAAA;CAAA,IAAAgB;AAAA,KAAAhB,EAAA,OAAA0B,SAAA;AAAxDV,OAAA,oBAAC,MAAD;GAAe,SAAA;GAAkB,OAAAD;aAC9BW;GACI,CAAA;AAAA1B,IAAA,KAAA0B;AAAA1B,IAAA,KAAAgB;OAAAA,MAAAhB,EAAA;CAAA,IAAAqB;AAAA,KAAArB,EAAA,OAAA2B,SAAA;AACNN,OAAAM,SAAOW,OACGC,OACL,CAAAC,IAACC,OAMH;AAAAzC,IAAA,KAAA2B;AAAA3B,IAAA,KAAAqB;OAAAA,MAAArB,EAAA;CAAA,IAAA0C;AAAA,KAAA1C,EAAA,OAAAgB,MAAAhB,EAAA,OAAAqB,IAAA;AAtBNqB,OAAA,qBAAA,OAAA;GACS,OAAAnC;aADT;IAUEI;IACAK;IAGCK;IASG;;AAAArB,IAAA,KAAAgB;AAAAhB,IAAA,KAAAqB;AAAArB,IAAA,KAAA0C;OAAAA,MAAA1C,EAAA;AAAA,QAvBN0C;;AAFJ,SAAAD,OAAAxB,QAAA;AAAA,QAoBY,oBAAC,QAAD;EAAoC,eAAMA,OAAMA,QAAQ;YACrDA,OAAMC;EACA,EAFID,OAAMC,MAEV;;AAtBrB,SAAAqB,OAAAxC,IAAA;CAiBkB,MAAA,EAAAoB,cAAApB;AAAa,QAAKoB,WAAW"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ComponentProps, NamedExoticComponent } from "react";
|
|
2
|
+
import { Tree } from "@stratakit/structures";
|
|
3
|
+
|
|
4
|
+
//#region src/presentation-hierarchies-react/stratakit/TreeAction.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* Attributes used to decide how to render tree actions. They allow to differentiate action style based on the context
|
|
7
|
+
* where that action is used.
|
|
8
|
+
* @alpha
|
|
9
|
+
*/
|
|
10
|
+
interface TreeActionBaseAttributes {
|
|
11
|
+
/**
|
|
12
|
+
* Specifies action variant supported by tree nodes:
|
|
13
|
+
*
|
|
14
|
+
* - "default" - standard action displayed in the dropdown menu accessible through the ellipsis button on the node.
|
|
15
|
+
* - "inline" - actions displayed directly on the tree node.
|
|
16
|
+
* - "context-menu" - actions displayed in the context menu opened by right-clicking the tree node.
|
|
17
|
+
*/
|
|
18
|
+
variant?: "default" | "inline" | "context-menu";
|
|
19
|
+
/**
|
|
20
|
+
* Indicates that the actions is not applicable for current tree node and should be hidden.
|
|
21
|
+
* When set to true, the action will not be rendered at all.
|
|
22
|
+
*/
|
|
23
|
+
hide?: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** @alpha */
|
|
26
|
+
type TreeActionBaseProps = ComponentProps<typeof Tree.ItemAction> & TreeActionBaseAttributes;
|
|
27
|
+
/**
|
|
28
|
+
* Base component used to render tree actions. It is designed to allow rendering same action in different contexts: inline, dropdown, context menu.
|
|
29
|
+
* Should be used together with `StrataKitTreeNodeRenderer` and returned from `getInlineActions`, `getMenuActions` and `getContextMenuActions` callbacks.
|
|
30
|
+
*
|
|
31
|
+
* When implementing custom action that returns this component, make sure to forward `TreeActionBaseAttributes` props to it. Example:
|
|
32
|
+
*
|
|
33
|
+
* ```tsx
|
|
34
|
+
* interface MyCustomTreeActionProps extends TreeActionBaseAttributes {
|
|
35
|
+
* myProp: string
|
|
36
|
+
* }
|
|
37
|
+
*
|
|
38
|
+
* function MyCustomTreeAction({ myProp, ...attributes }: MyCustomTreeActionProps) {
|
|
39
|
+
* // custom button logic goes here
|
|
40
|
+
* return <TreeActionBase {...attributes} icon={...} onClick={...} />
|
|
41
|
+
* }
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @alpha
|
|
45
|
+
*/
|
|
46
|
+
declare const TreeActionBase: NamedExoticComponent<TreeActionBaseProps>;
|
|
47
|
+
//#endregion
|
|
48
|
+
export { TreeActionBase, TreeActionBaseAttributes };
|
|
49
|
+
//# sourceMappingURL=TreeAction.d.ts.map
|