@itwin/presentation-hierarchies-react 2.0.0-alpha.59 → 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 +6 -0
- package/README.md +30 -6
- package/lib/presentation-hierarchies-react/FlatTreeNode.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/FlatTreeNode.js.map +1 -1
- package/lib/presentation-hierarchies-react/LocalizationContext.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/LocalizationContext.js.map +1 -1
- package/lib/presentation-hierarchies-react/TreeNode.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/UseIModelTree.js.map +1 -1
- package/lib/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -1
- package/lib/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -1
- package/lib/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/UseTree.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/LocalizedStrings.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/TreeModel.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -1
- package/package.json +9 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeLoader.js","names":["catchError","EMPTY","expand","filter","from","map","mergeMap","of","toArray","createNodeId","Observable","GenericInstanceFilter","HierarchyNode","HierarchyProvider","RowsLimitExceededError","ErrorInfo","TreeModelHierarchyNode","TreeModelRootNode","LoadedTreePart","parent","loadedNodes","error","HierarchyLevelOptions","instanceFilter","hierarchyLevelSizeLimit","LoadNodesOptions","getHierarchyLevelOptions","node","shouldLoadChildren","buildNode","ignoreCache","ITreeLoader","loadNodes","options","TreeLoader","_treeNodeIdFactory","Pick","constructor","_hierarchyProvider","_onHierarchyLimitExceeded","props","parentId","limit","_onHierarchyLoadError","type","treeNodeIdFactory","loadChildren","Omit","infoNodeIdBase","id","treeModelNodesFactory","createTreeModelNodesFactory","getNodes","parentNode","nodeData","pipe","childNodes","length","const","err","hierarchyLoadErrorType","Error","isRowsLimitError","message","resultSetSizeLimit","isTimeoutError","loadedPart","modelNode","children","label","includes"],"sources":["../../../src/presentation-hierarchies-react/internal/TreeLoader.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 { catchError, EMPTY, expand, filter, from, map, mergeMap, of, toArray } from \"rxjs\";\nimport { createNodeId } from \"./Utils.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type {
|
|
1
|
+
{"version":3,"file":"TreeLoader.js","names":["catchError","EMPTY","expand","filter","from","map","mergeMap","of","toArray","createNodeId","Observable","GenericInstanceFilter","HierarchyNode","HierarchyProvider","RowsLimitExceededError","ErrorInfo","TreeModelHierarchyNode","TreeModelRootNode","LoadedTreePart","parent","loadedNodes","error","HierarchyLevelOptions","instanceFilter","hierarchyLevelSizeLimit","LoadNodesOptions","getHierarchyLevelOptions","node","shouldLoadChildren","buildNode","ignoreCache","ITreeLoader","loadNodes","options","TreeLoader","_treeNodeIdFactory","Pick","constructor","_hierarchyProvider","_onHierarchyLimitExceeded","props","parentId","limit","_onHierarchyLoadError","type","treeNodeIdFactory","loadChildren","Omit","infoNodeIdBase","id","treeModelNodesFactory","createTreeModelNodesFactory","getNodes","parentNode","nodeData","pipe","childNodes","length","const","err","hierarchyLoadErrorType","Error","isRowsLimitError","message","resultSetSizeLimit","isTimeoutError","loadedPart","modelNode","children","label","includes"],"sources":["../../../src/presentation-hierarchies-react/internal/TreeLoader.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 { catchError, EMPTY, expand, filter, from, map, mergeMap, of, toArray } from \"rxjs\";\nimport { createNodeId } from \"./Utils.js\";\n\nimport type { Observable } from \"rxjs\";\nimport type {\n GenericInstanceFilter,\n HierarchyNode,\n HierarchyProvider,\n RowsLimitExceededError,\n} from \"@itwin/presentation-hierarchies\";\nimport type { ErrorInfo } from \"../TreeNode.js\";\nimport type { TreeModelHierarchyNode, TreeModelRootNode } from \"./TreeModel.js\";\n\n/** @internal */\nexport type LoadedTreePart = { parent: TreeModelHierarchyNode | TreeModelRootNode } & (\n | { loadedNodes: TreeModelHierarchyNode[] }\n | { error: ErrorInfo }\n);\n\n/** @internal */\nexport interface HierarchyLevelOptions {\n instanceFilter?: GenericInstanceFilter;\n hierarchyLevelSizeLimit?: number | \"unbounded\";\n}\n\n/** @internal */\nexport interface LoadNodesOptions {\n parent: TreeModelHierarchyNode | TreeModelRootNode;\n getHierarchyLevelOptions: (node: TreeModelRootNode | TreeModelHierarchyNode) => HierarchyLevelOptions;\n shouldLoadChildren: (node: TreeModelHierarchyNode) => boolean;\n buildNode?: (node: TreeModelHierarchyNode) => TreeModelHierarchyNode;\n ignoreCache?: boolean;\n}\n\n/** @internal */\nexport interface ITreeLoader {\n loadNodes(options: LoadNodesOptions): Observable<LoadedTreePart>;\n}\n\n/** @internal */\nexport class TreeLoader implements ITreeLoader {\n private _treeNodeIdFactory: (node: Pick<HierarchyNode, \"key\" | \"parentKeys\">) => string;\n\n constructor(\n private _hierarchyProvider: HierarchyProvider,\n private _onHierarchyLimitExceeded: (props: {\n parentId?: string;\n filter?: GenericInstanceFilter;\n limit?: number | \"unbounded\";\n }) => void,\n private _onHierarchyLoadError: (props: { parentId?: string; type: \"timeout\" | \"unknown\"; error: unknown }) => void,\n treeNodeIdFactory?: (node: Pick<HierarchyNode, \"key\" | \"parentKeys\">) => string,\n ) {\n this._treeNodeIdFactory = treeNodeIdFactory ?? /* c8 ignore next */ createNodeId;\n }\n\n private loadChildren({\n parent,\n getHierarchyLevelOptions,\n buildNode,\n ignoreCache,\n }: Omit<LoadNodesOptions, \"shouldLoadChildren\">) {\n const { instanceFilter, hierarchyLevelSizeLimit } = getHierarchyLevelOptions(parent);\n const infoNodeIdBase = `${parent.id ?? \"<root>\"}`;\n const treeModelNodesFactory = createTreeModelNodesFactory({\n buildNode,\n treeNodeIdFactory: this._treeNodeIdFactory,\n });\n return from(\n this._hierarchyProvider.getNodes({\n parentNode: parent.nodeData,\n hierarchyLevelSizeLimit,\n instanceFilter,\n ignoreCache,\n }),\n ).pipe(\n toArray(),\n map((childNodes): LoadedTreePart => {\n return instanceFilter && childNodes.length === 0\n ? { parent, error: { id: `${infoNodeIdBase}-no-filter-matches`, type: \"NoFilterMatches\" as const } }\n : { parent, loadedNodes: childNodes.map(treeModelNodesFactory) };\n }),\n catchError((err) => {\n let hierarchyLoadErrorType: \"unknown\" | \"timeout\" = \"unknown\";\n if (err instanceof Error) {\n if (isRowsLimitError(err)) {\n this._onHierarchyLimitExceeded({ parentId: parent.id, filter: instanceFilter, limit: err.limit });\n return of({\n parent,\n error: {\n id: `${infoNodeIdBase}-${err.message}`,\n type: \"ResultSetTooLarge\" as const,\n resultSetSizeLimit: err.limit,\n },\n });\n }\n if (isTimeoutError(err)) {\n hierarchyLoadErrorType = \"timeout\";\n }\n }\n\n this._onHierarchyLoadError({ parentId: parent.id, type: hierarchyLoadErrorType, error: err });\n return of({\n parent,\n error: {\n id: `${infoNodeIdBase}-ChildrenLoad`,\n type: \"ChildrenLoad\" as const,\n message: \"Failed to create hierarchy level\",\n },\n });\n }),\n );\n }\n\n public loadNodes({ shouldLoadChildren, ...options }: LoadNodesOptions) {\n return this.loadChildren(options).pipe(\n expand((loadedPart) =>\n \"loadedNodes\" in loadedPart\n ? from(loadedPart.loadedNodes).pipe(\n filter((node) => shouldLoadChildren(node)),\n mergeMap((node) => this.loadChildren({ ...options, parent: node })),\n )\n : EMPTY,\n ),\n );\n }\n}\n\nfunction createTreeModelNodesFactory({\n buildNode,\n treeNodeIdFactory,\n}: {\n buildNode?: (node: TreeModelHierarchyNode) => TreeModelHierarchyNode;\n treeNodeIdFactory: (node: Pick<HierarchyNode, \"key\" | \"parentKeys\">) => string;\n}): (node: HierarchyNode) => TreeModelHierarchyNode {\n return (node: HierarchyNode) => {\n const modelNode: TreeModelHierarchyNode = {\n id: treeNodeIdFactory(node),\n children: node.children,\n label: node.label,\n nodeData: node,\n };\n return buildNode ? buildNode(modelNode) : modelNode;\n };\n}\n\nfunction isRowsLimitError(error: Error): error is RowsLimitExceededError {\n return \"limit\" in error && error.message.includes(\"Query rows limit of\");\n}\n\nfunction isTimeoutError(error: Error) {\n return error.message.includes(\"query too long to execute or server is too busy\");\n}\n"],"mappings":";;;;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OpD,GAAG;IACRY;IACAE,OAAO;KACL4B,IAAI,GAAGD,eAAc;KACrBJ,MAAM;KACNmB,SAAS;KACX;IACD,CAAC;IAEN,CAAC;;CAGH,UAAiB,EAAEnC,oBAAoB,GAAGK,WAA6B;AACrE,SAAO,KAAKa,aAAab,QAAQ,CAACsB,KAChCrD,QAAQgE,eACN,iBAAiBA,aACb9D,KAAK8D,WAAW9C,YAAY,CAACmC,KAC3BpD,QAAQwB,SAASC,mBAAmBD,KAAK,CAAC,EAC1CrB,UAAUqB,SAAS,KAAKmB,aAAa;GAAE,GAAGb;GAASd,QAAQQ;GAAM,CAAC,CACpE,CAAC,GACD1B,MAER,CAAC;;;AAIL,SAASkD,4BAA4B,EACnCtB,WACAgB,qBAIkD;AAClD,SAAQlB,SAAwB;EAC9B,MAAMwC,YAAoC;GACxClB,IAAIJ,kBAAkBlB,KAAK;GAC3ByC,UAAUzC,KAAKyC;GACfC,OAAO1C,KAAK0C;GACZf,UAAU3B;GACX;AACD,SAAOE,YAAYA,UAAUsC,UAAU,GAAGA;;;AAI9C,SAASL,iBAAiBzC,OAA+C;AACvE,QAAO,WAAWA,SAASA,MAAM0C,QAAQO,SAAS,sBAAsB;;AAG1E,SAASL,eAAe5C,OAAc;AACpC,QAAOA,MAAM0C,QAAQO,SAAS,kDAAkD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeModel.js","names":["GenericInstanceFilter","HierarchyNode","ErrorInfo","SelectionChangeType","TreeModelRootNode","id","nodeData","hierarchyLimit","instanceFilter","isLoading","error","TreeModelHierarchyNode","label","children","isExpanded","isSelected","TreeModel","parentChildMap","Map","idToNode","rootNode","expandNode","model","nodeId","node","get","type","removeSubTree","addHierarchyPart","rootId","hierarchyPart","parentId","set","parentNode","undefined","clearNodeError","currentChildren","delete","childId","childNode","setHierarchyLimit","limit","updateForReload","setInstanceFilter","filter","selectNodes","nodeIds","Array","changeType","find","modelNode","isNodeSelected","currentNode","getNode","setIsLoading","update"],"sources":["../../../src/presentation-hierarchies-react/internal/TreeModel.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 type { GenericInstanceFilter, HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { ErrorInfo } from \"../TreeNode.js\";\nimport type { SelectionChangeType } from \"../UseSelectionHandler.js\";\n\n/** @internal */\nexport interface TreeModelRootNode {\n id: undefined;\n nodeData: undefined;\n hierarchyLimit?: number | \"unbounded\";\n instanceFilter?: GenericInstanceFilter;\n isLoading?: boolean;\n error?: ErrorInfo;\n}\n\n/** @internal */\nexport interface TreeModelHierarchyNode {\n id: string;\n nodeData: HierarchyNode;\n label: string;\n children: boolean;\n isLoading?: boolean;\n isExpanded?: boolean;\n isSelected?: boolean;\n hierarchyLimit?: number | \"unbounded\";\n instanceFilter?: GenericInstanceFilter;\n error?: ErrorInfo;\n}\n\n/** @internal */\nexport interface TreeModel {\n parentChildMap: Map<string | undefined, string[]>;\n idToNode: Map<string, TreeModelHierarchyNode>;\n rootNode: TreeModelRootNode;\n}\n\n/** @internal */\nexport namespace TreeModel {\n export function expandNode(model: TreeModel
|
|
1
|
+
{"version":3,"file":"TreeModel.js","names":["GenericInstanceFilter","HierarchyNode","ErrorInfo","SelectionChangeType","TreeModelRootNode","id","nodeData","hierarchyLimit","instanceFilter","isLoading","error","TreeModelHierarchyNode","label","children","isExpanded","isSelected","TreeModel","parentChildMap","Map","idToNode","rootNode","expandNode","model","nodeId","node","get","type","removeSubTree","addHierarchyPart","rootId","hierarchyPart","parentId","set","parentNode","undefined","clearNodeError","currentChildren","delete","childId","childNode","setHierarchyLimit","limit","updateForReload","setInstanceFilter","filter","selectNodes","nodeIds","Array","changeType","find","modelNode","isNodeSelected","currentNode","getNode","setIsLoading","update"],"sources":["../../../src/presentation-hierarchies-react/internal/TreeModel.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 type { GenericInstanceFilter, HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { ErrorInfo } from \"../TreeNode.js\";\nimport type { SelectionChangeType } from \"../UseSelectionHandler.js\";\n\n/** @internal */\nexport interface TreeModelRootNode {\n id: undefined;\n nodeData: undefined;\n hierarchyLimit?: number | \"unbounded\";\n instanceFilter?: GenericInstanceFilter;\n isLoading?: boolean;\n error?: ErrorInfo;\n}\n\n/** @internal */\nexport interface TreeModelHierarchyNode {\n id: string;\n nodeData: HierarchyNode;\n label: string;\n children: boolean;\n isLoading?: boolean;\n isExpanded?: boolean;\n isSelected?: boolean;\n hierarchyLimit?: number | \"unbounded\";\n instanceFilter?: GenericInstanceFilter;\n error?: ErrorInfo;\n}\n\n/** @internal */\nexport interface TreeModel {\n parentChildMap: Map<string | undefined, string[]>;\n idToNode: Map<string, TreeModelHierarchyNode>;\n rootNode: TreeModelRootNode;\n}\n\n/** @internal */\nexport namespace TreeModel {\n export function expandNode(\n model: TreeModel,\n nodeId: string,\n isExpanded: boolean,\n ): \"none\" | \"loadChildren\" | \"reloadChildren\" {\n const node = model.idToNode.get(nodeId);\n if (!node) {\n return \"none\";\n }\n\n node.isExpanded = isExpanded;\n if (!isExpanded) {\n return \"none\";\n }\n\n if (node.error?.type === \"ChildrenLoad\") {\n node.isLoading = true;\n // remove subtree if there `ChildrenLoad` error info in order to attempt reloading children\n TreeModel.removeSubTree(model, nodeId);\n return \"reloadChildren\";\n }\n\n if (!node.children) {\n return \"none\";\n }\n\n const children = model.parentChildMap.get(node.id);\n if (!children) {\n node.isLoading = true;\n return \"loadChildren\";\n }\n\n return \"none\";\n }\n\n /** @internal */\n export function addHierarchyPart(model: TreeModel, rootId: string | undefined, hierarchyPart: TreeModel): void {\n removeSubTree(model, rootId);\n model.rootNode.error = hierarchyPart.rootNode.error;\n\n for (const [parentId, children] of hierarchyPart.parentChildMap) {\n model.parentChildMap.set(parentId, children);\n }\n\n for (const [nodeId, node] of hierarchyPart.idToNode) {\n model.idToNode.set(nodeId, node);\n }\n\n const parentNode = rootId !== undefined ? model.idToNode.get(rootId) : model.rootNode;\n /* c8 ignore next 3*/\n if (!parentNode) {\n return;\n }\n parentNode.isLoading = false;\n }\n\n export function removeSubTree(model: TreeModel, parentId: string | undefined): void {\n clearNodeError(model, parentId);\n const currentChildren = model.parentChildMap.get(parentId);\n if (!currentChildren) {\n return;\n }\n model.parentChildMap.delete(parentId);\n\n for (const childId of currentChildren) {\n const childNode = model.idToNode.get(childId);\n if (childNode) {\n removeSubTree(model, childNode.id);\n }\n model.idToNode.delete(childId);\n }\n }\n\n export function setHierarchyLimit(\n model: TreeModel,\n nodeId: string | undefined,\n limit?: number | \"unbounded\",\n ): boolean {\n return updateForReload(model, nodeId, (node) => {\n node.hierarchyLimit = limit;\n });\n }\n\n export function setInstanceFilter(\n model: TreeModel,\n nodeId: string | undefined,\n filter?: GenericInstanceFilter,\n ): boolean {\n return updateForReload(model, nodeId, (node) => {\n if (filter && node.id !== undefined) {\n node.isExpanded = true;\n }\n node.instanceFilter = filter;\n });\n }\n\n export function selectNodes(model: TreeModel, nodeIds: Array<string>, changeType: SelectionChangeType) {\n if (changeType === \"replace\") {\n for (const [nodeId, node] of model.idToNode) {\n node.isSelected = !!nodeIds.find((id) => id === nodeId);\n }\n return;\n }\n for (const nodeId of nodeIds) {\n const modelNode = model.idToNode.get(nodeId);\n if (!modelNode) {\n return;\n }\n modelNode.isSelected = changeType === \"add\";\n }\n }\n\n export function isNodeSelected(model: TreeModel, nodeId: string): boolean {\n const currentNode = model.idToNode.get(nodeId);\n return !!currentNode && !!currentNode.isSelected;\n }\n\n export function getNode(\n model: TreeModel,\n nodeId: string | undefined,\n ): TreeModelHierarchyNode | TreeModelRootNode | undefined {\n if (!nodeId) {\n return model.rootNode;\n }\n return model.idToNode.get(nodeId);\n }\n\n export function setIsLoading(model: TreeModel, nodeId: string | undefined, isLoading: boolean) {\n if (nodeId === undefined) {\n model.rootNode.isLoading = isLoading;\n return;\n }\n const modelNode = model.idToNode.get(nodeId);\n /* c8 ignore next 3*/\n if (!modelNode) {\n return;\n }\n modelNode.isLoading = isLoading;\n }\n}\n\nfunction updateForReload(\n model: TreeModel,\n nodeId: string | undefined,\n update: (node: TreeModelHierarchyNode | TreeModelRootNode) => void,\n) {\n TreeModel.removeSubTree(model, nodeId);\n if (nodeId === undefined) {\n update(model.rootNode);\n model.rootNode.isLoading = true;\n return true;\n }\n\n const modelNode = model.idToNode.get(nodeId);\n if (!modelNode) {\n return false;\n }\n\n update(modelNode);\n if (modelNode.isExpanded) {\n modelNode.isLoading = true;\n return true;\n }\n return false;\n}\n\nfunction clearNodeError(model: TreeModel, parentId: string | undefined) {\n if (!parentId) {\n return (model.rootNode.error = undefined);\n }\n const node = model.idToNode.get(parentId);\n if (!node) {\n return;\n }\n node.error = undefined;\n}\n"],"mappings":";AAyCO,IAAA;;CACE,SAASqB,WACdC,OACAC,QACAT,YAC4C;EAC5C,MAAMU,OAAOF,MAAMH,SAASM,IAAIF,OAAO;AACvC,MAAI,CAACC,KACH,QAAO;AAGTA,OAAKV,aAAaA;AAClB,MAAI,CAACA,WACH,QAAO;AAGT,MAAIU,KAAKd,OAAOgB,SAAS,gBAAgB;AACvCF,QAAKf,YAAY;AAEjBO,aAAUW,cAAcL,OAAOC,OAAO;AACtC,UAAO;;AAGT,MAAI,CAACC,KAAKX,SACR,QAAO;AAIT,MAAI,CADaS,MAAML,eAAeQ,IAAID,KAAKnB,GAAG,EACnC;AACbmB,QAAKf,YAAY;AACjB,UAAO;;AAGT,SAAO;;;CAIF,SAASmB,iBAAiBN,OAAkBO,QAA4BC,eAAgC;AAC7GH,gBAAcL,OAAOO,OAAO;AAC5BP,QAAMF,SAASV,QAAQoB,cAAcV,SAASV;AAE9C,OAAK,MAAM,CA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AC5C,OAAI,CAAC2B,UACH;AAEFA,aAAUnC,aAAaiC,eAAe;;;;CAInC,SAASG,eAAe7B,OAAkBC,QAAyB;EACxE,MAAM6B,cAAc9B,MAAMH,SAASM,IAAIF,OAAO;AAC9C,SAAO,CAAC,CAAC6B,eAAe,CAAC,CAACA,YAAYrC;;;CAGjC,SAASsC,QACd/B,OACAC,QACwD;AACxD,MAAI,CAACA,OACH,QAAOD,MAAMF;AAEf,SAAOE,MAAMH,SAASM,IAAIF,OAAO;;;CAG5B,SAAS+B,aAAahC,OAAkBC,QAA4Bd,WAAoB;AAC7F,MAAIc,WAAWW,KAAAA,GAAW;AACxBZ,SAAMF,SAASX,YAAYA;AAC3B;;EAEF,MAAMyC,YAAY5B,MAAMH,SAASM,IAAIF,OAAO;;AAE5C,MAAI,CAAC2B,UACH;AAEFA,YAAUzC,YAAYA;;;iCAE1B;AAEA,SAASiC,gBACPpB,OACAC,QACAgC,QACA;AACAvC,WAAUW,cAAcL,OAAOC,OAAO;AACtC,KAAIA,WAAWW,KAAAA,GAAW;AACxBqB,SAAOjC,MAAMF,SAAS;AACtBE,QAAMF,SAASX,YAAY;AAC3B,SAAO;;CAGT,MAAMyC,YAAY5B,MAAMH,SAASM,IAAIF,OAAO;AAC5C,KAAI,CAAC2B,UACH,QAAO;AAGTK,QAAOL,UAAU;AACjB,KAAIA,UAAUpC,YAAY;AACxBoC,YAAUzC,YAAY;AACtB,SAAO;;AAET,QAAO;;AAGT,SAAS0B,eAAeb,OAAkBS,UAA8B;AACtE,KAAI,CAACA,UAAU;AACLT,QAAMF,SAASV,QAAQwB,KAAAA;AAA/B;;CAEF,MAAMV,OAAOF,MAAMH,SAASM,IAAIM,SAAS;AACzC,KAAI,CAACP,KACH;AAEFA,MAAKd,QAAQwB,KAAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseUnifiedSelection.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/internal/UseUnifiedSelection.ts"],"mappings":";;;;;UAuBiB,4BAAA;
|
|
1
|
+
{"version":3,"file":"UseUnifiedSelection.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/internal/UseUnifiedSelection.ts"],"mappings":";;;;;UAuBiB,4BAAA;EAuBV;;;EAnBL,UAAA;EAAA;;;;;;;;;;;;;;EAgBA,8BAAA,IACE,IAAA,EAAM,wBAAA;IAA6B,GAAA,EAAK,cAAA;EAAA,GACxC,eAAA,aACG,UAAA;;;;EAKL,gBAAA,EAAkB,gBAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UseUnifiedSelection.js","names":["useEffect","useState","assert","HierarchyNode","Selectables","GenericNodeKey","InstancesNodeKey","NonGroupingHierarchyNode","InstanceKey","Selectable","SelectionStorage","SelectionChangeType","TreeModelHierarchyNode","TreeModelRootNode","TreeSelectionOptions","isNodeSelected","nodeId","selectNodes","nodeIds","Array","changeType","UseUnifiedTreeSelectionProps","sourceName","createSelectableForGenericNode","node","key","treeModelNodeId","selectionStorage","useUnifiedTreeSelection","t0","$","_c","getTreeModelNode","t1","undefined","defaultCreateSelectableForGenericNode","options","setOptions","_temp3","t2","t3","createOptions","selectionChangeEvent","addListener","args","level","_temp","_temp2","NonNullable","identifier","data","loadInstanceKeys","source","storage","getNode","id","imodelKey","nodeSelectables","groupNodeSelectablesByIModelKey","storageSelectables","getSelection","hasAny","imodelSelectables","Map","selectablesList","get","set","forEach","selectable","push","selectables","actionProps","addToSelection","removeFromSelection","replaceSelection","modelNode","hierarchyNode","nodeData","isInstancesNode","groupIModelInstanceKeys","instanceKeys","isGroupingNode","groupingNodeSelectables","groupedInstanceKeys","isGeneric","reduce"],"sources":["../../../src/presentation-hierarchies-react/internal/UseUnifiedSelection.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 { useEffect, useState } from \"react\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { Selectables } from \"@itwin/unified-selection\";\n\nimport type { GenericNodeKey, InstancesNodeKey, NonGroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { Selectable, SelectionStorage } from \"@itwin/unified-selection\";\nimport type { SelectionChangeType } from \"../UseSelectionHandler.js\";\nimport type { TreeModelHierarchyNode, TreeModelRootNode } from \"./TreeModel.js\";\n\n/** @internal */\nexport interface TreeSelectionOptions {\n isNodeSelected: (nodeId: string) => boolean;\n selectNodes: (nodeIds: Array<string>, changeType: SelectionChangeType) => void;\n}\n\n/** @public */\nexport interface UseUnifiedTreeSelectionProps {\n /**\n * Identifier to distinguish this source of changes to the unified selection from another ones in the application.\n */\n sourceName: string;\n\n /**\n * An optional function that allows customizing the `Selectable` object that gets created for generic hierarchy nodes. When\n * not supplied, the `Selectable` is created using the following signature:\n * ```ts\n * {\n * identifier: treeModelNodeId,\n * data: node,\n * async *loadInstanceKeys() {},\n * }\n * ```\n *\n * @param node Hierarchy node to create a selectable for.\n * @param treeModelNodeId ID of the hierarchy node in the internal tree model. This ID uniquely identifies the node in the whole hierarchy, as opposed to `GenericNodeKey.id` contained within the `node`, which may not be unique.\n */\n createSelectableForGenericNode?: (node: NonGroupingHierarchyNode & { key: GenericNodeKey }, treeModelNodeId: string) => Selectable;\n\n /**\n * Unified selection storage to use for listening, getting and changing active selection.\n */\n selectionStorage: SelectionStorage;\n}\n\n/** @internal */\nexport function useUnifiedTreeSelection({\n sourceName,\n selectionStorage,\n getTreeModelNode,\n createSelectableForGenericNode = defaultCreateSelectableForGenericNode,\n}: UseUnifiedTreeSelectionProps & { getTreeModelNode: (nodeId: string) => TreeModelHierarchyNode | TreeModelRootNode | undefined }): TreeSelectionOptions {\n const [options, setOptions] = useState<TreeSelectionOptions>(() => ({\n isNodeSelected: /* c8 ignore next */ () => false,\n selectNodes: /* c8 ignore next */ () => {},\n }));\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setOptions(createOptions(sourceName, selectionStorage, createSelectableForGenericNode, getTreeModelNode));\n return selectionStorage.selectionChangeEvent.addListener((args) => {\n if (args.level > 0) {\n return;\n }\n setOptions(createOptions(sourceName, selectionStorage, createSelectableForGenericNode, getTreeModelNode));\n });\n }, [selectionStorage, createSelectableForGenericNode, getTreeModelNode, sourceName]);\n\n return options;\n}\n\nconst defaultCreateSelectableForGenericNode: NonNullable<UseUnifiedTreeSelectionProps[\"createSelectableForGenericNode\"]> = (\n node,\n treeModelNodeId,\n): Selectable => ({\n identifier: treeModelNodeId,\n data: node,\n async *loadInstanceKeys() {},\n});\n\nfunction createOptions(\n source: string,\n storage: SelectionStorage,\n createSelectableForGenericNode: NonNullable<UseUnifiedTreeSelectionProps[\"createSelectableForGenericNode\"]>,\n getNode: (nodeId: string) => TreeModelHierarchyNode | TreeModelRootNode | undefined,\n): TreeSelectionOptions {\n return {\n isNodeSelected: (nodeId: string) => {\n const node = getNode(nodeId);\n if (!node || node.id === undefined) {\n return false;\n }\n for (const [imodelKey, nodeSelectables] of groupNodeSelectablesByIModelKey(node, createSelectableForGenericNode)) {\n const storageSelectables = storage.getSelection({ imodelKey, level: 0 });\n if (Selectables.hasAny(storageSelectables, nodeSelectables)) {\n return true;\n }\n }\n return false;\n },\n\n selectNodes: (nodeIds: Array<string>, changeType: SelectionChangeType) => {\n const imodelSelectables = new Map<string, Selectable[]>();\n for (const nodeId of nodeIds) {\n const node = getNode(nodeId);\n if (!node || node.id === undefined) {\n return;\n }\n for (const [imodelKey, nodeSelectables] of groupNodeSelectablesByIModelKey(node, createSelectableForGenericNode)) {\n let selectablesList = imodelSelectables.get(imodelKey);\n if (!selectablesList) {\n selectablesList = [];\n imodelSelectables.set(imodelKey, selectablesList);\n }\n nodeSelectables.forEach((selectable) => selectablesList.push(selectable));\n }\n }\n imodelSelectables.forEach((selectables, imodelKey) => {\n const actionProps = { imodelKey, source, selectables, level: 0 };\n switch (changeType) {\n case \"add\":\n storage.addToSelection(actionProps);\n return;\n case \"remove\":\n storage.removeFromSelection(actionProps);\n return;\n case \"replace\":\n storage.replaceSelection(actionProps);\n return;\n }\n });\n },\n };\n}\n\nfunction groupNodeSelectablesByIModelKey(\n modelNode: TreeModelHierarchyNode,\n createSelectableForGenericNode: NonNullable<UseUnifiedTreeSelectionProps[\"createSelectableForGenericNode\"]>,\n): Map<string, Selectable[]> {\n const hierarchyNode = modelNode.nodeData;\n if (HierarchyNode.isInstancesNode(hierarchyNode)) {\n return groupIModelInstanceKeys(hierarchyNode.key.instanceKeys);\n }\n if (HierarchyNode.isGroupingNode(hierarchyNode)) {\n const groupingNodeSelectables = new Map<string, Selectable[]>();\n groupIModelInstanceKeys(hierarchyNode.groupedInstanceKeys).forEach((instanceKeys, imodelKey) => {\n groupingNodeSelectables.set(imodelKey, [\n {\n identifier: modelNode.id,\n data: hierarchyNode,\n async *loadInstanceKeys() {\n for (const key of instanceKeys) {\n yield key;\n }\n },\n },\n ]);\n });\n return groupingNodeSelectables;\n }\n assert(HierarchyNode.isGeneric(hierarchyNode));\n // note: generic nodes aren't associated with an imodel\n return new Map([[\"\", [createSelectableForGenericNode(hierarchyNode, modelNode.id)]]]);\n}\n\nfunction groupIModelInstanceKeys(instanceKeys: InstancesNodeKey[\"instanceKeys\"]) {\n return instanceKeys.reduce((imodelSelectables, key) => {\n const imodelKey = key.imodelKey ?? \"\";\n let selectablesList = imodelSelectables.get(imodelKey);\n if (!selectablesList) {\n selectablesList = [];\n imodelSelectables.set(imodelKey, selectablesList);\n }\n selectablesList.push(key);\n return imodelSelectables;\n }, new Map<string, InstanceKey[]>());\n}\n"],"mappings":";;;;;;;AAoDA,SAAO4B,wBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAiC,MAAA,EAAAT,YAAAK,kBAAAK,kBAAAT,gCAAAU,OAAAJ;CAItC,M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MAAM0B;IACN,OAAOzB,mBAAmB;AACxB,UAAK,MAAM1B,OAAOuD,aAChB,OAAMvD;;IAGX,CACF,CAAC;IACF;AACF,SAAOyD;;AAEThF,QAAOC,cAAciF,UAAUR,cAAc,CAAC;AAE9C,QAAO,IAAIb,IAAI,CAAC,CAAC,IAAI,CAACxC,+BAA+BqD,eAAeD,UAAUpB,GAAG,CAAC,CAAC,CAAC,CAAC;;AAGvF,SAASwB,wBAAwBC,cAAgD;AAC/E,QAAOA,aAAaK,QAAQvB,mBAAmBrC,QAAQ;EACrD,MAAM+B,YAAY/B,IAAI+B,aAAa;EACnC,IAAIQ,kBAAkBF,kBAAkBG,IAAIT,UAAU;AACtD,MAAI,CAACQ,iBAAiB;AACpBA,qBAAkB,EAAE;AACpBF,qBAAkBI,IAAIV,WAAWQ,gBAAgB;;AAEnDA,kBAAgBK,KAAK5C,IAAI;AACzB,SAAOqC;oBACN,IAAIC,KAA4B,CAAC"}
|
|
1
|
+
{"version":3,"file":"UseUnifiedSelection.js","names":["useEffect","useState","assert","HierarchyNode","Selectables","GenericNodeKey","InstancesNodeKey","NonGroupingHierarchyNode","InstanceKey","Selectable","SelectionStorage","SelectionChangeType","TreeModelHierarchyNode","TreeModelRootNode","TreeSelectionOptions","isNodeSelected","nodeId","selectNodes","nodeIds","Array","changeType","UseUnifiedTreeSelectionProps","sourceName","createSelectableForGenericNode","node","key","treeModelNodeId","selectionStorage","useUnifiedTreeSelection","t0","$","_c","getTreeModelNode","t1","undefined","defaultCreateSelectableForGenericNode","options","setOptions","_temp3","t2","t3","createOptions","selectionChangeEvent","addListener","args","level","_temp","_temp2","NonNullable","identifier","data","loadInstanceKeys","source","storage","getNode","id","imodelKey","nodeSelectables","groupNodeSelectablesByIModelKey","storageSelectables","getSelection","hasAny","imodelSelectables","Map","selectablesList","get","set","forEach","selectable","push","selectables","actionProps","addToSelection","removeFromSelection","replaceSelection","modelNode","hierarchyNode","nodeData","isInstancesNode","groupIModelInstanceKeys","instanceKeys","isGroupingNode","groupingNodeSelectables","groupedInstanceKeys","isGeneric","reduce"],"sources":["../../../src/presentation-hierarchies-react/internal/UseUnifiedSelection.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 { useEffect, useState } from \"react\";\nimport { assert } from \"@itwin/core-bentley\";\nimport { HierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport { Selectables } from \"@itwin/unified-selection\";\n\nimport type { GenericNodeKey, InstancesNodeKey, NonGroupingHierarchyNode } from \"@itwin/presentation-hierarchies\";\nimport type { InstanceKey } from \"@itwin/presentation-shared\";\nimport type { Selectable, SelectionStorage } from \"@itwin/unified-selection\";\nimport type { SelectionChangeType } from \"../UseSelectionHandler.js\";\nimport type { TreeModelHierarchyNode, TreeModelRootNode } from \"./TreeModel.js\";\n\n/** @internal */\nexport interface TreeSelectionOptions {\n isNodeSelected: (nodeId: string) => boolean;\n selectNodes: (nodeIds: Array<string>, changeType: SelectionChangeType) => void;\n}\n\n/** @public */\nexport interface UseUnifiedTreeSelectionProps {\n /**\n * Identifier to distinguish this source of changes to the unified selection from another ones in the application.\n */\n sourceName: string;\n\n /**\n * An optional function that allows customizing the `Selectable` object that gets created for generic hierarchy nodes. When\n * not supplied, the `Selectable` is created using the following signature:\n * ```ts\n * {\n * identifier: treeModelNodeId,\n * data: node,\n * async *loadInstanceKeys() {},\n * }\n * ```\n *\n * @param node Hierarchy node to create a selectable for.\n * @param treeModelNodeId ID of the hierarchy node in the internal tree model. This ID uniquely identifies the node in the whole hierarchy, as opposed to `GenericNodeKey.id` contained within the `node`, which may not be unique.\n */\n createSelectableForGenericNode?: (\n node: NonGroupingHierarchyNode & { key: GenericNodeKey },\n treeModelNodeId: string,\n ) => Selectable;\n\n /**\n * Unified selection storage to use for listening, getting and changing active selection.\n */\n selectionStorage: SelectionStorage;\n}\n\n/** @internal */\nexport function useUnifiedTreeSelection({\n sourceName,\n selectionStorage,\n getTreeModelNode,\n createSelectableForGenericNode = defaultCreateSelectableForGenericNode,\n}: UseUnifiedTreeSelectionProps & {\n getTreeModelNode: (nodeId: string) => TreeModelHierarchyNode | TreeModelRootNode | undefined;\n}): TreeSelectionOptions {\n const [options, setOptions] = useState<TreeSelectionOptions>(() => ({\n isNodeSelected: /* c8 ignore next */ () => false,\n selectNodes: /* c8 ignore next */ () => {},\n }));\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setOptions(createOptions(sourceName, selectionStorage, createSelectableForGenericNode, getTreeModelNode));\n return selectionStorage.selectionChangeEvent.addListener((args) => {\n if (args.level > 0) {\n return;\n }\n setOptions(createOptions(sourceName, selectionStorage, createSelectableForGenericNode, getTreeModelNode));\n });\n }, [selectionStorage, createSelectableForGenericNode, getTreeModelNode, sourceName]);\n\n return options;\n}\n\nconst defaultCreateSelectableForGenericNode: NonNullable<\n UseUnifiedTreeSelectionProps[\"createSelectableForGenericNode\"]\n> = (node, treeModelNodeId): Selectable => ({ identifier: treeModelNodeId, data: node, async *loadInstanceKeys() {} });\n\nfunction createOptions(\n source: string,\n storage: SelectionStorage,\n createSelectableForGenericNode: NonNullable<UseUnifiedTreeSelectionProps[\"createSelectableForGenericNode\"]>,\n getNode: (nodeId: string) => TreeModelHierarchyNode | TreeModelRootNode | undefined,\n): TreeSelectionOptions {\n return {\n isNodeSelected: (nodeId: string) => {\n const node = getNode(nodeId);\n if (!node || node.id === undefined) {\n return false;\n }\n for (const [imodelKey, nodeSelectables] of groupNodeSelectablesByIModelKey(\n node,\n createSelectableForGenericNode,\n )) {\n const storageSelectables = storage.getSelection({ imodelKey, level: 0 });\n if (Selectables.hasAny(storageSelectables, nodeSelectables)) {\n return true;\n }\n }\n return false;\n },\n\n selectNodes: (nodeIds: Array<string>, changeType: SelectionChangeType) => {\n const imodelSelectables = new Map<string, Selectable[]>();\n for (const nodeId of nodeIds) {\n const node = getNode(nodeId);\n if (!node || node.id === undefined) {\n return;\n }\n for (const [imodelKey, nodeSelectables] of groupNodeSelectablesByIModelKey(\n node,\n createSelectableForGenericNode,\n )) {\n let selectablesList = imodelSelectables.get(imodelKey);\n if (!selectablesList) {\n selectablesList = [];\n imodelSelectables.set(imodelKey, selectablesList);\n }\n nodeSelectables.forEach((selectable) => selectablesList.push(selectable));\n }\n }\n imodelSelectables.forEach((selectables, imodelKey) => {\n const actionProps = { imodelKey, source, selectables, level: 0 };\n switch (changeType) {\n case \"add\":\n storage.addToSelection(actionProps);\n return;\n case \"remove\":\n storage.removeFromSelection(actionProps);\n return;\n case \"replace\":\n storage.replaceSelection(actionProps);\n return;\n }\n });\n },\n };\n}\n\nfunction groupNodeSelectablesByIModelKey(\n modelNode: TreeModelHierarchyNode,\n createSelectableForGenericNode: NonNullable<UseUnifiedTreeSelectionProps[\"createSelectableForGenericNode\"]>,\n): Map<string, Selectable[]> {\n const hierarchyNode = modelNode.nodeData;\n if (HierarchyNode.isInstancesNode(hierarchyNode)) {\n return groupIModelInstanceKeys(hierarchyNode.key.instanceKeys);\n }\n if (HierarchyNode.isGroupingNode(hierarchyNode)) {\n const groupingNodeSelectables = new Map<string, Selectable[]>();\n groupIModelInstanceKeys(hierarchyNode.groupedInstanceKeys).forEach((instanceKeys, imodelKey) => {\n groupingNodeSelectables.set(imodelKey, [\n {\n identifier: modelNode.id,\n data: hierarchyNode,\n async *loadInstanceKeys() {\n for (const key of instanceKeys) {\n yield key;\n }\n },\n },\n ]);\n });\n return groupingNodeSelectables;\n }\n assert(HierarchyNode.isGeneric(hierarchyNode));\n // note: generic nodes aren't associated with an imodel\n return new Map([[\"\", [createSelectableForGenericNode(hierarchyNode, modelNode.id)]]]);\n}\n\nfunction groupIModelInstanceKeys(instanceKeys: InstancesNodeKey[\"instanceKeys\"]) {\n return instanceKeys.reduce((imodelSelectables, key) => {\n const imodelKey = key.imodelKey ?? \"\";\n let selectablesList = imodelSelectables.get(imodelKey);\n if (!selectablesList) {\n selectablesList = [];\n imodelSelectables.set(imodelKey, selectablesList);\n }\n selectablesList.push(key);\n return imodelSelectables;\n }, new Map<string, InstanceKey[]>());\n}\n"],"mappings":";;;;;;;AAuDA,SAAO4B,wBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAiC,MAAA,EAAAT,YAAAK,kBAAAK,kBAAAT,gCAAAU,OAAAJ;CAItC,MAAAN,iCAAAU,OAAAC,KAAAA,IAAAC,wCAAAF;CAIA,MAAA,CAAAG,SAAAC,cAA8BpC,SAA+BqC,OAG1D;CAAC,IAAAC;CAAA,IAAAC;AAAA,KAAAV,EAAA,OAAAP,kCAAAO,EAAA,OAAAE,oBAAAF,EAAA,OAAAH,oBAAAG,EAAA,OAAAR,YAAA;AAEMiB,aAAA;AAERF,cAAWI,cAAcnB,YAAYK,kBAAkBJ,gCAAgCS,iBAAiB,CAAC;AAAA,UAClGL,iBAAgBe,qBAAqBC,aAAaC,SAAA;AACvD,QAAIA,KAAIC,QAAS,EAAC;AAGlBR,eAAWI,cAAcnB,YAAYK,kBAAkBJ,gCAAgCS,iBAAiB,CAAC;KACzG;;AACDQ,OAAA;GAACb;GAAkBJ;GAAgCS;GAAkBV;GAAW;AAAAQ,IAAA,KAAAP;AAAAO,IAAA,KAAAE;AAAAF,IAAA,KAAAH;AAAAG,IAAA,KAAAR;AAAAQ,IAAA,KAAAS;AAAAT,IAAA,KAAAU;QAAA;AAAAD,OAAAT,EAAA;AAAAU,OAAAV,EAAA;;AATnF9B,WAAUuC,IASPC,GAAiF;AAAA,QAE7EJ;;AAxBF,SAAAE,SAAA;AAAA,QAQ+D;EAAAvB,gBAC7B+B;EAAW7B,aACd8B;EACnC;;AAXI,SAAAA,SAAA;AAAA,SAAAD,QAAA;AAAA,QASwC;;AAkB/C,MAAMX,yCAEDX,MAAME,qBAAiC;CAAEuB,YAAYvB;CAAiBwB,MAAM1B;CAAM,OAAO2B,mBAAmB;CAAI;AAErH,SAASV,c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CAC9C,QAAOG,wBAAwBH,cAAcnD,IAAIuD,aAAa;AAEhE,KAAI7E,cAAc8E,eAAeL,cAAc,EAAE;EAC/C,MAAMM,0CAA0B,IAAInB,KAA2B;AAC/DgB,0BAAwBH,cAAcO,oBAAoB,CAAChB,SAASa,cAAcxB,cAAc;AAC9F0B,2BAAwBhB,IAAIV,WAAW,CACrC;IACEP,YAAY0B,UAAUpB;IACtBL,MAAM0B;IACN,OAAOzB,mBAAmB;AACxB,UAAK,MAAM1B,OAAOuD,aAChB,OAAMvD;;IAGX,CACF,CAAC;IACF;AACF,SAAOyD;;AAEThF,QAAOC,cAAciF,UAAUR,cAAc,CAAC;AAE9C,QAAO,IAAIb,IAAI,CAAC,CAAC,IAAI,CAACxC,+BAA+BqD,eAAeD,UAAUpB,GAAG,CAAC,CAAC,CAAC,CAAC;;AAGvF,SAASwB,wBAAwBC,cAAgD;AAC/E,QAAOA,aAAaK,QAAQvB,mBAAmBrC,QAAQ;EACrD,MAAM+B,YAAY/B,IAAI+B,aAAa;EACnC,IAAIQ,kBAAkBF,kBAAkBG,IAAIT,UAAU;AACtD,MAAI,CAACQ,iBAAiB;AACpBA,qBAAkB,EAAE;AACpBF,qBAAkBI,IAAIV,WAAWQ,gBAAgB;;AAEnDA,kBAAgBK,KAAK5C,IAAI;AACzB,SAAOqC;oBACN,IAAIC,KAA4B,CAAC"}
|
|
@@ -1 +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 <ErrorItemContainer errorNode={errorNode} message={errorNode.error.message} scrollToElement={() => scrollToNode(errorNode)} />;\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,0BAAA;AACzBM,cAAMN,yBAAyBZ,UAASmB,GAAkB,EAAAC,aAAC7B,mBAAmB;AAAAmB,KAAA,KAAAV,UAAAmB;AAAAT,KAAA,KAAAE;AAAAF,KA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8C,eAAqBtC;CAA6B,IAAAI;AAAA,KAAAZ,EAAA,OAAA+C,OAAAC,IAAA,4BAAA,EAAA;AAEpCpC,OAAA;GAAAqC,SAAW;GAAMC,YAAc;GAAKC,UAAY;GAAQ;AAAAnD,IAAA,KAAAY;OAAAA,MAAAZ,EAAA;CAAA,IAAAa;AAAA,KAAAb,EAAA,OAAA+C,OAAAC,IAAA,4BAAA,EAAA;AAExBnC,OAAA,oBAAA,UAAA,EAAU,CAAA;AAAAb,IAAA,KAAAa;OAAAA,MAAAb,EAAA;CAAA,IAAAgB;AAAA,KAAAhB,EAAA,OAAA2C,aAAA3C,EAAA,OAAAsC,iBAAA;AAApDtB,OAAA,oBAAC,QAAD;GAAiBsB,SAAAA;GAAyB,QAAAzB;aACvC8B;GACM,CAAA;AAAA3C,IAAA,KAAA2C;AAAA3C,IAAA,KAAAsC;AAAAtC,IAAA,KAAAgB;OAAAA,MAAAhB,EAAA;CACR,MAAAiB,KAAA6B,aAAY,KAAMA,aAAY,KAA9B;CAAwC,IAAAzB;AAAA,KAAArB,EAAA,OAAA8C,aAAA,MAAA9C,EAAA,OAAAgB,MAAAhB,EAAA,OAAAiB,IAAA;AAL3CI,OAAA,qBAAA,OAAA;GAAY,OAAAT;aAAZ;IACGkC,aAAY;IACb9B;IAGCC;IACG;;AAAAjB,IAAA,KAAA8C,aAAA;AAAA9C,IAAA,KAAAgB;AAAAhB,IAAA,KAAAiB;AAAAjB,IAAA,MAAAqB;OAAAA,MAAArB,EAAA;AAAA,QANNqB"}
|
|
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,0BAAA;AACzBM,cAAMN,yBAAyBZ,UAASmB,GAA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;;iBAAgB,0BAAA,CAAA;
|
|
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"}
|
|
@@ -1 +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({
|
|
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,SAAOU,2BAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAoC,MAAA,EAAAJ,OAAAK,0BAAAC,eAAAJ;CAKzC,MAAAK,YAAkBb,gBAAgB;AAElC,KAAIM,MAAKQ,SAAU,qBAAmB;EAAA,IAAAC;AAAA,MAAAN,EAAA,OAAAE,0BAAA;AACZI,cAAMJ,yBAAyBK,KAAAA,EAAwB,EAAAC,aAAC,YAAY;AAAAR,KAAA,KAAAE;AAAAF,KAAA,KAAAM;QAAAA,MAAAN,EAAA;EAA5F,MAAAS,kBAAwBH;EAAqE,IAAAI;AAAA,MAAAV,EAAA,OAAAH,MAAAc,sBAAAX,EAAA,OAAAI,WAAA;AAGhFM,QAAAN,UAAU,0BAA0B,CAAAQ,QAAS,aAAaf,MAAKc,mBAAmBE,UAAW,CAAC;AAAAb,KAAA,KAAAH,MAAAc;AAAAX,KAAA,KAAAI;AAAAJ,KAAA,KAAAU;QAAAA,MAAA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B;AAAA1B,IAAA,KAAAoB;OAAAA,MAAApB,EAAA;CAAA,IAAAyC;AAAA,KAAAzC,EAAA,OAAAe,MAAAf,EAAA,OAAAoB,IAAA;AAtBNqB,OAAA,qBAAA,OAAA;GACS,OAAAnC;aADT;IAUEI;IACAK;IAGCK;IASG;;AAAApB,IAAA,KAAAe;AAAAf,IAAA,KAAAoB;AAAApB,IAAA,KAAAyC;OAAAA,MAAAzC,EAAA;AAAA,QAvBNyC;;AAFJ,SAAAD,OAAAxB,QAAA;AAAA,QAoBY,oBAAC,QAAD;EAAoC,eAAMA,OAAMA,QAAQ;YACrDA,OAAMC;EACA,EAFID,OAAMC,MAEV;;AAtBrB,SAAAqB,OAAAvC,IAAA;CAiBkB,MAAA,EAAAmB,cAAAnB;AAAa,QAAKmB,WAAW"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeErrorRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.tsx"],"mappings":";;;;;;;AAYqE;;;UAO3D,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;
|
|
1
|
+
{"version":3,"file":"TreeErrorRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.tsx"],"mappings":";;;;;;;AAYqE;;;UAO3D,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;EACd,SAAA;EACA,UAAA;EACA,WAAA;EAAA,GACG;AAAA,GACF,sBAAA,GAAyB,GAAA,CAAI,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeErrorRenderer.js","names":["cloneElement","unstable_ErrorRegion","ErrorRegion","useTranslation","ErrorItemRenderer","JSX","ReactElement","useErrorNodes","ErrorItemRendererProps","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 { useTranslation } from \"../LocalizationContext.js\";\nimport { ErrorItemRenderer } from \"./ErrorItemRenderer.js\";\n\nimport type { JSX, ReactElement } from \"react\";\nimport type { useErrorNodes } from \"../FlatTreeNode.js\";\nimport type { ErrorItemRendererProps } from \"./ErrorItemRenderer.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({
|
|
1
|
+
{"version":3,"file":"TreeErrorRenderer.js","names":["cloneElement","unstable_ErrorRegion","ErrorRegion","useTranslation","ErrorItemRenderer","JSX","ReactElement","useErrorNodes","ErrorItemRendererProps","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 { useTranslation } from \"../LocalizationContext.js\";\nimport { ErrorItemRenderer } from \"./ErrorItemRenderer.js\";\n\nimport type { JSX, ReactElement } from \"react\";\nimport type { useErrorNodes } from \"../FlatTreeNode.js\";\nimport type { ErrorItemRendererProps } from \"./ErrorItemRenderer.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({\n treeLabel,\n errorNodes,\n renderError,\n ...errorItemRendererProps\n}: TreeErrorRendererProps): JSX.Element {\n const translate = useTranslation();\n const errorItems = errorNodes.map((errorNode) => {\n const errorRendererProps: ErrorItemRendererProps = { errorNode, ...errorItemRendererProps };\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={\n errorNodes.length === 0\n ? translate(\"noIssuesFound\")\n : translate(\"issuesFound\").replace(\"{{number_of_issues}}\", errorNodes.length.toString())\n }\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;CAMhC,MAAAI,YAAkBnB,gBAAgB;CAClC,MAAAoB,aAAmBZ,WAAUa,KAAKC,cAAA;EAChC,MAAAC,qBAAmD;GAAAD;GAAA,GAAgBJ;GAAwB;AAE3F,MAAIR,YAAW,QACNb,aAAaa,YAAYa,mBAAmB,EAAE,EAAAC,KAAOF,UAASG,IAAK,CAAC;AAC5E,SAEM,oBAAC,mBAAD,EAAoC,GAAMF,oBAAsB,EAAxCD,UAASG,GAA+B;GACvE;CAAC,IAAAC;AAAA,KAAAV,EAAA,OAAAW,OAAAC,IAAA,4BAAA,EAAA;AAIQF,OAAA,EAAAG,OAAS,QAAQ;AAAAb,IAAA,KAAAU;OAAAA,MAAAV,EAAA;CAAA,IAAAc;AAAA,KAAAd,EAAA,OAAAG,aAAAH,EAAA,OAAAT,WAAA;AACZuB,OAAAX,UAAU,gBAAgB,CAAAY,QAAS,kBAAkBxB,UAAU;AAAAS,IAAA,KAAAG;AAAAH,IAAA,KAAAT;AAAAS,IAAA,KAAAc;OAAAA,MAAAd,EAAA;CAAA,IAAAgB;AAAA,KAAAhB,EAAA,OAAAR,WAAAyB,UAAAjB,EAAA,OAAAG,WAAA;AAEzEa,OAAAxB,WAAUyB,WAAY,IAClBd,UAAU,gBAC4E,GAAtFA,UAAU,cAAc,CAAAY,QAAS,wBAAwBvB,WAAUyB,OAAOC,UAAW,CAAC;AAAAlB,IAAA,KAAAR,WAAAyB;AAAAjB,IAAA,KAAAG;AAAAH,IAAA,KAAAgB;OAAAA,MAAAhB,EAAA;CAAA,IAAAmB;AAAA,KAAAnB,EAAA,OAAAI,cAAAJ,EAAA,OAAAc,MAAAd,EAAA,OAAAgB,IAAA;AAN9FG,OAAA,oBAAA,qBAAA,MAAA;GACS,OAAAT;GACK,cAAAI;GAEV,OAAAE;GAIKZ,OAAAA;GACP,CAAA;AAAAJ,IAAA,KAAAI;AAAAJ,IAAA,KAAAc;AAAAd,IAAA,KAAAgB;AAAAhB,IAAA,MAAAmB;OAAAA,MAAAnB,EAAA;AAAA,QATFmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeFilterAction.js","names":["memo","useCallback","useTranslation","TreeActionBase","filterSvg","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 { useTranslation } from \"../LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\n\nimport filterSvg from \"@stratakit/icons/filter.svg\";\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
|
|
1
|
+
{"version":3,"file":"TreeNodeFilterAction.js","names":["memo","useCallback","useTranslation","TreeActionBase","filterSvg","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 { useTranslation } from \"../LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\n\nimport filterSvg from \"@stratakit/icons/filter.svg\";\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(\n 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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L,wCAAAM,KAAAA;CACC,MAAAE,KAAA,CAACtB,YAAD,CAAcI,KAAImB;CAAa,IAAAC;AAAA,KAAAlB,EAAA,QAAAE,oBAAAF,EAAA,QAAAM,wBAAAN,EAAA,QAAAW,eAAAX,EAAA,QAAAY,MAAAZ,EAAA,QAAAe,MAAAf,EAAA,QAAAgB,IAAA;AAPvCE,OAAA,oBAAC,gBAAD;GAAe,GACThB;GACGI,OAAAA;GACEK,SAAAA;GACHxB,MAAAA;GACG,SAAAyB;GACJ,KAAAG;GACC,MAAAC;GACN,CAAA;AAAAhB,IAAA,MAAAE;AAAAF,IAAA,MAAAM;AAAAN,IAAA,MAAAW;AAAAX,IAAA,MAAAY;AAAAZ,IAAA,MAAAe;AAAAf,IAAA,MAAAgB;AAAAhB,IAAA,MAAAkB;OAAAA,MAAAlB,EAAA;AAAA,QARFkB;EAWL"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenameAction.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.tsx"],"mappings":";;;;;;;AA0BA;;;;;;;;cAAa,oBAAA,EAAsB,oBAAA,CAAqB,wBAAA;EAA6B,IAAA,EAAM,QAAA;AAAA;;
|
|
1
|
+
{"version":3,"file":"TreeNodeRenameAction.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.tsx"],"mappings":";;;;;;;AA0BA;;;;;;;;cAAa,oBAAA,EAAsB,oBAAA,CAAqB,wBAAA;EAA6B,IAAA,EAAM,QAAA;AAAA;;UAmB1E,oBAAA;EAnBkF;AAmBnG;;;EAKE,cAAA,GAAiB,QAAA;EACjB,mBAAA;EACA,QAAA,IAAY,QAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenameAction.js","names":["createContext","memo","useCallback","useContext","useMemo","useState","useTranslation","TreeActionBase","renameSvg","NamedExoticComponent","PropsWithChildren","TreeNode","TreeActionBaseAttributes","TreeNodeRenameAction","node","t0","$","_c","actionAttributes","translate","context","useTreeNodeRenameContext","t1","rename","t2","canRename","startRename","t3","handleClick","t4","t5","TreeNodeEditingProps","onLabelChanged","newLabel","labelValidationHint","validate","RenameParameters","nodeId","commit","TreeNodeRenameContext","renameParameters","cancelRename","treeNodeRenameContext","undefined","TreeNodeRenameContextProvider","value","children","useTreeNodeRenameContextValue","getEditingProps","setRenameParameters","id","Symbol","for","node_0"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.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, memo, useCallback, useContext, useMemo, useState } from \"react\";\nimport { useTranslation } from \"../LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\n\nimport renameSvg from \"@stratakit/icons/rename.svg\";\n\nimport type { NamedExoticComponent, PropsWithChildren } from \"react\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { TreeActionBaseAttributes } from \"./TreeAction.js\";\n\n/**\n * React component that renders a rename action for a tree item.\n *\n * The tree component must have `getEditingProps.onLabelChanged` prop set to enable renaming functionality. When\n * rename is completed, the `onLabelChanged` function is called to make the actual data update.\n *\n * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action\n * to tree items.\n *\n * @alpha\n */\nexport const TreeNodeRenameAction: NamedExoticComponent<TreeActionBaseAttributes & { node: TreeNode }> = memo(function TreeNodeRenameAction({
|
|
1
|
+
{"version":3,"file":"TreeNodeRenameAction.js","names":["createContext","memo","useCallback","useContext","useMemo","useState","useTranslation","TreeActionBase","renameSvg","NamedExoticComponent","PropsWithChildren","TreeNode","TreeActionBaseAttributes","TreeNodeRenameAction","node","t0","$","_c","actionAttributes","translate","context","useTreeNodeRenameContext","t1","rename","t2","canRename","startRename","t3","handleClick","t4","t5","TreeNodeEditingProps","onLabelChanged","newLabel","labelValidationHint","validate","RenameParameters","nodeId","commit","TreeNodeRenameContext","renameParameters","cancelRename","treeNodeRenameContext","undefined","TreeNodeRenameContextProvider","value","children","useTreeNodeRenameContextValue","getEditingProps","setRenameParameters","id","Symbol","for","node_0"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.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, memo, useCallback, useContext, useMemo, useState } from \"react\";\nimport { useTranslation } from \"../LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\n\nimport renameSvg from \"@stratakit/icons/rename.svg\";\n\nimport type { NamedExoticComponent, PropsWithChildren } from \"react\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { TreeActionBaseAttributes } from \"./TreeAction.js\";\n\n/**\n * React component that renders a rename action for a tree item.\n *\n * The tree component must have `getEditingProps.onLabelChanged` prop set to enable renaming functionality. When\n * rename is completed, the `onLabelChanged` function is called to make the actual data update.\n *\n * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action\n * to tree items.\n *\n * @alpha\n */\nexport const TreeNodeRenameAction: NamedExoticComponent<TreeActionBaseAttributes & { node: TreeNode }> = memo(\n function TreeNodeRenameAction({ node, ...actionAttributes }: TreeActionBaseAttributes & { node: TreeNode }) {\n const translate = useTranslation();\n const context = useTreeNodeRenameContext();\n const rename = translate(\"rename\");\n\n const canRename = context?.canRename(node) ?? false;\n const startRename = context?.startRename;\n const handleClick = useCallback(() => {\n startRename?.(node);\n }, [startRename, node]);\n\n return (\n <TreeActionBase {...actionAttributes} label={rename} onClick={handleClick} icon={renameSvg} hide={!canRename} />\n );\n },\n);\n\n/** @alpha */\nexport interface TreeNodeEditingProps {\n /**\n * A callback that is invoked when node label is changed. Should be used together\n * with `<TreeNodeRenameAction />` to enter label editing mode.\n */\n onLabelChanged: (newLabel: string) => void;\n labelValidationHint?: string;\n validate?: (newLabel: string) => boolean;\n}\n\n/** @internal */\nexport interface RenameParameters {\n nodeId: string;\n commit: (newLabel: string) => void;\n labelValidationHint?: string;\n validate?: (newLabel: string) => boolean;\n}\n\ninterface TreeNodeRenameContext {\n renameParameters?: RenameParameters;\n startRename: (node: TreeNode) => void;\n canRename: (node: TreeNode) => boolean;\n cancelRename: () => void;\n}\n\nconst treeNodeRenameContext = createContext<TreeNodeRenameContext | undefined>(undefined);\n\n/** @internal */\nexport const useTreeNodeRenameContext = () => {\n return useContext(treeNodeRenameContext);\n};\n\n/** @internal */\nexport function TreeNodeRenameContextProvider({\n value,\n children,\n}: PropsWithChildren<{ value: TreeNodeRenameContext }>) {\n return <treeNodeRenameContext.Provider value={value}>{children}</treeNodeRenameContext.Provider>;\n}\n\n/** @internal */\nexport function useTreeNodeRenameContextValue({\n getEditingProps,\n}: {\n getEditingProps?: (node: TreeNode) => TreeNodeEditingProps | undefined;\n}) {\n const [renameParameters, setRenameParameters] = useState<RenameParameters | undefined>(undefined);\n\n const startRename = useCallback(\n (node: TreeNode) => {\n const { onLabelChanged, labelValidationHint, validate } = getEditingProps?.(node) ?? {};\n if (onLabelChanged) {\n setRenameParameters({\n nodeId: node.id,\n commit: (newLabel) => {\n onLabelChanged(newLabel);\n setRenameParameters(undefined);\n },\n labelValidationHint,\n validate,\n });\n }\n },\n [getEditingProps],\n );\n\n const cancelRename = useCallback(() => {\n setRenameParameters(undefined);\n }, []);\n\n const canRename = useCallback(\n (node: TreeNode) => {\n return getEditingProps?.(node)?.onLabelChanged !== undefined;\n },\n [getEditingProps],\n );\n\n return useMemo(\n () => ({ renameParameters, cancelRename, startRename, canRename }),\n [renameParameters, canRename, startRename, cancelRename],\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAaa,uBAA4FZ,KACvG,SAA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AAAQ;OAAAA,MAAAR,EAAA;CAFD,MAAAyB,eAAqBjB;CAEd,IAAAG;AAAA,KAAAX,EAAA,OAAAgC,iBAAA;AAGLrB,QAAA0B,WACSL,kBAAkBlC,OAAqB,EAAAkB,mBAAKW,KAAAA;AACpD3B,IAAA,KAAAgC;AAAAhC,IAAA,KAAAW;OAAAA,MAAAX,EAAA;CAHH,MAAAS,YAAkBE;CAKhB,IAAAE;AAAA,KAAAb,EAAA,OAAAS,aAAAT,EAAA,OAAAwB,oBAAAxB,EAAA,OAAAU,aAAA;AAGOG,OAAA;GAAAW;GAAAC;GAAAf;GAAAD;GAA0D;AAAAT,IAAA,KAAAS;AAAAT,IAAA,KAAAwB;AAAAxB,IAAA,KAAAU;AAAAV,IAAA,KAAAa;OAAAA,MAAAb,EAAA;AAAA,QAA1Da"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.tsx"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"TreeNodeRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.tsx"],"mappings":";;;;KAyDY,sBAAA,GAAyB,IAAA,CACnC,wBAAA,QAAgC,IAAA,CAAK,IAAA;;;;;EAOrC,WAAA,GAAc,SAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.js","names":["cloneElement","forwardRef","isValidElement","memo","useCallback","useEffect","useId","useMemo","useRef","useState","Description","IconButton","Spinner","Text","TextBox","DropdownMenu","unstable_Popover","Popover","Tree","useTranslation","TreeActionBase","useTreeNodeRenameContext","checkmarkSvg","dismissSvg","refreshSvg","ComponentPropsWithoutRef","FC","PropsWithRef","ReactNode","RefAttributes","TreeRendererProps","TreeNode","TreeActionBaseAttributes","TreeNodeRendererOwnProps","Pick","node","menuActions","inlineActions","contextMenuActions","StrataKitTreeItemProps","Omit","Item","decorations","TreeNodeRendererProps","StrataKitTreeNodeRenderer","HTMLElement","HierarchyNode","props","forwardedRef","$","_c","expandNode","reloadTree","treeItemProps","translate","renameContext","contextMenuProps","setContextMenuProps","undefined","label","t0","bb0","error","type","t1","t2","id","parentNodeId","state","t3","injectActionVariant","inlineActionItems","bb1","menuActionItems","bb2","isNodeExpandable","children","length","isExpanded","expanded","renameParameters","cancelRename","t4","commit","t5","labelValidationHint","t6","validate","t7","labelEditor","t8","nodeId","t9","t10","t11","t12","e","onContextMenu","preventDefault","actions","position","x","clientX","y","clientY","t13","t14","t15","t16","Symbol","for","open","t17","t18","top","left","t19","t20","t21","t22","PlaceholderNode","LabelEditor","initialLabel","onChange","onCancel","inputRef","newLabelValue","setNewLabelValue","hasError","setHasError","handleLabelChange","cancelLabelChange","current","focus","select","canRename","inputId","width","event","target","value","event_0","key","display","variant","filter","action","map"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.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 \"./TreeNodeRenderer.css\";\n\nimport { cloneElement, forwardRef, isValidElement, memo, useCallback, useEffect, useId, useMemo, useRef, useState } from \"react\";\nimport { Description, IconButton, Spinner, Text, TextBox } from \"@stratakit/bricks\";\nimport { DropdownMenu, unstable_Popover as Popover, Tree } from \"@stratakit/structures\";\nimport { useTranslation } from \"../LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\nimport { useTreeNodeRenameContext } from \"./TreeNodeRenameAction.js\";\n\nimport checkmarkSvg from \"@stratakit/icons/checkmark.svg\";\nimport dismissSvg from \"@stratakit/icons/dismiss.svg\";\nimport refreshSvg from \"@stratakit/icons/refresh.svg\";\n\nimport type { ComponentPropsWithoutRef, FC, PropsWithRef, ReactNode, RefAttributes } from \"react\";\nimport type { TreeRendererProps } from \"../Renderers.js\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { TreeActionBaseAttributes } from \"./TreeAction.js\";\n\n/** @internal */\ninterface TreeNodeRendererOwnProps extends Pick<TreeRendererProps, \"expandNode\" | \"reloadTree\"> {\n /** Node that is rendered. */\n node: TreeNode;\n /**\n * Menu actions for tree item.\n * Must be an array of `<TreeActionBase />` or `<Divider />` elements.\n */\n menuActions?: ReactNode[];\n /**\n * Inline actions for tree item.\n * Must be an array of `<TreeActionBase />` elements.\n * Max 2 items.\n */\n inlineActions?: ReactNode[];\n /**\n * Context menu actions for tree item.\n * Must be an array of `<TreeActionBase />` or `<Divider />` elements.\n */\n contextMenuActions?: ReactNode[];\n}\n\n/** @alpha */\nexport type StrataKitTreeItemProps = Omit<\n ComponentPropsWithoutRef<typeof Tree.Item>,\n \"actions\" | \"inlineActions\" | \"expanded\" | \"onExpandedChange\" | \"icon\" | \"unstable_decorations\" | \"error\"\n> & {\n /**\n * Used to render elements between expander and label.\n * E.g. icons, color picker, etc.\n */\n decorations?: ReactNode;\n};\n\n/** @internal */\nexport type TreeNodeRendererProps = StrataKitTreeItemProps & TreeNodeRendererOwnProps;\n\n/**\n * A component that renders a given `TreeNode` using the `Tree.Item` component from `@stratakit/structures`.\n *\n * @internal\n */\nexport const StrataKitTreeNodeRenderer: FC<PropsWithRef<TreeNodeRendererProps & RefAttributes<HTMLElement>>> = memo(\n forwardRef<HTMLElement, TreeNodeRendererProps>(function HierarchyNode(props, forwardedRef) {\n const { node, decorations, inlineActions, menuActions, contextMenuActions, expandNode, reloadTree, ...treeItemProps } = props;\n const translate = useTranslation();\n const renameContext = useTreeNodeRenameContext();\n const [contextMenuProps, setContextMenuProps] = useState<{ position: { x: number; y: number }; actions: ReactNode[] } | undefined>(undefined);\n\n const label = treeItemProps.label ?? node.label;\n const inlineActionItems = useMemo(() => {\n if (node.error !== undefined && node.error.type === \"ChildrenLoad\") {\n return [\n <TreeActionBase\n key=\"retry\"\n label={translate(\"retry\")}\n onClick={() => reloadTree({ parentNodeId: node.id, state: \"reset\" })}\n visible={true}\n icon={refreshSvg}\n variant=\"inline\"\n />,\n ];\n }\n if (!inlineActions) {\n return undefined;\n }\n return injectActionVariant(inlineActions, \"inline\");\n }, [node, inlineActions, translate, reloadTree]);\n\n const menuActionItems = useMemo(() => {\n if (!menuActions) {\n return undefined;\n }\n return injectActionVariant(menuActions, \"default\");\n }, [menuActions]);\n\n const expanded = useMemo(() => {\n if (node.error && (node.error.type !== \"Unknown\" || !node.error.isNodeExpandable)) {\n return undefined;\n }\n\n // this is a leaf node\n if (node.children !== true && node.children.length === 0) {\n return undefined;\n }\n\n return node.isExpanded;\n }, [node]);\n\n const { renameParameters, cancelRename } = renameContext ?? {};\n const labelEditor = (\n <LabelEditor\n initialLabel={node.label}\n onChange={renameParameters?.commit}\n onCancel={cancelRename}\n labelValidationHint={renameParameters?.labelValidationHint}\n validate={renameParameters?.validate}\n />\n );\n\n return (\n <>\n <Popover content={labelEditor} placement=\"bottom\" open={renameParameters?.nodeId === node.id} setOpen={cancelRename} unmountOnHide>\n <Tree.Item\n {...treeItemProps}\n ref={forwardedRef}\n label={label}\n expanded={expanded}\n onExpandedChange={useCallback(\n (isExpanded: boolean) => {\n expandNode(node.id, isExpanded);\n },\n [node, expandNode],\n )}\n inlineActions={inlineActionItems}\n actions={menuActionItems}\n unstable_decorations={decorations}\n error={node.error ? node.error.id : undefined}\n onContextMenu={(e) => {\n if (treeItemProps.onContextMenu) {\n treeItemProps.onContextMenu(e);\n }\n\n if (!contextMenuActions) {\n return;\n }\n\n e.preventDefault();\n const actions = injectActionVariant(contextMenuActions, \"context-menu\");\n if (actions.length === 0) {\n return;\n }\n\n setContextMenuProps({\n position: {\n x: e.clientX,\n y: e.clientY,\n },\n actions,\n });\n }}\n />\n </Popover>\n <DropdownMenu.Provider\n open={contextMenuProps !== undefined}\n setOpen={(open) => {\n if (!open) {\n setContextMenuProps(undefined);\n }\n }}\n key={`${node.id}-${contextMenuProps?.position.x ?? \"\"}-${contextMenuProps?.position.y ?? \"\"}`}\n >\n {contextMenuProps ? (\n <DropdownMenu.Button style={{ position: \"fixed\", top: contextMenuProps.position.y, left: contextMenuProps.position.x }} render={<div />} />\n ) : null}\n {/* `autoFocus` prop is coming from ariakit and is not native HTML `autoFocus` prop. */}\n {/* `focusable` is needed for `autoFocus` to work. StrataKit exposes only `autoFocus` and does not set `focusable` internally. */}\n {/* eslint-disable jsx-a11y/no-autofocus */}\n {/* @ts-expect-error focusable is passed through */}\n <DropdownMenu.Content focusable autoFocus={true}>\n {contextMenuProps?.actions}\n </DropdownMenu.Content>\n </DropdownMenu.Provider>\n </>\n );\n }),\n);\n\nexport const PlaceholderNode: FC<\n PropsWithRef<Pick<StrataKitTreeItemProps, \"style\" | \"aria-level\" | \"aria-posinset\" | \"aria-setsize\"> & RefAttributes<HTMLElement>>\n> = memo(\n forwardRef<HTMLElement, Pick<StrataKitTreeItemProps, \"style\" | \"aria-level\" | \"aria-posinset\" | \"aria-setsize\">>(function PlaceholderNode(\n { ...props },\n forwardedRef,\n ) {\n const translate = useTranslation();\n return (\n <Tree.Item {...props} ref={forwardedRef} label={translate(\"loading\")} unstable_decorations={<Spinner size={\"small\"} title={translate(\"loading\")} />} />\n );\n }),\n);\n\nfunction LabelEditor({\n initialLabel,\n labelValidationHint,\n onChange,\n onCancel,\n validate,\n}: {\n initialLabel: string;\n labelValidationHint?: string;\n onChange?: (newLabel: string) => void;\n onCancel?: () => void;\n validate?: (newLabel: string) => boolean;\n}) {\n const translate = useTranslation();\n const inputRef = useRef<HTMLInputElement>(null);\n const [newLabelValue, setNewLabelValue] = useState(initialLabel);\n const [hasError, setHasError] = useState<boolean>(false);\n const handleLabelChange = () => {\n if (validate && !validate(newLabelValue)) {\n setHasError(true);\n return;\n }\n\n if (initialLabel !== newLabelValue) {\n onChange?.(newLabelValue);\n return;\n }\n onCancel?.();\n };\n\n const cancelLabelChange = () => {\n setNewLabelValue(initialLabel);\n onCancel?.();\n };\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n inputRef.current.select();\n }\n }, []);\n\n const canRename = newLabelValue && newLabelValue !== initialLabel && !hasError;\n const inputId = useId();\n\n return (\n <div key={initialLabel} className=\"phr-node-label-editor\">\n <div className=\"phr-node-label-editor-input-row\">\n <TextBox.Root style={{ width: \"100%\" }} className={hasError ? \"with-error\" : undefined}>\n <TextBox.Input\n id={inputId}\n ref={inputRef}\n aria-label={translate(\"newLabel\")}\n value={newLabelValue}\n onChange={(event) => {\n setNewLabelValue(event.target.value);\n setHasError(false);\n }}\n onKeyUp={(event) => {\n if (event.key === \"Enter\") {\n handleLabelChange();\n } else if (event.key === \"Escape\") {\n cancelLabelChange();\n }\n }}\n />\n </TextBox.Root>\n <IconButton icon={dismissSvg} label={translate(\"cancel\")} onClick={cancelLabelChange} />\n <IconButton icon={checkmarkSvg} label={translate(\"confirm\")} onClick={handleLabelChange} disabled={!canRename} />\n </div>\n {labelValidationHint !== undefined ? (\n <Description id={inputId} tone={hasError ? \"critical\" : \"neutral\"} style={{ display: \"flex\" }}>\n <Text variant=\"caption-lg\">{labelValidationHint}</Text>\n </Description>\n ) : undefined}\n </div>\n );\n}\n\nfunction injectActionVariant(actions: ReactNode[], variant: TreeActionBaseAttributes[\"variant\"]) {\n return actions\n .filter((action) => isValidElement<TreeActionBaseAttributes>(action))\n .map((action) => cloneElement<TreeActionBaseAttributes>(action, { variant }));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAiEA,MAAa4C,4BAAkGzC,KAC7GF,WAA+C,SAAA6C,cAAAC,OAAAC,cAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAZ;CAAA,IAAAI;CAAA,IAAAS;CAAA,IAAAd;CAAA,IAAAD;CAAA,IAAAD;CAAA,IAAAiB;CAAA,IAAAC;AAAA,KAAAJ,EAAA,OAAAF,OAAA;AAC7C,GAAA,CAAAZ,MAAAO,aAAAL,eAAAD,aAAAE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|
1
|
+
{"version":3,"file":"TreeNodeRenderer.js","names":["cloneElement","forwardRef","isValidElement","memo","useCallback","useEffect","useId","useMemo","useRef","useState","Description","IconButton","Spinner","Text","TextBox","DropdownMenu","unstable_Popover","Popover","Tree","useTranslation","TreeActionBase","useTreeNodeRenameContext","checkmarkSvg","dismissSvg","refreshSvg","ComponentPropsWithoutRef","FC","PropsWithRef","ReactNode","RefAttributes","TreeRendererProps","TreeNode","TreeActionBaseAttributes","TreeNodeRendererOwnProps","Pick","node","menuActions","inlineActions","contextMenuActions","StrataKitTreeItemProps","Omit","Item","decorations","TreeNodeRendererProps","StrataKitTreeNodeRenderer","HTMLElement","HierarchyNode","props","forwardedRef","$","_c","expandNode","reloadTree","treeItemProps","translate","renameContext","contextMenuProps","setContextMenuProps","undefined","label","t0","bb0","error","type","t1","t2","id","parentNodeId","state","t3","injectActionVariant","inlineActionItems","bb1","menuActionItems","bb2","isNodeExpandable","children","length","isExpanded","expanded","renameParameters","cancelRename","t4","commit","t5","labelValidationHint","t6","validate","t7","labelEditor","t8","nodeId","t9","t10","t11","t12","e","onContextMenu","preventDefault","actions","position","x","clientX","y","clientY","t13","t14","t15","t16","Symbol","for","open","t17","t18","top","left","t19","t20","t21","t22","PlaceholderNode","LabelEditor","initialLabel","onChange","onCancel","inputRef","newLabelValue","setNewLabelValue","hasError","setHasError","handleLabelChange","cancelLabelChange","current","focus","select","canRename","inputId","width","event","target","value","event_0","key","display","variant","filter","action","map"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.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 \"./TreeNodeRenderer.css\";\n\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n memo,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from \"react\";\nimport { Description, IconButton, Spinner, Text, TextBox } from \"@stratakit/bricks\";\nimport { DropdownMenu, unstable_Popover as Popover, Tree } from \"@stratakit/structures\";\nimport { useTranslation } from \"../LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\nimport { useTreeNodeRenameContext } from \"./TreeNodeRenameAction.js\";\n\nimport checkmarkSvg from \"@stratakit/icons/checkmark.svg\";\nimport dismissSvg from \"@stratakit/icons/dismiss.svg\";\nimport refreshSvg from \"@stratakit/icons/refresh.svg\";\n\nimport type { ComponentPropsWithoutRef, FC, PropsWithRef, ReactNode, RefAttributes } from \"react\";\nimport type { TreeRendererProps } from \"../Renderers.js\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { TreeActionBaseAttributes } from \"./TreeAction.js\";\n\n/** @internal */\ninterface TreeNodeRendererOwnProps extends Pick<TreeRendererProps, \"expandNode\" | \"reloadTree\"> {\n /** Node that is rendered. */\n node: TreeNode;\n /**\n * Menu actions for tree item.\n * Must be an array of `<TreeActionBase />` or `<Divider />` elements.\n */\n menuActions?: ReactNode[];\n /**\n * Inline actions for tree item.\n * Must be an array of `<TreeActionBase />` elements.\n * Max 2 items.\n */\n inlineActions?: ReactNode[];\n /**\n * Context menu actions for tree item.\n * Must be an array of `<TreeActionBase />` or `<Divider />` elements.\n */\n contextMenuActions?: ReactNode[];\n}\n\n/** @alpha */\nexport type StrataKitTreeItemProps = Omit<\n ComponentPropsWithoutRef<typeof Tree.Item>,\n \"actions\" | \"inlineActions\" | \"expanded\" | \"onExpandedChange\" | \"icon\" | \"unstable_decorations\" | \"error\"\n> & {\n /**\n * Used to render elements between expander and label.\n * E.g. icons, color picker, etc.\n */\n decorations?: ReactNode;\n};\n\n/** @internal */\nexport type TreeNodeRendererProps = StrataKitTreeItemProps & TreeNodeRendererOwnProps;\n\n/**\n * A component that renders a given `TreeNode` using the `Tree.Item` component from `@stratakit/structures`.\n *\n * @internal\n */\nexport const StrataKitTreeNodeRenderer: FC<PropsWithRef<TreeNodeRendererProps & RefAttributes<HTMLElement>>> = memo(\n forwardRef<HTMLElement, TreeNodeRendererProps>(function HierarchyNode(props, forwardedRef) {\n const {\n node,\n decorations,\n inlineActions,\n menuActions,\n contextMenuActions,\n expandNode,\n reloadTree,\n ...treeItemProps\n } = props;\n const translate = useTranslation();\n const renameContext = useTreeNodeRenameContext();\n const [contextMenuProps, setContextMenuProps] = useState<\n { position: { x: number; y: number }; actions: ReactNode[] } | undefined\n >(undefined);\n\n const label = treeItemProps.label ?? node.label;\n const inlineActionItems = useMemo(() => {\n if (node.error !== undefined && node.error.type === \"ChildrenLoad\") {\n return [\n <TreeActionBase\n key=\"retry\"\n label={translate(\"retry\")}\n onClick={() => reloadTree({ parentNodeId: node.id, state: \"reset\" })}\n visible={true}\n icon={refreshSvg}\n variant=\"inline\"\n />,\n ];\n }\n if (!inlineActions) {\n return undefined;\n }\n return injectActionVariant(inlineActions, \"inline\");\n }, [node, inlineActions, translate, reloadTree]);\n\n const menuActionItems = useMemo(() => {\n if (!menuActions) {\n return undefined;\n }\n return injectActionVariant(menuActions, \"default\");\n }, [menuActions]);\n\n const expanded = useMemo(() => {\n if (node.error && (node.error.type !== \"Unknown\" || !node.error.isNodeExpandable)) {\n return undefined;\n }\n\n // this is a leaf node\n if (node.children !== true && node.children.length === 0) {\n return undefined;\n }\n\n return node.isExpanded;\n }, [node]);\n\n const { renameParameters, cancelRename } = renameContext ?? {};\n const labelEditor = (\n <LabelEditor\n initialLabel={node.label}\n onChange={renameParameters?.commit}\n onCancel={cancelRename}\n labelValidationHint={renameParameters?.labelValidationHint}\n validate={renameParameters?.validate}\n />\n );\n\n return (\n <>\n <Popover\n content={labelEditor}\n placement=\"bottom\"\n open={renameParameters?.nodeId === node.id}\n setOpen={cancelRename}\n unmountOnHide\n >\n <Tree.Item\n {...treeItemProps}\n ref={forwardedRef}\n label={label}\n expanded={expanded}\n onExpandedChange={useCallback(\n (isExpanded: boolean) => {\n expandNode(node.id, isExpanded);\n },\n [node, expandNode],\n )}\n inlineActions={inlineActionItems}\n actions={menuActionItems}\n unstable_decorations={decorations}\n error={node.error ? node.error.id : undefined}\n onContextMenu={(e) => {\n if (treeItemProps.onContextMenu) {\n treeItemProps.onContextMenu(e);\n }\n\n if (!contextMenuActions) {\n return;\n }\n\n e.preventDefault();\n const actions = injectActionVariant(contextMenuActions, \"context-menu\");\n if (actions.length === 0) {\n return;\n }\n\n setContextMenuProps({ position: { x: e.clientX, y: e.clientY }, actions });\n }}\n />\n </Popover>\n <DropdownMenu.Provider\n open={contextMenuProps !== undefined}\n setOpen={(open) => {\n if (!open) {\n setContextMenuProps(undefined);\n }\n }}\n key={`${node.id}-${contextMenuProps?.position.x ?? \"\"}-${contextMenuProps?.position.y ?? \"\"}`}\n >\n {contextMenuProps ? (\n <DropdownMenu.Button\n style={{ position: \"fixed\", top: contextMenuProps.position.y, left: contextMenuProps.position.x }}\n render={<div />}\n />\n ) : null}\n {/* `autoFocus` prop is coming from ariakit and is not native HTML `autoFocus` prop. */}\n {/* `focusable` is needed for `autoFocus` to work. StrataKit exposes only `autoFocus` and does not set `focusable` internally. */}\n {/* eslint-disable jsx-a11y/no-autofocus */}\n {/* @ts-expect-error focusable is passed through */}\n <DropdownMenu.Content focusable autoFocus={true}>\n {contextMenuProps?.actions}\n </DropdownMenu.Content>\n </DropdownMenu.Provider>\n </>\n );\n }),\n);\n\nexport const PlaceholderNode: FC<\n PropsWithRef<\n Pick<StrataKitTreeItemProps, \"style\" | \"aria-level\" | \"aria-posinset\" | \"aria-setsize\"> & RefAttributes<HTMLElement>\n >\n> = memo(\n forwardRef<HTMLElement, Pick<StrataKitTreeItemProps, \"style\" | \"aria-level\" | \"aria-posinset\" | \"aria-setsize\">>(\n function PlaceholderNode({ ...props }, forwardedRef) {\n const translate = useTranslation();\n return (\n <Tree.Item\n {...props}\n ref={forwardedRef}\n label={translate(\"loading\")}\n unstable_decorations={<Spinner size={\"small\"} title={translate(\"loading\")} />}\n />\n );\n },\n ),\n);\n\nfunction LabelEditor({\n initialLabel,\n labelValidationHint,\n onChange,\n onCancel,\n validate,\n}: {\n initialLabel: string;\n labelValidationHint?: string;\n onChange?: (newLabel: string) => void;\n onCancel?: () => void;\n validate?: (newLabel: string) => boolean;\n}) {\n const translate = useTranslation();\n const inputRef = useRef<HTMLInputElement>(null);\n const [newLabelValue, setNewLabelValue] = useState(initialLabel);\n const [hasError, setHasError] = useState<boolean>(false);\n const handleLabelChange = () => {\n if (validate && !validate(newLabelValue)) {\n setHasError(true);\n return;\n }\n\n if (initialLabel !== newLabelValue) {\n onChange?.(newLabelValue);\n return;\n }\n onCancel?.();\n };\n\n const cancelLabelChange = () => {\n setNewLabelValue(initialLabel);\n onCancel?.();\n };\n\n useEffect(() => {\n if (inputRef.current) {\n inputRef.current.focus();\n inputRef.current.select();\n }\n }, []);\n\n const canRename = newLabelValue && newLabelValue !== initialLabel && !hasError;\n const inputId = useId();\n\n return (\n <div key={initialLabel} className=\"phr-node-label-editor\">\n <div className=\"phr-node-label-editor-input-row\">\n <TextBox.Root style={{ width: \"100%\" }} className={hasError ? \"with-error\" : undefined}>\n <TextBox.Input\n id={inputId}\n ref={inputRef}\n aria-label={translate(\"newLabel\")}\n value={newLabelValue}\n onChange={(event) => {\n setNewLabelValue(event.target.value);\n setHasError(false);\n }}\n onKeyUp={(event) => {\n if (event.key === \"Enter\") {\n handleLabelChange();\n } else if (event.key === \"Escape\") {\n cancelLabelChange();\n }\n }}\n />\n </TextBox.Root>\n <IconButton icon={dismissSvg} label={translate(\"cancel\")} onClick={cancelLabelChange} />\n <IconButton\n icon={checkmarkSvg}\n label={translate(\"confirm\")}\n onClick={handleLabelChange}\n disabled={!canRename}\n />\n </div>\n {labelValidationHint !== undefined ? (\n <Description id={inputId} tone={hasError ? \"critical\" : \"neutral\"} style={{ display: \"flex\" }}>\n <Text variant=\"caption-lg\">{labelValidationHint}</Text>\n </Description>\n ) : undefined}\n </div>\n );\n}\n\nfunction injectActionVariant(actions: ReactNode[], variant: TreeActionBaseAttributes[\"variant\"]) {\n return actions\n .filter((action) => isValidElement<TreeActionBaseAttributes>(action))\n .map((action) => cloneElement<TreeActionBaseAttributes>(action, { variant }));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA4EA,MAAa4C,4BAAkGzC,KAC7GF,WAA+C,SAAA6C,cAAAC,OAAAC,cAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAZ;CAAA,IAAAI;CAAA,IAAAS;CAAA,IAAAd;CAAA,IAAAD;CAAA,IAAAD;CAAA,IAAAiB;CAAA,IAAAC;AAAA,KAAAJ,EAAA,OAAAF,OAAA;AAC7C,GAAA,CAAAZ,MAAAO,aAAAL,eAAAD,aAAAE,oBAAAa,YAAAC,eAAAC,iBASIN;AAAME,IAAA,KAAAF;AAAAE,IAAA,KAAAX;AAAAW,IAAA,KAAAP;AAAAO,IAAA,KAAAE;AAAAF,IAAA,KAAAZ;AAAAY,IAAA,KAAAb;AAAAa,IAAA,KAAAd;AAAAc,IAAA,KAAAG;AAAAH,IAAA,KAAAI;QAAA;AAAAf,uBAAAW,EAAA;AAAAP,gBAAAO,EAAA;AAAAE,eAAAF,EAAA;AAAAZ,kBAAAY,EAAA;AAAAb,gBAAAa,EAAA;AAAAd,SAAAc,EAAA;AAAAG,eAAAH,EAAA;AAAAI,kBAAAJ,EAAA;;CACV,MAAAK,YAAkBnC,gBAAgB;CAClC,MAAAoC,gBAAsBlC,0BAA0B;CAChD,MAAA,CAAAmC,kBAAAC,uBAAgDhD,SAE9CiD,KAAAA,EAAU;CAEZ,MAAAC,QAAcN,cAAaM,SAAUxB,KAAIwB;CAAO,IAAAC;AAAAC,MAAA;AAE9C,MAAI1B,KAAI2B,UAAWJ,KAAAA,KAAavB,KAAI2B,MAAMC,SAAU,gBAAc;GAAA,IAAAC;AAAA,OAAAf,EAAA,OAAAK,WAAA;AAIrDU,SAAAV,UAAU,QAAQ;AAAAL,MAAA,KAAAK;AAAAL,MAAA,MAAAe;SAAAA,MAAAf,E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KAAA;AAjCfG,QAAA,qBAAA,OAAA;GAAkC,WAAA;aAAlC,CACEJ,KA4BCC,IAKG;KAlCIS,aAkCJ;AAAAzE,IAAA,MAAAyE;AAAAzE,IAAA,MAAA+D;AAAA/D,IAAA,MAAAgE;AAAAhE,IAAA,MAAAmE;OAAAA,OAAAnE,EAAA;AAAA,QAlCNmE;;AAsCJ,SAAS9C,oBAAoB6B,SAAsB6C,SAA8C;AAC/F,QAAO7C,QACJ8C,QAAQC,WAAWhJ,eAAyCgJ,OAAO,CAAC,CACpEC,KAAKD,WAAWlJ,aAAuCkJ,QAAQ,EAAEF,SAAS,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeRenderer.tsx"],"mappings":";;;;;;;;;;;UAyBU,oBAAA;EACR,EAAA;EAD4B;;;;EAM5B,SAAA;EAMyB;EAJzB,aAAA,GAAgB,aAAA;EAOmC;EALnD,aAAA,IAAiB,KAAA,EAAO,sBAAA,KAA2B,YAAA;EAK3B;EAHxB,eAAA,IAAmB,IAAA,EAAM,QAAA,KAAa,oBAAA;
|
|
1
|
+
{"version":3,"file":"TreeRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeRenderer.tsx"],"mappings":";;;;;;;;;;;UAyBU,oBAAA;EACR,EAAA;EAD4B;;;;EAM5B,SAAA;EAMyB;EAJzB,aAAA,GAAgB,aAAA;EAOmC;EALnD,aAAA,IAAiB,KAAA,EAAO,sBAAA,KAA2B,YAAA;EAK3B;EAHxB,eAAA,IAAmB,IAAA,EAAM,QAAA,KAAa,oBAAA;EAO9B;EAJR,aAAA,GAAgB,OAAA,CAAQ,IAAA,CAAK,cAAA,QAAsB,IAAA,CAAK,IAAA;EAK3C;EAFb,gBAAA,IACE,IAAA,EAAM,QAAA,KACH,OAAA,CAAQ,IAAA,CAAK,sBAAA;EAMqB;;;;EAAvC,c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