@itwin/presentation-hierarchies-react 2.0.0-alpha.6 → 2.0.0-alpha.60
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 +1137 -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 +93 -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 +297 -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 +120 -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 +38 -0
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +380 -0
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +27 -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 +63 -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 +534 -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,380 @@
|
|
|
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(83);
|
|
19
|
+
const { errorNode, getHierarchyLevelDetails, filterHierarchyLevel, reloadTree, scrollToNode } = t0;
|
|
20
|
+
const translate = useTranslation();
|
|
21
|
+
if (errorNode.error.type === "ResultSetTooLarge") {
|
|
22
|
+
const limit = errorNode.error.resultSetSizeLimit;
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[0] !== errorNode.id || $[1] !== getHierarchyLevelDetails) {
|
|
25
|
+
t1 = () => getHierarchyLevelDetails(errorNode.id)?.setSizeLimit(MAX_LIMIT_OVERRIDE);
|
|
26
|
+
$[0] = errorNode.id;
|
|
27
|
+
$[1] = getHierarchyLevelDetails;
|
|
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] !== errorNode.id || $[14] !== filterHierarchyLevel || $[15] !== getHierarchyLevelDetails) {
|
|
65
|
+
t6 = () => {
|
|
66
|
+
const hierarchyLevelDetails = getHierarchyLevelDetails(errorNode.id);
|
|
67
|
+
hierarchyLevelDetails && filterHierarchyLevel?.(hierarchyLevelDetails);
|
|
68
|
+
};
|
|
69
|
+
$[13] = errorNode.id;
|
|
70
|
+
$[14] = filterHierarchyLevel;
|
|
71
|
+
$[15] = getHierarchyLevelDetails;
|
|
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] !== errorNode.isFilterable || $[20] !== filterHierarchyLevel) {
|
|
82
|
+
t8 = () => !!filterHierarchyLevel && !!errorNode.isFilterable;
|
|
83
|
+
$[19] = errorNode.isFilterable;
|
|
84
|
+
$[20] = filterHierarchyLevel;
|
|
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] !== errorNode || $[33] !== scrollToNode) {
|
|
115
|
+
t12 = () => scrollToNode(errorNode);
|
|
116
|
+
$[32] = errorNode;
|
|
117
|
+
$[33] = scrollToNode;
|
|
118
|
+
$[34] = t12;
|
|
119
|
+
} else t12 = $[34];
|
|
120
|
+
let t13;
|
|
121
|
+
if ($[35] !== errorNode || $[36] !== t10 || $[37] !== t11 || $[38] !== t12) {
|
|
122
|
+
t13 = /* @__PURE__ */ jsx(ErrorItemContainer, {
|
|
123
|
+
errorNode,
|
|
124
|
+
actions: t10,
|
|
125
|
+
message: t11,
|
|
126
|
+
scrollToElement: t12
|
|
127
|
+
});
|
|
128
|
+
$[35] = errorNode;
|
|
129
|
+
$[36] = t10;
|
|
130
|
+
$[37] = t11;
|
|
131
|
+
$[38] = t12;
|
|
132
|
+
$[39] = t13;
|
|
133
|
+
} else t13 = $[39];
|
|
134
|
+
return t13;
|
|
135
|
+
}
|
|
136
|
+
if (errorNode.error.type === "NoFilterMatches") {
|
|
137
|
+
let t1;
|
|
138
|
+
if ($[40] !== errorNode.id || $[41] !== filterHierarchyLevel || $[42] !== getHierarchyLevelDetails) {
|
|
139
|
+
t1 = () => {
|
|
140
|
+
const hierarchyLevelDetails_0 = getHierarchyLevelDetails(errorNode.id);
|
|
141
|
+
hierarchyLevelDetails_0 && filterHierarchyLevel?.(hierarchyLevelDetails_0);
|
|
142
|
+
};
|
|
143
|
+
$[40] = errorNode.id;
|
|
144
|
+
$[41] = filterHierarchyLevel;
|
|
145
|
+
$[42] = getHierarchyLevelDetails;
|
|
146
|
+
$[43] = t1;
|
|
147
|
+
} else t1 = $[43];
|
|
148
|
+
let t2;
|
|
149
|
+
if ($[44] !== translate) {
|
|
150
|
+
t2 = translate("noFilteredChildrenChangeFilter");
|
|
151
|
+
$[44] = translate;
|
|
152
|
+
$[45] = t2;
|
|
153
|
+
} else t2 = $[45];
|
|
154
|
+
let t3;
|
|
155
|
+
if ($[46] !== t1 || $[47] !== t2) {
|
|
156
|
+
t3 = [{
|
|
157
|
+
action: t1,
|
|
158
|
+
label: t2,
|
|
159
|
+
condition: _temp
|
|
160
|
+
}];
|
|
161
|
+
$[46] = t1;
|
|
162
|
+
$[47] = t2;
|
|
163
|
+
$[48] = t3;
|
|
164
|
+
} else t3 = $[48];
|
|
165
|
+
let t4;
|
|
166
|
+
if ($[49] !== translate) {
|
|
167
|
+
t4 = translate("noFilteredChildren");
|
|
168
|
+
$[49] = translate;
|
|
169
|
+
$[50] = t4;
|
|
170
|
+
} else t4 = $[50];
|
|
171
|
+
let t5;
|
|
172
|
+
if ($[51] !== errorNode || $[52] !== scrollToNode) {
|
|
173
|
+
t5 = () => scrollToNode(errorNode);
|
|
174
|
+
$[51] = errorNode;
|
|
175
|
+
$[52] = scrollToNode;
|
|
176
|
+
$[53] = t5;
|
|
177
|
+
} else t5 = $[53];
|
|
178
|
+
let t6;
|
|
179
|
+
if ($[54] !== errorNode || $[55] !== t3 || $[56] !== t4 || $[57] !== t5) {
|
|
180
|
+
t6 = /* @__PURE__ */ jsx(ErrorItemContainer, {
|
|
181
|
+
errorNode,
|
|
182
|
+
actions: t3,
|
|
183
|
+
message: t4,
|
|
184
|
+
scrollToElement: t5
|
|
185
|
+
});
|
|
186
|
+
$[54] = errorNode;
|
|
187
|
+
$[55] = t3;
|
|
188
|
+
$[56] = t4;
|
|
189
|
+
$[57] = t5;
|
|
190
|
+
$[58] = t6;
|
|
191
|
+
} else t6 = $[58];
|
|
192
|
+
return t6;
|
|
193
|
+
}
|
|
194
|
+
if (errorNode.error.type === "ChildrenLoad") {
|
|
195
|
+
let t1;
|
|
196
|
+
if ($[59] !== errorNode.id || $[60] !== reloadTree) {
|
|
197
|
+
t1 = () => reloadTree({ parentNodeId: errorNode.id });
|
|
198
|
+
$[59] = errorNode.id;
|
|
199
|
+
$[60] = reloadTree;
|
|
200
|
+
$[61] = t1;
|
|
201
|
+
} else t1 = $[61];
|
|
202
|
+
let t2;
|
|
203
|
+
if ($[62] !== translate) {
|
|
204
|
+
t2 = translate("retry");
|
|
205
|
+
$[62] = translate;
|
|
206
|
+
$[63] = t2;
|
|
207
|
+
} else t2 = $[63];
|
|
208
|
+
let t3;
|
|
209
|
+
if ($[64] !== t1 || $[65] !== t2) {
|
|
210
|
+
t3 = [{
|
|
211
|
+
action: t1,
|
|
212
|
+
label: t2,
|
|
213
|
+
condition: _temp2
|
|
214
|
+
}];
|
|
215
|
+
$[64] = t1;
|
|
216
|
+
$[65] = t2;
|
|
217
|
+
$[66] = t3;
|
|
218
|
+
} else t3 = $[66];
|
|
219
|
+
let t4;
|
|
220
|
+
if ($[67] !== translate) {
|
|
221
|
+
t4 = translate("failedToCreateHierarchy");
|
|
222
|
+
$[67] = translate;
|
|
223
|
+
$[68] = t4;
|
|
224
|
+
} else t4 = $[68];
|
|
225
|
+
let t5;
|
|
226
|
+
if ($[69] !== errorNode || $[70] !== scrollToNode) {
|
|
227
|
+
t5 = () => scrollToNode(errorNode);
|
|
228
|
+
$[69] = errorNode;
|
|
229
|
+
$[70] = scrollToNode;
|
|
230
|
+
$[71] = t5;
|
|
231
|
+
} else t5 = $[71];
|
|
232
|
+
let t6;
|
|
233
|
+
if ($[72] !== errorNode || $[73] !== t3 || $[74] !== t4 || $[75] !== t5) {
|
|
234
|
+
t6 = /* @__PURE__ */ jsx(ErrorItemContainer, {
|
|
235
|
+
errorNode,
|
|
236
|
+
actions: t3,
|
|
237
|
+
message: t4,
|
|
238
|
+
scrollToElement: t5
|
|
239
|
+
});
|
|
240
|
+
$[72] = errorNode;
|
|
241
|
+
$[73] = t3;
|
|
242
|
+
$[74] = t4;
|
|
243
|
+
$[75] = t5;
|
|
244
|
+
$[76] = t6;
|
|
245
|
+
} else t6 = $[76];
|
|
246
|
+
return t6;
|
|
247
|
+
}
|
|
248
|
+
let t1;
|
|
249
|
+
if ($[77] !== errorNode || $[78] !== scrollToNode) {
|
|
250
|
+
t1 = () => scrollToNode(errorNode);
|
|
251
|
+
$[77] = errorNode;
|
|
252
|
+
$[78] = scrollToNode;
|
|
253
|
+
$[79] = t1;
|
|
254
|
+
} else t1 = $[79];
|
|
255
|
+
let t2;
|
|
256
|
+
if ($[80] !== errorNode || $[81] !== t1) {
|
|
257
|
+
t2 = /* @__PURE__ */ jsx(ErrorItemContainer, {
|
|
258
|
+
errorNode,
|
|
259
|
+
message: errorNode.error.message,
|
|
260
|
+
scrollToElement: t1
|
|
261
|
+
});
|
|
262
|
+
$[80] = errorNode;
|
|
263
|
+
$[81] = t1;
|
|
264
|
+
$[82] = t2;
|
|
265
|
+
} else t2 = $[82];
|
|
266
|
+
return t2;
|
|
267
|
+
}
|
|
268
|
+
function _temp2() {
|
|
269
|
+
return true;
|
|
270
|
+
}
|
|
271
|
+
function _temp() {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
function ErrorItemContainer(t0) {
|
|
275
|
+
const $ = c(10);
|
|
276
|
+
const { errorNode, message, actions, scrollToElement } = t0;
|
|
277
|
+
let t1;
|
|
278
|
+
if ($[0] !== errorNode.label || $[1] !== message || $[2] !== scrollToElement) {
|
|
279
|
+
t1 = /* @__PURE__ */ jsx(MessageWithLink, {
|
|
280
|
+
linkLabel: errorNode.label,
|
|
281
|
+
scrollToElement,
|
|
282
|
+
message
|
|
283
|
+
});
|
|
284
|
+
$[0] = errorNode.label;
|
|
285
|
+
$[1] = message;
|
|
286
|
+
$[2] = scrollToElement;
|
|
287
|
+
$[3] = t1;
|
|
288
|
+
} else t1 = $[3];
|
|
289
|
+
let t2;
|
|
290
|
+
if ($[4] !== actions) {
|
|
291
|
+
t2 = actions?.filter(_temp3).map(_temp4);
|
|
292
|
+
$[4] = actions;
|
|
293
|
+
$[5] = t2;
|
|
294
|
+
} else t2 = $[5];
|
|
295
|
+
let t3;
|
|
296
|
+
if ($[6] !== errorNode.id || $[7] !== t1 || $[8] !== t2) {
|
|
297
|
+
t3 = /* @__PURE__ */ jsx(unstable_ErrorRegion.Item, {
|
|
298
|
+
message: t1,
|
|
299
|
+
messageId: errorNode.id,
|
|
300
|
+
actions: t2
|
|
301
|
+
});
|
|
302
|
+
$[6] = errorNode.id;
|
|
303
|
+
$[7] = t1;
|
|
304
|
+
$[8] = t2;
|
|
305
|
+
$[9] = t3;
|
|
306
|
+
} else t3 = $[9];
|
|
307
|
+
return t3;
|
|
308
|
+
}
|
|
309
|
+
function _temp4(t0) {
|
|
310
|
+
const { label, action } = t0;
|
|
311
|
+
return /* @__PURE__ */ jsx(Text, {
|
|
312
|
+
variant: "body-sm",
|
|
313
|
+
children: /* @__PURE__ */ jsx(Anchor, {
|
|
314
|
+
onClick: action,
|
|
315
|
+
render: /* @__PURE__ */ jsx("button", {}),
|
|
316
|
+
children: label
|
|
317
|
+
})
|
|
318
|
+
}, label);
|
|
319
|
+
}
|
|
320
|
+
function _temp3(t0) {
|
|
321
|
+
const { condition } = t0;
|
|
322
|
+
return condition();
|
|
323
|
+
}
|
|
324
|
+
function MessageWithLink(t0) {
|
|
325
|
+
const $ = c(11);
|
|
326
|
+
const { linkLabel, scrollToElement, message } = t0;
|
|
327
|
+
let t1;
|
|
328
|
+
if ($[0] !== message) {
|
|
329
|
+
t1 = message.split("{{node}}", 2);
|
|
330
|
+
$[0] = message;
|
|
331
|
+
$[1] = t1;
|
|
332
|
+
} else t1 = $[1];
|
|
333
|
+
const splitMessage = t1;
|
|
334
|
+
let t2;
|
|
335
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
336
|
+
t2 = {
|
|
337
|
+
display: "flex",
|
|
338
|
+
whiteSpace: "pre",
|
|
339
|
+
flexWrap: "wrap"
|
|
340
|
+
};
|
|
341
|
+
$[2] = t2;
|
|
342
|
+
} else t2 = $[2];
|
|
343
|
+
let t3;
|
|
344
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
345
|
+
t3 = /* @__PURE__ */ jsx("button", {});
|
|
346
|
+
$[3] = t3;
|
|
347
|
+
} else t3 = $[3];
|
|
348
|
+
let t4;
|
|
349
|
+
if ($[4] !== linkLabel || $[5] !== scrollToElement) {
|
|
350
|
+
t4 = /* @__PURE__ */ jsx(Anchor, {
|
|
351
|
+
onClick: scrollToElement,
|
|
352
|
+
render: t3,
|
|
353
|
+
children: linkLabel
|
|
354
|
+
});
|
|
355
|
+
$[4] = linkLabel;
|
|
356
|
+
$[5] = scrollToElement;
|
|
357
|
+
$[6] = t4;
|
|
358
|
+
} else t4 = $[6];
|
|
359
|
+
const t5 = splitMessage[1] ? splitMessage[1] : null;
|
|
360
|
+
let t6;
|
|
361
|
+
if ($[7] !== splitMessage[0] || $[8] !== t4 || $[9] !== t5) {
|
|
362
|
+
t6 = /* @__PURE__ */ jsxs("div", {
|
|
363
|
+
style: t2,
|
|
364
|
+
children: [
|
|
365
|
+
splitMessage[0],
|
|
366
|
+
t4,
|
|
367
|
+
t5
|
|
368
|
+
]
|
|
369
|
+
});
|
|
370
|
+
$[7] = splitMessage[0];
|
|
371
|
+
$[8] = t4;
|
|
372
|
+
$[9] = t5;
|
|
373
|
+
$[10] = t6;
|
|
374
|
+
} else t6 = $[10];
|
|
375
|
+
return t6;
|
|
376
|
+
}
|
|
377
|
+
//#endregion
|
|
378
|
+
export { ErrorItemRenderer };
|
|
379
|
+
|
|
380
|
+
//# sourceMappingURL=ErrorItemRenderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorItemRenderer.js","names":["Anchor","Text","unstable_ErrorRegion","ErrorRegion","MAX_LIMIT_OVERRIDE","useTranslation","JSX","useErrorNodes","HierarchyLevelDetails","TreeRendererProps","TreeNode","ErrorItemRendererProps","Pick","errorNode","ReturnType","reloadTree","options","parentNodeId","scrollToNode","filterHierarchyLevel","hierarchyLevelDetails","ErrorItemRenderer","t0","$","_c","getHierarchyLevelDetails","translate","error","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 { useErrorNodes } from \"../FlatTreeNode.js\";\nimport type { HierarchyLevelDetails, TreeRendererProps } from \"../Renderers.js\";\nimport type { TreeNode } from \"../TreeNode.js\";\n\n/** @alpha */\nexport interface ErrorItemRendererProps extends Pick<TreeRendererProps, \"getHierarchyLevelDetails\"> {\n /** A node containing an error. */\n errorNode: ReturnType<typeof useErrorNodes>[number];\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: (errorNode: TreeNode) => 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 errorNode,\n getHierarchyLevelDetails,\n filterHierarchyLevel,\n reloadTree,\n scrollToNode,\n}: ErrorItemRendererProps): JSX.Element {\n const translate = useTranslation();\n\n if (errorNode.error.type === \"ResultSetTooLarge\") {\n const limit = errorNode.error.resultSetSizeLimit;\n const onOverrideLimit = () => getHierarchyLevelDetails(errorNode.id)?.setSizeLimit(MAX_LIMIT_OVERRIDE);\n return (\n <ErrorItemContainer\n errorNode={errorNode}\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(errorNode.id);\n hierarchyLevelDetails && filterHierarchyLevel?.(hierarchyLevelDetails);\n },\n label: translate(\"increaseHierarchyLimitWithFiltering\"),\n condition: () => !!filterHierarchyLevel && !!errorNode.isFilterable,\n },\n ]}\n message={translate(\"resultLimitExceeded\").replace(\"{{limit}}\", limit.toString())}\n scrollToElement={() => scrollToNode(errorNode)}\n />\n );\n }\n if (errorNode.error.type === \"NoFilterMatches\") {\n return (\n <ErrorItemContainer\n errorNode={errorNode}\n actions={[\n {\n action: () => {\n const hierarchyLevelDetails = getHierarchyLevelDetails(errorNode.id);\n hierarchyLevelDetails && filterHierarchyLevel?.(hierarchyLevelDetails);\n },\n label: translate(\"noFilteredChildrenChangeFilter\"),\n condition: () => true,\n },\n ]}\n message={translate(\"noFilteredChildren\")}\n scrollToElement={() => scrollToNode(errorNode)}\n />\n );\n }\n if (errorNode.error.type === \"ChildrenLoad\") {\n return (\n <ErrorItemContainer\n errorNode={errorNode}\n actions={[\n {\n action: () => reloadTree({ parentNodeId: errorNode.id }),\n label: translate(\"retry\"),\n condition: () => true,\n },\n ]}\n message={translate(\"failedToCreateHierarchy\")}\n scrollToElement={() => scrollToNode(errorNode)}\n />\n );\n }\n\n return (\n <ErrorItemContainer\n errorNode={errorNode}\n message={errorNode.error.message}\n scrollToElement={() => scrollToNode(errorNode)}\n />\n );\n}\n\ntype ErrorItemContainerProps = {\n errorNode: TreeNode;\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.label} scrollToElement={scrollToElement} message={message} />}\n messageId={errorNode.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":";;;;;;;;;;;;;;;;AAoCA,SAAOqB,kBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAA2B,MAAA,EAAAX,WAAAY,0BAAAN,sBAAAJ,YAAAG,iBAAAI;CAOhC,MAAAI,YAAkBrB,gBAAgB;AAElC,KAAIQ,UAASc,MAAMC,SAAU,qBAAmB;EAC9C,MAAAC,QAAchB,UAASc,MAAMG;EAAoB,IAAAC;AAAA,MAAAR,EAAA,OAAAV,UAAAmB,MAAAT,EAAA,OAAAE,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hierarchies-react/stratakit/RootErrorRenderer.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* @alpha
|
|
8
|
+
*/
|
|
9
|
+
type StrataKitRootErrorRendererProps = {
|
|
10
|
+
/**
|
|
11
|
+
* Root error to be displayed
|
|
12
|
+
*/
|
|
13
|
+
error: ErrorInfo;
|
|
14
|
+
} & RootErrorRendererProps;
|
|
15
|
+
/**
|
|
16
|
+
* A component that renders root node error state.
|
|
17
|
+
*
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
declare function StrataKitRootErrorRenderer({
|
|
21
|
+
error,
|
|
22
|
+
getHierarchyLevelDetails,
|
|
23
|
+
reloadTree
|
|
24
|
+
}: StrataKitRootErrorRendererProps): JSX.Element;
|
|
25
|
+
//#endregion
|
|
26
|
+
export { StrataKitRootErrorRenderer };
|
|
27
|
+
//# 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":";;;;;;;AAkBA;KAAY,+BAAA;;;;EAIV,KAAA,EAAO,SAAA;AAAA,IACL,sBAAA;;;AAOJ;;;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","ErrorInfo","StrataKitRootErrorRendererProps","error","StrataKitRootErrorRenderer","t0","$","_c","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\";\nimport type { ErrorInfo } from \"../TreeNode.js\";\n\n/**\n * @alpha\n */\nexport type StrataKitRootErrorRendererProps = {\n /**\n * Root error to be displayed\n */\n error: ErrorInfo;\n} & 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":";;;;;;;;;;;;AA8BA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-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
|