@itwin/presentation-hierarchies-react 2.0.0-alpha.54 → 2.0.0-alpha.56
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 +38 -0
- package/README.md +23 -61
- package/lib/presentation-hierarchies-react/Renderers.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/TreeNode.d.ts +2 -0
- package/lib/presentation-hierarchies-react/TreeNode.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseIModelTree.d.ts +1 -1
- package/lib/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseIModelTree.js +43 -48
- package/lib/presentation-hierarchies-react/UseIModelTree.js.map +1 -0
- package/lib/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -0
- package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseTree.d.ts +8 -3
- package/lib/presentation-hierarchies-react/UseTree.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseTree.js +21 -21
- package/lib/presentation-hierarchies-react/UseTree.js.map +1 -0
- package/lib/presentation-hierarchies-react/Utils.js.map +1 -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.map +1 -0
- package/lib/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/TreeModel.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -0
- package/lib/presentation-hierarchies-react/internal/Utils.js.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/ErrorItemRenderer.d.ts +3 -3
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/ErrorItemRenderer.js +158 -128
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/FlatTreeNode.js +7 -4
- package/lib/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +24 -0
- package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.js +41 -0
- package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/RootErrorRenderer.js +64 -46
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeErrorRenderer.d.ts +3 -3
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeErrorRenderer.js +19 -20
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeFilterAction.js +43 -30
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenameAction.js +37 -31
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -0
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenderer.js +227 -192
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeRenderer.d.ts +3 -6
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -0
- package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeRenderer.js +39 -45
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -0
- package/lib/{esm/presentation-hierarchies-react.d.ts → presentation-hierarchies-react.d.ts} +3 -2
- package/lib/{esm/presentation-hierarchies-react.js → presentation-hierarchies-react.js} +3 -2
- package/lib/public/locales/en/PresentationHierarchies_1.0.json +26 -0
- package/package.json +19 -15
- package/lib/esm/presentation-hierarchies-react/Renderers.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/Utils.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +0 -138
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js +0 -67
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +0 -1
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/Renderers.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseNodeHighlighting.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseNodeHighlighting.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseSelectionHandler.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/UseSelectionHandler.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/Utils.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/DisposePolyfill.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/TreeActions.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/TreeLoader.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/TreeModel.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/TreeModel.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/UseUnifiedSelection.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/UseUnifiedSelection.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/internal/Utils.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/FlatTreeNode.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/RootErrorRenderer.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeAction.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeAction.js +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeFilterAction.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenameAction.d.ts +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenderer.css +0 -0
- /package/lib/{esm/presentation-hierarchies-react → presentation-hierarchies-react}/stratakit/TreeNodeRenderer.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatTreeNode.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/FlatTreeNode.ts"],"mappings":";;;;;AAO+C;;;UAOrC,mBAAA;EACR,EAAA;EACA,KAAA;EACA,WAAA;AAAA;;AAQF;;;;UAAiB,gBAAA;EACf,EAAA;EACA,KAAA;EACA,SAAA;EACA,UAAA;EACA,IAAA,EAAM,QAAA;AAAA;;AASR;;;;;KAAY,YAAA,GAAe,gBAAA,GAAmB,mBAAA;;;;;;;AA8C9C;iBAhCgB,gBAAA,CAAiB,SAAA,EAAW,QAAA,KAAU,YAAA;;;;;;iBAgCtC,aAAA,CAAc,SAAA,EAAW,QAAA,KAAa,KAAA,CAAM,QAAA,GAAW,IAAA,CAAK,QAAA,CAAS,QAAA"}
|
|
@@ -32,7 +32,8 @@ function getFlatItems(nodes, level) {
|
|
|
32
32
|
levelSize: nodes.length,
|
|
33
33
|
posInLevel: index + 1
|
|
34
34
|
});
|
|
35
|
-
if (!node.isExpanded
|
|
35
|
+
if (!node.isExpanded) return;
|
|
36
|
+
if (node.error && (node.error.type !== "Unknown" || !node.error.isNodeExpandable)) return;
|
|
36
37
|
if (node.children !== true) {
|
|
37
38
|
const childNodes = getFlatItems(node.children, level + 1);
|
|
38
39
|
flatItems.push(...childNodes);
|
|
@@ -62,9 +63,11 @@ function useErrorNodes(rootNodes) {
|
|
|
62
63
|
return t0;
|
|
63
64
|
}
|
|
64
65
|
function _temp(rootNode) {
|
|
65
|
-
if (isErrorNode(rootNode)) return [rootNode];
|
|
66
66
|
if (rootNode.children === true) return [];
|
|
67
|
-
|
|
67
|
+
const errors = isErrorNode(rootNode) ? [rootNode] : [];
|
|
68
|
+
if (errors.length === 1 && (rootNode.error?.type !== "Unknown" || !rootNode.error.isNodeExpandable)) return errors;
|
|
69
|
+
errors.push(...getErrorNodes(rootNode));
|
|
70
|
+
return errors;
|
|
68
71
|
}
|
|
69
72
|
function getErrorNodes(parent) {
|
|
70
73
|
const errorList = [];
|
|
@@ -72,7 +75,7 @@ function getErrorNodes(parent) {
|
|
|
72
75
|
parent.children.forEach((node) => {
|
|
73
76
|
if (isErrorNode(node)) {
|
|
74
77
|
errorList.push(node);
|
|
75
|
-
return;
|
|
78
|
+
if (node.error.type !== "Unknown" || !node.error.isNodeExpandable) return;
|
|
76
79
|
}
|
|
77
80
|
if (node.children !== true) {
|
|
78
81
|
const childErrorList = getErrorNodes(node);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FlatTreeNode.js","names":["useMemo","TreeNode","FlatPlaceholderItem","id","level","placeholder","FlatTreeNodeItem","levelSize","posInLevel","node","FlatTreeItem","isPlaceholderItem","item","useFlatTreeItems","rootNodes","$","_c","t0","getFlatItems","nodes","flatItems","forEach","index","push","length","isExpanded","error","type","isNodeExpandable","children","childNodes","useErrorNodes","flatMap","_temp","rootNode","errors","isErrorNode","getErrorNodes","parent","errorList","ReturnType","childErrorList","Pick","Required","undefined"],"sources":["../../../src/presentation-hierarchies-react/stratakit/FlatTreeNode.ts"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useMemo } from \"react\";\n\nimport type { TreeNode } from \"../TreeNode.js\";\n\n/**\n * Placeholder item that is added to hierarchy as a child for a parent item while its child items are loading.\n *\n * @alpha\n */\ninterface FlatPlaceholderItem {\n id: string;\n level: number;\n placeholder: true;\n}\n\n/**\n * An item containing `TreeNode` node with properties needed for a flat tree structure.\n *\n * @alpha\n */\nexport interface FlatTreeNodeItem {\n id: string;\n level: number;\n levelSize: number;\n posInLevel: number;\n node: TreeNode;\n}\n\n/**\n * An Item describing single tree item position and its content inside tree.\n * Returned by `useFlatTreeNodeList` hook.\n *\n * @alpha\n */\nexport type FlatTreeItem = FlatTreeNodeItem | FlatPlaceholderItem;\n\n/** @alpha */\nexport function isPlaceholderItem(item: FlatTreeItem): item is FlatPlaceholderItem {\n return \"placeholder\" in item;\n}\n\n/**\n * Used to get a list of `FlatTreeItem` objects for the given list of `TreeNode` objects that represent\n * a hierarchical structure. The resulting items can be used to render the hierarchy in a flat manner, e.g. using a\n * virtualized list.\n *\n * @alpha\n */\nexport function useFlatTreeItems(rootNodes: TreeNode[]) {\n return useMemo(() => getFlatItems(rootNodes, 1), [rootNodes]);\n}\n\nfunction getFlatItems(nodes: TreeNode[], level: number) {\n const flatItems: FlatTreeItem[] = [];\n nodes.forEach((node, index) => {\n flatItems.push({ node, id: node.id, level, levelSize: nodes.length, posInLevel: index + 1 });\n if (!node.isExpanded) {\n return;\n }\n\n if (node.error && (node.error.type !== \"Unknown\" || !node.error.isNodeExpandable)) {\n return;\n }\n\n if (node.children !== true) {\n const childNodes = getFlatItems(node.children, level + 1);\n flatItems.push(...childNodes);\n return;\n }\n\n flatItems.push({ id: `${node.id}-children-placeholder`, level: level + 1, placeholder: true } satisfies FlatPlaceholderItem);\n });\n return flatItems;\n}\n\n/**\n * Finds and returns all nodes containing errors in a given hierarchy.\n *\n * @alpha\n */\nexport function useErrorNodes(rootNodes: TreeNode[]): Array<TreeNode & Pick<Required<TreeNode>, \"error\">> {\n return useMemo(\n () =>\n rootNodes.flatMap((rootNode) => {\n if (rootNode.children === true) {\n return [];\n }\n const errors = isErrorNode(rootNode) ? [rootNode] : [];\n if (errors.length === 1 && (rootNode.error?.type !== \"Unknown\" || !rootNode.error.isNodeExpandable)) {\n return errors;\n }\n errors.push(...getErrorNodes(rootNode));\n return errors;\n }),\n [rootNodes],\n );\n}\n\nfunction getErrorNodes(parent: TreeNode) {\n const errorList: ReturnType<typeof useErrorNodes> = [];\n\n if (parent.children === true) {\n return [];\n }\n\n parent.children.forEach((node) => {\n if (isErrorNode(node)) {\n errorList.push(node);\n if (node.error.type !== \"Unknown\" || !node.error.isNodeExpandable) {\n return;\n }\n }\n\n if (node.children !== true) {\n const childErrorList = getErrorNodes(node);\n errorList.push(...childErrorList);\n return;\n }\n });\n return errorList;\n}\n\nfunction isErrorNode(node: TreeNode): node is TreeNode & Pick<Required<TreeNode>, \"error\"> {\n return node.error !== undefined;\n}\n"],"mappings":";;;;AA0CA,SAAgBW,kBAAkBC,MAAiD;AACjF,QAAO,iBAAiBA;;;;;;;;;AAU1B,SAAOC,iBAAAC,WAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,I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GAAIc,cAAcH,SAAS,CAAC;AAAA,QAChCC;;AAMf,SAASE,cAAcC,QAAkB;CACvC,MAAMC,YAA8C,EAAE;AAEtD,KAAID,OAAOT,aAAa,KACtB,QAAO,EAAE;AAGXS,QAAOT,SAASR,SAASZ,SAAS;AAChC,MAAI2B,YAAY3B,KAAK,EAAE;AACrB8B,aAAUhB,KAAKd,KAAK;AACpB,OAAIA,KAAKiB,MAAMC,SAAS,aAAa,CAAClB,KAAKiB,MAAME,iBAC/C;;AAIJ,MAAInB,KAAKoB,aAAa,MAAM;GAC1B,MAAMY,iBAAiBJ,cAAc5B,KAAK;AAC1C8B,aAAUhB,KAAK,GAAGkB,eAAe;AACjC;;GAEF;AACF,QAAOF;;AAGT,SAASH,YAAY3B,MAAsE;AACzF,QAAOA,KAAKiB,UAAUkB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { JSX, PropsWithChildren } from "react";
|
|
2
|
+
|
|
3
|
+
//#region src/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Properties for `LocalizationContextProvider`.
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
interface LocalizationContextProviderProps {
|
|
9
|
+
/** Localization object compatible with `@itwin/core-common` */
|
|
10
|
+
localization: {
|
|
11
|
+
getLocalizedString: (key: string) => string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Context provider for localizing components.
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
declare function LocalizationContextProvider({
|
|
19
|
+
localization,
|
|
20
|
+
children
|
|
21
|
+
}: PropsWithChildren<LocalizationContextProviderProps>): JSX.Element;
|
|
22
|
+
//#endregion
|
|
23
|
+
export { LocalizationContextProvider };
|
|
24
|
+
//# sourceMappingURL=LocalizationContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalizationContext.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/LocalizationContext.tsx"],"mappings":";;;AAW0C;;;;AAAA,UAQhC,gCAAA;EAGN;EADF,YAAA;IACE,kBAAA,GAAqB,GAAA;EAAA;AAAA;;;;;iBAQT,2BAAA,CAAA;EAA8B,YAAA;EAAc;AAAA,GAAY,iBAAA,CAAkB,gCAAA,IAAoC,GAAA,CAAI,OAAA"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { LOCALIZATION_NAMESPACE } from "../internal/LocalizedStrings.js";
|
|
2
|
+
import { c } from "react-compiler-runtime";
|
|
3
|
+
import { createContext, useContext } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/presentation-hierarchies-react/stratakit/LocalizationContext.tsx
|
|
7
|
+
const localizationContext = createContext((key) => key);
|
|
8
|
+
/**
|
|
9
|
+
* Context provider for localizing components.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
function LocalizationContextProvider(t0) {
|
|
13
|
+
const $ = c(5);
|
|
14
|
+
const { localization, children } = t0;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== localization) {
|
|
17
|
+
t1 = (key) => localization.getLocalizedString(`${LOCALIZATION_NAMESPACE}:${key}`);
|
|
18
|
+
$[0] = localization;
|
|
19
|
+
$[1] = t1;
|
|
20
|
+
} else t1 = $[1];
|
|
21
|
+
const translate = t1;
|
|
22
|
+
let t2;
|
|
23
|
+
if ($[2] !== children || $[3] !== translate) {
|
|
24
|
+
t2 = /* @__PURE__ */ jsx(localizationContext.Provider, {
|
|
25
|
+
value: translate,
|
|
26
|
+
children
|
|
27
|
+
});
|
|
28
|
+
$[2] = children;
|
|
29
|
+
$[3] = translate;
|
|
30
|
+
$[4] = t2;
|
|
31
|
+
} else t2 = $[4];
|
|
32
|
+
return t2;
|
|
33
|
+
}
|
|
34
|
+
/** @internal */
|
|
35
|
+
function useTranslation() {
|
|
36
|
+
return useContext(localizationContext);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
40
|
+
export { LocalizationContextProvider, useTranslation };
|
|
41
|
+
//# sourceMappingURL=LocalizationContext.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalizationContext.js","names":["createContext","useContext","useMemo","LOCALIZATION_NAMESPACE","JSX","PropsWithChildren","LocalizationKey","TranslateFunc","key","localizationContext","LocalizationContextProviderProps","localization","getLocalizedString","LocalizationContextProvider","t0","$","_c","children","t1","translate","t2","useTranslation"],"sources":["../../../src/presentation-hierarchies-react/stratakit/LocalizationContext.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 { createContext, useContext, useMemo } from \"react\";\nimport { LOCALIZATION_NAMESPACE } from \"../internal/LocalizedStrings.js\";\n\nimport type { JSX, PropsWithChildren } from \"react\";\nimport type { LocalizationKey } from \"../internal/LocalizedStrings.js\";\n\ntype TranslateFunc = (key: LocalizationKey) => string;\n\nconst localizationContext = createContext<TranslateFunc>((key) => key);\n\n/**\n * Properties for `LocalizationContextProvider`.\n * @public\n */\ninterface LocalizationContextProviderProps {\n /** Localization object compatible with `@itwin/core-common` */\n localization: {\n getLocalizedString: (key: string) => string;\n };\n}\n\n/**\n * Context provider for localizing components.\n * @public\n */\nexport function LocalizationContextProvider({ localization, children }: PropsWithChildren<LocalizationContextProviderProps>): JSX.Element {\n const translate = useMemo<TranslateFunc>(() => {\n return (key: LocalizationKey) => localization.getLocalizedString(`${LOCALIZATION_NAMESPACE}:${key}`);\n }, [localization]);\n return <localizationContext.Provider value={translate}>{children}</localizationContext.Provider>;\n}\n\n/** @internal */\nexport function useTranslation() {\n return useContext(localizationContext);\n}\n"],"mappings":";;;;;;AAaA,MAAMS,sBAAsBT,eAA8BQ,QAAQA,IAAI;;;;;AAiBtE,SAAOK,4BAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAqC,MAAA,EAAAL,cAAAM,aAAAH;CAA+E,IAAAI;AAAA,KAAAH,EAAA,OAAAJ,cAAA;AAEhHO,QAAAV,QAA0BG,aAAYC,mBAAoB,GAAGT,uBAAsB,GAAIK,MAAM;AAAAO,IAAA,KAAAJ;AAAAI,IAAA,KAAAG;OAAAA,MAAAH,EAAA;CADtG,MAAAI,YACED;CACiB,IAAAE;AAAA,KAAAL,EAAA,OAAAE,YAAAF,EAAA,OAAAI,WAAA;AACZC,OAAA,oBAAA,oBAAA;GAAqCD,OAAAA;GAAYF;IAAwC;AAAAF,IAAA,KAAAE;AAAAF,IAAA,KAAAI;AAAAJ,IAAA,KAAAK;OAAAA,MAAAL,EAAA;AAAA,QAAzFK;;;AAIT,SAAOC,iBAAA;AAAA,QACEpB,WAAWQ,oBAAoB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootErrorRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/RootErrorRenderer.tsx"],"mappings":";;;;;;;AAiBA;KAAY,+BAAA;;;;EAIV,KAAA,EAAO,SAAA;AAAA,IACL,sBAAA;;;AAOJ;;;iBAAgB,0BAAA,CAAA;EAA6B,KAAA;EAAO,wBAAA;EAA0B;AAAA,GAAc,+BAAA,GAAkC,GAAA,CAAI,OAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useTranslation } from "./LocalizationContext.js";
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Button, Text } from "@stratakit/bricks";
|
|
@@ -12,9 +12,9 @@ import errorSvg from "@stratakit/icons/status-error.svg";
|
|
|
12
12
|
* @alpha
|
|
13
13
|
*/
|
|
14
14
|
function StrataKitRootErrorRenderer(t0) {
|
|
15
|
-
const $ = c(
|
|
15
|
+
const $ = c(25);
|
|
16
16
|
const { error, getHierarchyLevelDetails, reloadTree } = t0;
|
|
17
|
-
const
|
|
17
|
+
const translate = useTranslation();
|
|
18
18
|
if (error.type === "ResultSetTooLarge") {
|
|
19
19
|
let t1;
|
|
20
20
|
if ($[0] !== getHierarchyLevelDetails) {
|
|
@@ -24,66 +24,84 @@ function StrataKitRootErrorRenderer(t0) {
|
|
|
24
24
|
} else t1 = $[1];
|
|
25
25
|
const onOverrideLimit = t1;
|
|
26
26
|
let t2;
|
|
27
|
-
if ($[2] !== error.resultSetSizeLimit || $[3] !==
|
|
28
|
-
t2 =
|
|
27
|
+
if ($[2] !== error.resultSetSizeLimit || $[3] !== translate) {
|
|
28
|
+
t2 = translate("rootResultLimitExceeded").replace("{{limit}}", error.resultSetSizeLimit.toString());
|
|
29
29
|
$[2] = error.resultSetSizeLimit;
|
|
30
|
-
$[3] =
|
|
30
|
+
$[3] = translate;
|
|
31
31
|
$[4] = t2;
|
|
32
32
|
} else t2 = $[4];
|
|
33
33
|
let t3;
|
|
34
|
-
if ($[5] !==
|
|
35
|
-
t3 =
|
|
34
|
+
if ($[5] !== translate) {
|
|
35
|
+
t3 = translate("increaseHierarchyLimitToUnlimited");
|
|
36
|
+
$[5] = translate;
|
|
37
|
+
$[6] = t3;
|
|
38
|
+
} else t3 = $[6];
|
|
39
|
+
let t4;
|
|
40
|
+
if ($[7] !== onOverrideLimit || $[8] !== t3) {
|
|
41
|
+
t4 = [{
|
|
36
42
|
action: onOverrideLimit,
|
|
37
|
-
label:
|
|
43
|
+
label: t3,
|
|
38
44
|
condition: _temp
|
|
39
45
|
}];
|
|
40
|
-
$[
|
|
41
|
-
$[
|
|
42
|
-
$[
|
|
43
|
-
} else
|
|
44
|
-
let
|
|
45
|
-
if ($[
|
|
46
|
-
|
|
46
|
+
$[7] = onOverrideLimit;
|
|
47
|
+
$[8] = t3;
|
|
48
|
+
$[9] = t4;
|
|
49
|
+
} else t4 = $[9];
|
|
50
|
+
let t5;
|
|
51
|
+
if ($[10] !== t2 || $[11] !== t4) {
|
|
52
|
+
t5 = /* @__PURE__ */ jsx(RootErrorContainer, {
|
|
47
53
|
message: t2,
|
|
48
|
-
actions:
|
|
54
|
+
actions: t4
|
|
49
55
|
});
|
|
50
|
-
$[
|
|
51
|
-
$[
|
|
52
|
-
$[
|
|
53
|
-
} else
|
|
54
|
-
return
|
|
56
|
+
$[10] = t2;
|
|
57
|
+
$[11] = t4;
|
|
58
|
+
$[12] = t5;
|
|
59
|
+
} else t5 = $[12];
|
|
60
|
+
return t5;
|
|
55
61
|
}
|
|
56
62
|
let t1;
|
|
57
|
-
if ($[
|
|
58
|
-
t1 = ()
|
|
63
|
+
if ($[13] !== translate) {
|
|
64
|
+
t1 = translate("failedToCreateRootHierarchy");
|
|
65
|
+
$[13] = translate;
|
|
66
|
+
$[14] = t1;
|
|
67
|
+
} else t1 = $[14];
|
|
68
|
+
let t2;
|
|
69
|
+
if ($[15] !== reloadTree) {
|
|
70
|
+
t2 = () => reloadTree({
|
|
59
71
|
parentNodeId: void 0,
|
|
60
72
|
state: "reset"
|
|
61
73
|
});
|
|
62
|
-
$[
|
|
63
|
-
$[
|
|
64
|
-
} else
|
|
65
|
-
let t2;
|
|
66
|
-
if ($[13] !== localizedStrings.retry || $[14] !== t1) {
|
|
67
|
-
t2 = [{
|
|
68
|
-
action: t1,
|
|
69
|
-
label: localizedStrings.retry,
|
|
70
|
-
condition: _temp2
|
|
71
|
-
}];
|
|
72
|
-
$[13] = localizedStrings.retry;
|
|
73
|
-
$[14] = t1;
|
|
74
|
-
$[15] = t2;
|
|
75
|
-
} else t2 = $[15];
|
|
74
|
+
$[15] = reloadTree;
|
|
75
|
+
$[16] = t2;
|
|
76
|
+
} else t2 = $[16];
|
|
76
77
|
let t3;
|
|
77
|
-
if ($[
|
|
78
|
-
t3 =
|
|
79
|
-
|
|
80
|
-
actions: t2
|
|
81
|
-
});
|
|
82
|
-
$[16] = localizedStrings.failedToCreateRootHierarchy;
|
|
83
|
-
$[17] = t2;
|
|
78
|
+
if ($[17] !== translate) {
|
|
79
|
+
t3 = translate("retry");
|
|
80
|
+
$[17] = translate;
|
|
84
81
|
$[18] = t3;
|
|
85
82
|
} else t3 = $[18];
|
|
86
|
-
|
|
83
|
+
let t4;
|
|
84
|
+
if ($[19] !== t2 || $[20] !== t3) {
|
|
85
|
+
t4 = [{
|
|
86
|
+
action: t2,
|
|
87
|
+
label: t3,
|
|
88
|
+
condition: _temp2
|
|
89
|
+
}];
|
|
90
|
+
$[19] = t2;
|
|
91
|
+
$[20] = t3;
|
|
92
|
+
$[21] = t4;
|
|
93
|
+
} else t4 = $[21];
|
|
94
|
+
let t5;
|
|
95
|
+
if ($[22] !== t1 || $[23] !== t4) {
|
|
96
|
+
t5 = /* @__PURE__ */ jsx(RootErrorContainer, {
|
|
97
|
+
message: t1,
|
|
98
|
+
actions: t4
|
|
99
|
+
});
|
|
100
|
+
$[22] = t1;
|
|
101
|
+
$[23] = t4;
|
|
102
|
+
$[24] = t5;
|
|
103
|
+
} else t5 = $[24];
|
|
104
|
+
return t5;
|
|
87
105
|
}
|
|
88
106
|
function _temp2() {
|
|
89
107
|
return true;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RootErrorRenderer.js","names":["Button","Text","Icon","errorSvg","useTranslation","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 errorSvg from \"@stratakit/icons/status-error.svg\";\nimport { useTranslation } from \"./LocalizationContext.js\";\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({ error, getHierarchyLevelDetails, reloadTree }: 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 {\n action: onOverrideLimit,\n label: translate(\"increaseHierarchyLimitToUnlimited\"),\n condition: () => true,\n },\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 style={{ height: \"100%\", display: \"flex\", flexDirection: \"column\", justifyContent: \"center\", alignItems: \"center\", gap: \"0.5rem\" }}>\n <Icon href={errorSvg} size=\"large\" />\n <Text variant={\"body-sm\"} style={{ textAlign: \"center\" }}>\n {message}\n </Text>\n {actions\n ?.filter(({ condition }) => condition())\n .map((action) => {\n return (\n <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AeA;;;UAAiB,wBAAA;EAaX;AAIN;;;;;;EATE,OAAA;EASiG;;;;EAJjG,IAAA;AAAA;;KAIU,mBAAA,GAAsB,cAAA,QAAsB,IAAA,CAAK,UAAA,IAAc,wBAAA;;;;;;;;;;;;;;;;;;;;cAqB9D,cAAA,EAAgB,oBAAA,CAAqB,mBAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeAction.js","names":["memo","DropdownMenu","Tree","ComponentProps","NamedExoticComponent","TreeActionBaseAttributes","variant","hide","TreeActionBaseProps","ItemAction","TreeActionBase","t0","$","_c","actionProps","dot","t1","visible","undefined","t2","t3"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeAction.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 { memo } from \"react\";\nimport { DropdownMenu, Tree } from \"@stratakit/structures\";\n\nimport type { ComponentProps, NamedExoticComponent } from \"react\";\n\n/**\n * Attributes used to decide how to render tree actions. They allow to differentiate action style based on the context\n * where that action is used.\n * @alpha\n */\nexport interface TreeActionBaseAttributes {\n /**\n * Specifies action variant supported by tree nodes:\n *\n * - \"default\" - standard action displayed in the dropdown menu accessible through the ellipsis button on the node.\n * - \"inline\" - actions displayed directly on the tree node.\n * - \"context-menu\" - actions displayed in the context menu opened by right-clicking the tree node.\n */\n variant?: \"default\" | \"inline\" | \"context-menu\";\n /**\n * Indicates that the actions is not applicable for current tree node and should be hidden.\n * When set to true, the action will not be rendered at all.\n */\n hide?: boolean;\n}\n\n/** @alpha */\nexport type TreeActionBaseProps = ComponentProps<typeof Tree.ItemAction> & TreeActionBaseAttributes;\n\n/**\n * Base component used to render tree actions. It is designed to allow rendering same action in different contexts: inline, dropdown, context menu.\n * Should be used together with `StrataKitTreeNodeRenderer` and returned from `getInlineActions`, `getMenuActions` and `getContextMenuActions` callbacks.\n *\n * When implementing custom action that returns this component, make sure to forward `TreeActionBaseAttributes` props to it. Example:\n *\n * ```tsx\n * interface MyCustomTreeActionProps extends TreeActionBaseAttributes {\n * myProp: string\n * }\n *\n * function MyCustomTreeAction({ myProp, ...attributes }: MyCustomTreeActionProps) {\n * // custom button logic goes here\n * return <TreeActionBase {...attributes} icon={...} onClick={...} />\n * }\n * ```\n *\n * @alpha\n */\nexport const TreeActionBase: NamedExoticComponent<TreeActionBaseProps> = memo(function TreeActionBase({\n hide,\n variant = \"default\",\n dot,\n visible,\n ...actionProps\n}: TreeActionBaseProps) {\n if (hide) {\n return variant === \"inline\" ? <Tree.ItemAction {...actionProps} visible={false} /> : undefined;\n }\n\n if (variant === \"context-menu\") {\n return <DropdownMenu.Item {...actionProps} />;\n }\n\n return <Tree.ItemAction {...actionProps} dot={dot} visible={variant === \"inline\" ? visible : undefined} />;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAaU,iBAA4DV,KAAK,SAAAU,eAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAR;CAAA,IAAAS;CAAA,IAAAC;AAAA,KAAAL,EAAA,OAAAD,IAAA;AAAwB,GAAA,CAAAJ,MAAAD,SAAAU,IAAAD,KAAAE,YAAAH,eAAAH;AAMhFC,IAAA,KAAAD;AAAAC,IAAA,KAAAE;AAAAF,IAAA,KAAAG;AAAAH,IAAA,KAAAL;AAAAK,IAAA,KAAAI;AAAAJ,IAAA,KAAAK;QAAA;AAAAH,gBAAAF,EAAA;AAAAG,QAAAH,EAAA;AAAAL,SAAAK,EAAA;AAAAI,OAAAJ,EAAA;AAAAK,YAAAL,EAAA;;CAJpB,MAAAN,UAAAU,OAAAE,SAAA,YAAAF;AAKA,KAAIT,MAAI;EAAA,IAAAY;AAAA,MAAAP,EAAA,OAAAE,eAAAF,EAAA,OAAAN,SAAA;AACCa,QAAAb,YAAY,WAAW,oBAAA,KAAA;IAAA,GAAqBQ;IAAsB,SAAA;KAAqB,GAAvFI;AAAuFN,KAAA,KAAAE;AAAAF,KAAA,KAAAN;AAAAM,KAAA,KAAAO;QAAAA,MAAAP,EAAA;AAAA,SAAvFO;;AAGT,KAAIb,YAAY,gBAAc;EAAA,IAAAa;AAAA,MAAAP,EAAA,OAAAE,aAAA;AACrBK,QAAA,oBAAA,aAAA,QAAA,GAAuBL,cAAe;AAAAF,KAAA,KAAAE;AAAAF,KAAA,MAAAO;QAAAA,MAAAP,EAAA;AAAA,SAAtCO;;CAGmD,MAAAA,KAAAb,YAAY,WAAZW,UAAAC;CAA0C,IAAAE;AAAA,KAAAR,EAAA,QAAAE,eAAAF,EAAA,QAAAG,OAAAH,EAAA,QAAAO,IAAA;AAA/FC,OAAA,oBAAA,KAAA;GAAA,GAAqBN;GAAkBC;GAAc,SAAAI;IAA8C;AAAAP,IAAA,MAAAE;AAAAF,IAAA,MAAAG;AAAAH,IAAA,MAAAO;AAAAP,IAAA,MAAAQ;OAAAA,MAAAR,EAAA;AAAA,QAAnGQ;EACP"}
|
|
@@ -16,14 +16,14 @@ interface TreeErrorRendererOwnProps {
|
|
|
16
16
|
treeLabel: string;
|
|
17
17
|
/** List of error nodes to render errors for. */
|
|
18
18
|
errorNodes: ReturnType<typeof useErrorNodes>;
|
|
19
|
-
/** Callback to render custom error messages. Component should be wrapped in `
|
|
19
|
+
/** Callback to render custom error messages. Component should be wrapped in `unstable_ErrorRegion.Item` from `@stratakit/structures` package. */
|
|
20
20
|
renderError?: (props: ErrorItemRendererProps) => ReactElement;
|
|
21
21
|
}
|
|
22
22
|
/** @alpha */
|
|
23
23
|
type TreeErrorRendererProps = TreeErrorRendererOwnProps & Omit<ErrorItemRendererProps, "errorNode">;
|
|
24
24
|
/**
|
|
25
|
-
* A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@
|
|
26
|
-
* As input, the component uses a list of `ErrorNode` objects, which are generally created using the `
|
|
25
|
+
* A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@stratakit/structures`.
|
|
26
|
+
* As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorNodes` hook.
|
|
27
27
|
*
|
|
28
28
|
* @alpha
|
|
29
29
|
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeErrorRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.tsx"],"mappings":";;;;;;;AAYuD;;;UAO7C,yBAAA;EAOI;;;;EAFZ,SAAA;EAAA;EAEA,UAAA,EAAY,UAAA,QAAkB,aAAA;EAAlB;EAEZ,WAAA,IAAe,KAAA,EAAO,sBAAA,KAA2B,YAAA;AAAA;;KAIvC,sBAAA,GAAyB,yBAAA,GAA4B,IAAA,CAAK,sBAAA;;;;AAAtE;;;iBAQgB,iBAAA,CAAA;EAAoB,SAAA;EAAW,UAAA;EAAY,WAAA;EAAA,GAAgB;AAAA,GAA0B,sBAAA,GAAyB,GAAA,CAAI,OAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useTranslation } from "./LocalizationContext.js";
|
|
2
2
|
import { ErrorItemRenderer } from "./ErrorItemRenderer.js";
|
|
3
3
|
import { c } from "react-compiler-runtime";
|
|
4
4
|
import { cloneElement } from "react";
|
|
@@ -7,15 +7,15 @@ import { unstable_ErrorRegion } from "@stratakit/structures";
|
|
|
7
7
|
|
|
8
8
|
//#region src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.tsx
|
|
9
9
|
/**
|
|
10
|
-
* A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@
|
|
11
|
-
* As input, the component uses a list of `ErrorNode` objects, which are generally created using the `
|
|
10
|
+
* A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@stratakit/structures`.
|
|
11
|
+
* As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorNodes` hook.
|
|
12
12
|
*
|
|
13
13
|
* @alpha
|
|
14
14
|
*/
|
|
15
15
|
function TreeErrorRenderer(t0) {
|
|
16
|
-
const $ = c(
|
|
16
|
+
const $ = c(11);
|
|
17
17
|
const { treeLabel, errorNodes, renderError, ...errorItemRendererProps } = t0;
|
|
18
|
-
const
|
|
18
|
+
const translate = useTranslation();
|
|
19
19
|
const errorItems = errorNodes.map((errorNode) => {
|
|
20
20
|
const errorRendererProps = {
|
|
21
21
|
errorNode,
|
|
@@ -30,33 +30,32 @@ function TreeErrorRenderer(t0) {
|
|
|
30
30
|
$[0] = t1;
|
|
31
31
|
} else t1 = $[0];
|
|
32
32
|
let t2;
|
|
33
|
-
if ($[1] !==
|
|
34
|
-
t2 =
|
|
35
|
-
$[1] =
|
|
33
|
+
if ($[1] !== translate || $[2] !== treeLabel) {
|
|
34
|
+
t2 = translate("issuesForTree").replace("{{tree_label}}", treeLabel);
|
|
35
|
+
$[1] = translate;
|
|
36
36
|
$[2] = treeLabel;
|
|
37
37
|
$[3] = t2;
|
|
38
38
|
} else t2 = $[3];
|
|
39
39
|
let t3;
|
|
40
|
-
if ($[4] !== errorNodes.length || $[5] !==
|
|
41
|
-
t3 = errorNodes.length === 0 ?
|
|
40
|
+
if ($[4] !== errorNodes.length || $[5] !== translate) {
|
|
41
|
+
t3 = errorNodes.length === 0 ? translate("noIssuesFound") : translate("issuesFound").replace("{{number_of_issues}}", errorNodes.length.toString());
|
|
42
42
|
$[4] = errorNodes.length;
|
|
43
|
-
$[5] =
|
|
44
|
-
$[6] =
|
|
45
|
-
|
|
46
|
-
} else t3 = $[7];
|
|
43
|
+
$[5] = translate;
|
|
44
|
+
$[6] = t3;
|
|
45
|
+
} else t3 = $[6];
|
|
47
46
|
let t4;
|
|
48
|
-
if ($[
|
|
47
|
+
if ($[7] !== errorItems || $[8] !== t2 || $[9] !== t3) {
|
|
49
48
|
t4 = /* @__PURE__ */ jsx(unstable_ErrorRegion.Root, {
|
|
50
49
|
style: t1,
|
|
51
50
|
"aria-label": t2,
|
|
52
51
|
label: t3,
|
|
53
52
|
items: errorItems
|
|
54
53
|
});
|
|
55
|
-
$[
|
|
56
|
-
$[
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
} else t4 = $[
|
|
54
|
+
$[7] = errorItems;
|
|
55
|
+
$[8] = t2;
|
|
56
|
+
$[9] = t3;
|
|
57
|
+
$[10] = t4;
|
|
58
|
+
} else t4 = $[10];
|
|
60
59
|
return t4;
|
|
61
60
|
}
|
|
62
61
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeErrorRenderer.js","names":["cloneElement","unstable_ErrorRegion","ErrorRegion","ErrorItemRenderer","useTranslation","JSX","ReactElement","ErrorItemRendererProps","useErrorNodes","TreeErrorRendererOwnProps","treeLabel","errorNodes","ReturnType","renderError","props","TreeErrorRendererProps","Omit","TreeErrorRenderer","t0","$","_c","errorItemRendererProps","translate","errorItems","map","errorNode","errorRendererProps","key","id","t1","Symbol","for","width","t2","replace","t3","length","toString","t4"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.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 { cloneElement } from \"react\";\nimport { unstable_ErrorRegion as ErrorRegion } from \"@stratakit/structures\";\nimport { ErrorItemRenderer } from \"./ErrorItemRenderer.js\";\nimport { useTranslation } from \"./LocalizationContext.js\";\n\nimport type { JSX, ReactElement } from \"react\";\nimport type { ErrorItemRendererProps } from \"./ErrorItemRenderer.js\";\nimport type { useErrorNodes } from \"./FlatTreeNode.js\";\n\n/**\n * Interface containing building blocks for `TreeErrorRenderer`.\n *\n * @alpha\n */\ninterface TreeErrorRendererOwnProps {\n /**\n * A user friendly display label of the tree. Should be unique within the consuming application,\n * as it's used for creating a unique accessible label for the error region.\n */\n treeLabel: string;\n /** List of error nodes to render errors for. */\n errorNodes: ReturnType<typeof useErrorNodes>;\n /** Callback to render custom error messages. Component should be wrapped in `unstable_ErrorRegion.Item` from `@stratakit/structures` package. */\n renderError?: (props: ErrorItemRendererProps) => ReactElement;\n}\n\n/** @alpha */\nexport type TreeErrorRendererProps = TreeErrorRendererOwnProps & Omit<ErrorItemRendererProps, \"errorNode\">;\n\n/**\n * A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@stratakit/structures`.\n * As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorNodes` hook.\n *\n * @alpha\n */\nexport function TreeErrorRenderer({ treeLabel, errorNodes, renderError, ...errorItemRendererProps }: TreeErrorRendererProps): JSX.Element {\n const translate = useTranslation();\n const errorItems = errorNodes.map((errorNode) => {\n const errorRendererProps: ErrorItemRendererProps = {\n errorNode,\n ...errorItemRendererProps,\n };\n\n if (renderError) {\n return cloneElement(renderError(errorRendererProps), { key: errorNode.id });\n }\n\n return <ErrorItemRenderer key={errorNode.id} {...errorRendererProps} />;\n });\n\n return (\n <ErrorRegion.Root\n style={{ width: \"100%\" }}\n aria-label={translate(\"issuesForTree\").replace(\"{{tree_label}}\", treeLabel)}\n label={errorNodes.length === 0 ? translate(\"noIssuesFound\") : translate(\"issuesFound\").replace(\"{{number_of_issues}}\", errorNodes.length.toString())}\n items={errorItems}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAwCA,SAAOiB,kBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAA2B,MAAA,EAAAV,WAAAC,YAAAE,aAAA,GAAAQ,2BAAAH;CAChC,MAAAI,YAAkBlB,gBAAgB;CAClC,MAAAmB,aAAmBZ,WAAUa,KAAKC,cAAA;EAChC,MAAAC,qBAAmD;GAAAD;GAAA,GAE9CJ;GACJ;AAED,MAAIR,YAAW,QACNb,aAAaa,YAAYa,mBAAmB,EAAE,EAAAC,KAAOF,UAASG,IAAK,CAAC;AAC5E,SAEM,oBAAC,qBAAmC,GAAMF,sBAAlBD,UAASG,GAA+B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BAAA,CAAqB,yBAAA;EAA8B,IAAA,EAAM,QAAA;AAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { useTranslation } from "./LocalizationContext.js";
|
|
1
2
|
import { TreeActionBase } from "./TreeAction.js";
|
|
2
|
-
import { useLocalizationContext } from "./LocalizationContext.js";
|
|
3
3
|
import { c } from "react-compiler-runtime";
|
|
4
4
|
import { memo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -17,7 +17,7 @@ import filterSvg from "@stratakit/icons/filter.svg";
|
|
|
17
17
|
* @alpha
|
|
18
18
|
*/
|
|
19
19
|
const TreeNodeFilterAction = memo(function TreeNodeFilterAction(t0) {
|
|
20
|
-
const $ = c(
|
|
20
|
+
const $ = c(20);
|
|
21
21
|
let actionAttributes;
|
|
22
22
|
let getHierarchyLevelDetails;
|
|
23
23
|
let node;
|
|
@@ -35,43 +35,56 @@ const TreeNodeFilterAction = memo(function TreeNodeFilterAction(t0) {
|
|
|
35
35
|
node = $[3];
|
|
36
36
|
onFilter = $[4];
|
|
37
37
|
}
|
|
38
|
-
const
|
|
39
|
-
const { filterHierarchyLevel, filterHierarchyLevelActiveDescription } = localizedStrings;
|
|
38
|
+
const translate = useTranslation();
|
|
40
39
|
let t1;
|
|
41
|
-
if ($[5] !==
|
|
42
|
-
t1 = ()
|
|
40
|
+
if ($[5] !== translate) {
|
|
41
|
+
t1 = translate("filterHierarchyLevel");
|
|
42
|
+
$[5] = translate;
|
|
43
|
+
$[6] = t1;
|
|
44
|
+
} else t1 = $[6];
|
|
45
|
+
const filterHierarchyLevel = t1;
|
|
46
|
+
let t2;
|
|
47
|
+
if ($[7] !== translate) {
|
|
48
|
+
t2 = translate("filterHierarchyLevelActiveDescription");
|
|
49
|
+
$[7] = translate;
|
|
50
|
+
$[8] = t2;
|
|
51
|
+
} else t2 = $[8];
|
|
52
|
+
const filterHierarchyLevelActiveDescription = t2;
|
|
53
|
+
let t3;
|
|
54
|
+
if ($[9] !== getHierarchyLevelDetails || $[10] !== node.id || $[11] !== onFilter) {
|
|
55
|
+
t3 = () => {
|
|
43
56
|
const hierarchyLevelDetails = getHierarchyLevelDetails(node.id);
|
|
44
57
|
hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);
|
|
45
58
|
};
|
|
46
|
-
$[
|
|
47
|
-
$[
|
|
48
|
-
$[
|
|
49
|
-
$[
|
|
50
|
-
} else
|
|
51
|
-
const handleClick =
|
|
52
|
-
const
|
|
53
|
-
const
|
|
54
|
-
const
|
|
55
|
-
let
|
|
56
|
-
if ($[
|
|
57
|
-
|
|
59
|
+
$[9] = getHierarchyLevelDetails;
|
|
60
|
+
$[10] = node.id;
|
|
61
|
+
$[11] = onFilter;
|
|
62
|
+
$[12] = t3;
|
|
63
|
+
} else t3 = $[12];
|
|
64
|
+
const handleClick = t3;
|
|
65
|
+
const t4 = node.isFiltered ? true : void 0;
|
|
66
|
+
const t5 = node.isFiltered ? filterHierarchyLevelActiveDescription : void 0;
|
|
67
|
+
const t6 = !onFilter || !node.isFilterable;
|
|
68
|
+
let t7;
|
|
69
|
+
if ($[13] !== actionAttributes || $[14] !== filterHierarchyLevel || $[15] !== handleClick || $[16] !== t4 || $[17] !== t5 || $[18] !== t6) {
|
|
70
|
+
t7 = /* @__PURE__ */ jsx(TreeActionBase, {
|
|
58
71
|
...actionAttributes,
|
|
59
72
|
label: filterHierarchyLevel,
|
|
60
73
|
onClick: handleClick,
|
|
61
74
|
icon: filterSvg,
|
|
62
|
-
visible:
|
|
63
|
-
dot:
|
|
64
|
-
hide:
|
|
75
|
+
visible: t4,
|
|
76
|
+
dot: t5,
|
|
77
|
+
hide: t6
|
|
65
78
|
});
|
|
66
|
-
$[
|
|
67
|
-
$[
|
|
68
|
-
$[
|
|
69
|
-
$[
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
$[
|
|
73
|
-
} else
|
|
74
|
-
return
|
|
79
|
+
$[13] = actionAttributes;
|
|
80
|
+
$[14] = filterHierarchyLevel;
|
|
81
|
+
$[15] = handleClick;
|
|
82
|
+
$[16] = t4;
|
|
83
|
+
$[17] = t5;
|
|
84
|
+
$[18] = t6;
|
|
85
|
+
$[19] = t7;
|
|
86
|
+
} else t7 = $[19];
|
|
87
|
+
return t7;
|
|
75
88
|
});
|
|
76
89
|
|
|
77
90
|
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TreeNodeFilterAction.js","names":["memo","useCallback","filterSvg","useTranslation","TreeActionBase","NamedExoticComponent","HierarchyLevelDetails","TreeRendererProps","TreeNode","TreeActionBaseAttributes","TreeNodeFilterActionProps","onFilter","hierarchyLevelDetails","Pick","TreeNodeFilterAction","node","t0","$","_c","actionAttributes","getHierarchyLevelDetails","translate","t1","filterHierarchyLevel","t2","filterHierarchyLevelActiveDescription","t3","id","handleClick","t4","isFiltered","undefined","t5","t6","isFilterable","t7"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.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 { memo, useCallback } from \"react\";\nimport filterSvg from \"@stratakit/icons/filter.svg\";\nimport { useTranslation } from \"./LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\n\nimport type { NamedExoticComponent } from \"react\";\nimport type { HierarchyLevelDetails, TreeRendererProps } from \"../Renderers.js\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { TreeActionBaseAttributes } from \"./TreeAction.js\";\n\n/** @alpha */\ntype TreeNodeFilterActionProps = {\n /**\n * Action to perform when the filter button is clicked for this node.\n */\n onFilter?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;\n} & TreeActionBaseAttributes &\n Pick<TreeRendererProps, \"getHierarchyLevelDetails\">;\n\n/**\n * React component that renders a filter action for a tree item.\n *\n * The action calls the `onFilter` callback prop when clicked.\n *\n * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action\n * to tree items.\n *\n * @alpha\n */\nexport const TreeNodeFilterAction: NamedExoticComponent<TreeNodeFilterActionProps & { node: TreeNode }> = memo(function TreeNodeFilterAction({\n node,\n onFilter,\n getHierarchyLevelDetails,\n ...actionAttributes\n}: TreeNodeFilterActionProps & { node: TreeNode }) {\n const translate = useTranslation();\n const filterHierarchyLevel = translate(\"filterHierarchyLevel\");\n const filterHierarchyLevelActiveDescription = translate(\"filterHierarchyLevelActiveDescription\");\n\n const handleClick = useCallback(() => {\n const hierarchyLevelDetails = getHierarchyLevelDetails(node.id);\n hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);\n }, [node, getHierarchyLevelDetails, onFilter]);\n\n return (\n <TreeActionBase\n {...actionAttributes}\n label={filterHierarchyLevel}\n onClick={handleClick}\n icon={filterSvg}\n visible={node.isFiltered ? true : undefined}\n dot={node.isFiltered ? filterHierarchyLevelActiveDescription : undefined}\n hide={!onFilter || !node.isFilterable}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAac,uBAA6Fd,KAAK,SAAAc,qBAAAE,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL;CAAA,IAAAJ;AAAA,KAAAM,EAAA,OAAAD,IAAA;AAA8B,GAAA,CAAAD,MAAAJ,UAAAS,6BAAAD,oBAAAH;AAK5FC,IAAA,KAAAD;AAAAC,IAAA,KAAAE;AAAAF,IAAA,KAAAG;AAAAH,IAAA,KAAAF;AAAAE,IAAA,KAAAN;QAAA;AAAAQ,qBAAAF,EAAA;AAAAG,6BAAAH,EAAA;AAAAF,SAAAE,EAAA;AAAAN,aAAAM,EAAA;;CAC/C,MAAAI,YAAkBlB,gBAAgB;CAAC,IAAAmB;AAAA,KAAAL,EAAA,OAAAI,WAAA;AACNC,OAAAD,UAAU,uBAAuB;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