@itwin/presentation-hierarchies-react 2.0.0-alpha.57 → 2.0.0-alpha.58
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 +172 -36
- package/lib/presentation-hierarchies-react/UseIModelTree.d.ts +2 -2
- package/lib/presentation-hierarchies-react/UseIModelTree.js +1 -2
- package/lib/presentation-hierarchies-react/UseIModelTree.js.map +1 -1
- package/lib/presentation-hierarchies-react/UseNodeHighlighting.js +1 -2
- package/lib/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -1
- package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts +0 -2
- package/lib/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/UseSelectionHandler.js +1 -2
- package/lib/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -1
- package/lib/presentation-hierarchies-react/UseTree.d.ts +2 -2
- package/lib/presentation-hierarchies-react/UseTree.js +1 -2
- package/lib/presentation-hierarchies-react/UseTree.js.map +1 -1
- package/lib/presentation-hierarchies-react/Utils.js +1 -1
- package/lib/presentation-hierarchies-react/Utils.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/DisposePolyfill.js +2 -2
- package/lib/presentation-hierarchies-react/internal/DisposePolyfill.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/LocalizedStrings.js +1 -1
- package/lib/presentation-hierarchies-react/internal/TreeActions.js +1 -2
- package/lib/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/TreeLoader.js +1 -2
- package/lib/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/TreeModel.d.ts +0 -2
- package/lib/presentation-hierarchies-react/internal/TreeModel.js +1 -1
- package/lib/presentation-hierarchies-react/internal/TreeModel.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +0 -2
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js +1 -2
- package/lib/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
- package/lib/presentation-hierarchies-react/internal/Utils.js +1 -2
- package/lib/presentation-hierarchies-react/internal/Utils.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/FlatTreeNode.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeAction.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts +0 -2
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +0 -4
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -1
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js +1 -2
- package/lib/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -1
- package/lib/presentation-hierarchies-react.js +1 -2
- package/package.json +12 -10
|
@@ -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,gCAAA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M0B;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?: (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,MAAAN,iCAAAU,OAAAC,KAAAA,IAAAC,wCAAAF;CAEA,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;;AAtBF,SAAAE,SAAA;AAAA,QAM+D;EAAAvB,gBAC7B+B;EAAW7B,aACd8B;EACnC;;AATI,SAAAA,SAAA;AAAA,SAAAD,QAAA;AAAA,QAOwC;;AAkB/C,MAAMX,yCACJX,MACAE,qBACgB;CAChBuB,YAAYvB;CACZwB,MAAM1B;CACN,OAAO2B,mBAAmB;CAC3B;AAED,SAASV,cACPW,QACAC,SACA9B,gCACA+B,SACs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AwBH,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,6 +1,5 @@
|
|
|
1
1
|
import "./DisposePolyfill.js";
|
|
2
2
|
import { HierarchyNodeKey } from "@itwin/presentation-hierarchies";
|
|
3
|
-
|
|
4
3
|
//#region src/presentation-hierarchies-react/internal/Utils.ts
|
|
5
4
|
/** @internal */
|
|
6
5
|
function createNodeId(node) {
|
|
@@ -37,7 +36,7 @@ function safeDispose(disposable) {
|
|
|
37
36
|
if ("dispose" in disposable) disposable.dispose();
|
|
38
37
|
else if (Symbol.dispose in disposable) disposable[Symbol.dispose]();
|
|
39
38
|
}
|
|
40
|
-
|
|
41
39
|
//#endregion
|
|
42
40
|
export { MAX_LIMIT_OVERRIDE, createNodeId, safeDispose, sameNodes };
|
|
41
|
+
|
|
43
42
|
//# sourceMappingURL=Utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Utils.js","names":["HierarchyNodeKey","HierarchyNode","createNodeId","node","Pick","parentKeys","map","serializeNodeKey","key","join","convertObjectValuesToString","obj","Object","entries","value","String","sameNodes","lhs","rhs","compare","length","i","MAX_LIMIT_OVERRIDE","safeDispose","disposable","Symbol","dispose"],"sources":["../../../src/presentation-hierarchies-react/internal/Utils.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 \"./DisposePolyfill.js\";\n\nimport { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\nimport type { HierarchyNode } from \"@itwin/presentation-hierarchies\";\n\n/** @internal */\nexport function createNodeId(node: Pick<HierarchyNode, \"key\" | \"parentKeys\">) {\n return [...node.parentKeys.map(serializeNodeKey), serializeNodeKey(node.key)].join(\";\");\n}\n\nfunction serializeNodeKey(key: HierarchyNodeKey): string {\n return convertObjectValuesToString(key);\n}\n\nfunction convertObjectValuesToString(obj: object): string {\n return Object.entries(obj)\n .map(([, value]) => {\n if (typeof value === \"object\") {\n return convertObjectValuesToString(value);\n }\n return String(value);\n })\n .join(\",\");\n}\n\n/** @internal */\nexport function sameNodes(lhs: HierarchyNode, rhs: HierarchyNode): boolean {\n if (HierarchyNodeKey.compare(lhs.key, rhs.key) !== 0) {\n return false;\n }\n\n if (lhs.parentKeys.length !== rhs.parentKeys.length) {\n return false;\n }\n\n for (let i = lhs.parentKeys.length - 1; i >= 0; --i) {\n if (HierarchyNodeKey.compare(lhs.parentKeys[i], rhs.parentKeys[i]) !== 0) {\n return false;\n }\n }\n return true;\n}\n\n/** @internal */\nexport const MAX_LIMIT_OVERRIDE = 10000;\n\n/**\n * A helper that disposes the given object, if it's disposable.\n *\n * The first option is to dispose using the deprecated `dispose` method if it exists on the object.\n * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is\n * considered as non-disposable and nothing is done with it.\n *\n * @internal\n */\nexport function safeDispose(disposable: {} | { [Symbol.dispose]: () => void } | { dispose: () => void }) {\n if (\"dispose\" in disposable) {\n disposable.dispose();\n } else if (Symbol.dispose in disposable) {\n disposable[Symbol.dispose]();\n }\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Utils.js","names":["HierarchyNodeKey","HierarchyNode","createNodeId","node","Pick","parentKeys","map","serializeNodeKey","key","join","convertObjectValuesToString","obj","Object","entries","value","String","sameNodes","lhs","rhs","compare","length","i","MAX_LIMIT_OVERRIDE","safeDispose","disposable","Symbol","dispose"],"sources":["../../../src/presentation-hierarchies-react/internal/Utils.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 \"./DisposePolyfill.js\";\n\nimport { HierarchyNodeKey } from \"@itwin/presentation-hierarchies\";\n\nimport type { HierarchyNode } from \"@itwin/presentation-hierarchies\";\n\n/** @internal */\nexport function createNodeId(node: Pick<HierarchyNode, \"key\" | \"parentKeys\">) {\n return [...node.parentKeys.map(serializeNodeKey), serializeNodeKey(node.key)].join(\";\");\n}\n\nfunction serializeNodeKey(key: HierarchyNodeKey): string {\n return convertObjectValuesToString(key);\n}\n\nfunction convertObjectValuesToString(obj: object): string {\n return Object.entries(obj)\n .map(([, value]) => {\n if (typeof value === \"object\") {\n return convertObjectValuesToString(value);\n }\n return String(value);\n })\n .join(\",\");\n}\n\n/** @internal */\nexport function sameNodes(lhs: HierarchyNode, rhs: HierarchyNode): boolean {\n if (HierarchyNodeKey.compare(lhs.key, rhs.key) !== 0) {\n return false;\n }\n\n if (lhs.parentKeys.length !== rhs.parentKeys.length) {\n return false;\n }\n\n for (let i = lhs.parentKeys.length - 1; i >= 0; --i) {\n if (HierarchyNodeKey.compare(lhs.parentKeys[i], rhs.parentKeys[i]) !== 0) {\n return false;\n }\n }\n return true;\n}\n\n/** @internal */\nexport const MAX_LIMIT_OVERRIDE = 10000;\n\n/**\n * A helper that disposes the given object, if it's disposable.\n *\n * The first option is to dispose using the deprecated `dispose` method if it exists on the object.\n * If not, we use the new `Symbol.dispose` method. If that doesn't exist either, the object is\n * considered as non-disposable and nothing is done with it.\n *\n * @internal\n */\nexport function safeDispose(disposable: {} | { [Symbol.dispose]: () => void } | { dispose: () => void }) {\n if (\"dispose\" in disposable) {\n disposable.dispose();\n } else if (Symbol.dispose in disposable) {\n disposable[Symbol.dispose]();\n }\n}\n"],"mappings":";;;;AAYA,SAAgBE,aAAaC,MAAiD;AAC5E,QAAO,CAAC,GAAGA,KAAKE,WAAWC,IAAIC,iBAAiB,EAAEA,iBAAiBJ,KAAKK,IAAI,CAAC,CAACC,KAAK,IAAI;;AAGzF,SAASF,iBAAiBC,KAA+B;AACvD,QAAOE,4BAA4BF,IAAI;;AAGzC,SAASE,4BAA4BC,KAAqB;AACxD,QAAOC,OAAOC,QAAQF,IAAI,CACvBL,KAAK,GAAGQ,WAAW;AAClB,MAAI,OAAOA,UAAU,SACnB,QAAOJ,4BAA4BI,MAAM;AAE3C,SAAOC,OAAOD,MAAM;GACpB,CACDL,KAAK,IAAI;;;AAId,SAAgBO,UAAUC,KAAoBC,KAA6B;AACzE,KAAIlB,iBAAiBmB,QAAQF,IAAIT,KAAKU,IAAIV,IAAI,KAAK,EACjD,QAAO;AAGT,KAAIS,IAAIZ,WAAWe,WAAWF,IAAIb,WAAWe,OAC3C,QAAO;AAGT,MAAK,IAAIC,IAAIJ,IAAIZ,WAAWe,SAAS,GAAGC,KAAK,GAAG,EAAEA,EAChD,KAAIrB,iBAAiBmB,QAAQF,IAAIZ,WAAWgB,IAAIH,IAAIb,WAAWgB,GAAG,KAAK,EACrE,QAAO;AAGX,QAAO;;;AAIT,MAAaC,qBAAqB;;;;;;;;;;AAWlC,SAAgBC,YAAYC,YAA6E;AACvG,KAAI,aAAaA,WACfA,YAAWE,SAAS;UACXD,OAAOC,WAAWF,WAC3BA,YAAWC,OAAOC,UAAU"}
|
|
@@ -4,7 +4,6 @@ import { c } from "react-compiler-runtime";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { unstable_ErrorRegion } from "@stratakit/structures";
|
|
6
6
|
import { Anchor, Text } from "@stratakit/bricks";
|
|
7
|
-
|
|
8
7
|
//#region src/presentation-hierarchies-react/stratakit/ErrorItemRenderer.tsx
|
|
9
8
|
/**
|
|
10
9
|
* Renders StrataKit `<ErrorRegion.Item />` for all supported error types:
|
|
@@ -375,7 +374,7 @@ function MessageWithLink(t0) {
|
|
|
375
374
|
} else t6 = $[10];
|
|
376
375
|
return t6;
|
|
377
376
|
}
|
|
378
|
-
|
|
379
377
|
//#endregion
|
|
380
378
|
export { ErrorItemRenderer };
|
|
379
|
+
|
|
381
380
|
//# sourceMappingURL=ErrorItemRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorItemRenderer.js","names":["Anchor","Text","unstable_ErrorRegion","ErrorRegion","MAX_LIMIT_OVERRIDE","useTranslation","JSX","HierarchyLevelDetails","TreeRendererProps","TreeNode","useErrorNodes","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 { HierarchyLevelDetails, TreeRendererProps } from \"../Renderers.js\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { useErrorNodes } from \"./FlatTreeNode.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,KAAA,KAAAQ;QAAAA,MAAAR,EAAA;EAAtG,MAAAW,kBAAwBH;EAA+E,IAAAI;AAAA,MAAAZ,EAAA,OAAAW,iBAAA;AAMvFC,cAAA;AACND,qBAAiB;;AAClBX,KAAA,KAAAW;AAAAX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AAA,aAAU;AAAAb,IAAA,KAAAa;OAAAA,MAAAb,EAAA;CAAA,IAAAgB;AAAA,KAAAhB,EAAA,OAAA2C,aAAA3C,EAAA,OAAAsC,iBAAA;AAApDtB,OAAA,oBAAC;GAAgBsB,SAAAA;GAAyB,QAAAzB;aACvC8B;IACM;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;GAAY,OAAAT;;IACTkC,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","HierarchyLevelDetails","TreeRendererProps","TreeNode","useErrorNodes","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 { HierarchyLevelDetails, TreeRendererProps } from \"../Renderers.js\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { useErrorNodes } from \"./FlatTreeNode.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,KAAA,KAAAQ;QAAAA,MAAAR,EAAA;EAAtG,MAAAW,kBAAwBH;EAA+E,IAAAI;AAAA,MAAAZ,EAAA,OAAAW,iBAAA;AAMvFC,cAAA;AACND,qBAAiB;;AAClBX,KAAA,KAAAW;AAAAX,KAAA,KAAAY;QAAAA,MAAAZ,EAAA;EAAA,IAAAa;AAAA,MAAAb,EAAA,OAAAG,W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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,5 +1,4 @@
|
|
|
1
1
|
import { c } from "react-compiler-runtime";
|
|
2
|
-
|
|
3
2
|
//#region src/presentation-hierarchies-react/stratakit/FlatTreeNode.ts
|
|
4
3
|
/** @alpha */
|
|
5
4
|
function isPlaceholderItem(item) {
|
|
@@ -88,7 +87,7 @@ function getErrorNodes(parent) {
|
|
|
88
87
|
function isErrorNode(node) {
|
|
89
88
|
return node.error !== void 0;
|
|
90
89
|
}
|
|
91
|
-
|
|
92
90
|
//#endregion
|
|
93
91
|
export { isPlaceholderItem, useErrorNodes, useFlatTreeItems };
|
|
92
|
+
|
|
94
93
|
//# sourceMappingURL=FlatTreeNode.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlatTreeNode.js","names":["useMemo","TreeNode","FlatPlaceholderItem","id","level","placeholder","FlatTreeNodeItem","levelSize","posInLevel","node","FlatTreeItem","isPlaceholderItem","item","useFlatTreeItems","rootNodes","$","_c","t0","getFlatItems","nodes","flatItems","forEach","index","push","length","isExpanded","error","type","isNodeExpandable","children","childNodes","useErrorNodes","flatMap","_temp","rootNode","errors","isErrorNode","getErrorNodes","parent","errorList","ReturnType","childErrorList","Pick","Required","undefined"],"sources":["../../../src/presentation-hierarchies-react/stratakit/FlatTreeNode.ts"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useMemo } from \"react\";\n\nimport type { TreeNode } from \"../TreeNode.js\";\n\n/**\n * Placeholder item that is added to hierarchy as a child for a parent item while its child items are loading.\n *\n * @alpha\n */\ninterface FlatPlaceholderItem {\n id: string;\n level: number;\n placeholder: true;\n}\n\n/**\n * An item containing `TreeNode` node with properties needed for a flat tree structure.\n *\n * @alpha\n */\nexport interface FlatTreeNodeItem {\n id: string;\n level: number;\n levelSize: number;\n posInLevel: number;\n node: TreeNode;\n}\n\n/**\n * An Item describing single tree item position and its content inside tree.\n * Returned by `useFlatTreeNodeList` hook.\n *\n * @alpha\n */\nexport type FlatTreeItem = FlatTreeNodeItem | FlatPlaceholderItem;\n\n/** @alpha */\nexport function isPlaceholderItem(item: FlatTreeItem): item is FlatPlaceholderItem {\n return \"placeholder\" in item;\n}\n\n/**\n * Used to get a list of `FlatTreeItem` objects for the given list of `TreeNode` objects that represent\n * a hierarchical structure. The resulting items can be used to render the hierarchy in a flat manner, e.g. using a\n * virtualized list.\n *\n * @alpha\n */\nexport function useFlatTreeItems(rootNodes: TreeNode[]) {\n return useMemo(() => getFlatItems(rootNodes, 1), [rootNodes]);\n}\n\nfunction getFlatItems(nodes: TreeNode[], level: number) {\n const flatItems: FlatTreeItem[] = [];\n nodes.forEach((node, index) => {\n flatItems.push({ node, id: node.id, level, levelSize: nodes.length, posInLevel: index + 1 });\n if (!node.isExpanded) {\n return;\n }\n\n if (node.error && (node.error.type !== \"Unknown\" || !node.error.isNodeExpandable)) {\n return;\n }\n\n if (node.children !== true) {\n const childNodes = getFlatItems(node.children, level + 1);\n flatItems.push(...childNodes);\n return;\n }\n\n flatItems.push({ id: `${node.id}-children-placeholder`, level: level + 1, placeholder: true } satisfies FlatPlaceholderItem);\n });\n return flatItems;\n}\n\n/**\n * Finds and returns all nodes containing errors in a given hierarchy.\n *\n * @alpha\n */\nexport function useErrorNodes(rootNodes: TreeNode[]): Array<TreeNode & Pick<Required<TreeNode>, \"error\">> {\n return useMemo(\n () =>\n rootNodes.flatMap((rootNode) => {\n const errors = isErrorNode(rootNode) ? [rootNode] : [];\n if (rootNode.children === true) {\n return errors;\n }\n\n if (errors.length === 1 && (rootNode.error?.type !== \"Unknown\" || !rootNode.error.isNodeExpandable)) {\n return errors;\n }\n errors.push(...getErrorNodes(rootNode));\n return errors;\n }),\n [rootNodes],\n );\n}\n\nfunction getErrorNodes(parent: TreeNode) {\n const errorList: ReturnType<typeof useErrorNodes> = [];\n\n if (parent.children === true) {\n return [];\n }\n\n parent.children.forEach((node) => {\n if (isErrorNode(node)) {\n errorList.push(node);\n if (node.error.type !== \"Unknown\" || !node.error.isNodeExpandable) {\n return;\n }\n }\n\n if (node.children !== true) {\n const childErrorList = getErrorNodes(node);\n errorList.push(...childErrorList);\n return;\n }\n });\n return errorList;\n}\n\nfunction isErrorNode(node: TreeNode): node is TreeNode & Pick<Required<TreeNode>, \"error\"> {\n return node.error !== undefined;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"FlatTreeNode.js","names":["useMemo","TreeNode","FlatPlaceholderItem","id","level","placeholder","FlatTreeNodeItem","levelSize","posInLevel","node","FlatTreeItem","isPlaceholderItem","item","useFlatTreeItems","rootNodes","$","_c","t0","getFlatItems","nodes","flatItems","forEach","index","push","length","isExpanded","error","type","isNodeExpandable","children","childNodes","useErrorNodes","flatMap","_temp","rootNode","errors","isErrorNode","getErrorNodes","parent","errorList","ReturnType","childErrorList","Pick","Required","undefined"],"sources":["../../../src/presentation-hierarchies-react/stratakit/FlatTreeNode.ts"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { useMemo } from \"react\";\n\nimport type { TreeNode } from \"../TreeNode.js\";\n\n/**\n * Placeholder item that is added to hierarchy as a child for a parent item while its child items are loading.\n *\n * @alpha\n */\ninterface FlatPlaceholderItem {\n id: string;\n level: number;\n placeholder: true;\n}\n\n/**\n * An item containing `TreeNode` node with properties needed for a flat tree structure.\n *\n * @alpha\n */\nexport interface FlatTreeNodeItem {\n id: string;\n level: number;\n levelSize: number;\n posInLevel: number;\n node: TreeNode;\n}\n\n/**\n * An Item describing single tree item position and its content inside tree.\n * Returned by `useFlatTreeNodeList` hook.\n *\n * @alpha\n */\nexport type FlatTreeItem = FlatTreeNodeItem | FlatPlaceholderItem;\n\n/** @alpha */\nexport function isPlaceholderItem(item: FlatTreeItem): item is FlatPlaceholderItem {\n return \"placeholder\" in item;\n}\n\n/**\n * Used to get a list of `FlatTreeItem` objects for the given list of `TreeNode` objects that represent\n * a hierarchical structure. The resulting items can be used to render the hierarchy in a flat manner, e.g. using a\n * virtualized list.\n *\n * @alpha\n */\nexport function useFlatTreeItems(rootNodes: TreeNode[]) {\n return useMemo(() => getFlatItems(rootNodes, 1), [rootNodes]);\n}\n\nfunction getFlatItems(nodes: TreeNode[], level: number) {\n const flatItems: FlatTreeItem[] = [];\n nodes.forEach((node, index) => {\n flatItems.push({ node, id: node.id, level, levelSize: nodes.length, posInLevel: index + 1 });\n if (!node.isExpanded) {\n return;\n }\n\n if (node.error && (node.error.type !== \"Unknown\" || !node.error.isNodeExpandable)) {\n return;\n }\n\n if (node.children !== true) {\n const childNodes = getFlatItems(node.children, level + 1);\n flatItems.push(...childNodes);\n return;\n }\n\n flatItems.push({ id: `${node.id}-children-placeholder`, level: level + 1, placeholder: true } satisfies FlatPlaceholderItem);\n });\n return flatItems;\n}\n\n/**\n * Finds and returns all nodes containing errors in a given hierarchy.\n *\n * @alpha\n */\nexport function useErrorNodes(rootNodes: TreeNode[]): Array<TreeNode & Pick<Required<TreeNode>, \"error\">> {\n return useMemo(\n () =>\n rootNodes.flatMap((rootNode) => {\n const errors = isErrorNode(rootNode) ? [rootNode] : [];\n if (rootNode.children === true) {\n return errors;\n }\n\n if (errors.length === 1 && (rootNode.error?.type !== \"Unknown\" || !rootNode.error.isNodeExpandable)) {\n return errors;\n }\n errors.push(...getErrorNodes(rootNode));\n return errors;\n }),\n [rootNodes],\n );\n}\n\nfunction getErrorNodes(parent: TreeNode) {\n const errorList: ReturnType<typeof useErrorNodes> = [];\n\n if (parent.children === true) {\n return [];\n }\n\n parent.children.forEach((node) => {\n if (isErrorNode(node)) {\n errorList.push(node);\n if (node.error.type !== \"Unknown\" || !node.error.isNodeExpandable) {\n return;\n }\n }\n\n if (node.children !== true) {\n const childErrorList = getErrorNodes(node);\n errorList.push(...childErrorList);\n return;\n }\n });\n return errorList;\n}\n\nfunction isErrorNode(node: TreeNode): node is TreeNode & Pick<Required<TreeNode>, \"error\"> {\n return node.error !== undefined;\n}\n"],"mappings":";;;AA0CA,SAAgBW,kBAAkBC,MAAiD;AACjF,QAAO,iBAAiBA;;;;;;;;;AAU1B,SAAOC,iBAAAC,WAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;AAAA,KAAAF,EAAA,OAAAD,WAAA;AACgBG,OAAAC,aAAaJ,WAAW,EAAE;AAAAC,IAAA,KAAAD;AAAAC,IAAA,KAAAE;OAAAA,MAAAF,EAAA;AAAA,QAA1BE;;AAGvB,SAASC,aAAaC,OAAmBf,OAAe;CACtD,MAAMgB,YAA4B,EAAE;AACpCD,OAAME,SAASZ,MAAMa,UAAU;AAC7BF,YAAUG,KAAK;GA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a,CAAClB,KAAKiB,MAAME,iBAC/C;;AAIJ,MAAInB,KAAKoB,aAAa,MAAM;GAC1B,MAAMY,iBAAiBJ,cAAc5B,KAAK;AAC1C8B,aAAUhB,KAAK,GAAGkB,eAAe;AACjC;;GAEF;AACF,QAAOF;;AAGT,SAASH,YAAY3B,MAAsE;AACzF,QAAOA,KAAKiB,UAAUkB,KAAAA"}
|
|
@@ -2,7 +2,6 @@ import { LOCALIZATION_NAMESPACE } from "../internal/LocalizedStrings.js";
|
|
|
2
2
|
import { c } from "react-compiler-runtime";
|
|
3
3
|
import { createContext, useContext } from "react";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
|
-
|
|
6
5
|
//#region src/presentation-hierarchies-react/stratakit/LocalizationContext.tsx
|
|
7
6
|
const localizationContext = createContext((key) => key);
|
|
8
7
|
/**
|
|
@@ -35,7 +34,7 @@ function LocalizationContextProvider(t0) {
|
|
|
35
34
|
function useTranslation() {
|
|
36
35
|
return useContext(localizationContext);
|
|
37
36
|
}
|
|
38
|
-
|
|
39
37
|
//#endregion
|
|
40
38
|
export { LocalizationContextProvider, useTranslation };
|
|
39
|
+
|
|
41
40
|
//# sourceMappingURL=LocalizationContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalizationContext.js","names":["createContext","useContext","useMemo","LOCALIZATION_NAMESPACE","JSX","PropsWithChildren","LocalizationKey","TranslateFunc","key","localizationContext","LocalizationContextProviderProps","localization","getLocalizedString","LocalizationContextProvider","t0","$","_c","children","t1","translate","t2","useTranslation"],"sources":["../../../src/presentation-hierarchies-react/stratakit/LocalizationContext.tsx"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createContext, useContext, useMemo } from \"react\";\nimport { LOCALIZATION_NAMESPACE } from \"../internal/LocalizedStrings.js\";\n\nimport type { JSX, PropsWithChildren } from \"react\";\nimport type { LocalizationKey } from \"../internal/LocalizedStrings.js\";\n\ntype TranslateFunc = (key: LocalizationKey) => string;\n\nconst localizationContext = createContext<TranslateFunc>((key) => key);\n\n/**\n * Properties for `LocalizationContextProvider`.\n * @public\n */\ninterface LocalizationContextProviderProps {\n /** Localization object compatible with `@itwin/core-common` */\n localization: {\n getLocalizedString: (key: string) => string;\n };\n}\n\n/**\n * Context provider for localizing components.\n * @public\n */\nexport function LocalizationContextProvider({ localization, children }: PropsWithChildren<LocalizationContextProviderProps>): JSX.Element {\n const translate = useMemo<TranslateFunc>(() => {\n return (key: LocalizationKey) => localization.getLocalizedString(`${LOCALIZATION_NAMESPACE}:${key}`);\n }, [localization]);\n return <localizationContext.Provider value={translate}>{children}</localizationContext.Provider>;\n}\n\n/** @internal */\nexport function useTranslation() {\n return useContext(localizationContext);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalizationContext.js","names":["createContext","useContext","useMemo","LOCALIZATION_NAMESPACE","JSX","PropsWithChildren","LocalizationKey","TranslateFunc","key","localizationContext","LocalizationContextProviderProps","localization","getLocalizedString","LocalizationContextProvider","t0","$","_c","children","t1","translate","t2","useTranslation"],"sources":["../../../src/presentation-hierarchies-react/stratakit/LocalizationContext.tsx"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { createContext, useContext, useMemo } from \"react\";\nimport { LOCALIZATION_NAMESPACE } from \"../internal/LocalizedStrings.js\";\n\nimport type { JSX, PropsWithChildren } from \"react\";\nimport type { LocalizationKey } from \"../internal/LocalizedStrings.js\";\n\ntype TranslateFunc = (key: LocalizationKey) => string;\n\nconst localizationContext = createContext<TranslateFunc>((key) => key);\n\n/**\n * Properties for `LocalizationContextProvider`.\n * @public\n */\ninterface LocalizationContextProviderProps {\n /** Localization object compatible with `@itwin/core-common` */\n localization: {\n getLocalizedString: (key: string) => string;\n };\n}\n\n/**\n * Context provider for localizing components.\n * @public\n */\nexport function LocalizationContextProvider({ localization, children }: PropsWithChildren<LocalizationContextProviderProps>): JSX.Element {\n const translate = useMemo<TranslateFunc>(() => {\n return (key: LocalizationKey) => localization.getLocalizedString(`${LOCALIZATION_NAMESPACE}:${key}`);\n }, [localization]);\n return <localizationContext.Provider value={translate}>{children}</localizationContext.Provider>;\n}\n\n/** @internal */\nexport function useTranslation() {\n return useContext(localizationContext);\n}\n"],"mappings":";;;;;AAaA,MAAMS,sBAAsBT,eAA8BQ,QAAQA,IAAI;;;;;AAiBtE,SAAOK,4BAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAqC,MAAA,EAAAL,cAAAM,aAAAH;CAA+E,IAAAI;AAAA,KAAAH,EAAA,OAAAJ,cAAA;AAEhHO,QAAAV,QAA0BG,aAAYC,mBAAoB,GAAGT,uBAAsB,GAAIK,MAAM;AAAAO,IAAA,KAAAJ;AAAAI,IAAA,KAAAG;OAAAA,MAAAH,EAAA;CADtG,MAAAI,YACED;CACiB,IAAAE;AAAA,KAAAL,EAAA,OAAAE,YAAAF,EAAA,OAAAI,WAAA;AACZC,OAAA,oBAAA,oBAAA,UAAA;GAAqCD,OAAAA;GAAYF;GAAwC,CAAA;AAAAF,IAAA,KAAAE;AAAAF,IAAA,KAAAI;AAAAJ,IAAA,KAAAK;OAAAA,MAAAL,EAAA;AAAA,QAAzFK;;;AAIT,SAAOC,iBAAA;AAAA,QACEpB,WAAWQ,oBAAoB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootErrorRenderer.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/RootErrorRenderer.tsx"],"mappings":";;;;;;;
|
|
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;EAA6B,KAAA;EAAO,wBAAA;EAA0B;AAAA,GAAc,+BAAA,GAAkC,GAAA,CAAI,OAAA"}
|
|
@@ -4,7 +4,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
4
4
|
import { Button, Text } from "@stratakit/bricks";
|
|
5
5
|
import { Icon } from "@stratakit/foundations";
|
|
6
6
|
import errorSvg from "@stratakit/icons/status-error.svg";
|
|
7
|
-
|
|
8
7
|
//#region src/presentation-hierarchies-react/stratakit/RootErrorRenderer.tsx
|
|
9
8
|
/**
|
|
10
9
|
* A component that renders root node error state.
|
|
@@ -180,7 +179,7 @@ function _temp3(t0) {
|
|
|
180
179
|
const { condition } = t0;
|
|
181
180
|
return condition();
|
|
182
181
|
}
|
|
183
|
-
|
|
184
182
|
//#endregion
|
|
185
183
|
export { StrataKitRootErrorRenderer };
|
|
184
|
+
|
|
186
185
|
//# sourceMappingURL=RootErrorRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RootErrorRenderer.js","names":["Button","Text","Icon","
|
|
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({ error, getHierarchyLevelDetails, reloadTree }: StrataKitRootErrorRendererProps): JSX.Element {\n const translate = useTranslation();\n\n if (error.type === \"ResultSetTooLarge\") {\n const onOverrideLimit = () => getHierarchyLevelDetails(undefined)?.setSizeLimit(\"unbounded\");\n return (\n <RootErrorContainer\n message={translate(\"rootResultLimitExceeded\").replace(\"{{limit}}\", error.resultSetSizeLimit.toString())}\n actions={[\n {\n action: onOverrideLimit,\n label: translate(\"increaseHierarchyLimitToUnlimited\"),\n condition: () => true,\n },\n ]}\n />\n );\n }\n\n return (\n <RootErrorContainer\n message={translate(\"failedToCreateRootHierarchy\")}\n actions={[\n {\n action: () => reloadTree({ parentNodeId: undefined, state: \"reset\" }),\n label: translate(\"retry\"),\n condition: () => true,\n },\n ]}\n />\n );\n}\n\ninterface RootErrorContainerProps {\n message: string;\n actions?: { action: () => void; label: string; condition: () => boolean }[];\n}\n\nfunction RootErrorContainer({ actions, message }: RootErrorContainerProps) {\n return (\n <div style={{ height: \"100%\", display: \"flex\", flexDirection: \"column\", justifyContent: \"center\", alignItems: \"center\", gap: \"0.5rem\" }}>\n <Icon href={errorSvg} size=\"large\" />\n <Text variant={\"body-sm\"} style={{ textAlign: \"center\" }}>\n {message}\n </Text>\n {actions\n ?.filter(({ condition }) => condition())\n .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@ import { c } from "react-compiler-runtime";
|
|
|
2
2
|
import { memo } from "react";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { DropdownMenu, Tree } from "@stratakit/structures";
|
|
5
|
-
|
|
6
5
|
//#region src/presentation-hierarchies-react/stratakit/TreeAction.tsx
|
|
7
6
|
/**
|
|
8
7
|
* Base component used to render tree actions. It is designed to allow rendering same action in different contexts: inline, dropdown, context menu.
|
|
@@ -83,7 +82,7 @@ const TreeActionBase = memo(function TreeActionBase(t0) {
|
|
|
83
82
|
} else t3 = $[14];
|
|
84
83
|
return t3;
|
|
85
84
|
});
|
|
86
|
-
|
|
87
85
|
//#endregion
|
|
88
86
|
export { TreeActionBase };
|
|
87
|
+
|
|
89
88
|
//# sourceMappingURL=TreeAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeAction.js","names":["memo","DropdownMenu","Tree","ComponentProps","NamedExoticComponent","TreeActionBaseAttributes","variant","hide","TreeActionBaseProps","ItemAction","TreeActionBase","t0","$","_c","actionProps","dot","t1","visible","undefined","t2","t3"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeAction.tsx"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { memo } from \"react\";\nimport { DropdownMenu, Tree } from \"@stratakit/structures\";\n\nimport type { ComponentProps, NamedExoticComponent } from \"react\";\n\n/**\n * Attributes used to decide how to render tree actions. They allow to differentiate action style based on the context\n * where that action is used.\n * @alpha\n */\nexport interface TreeActionBaseAttributes {\n /**\n * Specifies action variant supported by tree nodes:\n *\n * - \"default\" - standard action displayed in the dropdown menu accessible through the ellipsis button on the node.\n * - \"inline\" - actions displayed directly on the tree node.\n * - \"context-menu\" - actions displayed in the context menu opened by right-clicking the tree node.\n */\n variant?: \"default\" | \"inline\" | \"context-menu\";\n /**\n * Indicates that the actions is not applicable for current tree node and should be hidden.\n * When set to true, the action will not be rendered at all.\n */\n hide?: boolean;\n}\n\n/** @alpha */\nexport type TreeActionBaseProps = ComponentProps<typeof Tree.ItemAction> & TreeActionBaseAttributes;\n\n/**\n * Base component used to render tree actions. It is designed to allow rendering same action in different contexts: inline, dropdown, context menu.\n * Should be used together with `StrataKitTreeNodeRenderer` and returned from `getInlineActions`, `getMenuActions` and `getContextMenuActions` callbacks.\n *\n * When implementing custom action that returns this component, make sure to forward `TreeActionBaseAttributes` props to it. Example:\n *\n * ```tsx\n * interface MyCustomTreeActionProps extends TreeActionBaseAttributes {\n * myProp: string\n * }\n *\n * function MyCustomTreeAction({ myProp, ...attributes }: MyCustomTreeActionProps) {\n * // custom button logic goes here\n * return <TreeActionBase {...attributes} icon={...} onClick={...} />\n * }\n * ```\n *\n * @alpha\n */\nexport const TreeActionBase: NamedExoticComponent<TreeActionBaseProps> = memo(function TreeActionBase({\n hide,\n variant = \"default\",\n dot,\n visible,\n ...actionProps\n}: TreeActionBaseProps) {\n if (hide) {\n return variant === \"inline\" ? <Tree.ItemAction {...actionProps} visible={false} /> : undefined;\n }\n\n if (variant === \"context-menu\") {\n return <DropdownMenu.Item {...actionProps} />;\n }\n\n return <Tree.ItemAction {...actionProps} dot={dot} visible={variant === \"inline\" ? visible : undefined} />;\n});\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TreeAction.js","names":["memo","DropdownMenu","Tree","ComponentProps","NamedExoticComponent","TreeActionBaseAttributes","variant","hide","TreeActionBaseProps","ItemAction","TreeActionBase","t0","$","_c","actionProps","dot","t1","visible","undefined","t2","t3"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeAction.tsx"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { memo } from \"react\";\nimport { DropdownMenu, Tree } from \"@stratakit/structures\";\n\nimport type { ComponentProps, NamedExoticComponent } from \"react\";\n\n/**\n * Attributes used to decide how to render tree actions. They allow to differentiate action style based on the context\n * where that action is used.\n * @alpha\n */\nexport interface TreeActionBaseAttributes {\n /**\n * Specifies action variant supported by tree nodes:\n *\n * - \"default\" - standard action displayed in the dropdown menu accessible through the ellipsis button on the node.\n * - \"inline\" - actions displayed directly on the tree node.\n * - \"context-menu\" - actions displayed in the context menu opened by right-clicking the tree node.\n */\n variant?: \"default\" | \"inline\" | \"context-menu\";\n /**\n * Indicates that the actions is not applicable for current tree node and should be hidden.\n * When set to true, the action will not be rendered at all.\n */\n hide?: boolean;\n}\n\n/** @alpha */\nexport type TreeActionBaseProps = ComponentProps<typeof Tree.ItemAction> & TreeActionBaseAttributes;\n\n/**\n * Base component used to render tree actions. It is designed to allow rendering same action in different contexts: inline, dropdown, context menu.\n * Should be used together with `StrataKitTreeNodeRenderer` and returned from `getInlineActions`, `getMenuActions` and `getContextMenuActions` callbacks.\n *\n * When implementing custom action that returns this component, make sure to forward `TreeActionBaseAttributes` props to it. Example:\n *\n * ```tsx\n * interface MyCustomTreeActionProps extends TreeActionBaseAttributes {\n * myProp: string\n * }\n *\n * function MyCustomTreeAction({ myProp, ...attributes }: MyCustomTreeActionProps) {\n * // custom button logic goes here\n * return <TreeActionBase {...attributes} icon={...} onClick={...} />\n * }\n * ```\n *\n * @alpha\n */\nexport const TreeActionBase: NamedExoticComponent<TreeActionBaseProps> = memo(function TreeActionBase({\n hide,\n variant = \"default\",\n dot,\n visible,\n ...actionProps\n}: TreeActionBaseProps) {\n if (hide) {\n return variant === \"inline\" ? <Tree.ItemAction {...actionProps} visible={false} /> : undefined;\n }\n\n if (variant === \"context-menu\") {\n return <DropdownMenu.Item {...actionProps} />;\n }\n\n return <Tree.ItemAction {...actionProps} dot={dot} visible={variant === \"inline\" ? visible : undefined} />;\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAqDA,MAAaU,iBAA4DV,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AAA,MAAAE;AAAAF,IAAA,MAAAG;AAAAH,IAAA,MAAAO;AAAAP,IAAA,MAAAQ;OAAAA,MAAAR,EAAA;AAAA,QAAnGQ;EACP"}
|
|
@@ -4,7 +4,6 @@ import { c } from "react-compiler-runtime";
|
|
|
4
4
|
import { cloneElement } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { unstable_ErrorRegion } from "@stratakit/structures";
|
|
7
|
-
|
|
8
7
|
//#region src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.tsx
|
|
9
8
|
/**
|
|
10
9
|
* A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@stratakit/structures`.
|
|
@@ -58,7 +57,7 @@ function TreeErrorRenderer(t0) {
|
|
|
58
57
|
} else t4 = $[10];
|
|
59
58
|
return t4;
|
|
60
59
|
}
|
|
61
|
-
|
|
62
60
|
//#endregion
|
|
63
61
|
export { TreeErrorRenderer };
|
|
62
|
+
|
|
64
63
|
//# sourceMappingURL=TreeErrorRenderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeErrorRenderer.js","names":["cloneElement","unstable_ErrorRegion","ErrorRegion","ErrorItemRenderer","useTranslation","JSX","ReactElement","ErrorItemRendererProps","useErrorNodes","TreeErrorRendererOwnProps","treeLabel","errorNodes","ReturnType","renderError","props","TreeErrorRendererProps","Omit","TreeErrorRenderer","t0","$","_c","errorItemRendererProps","translate","errorItems","map","errorNode","errorRendererProps","key","id","t1","Symbol","for","width","t2","replace","t3","length","toString","t4"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.tsx"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { cloneElement } from \"react\";\nimport { unstable_ErrorRegion as ErrorRegion } from \"@stratakit/structures\";\nimport { ErrorItemRenderer } from \"./ErrorItemRenderer.js\";\nimport { useTranslation } from \"./LocalizationContext.js\";\n\nimport type { JSX, ReactElement } from \"react\";\nimport type { ErrorItemRendererProps } from \"./ErrorItemRenderer.js\";\nimport type { useErrorNodes } from \"./FlatTreeNode.js\";\n\n/**\n * Interface containing building blocks for `TreeErrorRenderer`.\n *\n * @alpha\n */\ninterface TreeErrorRendererOwnProps {\n /**\n * A user friendly display label of the tree. Should be unique within the consuming application,\n * as it's used for creating a unique accessible label for the error region.\n */\n treeLabel: string;\n /** List of error nodes to render errors for. */\n errorNodes: ReturnType<typeof useErrorNodes>;\n /** Callback to render custom error messages. Component should be wrapped in `unstable_ErrorRegion.Item` from `@stratakit/structures` package. */\n renderError?: (props: ErrorItemRendererProps) => ReactElement;\n}\n\n/** @alpha */\nexport type TreeErrorRendererProps = TreeErrorRendererOwnProps & Omit<ErrorItemRendererProps, \"errorNode\">;\n\n/**\n * A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@stratakit/structures`.\n * As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorNodes` hook.\n *\n * @alpha\n */\nexport function TreeErrorRenderer({ treeLabel, errorNodes, renderError, ...errorItemRendererProps }: TreeErrorRendererProps): JSX.Element {\n const translate = useTranslation();\n const errorItems = errorNodes.map((errorNode) => {\n const errorRendererProps: ErrorItemRendererProps = {\n errorNode,\n ...errorItemRendererProps,\n };\n\n if (renderError) {\n return cloneElement(renderError(errorRendererProps), { key: errorNode.id });\n }\n\n return <ErrorItemRenderer key={errorNode.id} {...errorRendererProps} />;\n });\n\n return (\n <ErrorRegion.Root\n style={{ width: \"100%\" }}\n aria-label={translate(\"issuesForTree\").replace(\"{{tree_label}}\", treeLabel)}\n label={errorNodes.length === 0 ? translate(\"noIssuesFound\") : translate(\"issuesFound\").replace(\"{{number_of_issues}}\", errorNodes.length.toString())}\n items={errorItems}\n />\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"TreeErrorRenderer.js","names":["cloneElement","unstable_ErrorRegion","ErrorRegion","ErrorItemRenderer","useTranslation","JSX","ReactElement","ErrorItemRendererProps","useErrorNodes","TreeErrorRendererOwnProps","treeLabel","errorNodes","ReturnType","renderError","props","TreeErrorRendererProps","Omit","TreeErrorRenderer","t0","$","_c","errorItemRendererProps","translate","errorItems","map","errorNode","errorRendererProps","key","id","t1","Symbol","for","width","t2","replace","t3","length","toString","t4"],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeErrorRenderer.tsx"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { cloneElement } from \"react\";\nimport { unstable_ErrorRegion as ErrorRegion } from \"@stratakit/structures\";\nimport { ErrorItemRenderer } from \"./ErrorItemRenderer.js\";\nimport { useTranslation } from \"./LocalizationContext.js\";\n\nimport type { JSX, ReactElement } from \"react\";\nimport type { ErrorItemRendererProps } from \"./ErrorItemRenderer.js\";\nimport type { useErrorNodes } from \"./FlatTreeNode.js\";\n\n/**\n * Interface containing building blocks for `TreeErrorRenderer`.\n *\n * @alpha\n */\ninterface TreeErrorRendererOwnProps {\n /**\n * A user friendly display label of the tree. Should be unique within the consuming application,\n * as it's used for creating a unique accessible label for the error region.\n */\n treeLabel: string;\n /** List of error nodes to render errors for. */\n errorNodes: ReturnType<typeof useErrorNodes>;\n /** Callback to render custom error messages. Component should be wrapped in `unstable_ErrorRegion.Item` from `@stratakit/structures` package. */\n renderError?: (props: ErrorItemRendererProps) => ReactElement;\n}\n\n/** @alpha */\nexport type TreeErrorRendererProps = TreeErrorRendererOwnProps & Omit<ErrorItemRendererProps, \"errorNode\">;\n\n/**\n * A component that renders error display dropdown using the `unstable_ErrorRegion` component from `@stratakit/structures`.\n * As input, the component uses a list of `ErrorNode` objects, which are generally created using the `useErrorNodes` hook.\n *\n * @alpha\n */\nexport function TreeErrorRenderer({ treeLabel, errorNodes, renderError, ...errorItemRendererProps }: TreeErrorRendererProps): JSX.Element {\n const translate = useTranslation();\n const errorItems = errorNodes.map((errorNode) => {\n const errorRendererProps: ErrorItemRendererProps = {\n errorNode,\n ...errorItemRendererProps,\n };\n\n if (renderError) {\n return cloneElement(renderError(errorRendererProps), { key: errorNode.id });\n }\n\n return <ErrorItemRenderer key={errorNode.id} {...errorRendererProps} />;\n });\n\n return (\n <ErrorRegion.Root\n style={{ width: \"100%\" }}\n aria-label={translate(\"issuesForTree\").replace(\"{{tree_label}}\", treeLabel)}\n label={errorNodes.length === 0 ? translate(\"noIssuesFound\") : translate(\"issuesFound\").replace(\"{{number_of_issues}}\", errorNodes.length.toString())}\n items={errorItems}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,SAAOiB,kBAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAA2B,MAAA,EAAAV,WAAAC,YAAAE,aAAA,GAAAQ,2BAAAH;CAChC,MAAAI,YAAkBlB,gBAAgB;CAClC,MAAAmB,aAAmBZ,WAAUa,KAAKC,cAAA;EAChC,MAAAC,qBAAmD;GAAAD;GAAA,GAE9CJ;GACJ;AAED,MAAIR,YAAW,QACNb,aAAaa,YAAYa,mBAAmB,EAAE,EAAAC,KAAOF,UAASG,IAAK,CAAC;AAC5E,SAEM,oBAAC,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;AACpEa,OAAAxB,WAAUyB,WAAY,IAAId,UAAU,gBAAyG,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;AAHtJG,OAAA,oBAAA,qBAAA,MAAA;GACS,OAAAT;GACK,cAAAI;GACL,OAAAE;GACAZ,OAAAA;GACP,CAAA;AAAAJ,IAAA,KAAAI;AAAAJ,IAAA,KAAAc;AAAAd,IAAA,KAAAgB;AAAAhB,IAAA,MAAAmB;OAAAA,MAAAnB,EAAA;AAAA,QALFmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeFilterAction.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.tsx"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"TreeNodeFilterAction.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.tsx"],"mappings":";;;;;;;KAiBK,yBAAA;EAAA;;;EAIH,QAAA,IAAY,qBAAA,EAAuB,qBAAA;AAAA,IACjC,wBAAA,GACF,IAAA,CAAK,iBAAA;;;;;;;;;;;cAYM,oBAAA,EAAsB,oBAAA,CAAqB,yBAAA;EAA8B,IAAA,EAAM,QAAA;AAAA"}
|
|
@@ -4,7 +4,6 @@ import { c } from "react-compiler-runtime";
|
|
|
4
4
|
import { memo } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import filterSvg from "@stratakit/icons/filter.svg";
|
|
7
|
-
|
|
8
7
|
//#region src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.tsx
|
|
9
8
|
/**
|
|
10
9
|
* React component that renders a filter action for a tree item.
|
|
@@ -86,7 +85,7 @@ const TreeNodeFilterAction = memo(function TreeNodeFilterAction(t0) {
|
|
|
86
85
|
} else t7 = $[19];
|
|
87
86
|
return t7;
|
|
88
87
|
});
|
|
89
|
-
|
|
90
88
|
//#endregion
|
|
91
89
|
export { TreeNodeFilterAction };
|
|
90
|
+
|
|
92
91
|
//# sourceMappingURL=TreeNodeFilterAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeFilterAction.js","names":["memo","useCallback","
|
|
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 node,\n onFilter,\n getHierarchyLevelDetails,\n ...actionAttributes\n}: TreeNodeFilterActionProps & { node: TreeNode }) {\n const translate = useTranslation();\n const filterHierarchyLevel = translate(\"filterHierarchyLevel\");\n const filterHierarchyLevelActiveDescription = translate(\"filterHierarchyLevelActiveDescription\");\n\n const handleClick = useCallback(() => {\n const hierarchyLevelDetails = getHierarchyLevelDetails(node.id);\n hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);\n }, [node, getHierarchyLevelDetails, onFilter]);\n\n return (\n <TreeActionBase\n {...actionAttributes}\n label={filterHierarchyLevel}\n onClick={handleClick}\n icon={filterSvg}\n visible={node.isFiltered ? true : undefined}\n dot={node.isFiltered ? filterHierarchyLevelActiveDescription : undefined}\n hide={!onFilter || !node.isFilterable}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAmCA,MAAac,uBAA6Fd,KAAK,SAAAc,qBAAAE,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL;CAAA,IAAAJ;AAAA,KAAAM,EAAA,OAAAD,IAAA;AAA8B,GAAA,CAAAD,MAAAJ,UAAAS,6BAAAD,oBAAAH;AAK5FC,IAAA,KAAAD;AAAAC,IAAA,KAAAE;AAAAF,IAAA,KAAAG;AAAAH,IAAA,KAAAF;AAAAE,IAAA,KAAAN;QAAA;AAAAQ,qBAAAF,EAAA;AAAAG,6BAA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AAAAX,IAAA,MAAAY;AAAAZ,IAAA,MAAAe;AAAAf,IAAA,MAAAgB;AAAAhB,IAAA,MAAAkB;OAAAA,MAAAlB,EAAA;AAAA,QARFkB;EAUF"}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { TreeNode } from "../TreeNode.js";
|
|
2
2
|
import { TreeActionBaseAttributes } from "./TreeAction.js";
|
|
3
3
|
import { NamedExoticComponent, PropsWithChildren } from "react";
|
|
4
|
-
import "react/jsx-runtime";
|
|
5
|
-
|
|
6
4
|
//#region src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts
|
|
7
5
|
/**
|
|
8
6
|
* React component that renders a rename action for a tree item.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenameAction.d.ts","names":[],"sources":["../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.tsx"],"mappings":"
|
|
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;;UAkB1E,oBAAA;EAlBkF;AAkBnG;;;EAKE,cAAA,GAAiB,QAAA;EACjB,mBAAA;EACA,QAAA,IAAY,QAAA;AAAA"}
|
|
@@ -4,7 +4,6 @@ import { c } from "react-compiler-runtime";
|
|
|
4
4
|
import { createContext, memo, useContext, useState } from "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import renameSvg from "@stratakit/icons/rename.svg";
|
|
7
|
-
|
|
8
7
|
//#region src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.tsx
|
|
9
8
|
/**
|
|
10
9
|
* React component that renders a rename action for a tree item.
|
|
@@ -150,7 +149,7 @@ function useTreeNodeRenameContextValue(t0) {
|
|
|
150
149
|
} else t4 = $[8];
|
|
151
150
|
return t4;
|
|
152
151
|
}
|
|
153
|
-
|
|
154
152
|
//#endregion
|
|
155
153
|
export { TreeNodeRenameAction, TreeNodeRenameContextProvider, useTreeNodeRenameContext, useTreeNodeRenameContextValue };
|
|
154
|
+
|
|
156
155
|
//# sourceMappingURL=TreeNodeRenameAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenameAction.js","names":["createContext","memo","useCallback","useContext","useMemo","useState","
|
|
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({\n node,\n ...actionAttributes\n}: 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 <TreeActionBase {...actionAttributes} label={rename} onClick={handleClick} icon={renameSvg} hide={!canRename} />;\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({ value, children }: PropsWithChildren<{ value: TreeNodeRenameContext }>) {\n return <treeNodeRenameContext.Provider value={value}>{children}</treeNodeRenameContext.Provider>;\n}\n\n/** @internal */\nexport function useTreeNodeRenameContextValue({ getEditingProps }: { getEditingProps?: (node: TreeNode) => TreeNodeEditingProps | undefined }) {\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 () => ({\n renameParameters,\n cancelRename,\n startRename,\n canRename,\n }),\n [renameParameters, canRename, startRename, cancelRename],\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0BA,MAAaa,uBAA4FZ,KAAK,SAAAY,qBAAAE,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAC;CAAA,IAAAJ;AAAA,KAAAE,EAAA,OAAAD,IAAA;AAA8B,GAAA,CAAAD,SAAAI,oBAAAH;AAG5FC,IAAA,KAAAD;AAAAC,IAAA,KAAAE;AAAAF,IAAA,KAAAF;QAAA;AAAAI,qBAAAF,EAAA;AAAAF,SAAAE,EAAA;;CAC9C,MAAAG,YAAkBb,gBAAgB;CAClC,MAAAc,UAAgBC,0BAA0B;CAAC,IAAAC;AAAA,KAAAN,EAAA,OAAAG,WAAA;AAC5BG,OAAAH,UAAU,SAAS;AAAAH,IAAA,KAAAG;AAAAH,IAAA,KAAAM;OAAAA,MAAAN,EAAA;CAAlC,MAAAO,SAAeD;CAAoB,IAAAE;AAAA,KAAAR,EAAA,OAAAI,WAAAJ,EAAA,OAAAF,MAAA;AAEjBU,OAAAJ,SAAOK,UAAYX,KAAc,IAAjC;AAAiCE,IAAA,KAAAI;AAAAJ,IAAA,KAAAF;AAAAE,IAAA,KAAAQ;OAAAA,MAAAR,EAAA;CAAnD,MAAAS,YAAkBD;CAClB,MAAAE,cAAoBN,SAAOM;CA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AAN,EAAA,OAAAgC,iBAAA;AAGhG1B,QAAAR,SAAA;GACE,MAAA,EAAAkB,gBAAAE,qBAAAC,aAA0Da,kBAAkBlC,KAAW,IAA7B,EAA6B;AACvF,OAAIkB,eACFiB,qBAAoB;IAAAZ,QACVvB,KAAIoC;IAAGZ,SACPL,aAAA;AACND,oBAAeC,SAAS;AACxBgB,yBAAoBN,KAAAA,EAAU;;IAC/BT;IAAAC;IAGF,CAAC;;AAELnB,IAAA,KAAAgC;AAAAhC,IAAA,KAAAM;OAAAA,MAAAN,EAAA;CAdH,MAAAU,cAAoBJ;CAgBlB,IAAAE;AAAA,KAAAR,EAAA,OAAAmC,OAAAC,IAAA,4BAAA,EAAA;AAE+B5B,aAAA;AAC/ByB,uBAAoBN,KAAAA,EAAU;;AAC/B3B,IAAA,KAAAQ;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;GAKN;AAAAT,IAAA,KAAAS;AAAAT,IAAA,KAAAwB;AAAAxB,IAAA,KAAAU;AAAAV,IAAA,KAAAa;OAAAA,MAAAb,EAAA;AAAA,QALMa"}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import "../TreeNode.js";
|
|
2
|
-
import "../Renderers.js";
|
|
3
1
|
import { ComponentPropsWithoutRef, FC, ReactNode, RefAttributes } from "react";
|
|
4
2
|
import { Tree } from "@stratakit/structures";
|
|
5
|
-
import "./TreeNodeRenderer.css";
|
|
6
|
-
|
|
7
3
|
//#region src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts
|
|
8
4
|
/** @alpha */
|
|
9
5
|
type StrataKitTreeItemProps = Omit<ComponentPropsWithoutRef<typeof Tree.Item>, "actions" | "inlineActions" | "expanded" | "onExpandedChange" | "icon" | "unstable_decorations" | "error"> & {
|
|
@@ -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":";;;;KA8CY,sBAAA,GAAyB,IAAA,CACnC,wBAAA,QAAgC,IAAA,CAAK,IAAA;;;;;EAOrC,WAAA,GAAc,SAAA;AAAA"}
|
|
@@ -10,7 +10,6 @@ import "./TreeNodeRenderer.css";
|
|
|
10
10
|
import checkmarkSvg from "@stratakit/icons/checkmark.svg";
|
|
11
11
|
import dismissSvg from "@stratakit/icons/dismiss.svg";
|
|
12
12
|
import refreshSvg from "@stratakit/icons/refresh.svg";
|
|
13
|
-
|
|
14
13
|
//#region src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.tsx
|
|
15
14
|
/**
|
|
16
15
|
* A component that renders a given `TreeNode` using the `Tree.Item` component from `@stratakit/structures`.
|
|
@@ -529,7 +528,7 @@ function LabelEditor(t0) {
|
|
|
529
528
|
function injectActionVariant(actions, variant) {
|
|
530
529
|
return actions.filter((action) => isValidElement(action)).map((action) => cloneElement(action, { variant }));
|
|
531
530
|
}
|
|
532
|
-
|
|
533
531
|
//#endregion
|
|
534
532
|
export { PlaceholderNode, StrataKitTreeNodeRenderer };
|
|
533
|
+
|
|
535
534
|
//# sourceMappingURL=TreeNodeRenderer.js.map
|