@itwin/presentation-hierarchies-react 2.0.0-alpha.52 → 2.0.0-alpha.54
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 +33 -0
- package/lib/esm/presentation-hierarchies-react/Renderers.d.ts +62 -55
- package/lib/esm/presentation-hierarchies-react/Renderers.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts +33 -29
- package/lib/esm/presentation-hierarchies-react/TreeNode.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts +27 -16
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.js +181 -54
- package/lib/esm/presentation-hierarchies-react/UseIModelTree.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts +12 -6
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js +54 -49
- package/lib/esm/presentation-hierarchies-react/UseNodeHighlighting.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts +7 -30
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js +116 -74
- package/lib/esm/presentation-hierarchies-react/UseSelectionHandler.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts +67 -54
- package/lib/esm/presentation-hierarchies-react/UseTree.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/UseTree.js +283 -226
- package/lib/esm/presentation-hierarchies-react/UseTree.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/Utils.js +44 -27
- package/lib/esm/presentation-hierarchies-react/Utils.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js +6 -7
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js +271 -298
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js +91 -82
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts +3 -47
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js +114 -151
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts +32 -37
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js +128 -101
- package/lib/esm/presentation-hierarchies-react/internal/UseUnifiedSelection.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js +29 -44
- package/lib/esm/presentation-hierarchies-react/internal/Utils.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts +24 -13
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js +344 -67
- package/lib/esm/presentation-hierarchies-react/stratakit/ErrorItemRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts +16 -15
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js +78 -60
- package/lib/esm/presentation-hierarchies-react/stratakit/FlatTreeNode.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts +122 -117
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js +59 -38
- package/lib/esm/presentation-hierarchies-react/stratakit/LocalizationContext.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts +16 -5
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js +161 -35
- package/lib/esm/presentation-hierarchies-react/stratakit/RootErrorRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts +21 -17
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js +84 -31
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeAction.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts +22 -14
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js +61 -26
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeErrorRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts +15 -6
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js +75 -25
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts +16 -40
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js +140 -61
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts +14 -42
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js +489 -121
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeNodeRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts +58 -55
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.d.ts.map +1 -1
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js +412 -181
- package/lib/esm/presentation-hierarchies-react/stratakit/TreeRenderer.js.map +1 -1
- package/lib/esm/presentation-hierarchies-react.d.ts +17 -17
- package/lib/esm/presentation-hierarchies-react.js +15 -18
- package/package.json +17 -14
- package/lib/esm/presentation-hierarchies-react/Renderers.js +0 -6
- package/lib/esm/presentation-hierarchies-react/Renderers.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/TreeNode.js +0 -6
- package/lib/esm/presentation-hierarchies-react/TreeNode.js.map +0 -1
- package/lib/esm/presentation-hierarchies-react/Utils.d.ts +0 -8
- package/lib/esm/presentation-hierarchies-react/Utils.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts +0 -2
- package/lib/esm/presentation-hierarchies-react/internal/DisposePolyfill.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts +0 -53
- package/lib/esm/presentation-hierarchies-react/internal/TreeActions.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts +0 -62
- package/lib/esm/presentation-hierarchies-react/internal/TreeLoader.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/TreeModel.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts +0 -23
- package/lib/esm/presentation-hierarchies-react/internal/Utils.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react.d.ts.map +0 -1
- package/lib/esm/presentation-hierarchies-react.js.map +0 -1
|
@@ -1,6 +1,16 @@
|
|
|
1
|
-
import { HierarchyLevelDetails, TreeRendererProps } from "../Renderers.js";
|
|
2
1
|
import { TreeNode } from "../TreeNode.js";
|
|
2
|
+
import { HierarchyLevelDetails, TreeRendererProps } from "../Renderers.js";
|
|
3
3
|
import { TreeActionBaseAttributes } from "./TreeAction.js";
|
|
4
|
+
import { NamedExoticComponent } from "react";
|
|
5
|
+
|
|
6
|
+
//#region src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.d.ts
|
|
7
|
+
/** @alpha */
|
|
8
|
+
type TreeNodeFilterActionProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Action to perform when the filter button is clicked for this node.
|
|
11
|
+
*/
|
|
12
|
+
onFilter?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;
|
|
13
|
+
} & TreeActionBaseAttributes & Pick<TreeRendererProps, "getHierarchyLevelDetails">;
|
|
4
14
|
/**
|
|
5
15
|
* React component that renders a filter action for a tree item.
|
|
6
16
|
*
|
|
@@ -11,10 +21,9 @@ import { TreeActionBaseAttributes } from "./TreeAction.js";
|
|
|
11
21
|
*
|
|
12
22
|
* @alpha
|
|
13
23
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
onFilter?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;
|
|
17
|
-
} & TreeActionBaseAttributes & Pick<TreeRendererProps, "getHierarchyLevelDetails"> & {
|
|
18
|
-
node: TreeNode;
|
|
24
|
+
declare const TreeNodeFilterAction: NamedExoticComponent<TreeNodeFilterActionProps & {
|
|
25
|
+
node: TreeNode;
|
|
19
26
|
}>;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { TreeNodeFilterAction };
|
|
20
29
|
//# sourceMappingURL=TreeNodeFilterAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeFilterAction.d.ts","
|
|
1
|
+
{"version":3,"file":"TreeNodeFilterAction.d.ts","names":[],"sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.tsx"],"mappings":";;;;;;;KAgBK,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"}
|
|
@@ -1,29 +1,79 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import { memo, useCallback } from "react";
|
|
7
|
-
import filterSvg from "@stratakit/icons/filter.svg";
|
|
8
|
-
import { useLocalizationContext } from "./LocalizationContext.js";
|
|
9
1
|
import { TreeActionBase } from "./TreeAction.js";
|
|
2
|
+
import { useLocalizationContext } from "./LocalizationContext.js";
|
|
3
|
+
import { c } from "react-compiler-runtime";
|
|
4
|
+
import { memo } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import filterSvg from "@stratakit/icons/filter.svg";
|
|
7
|
+
|
|
8
|
+
//#region src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.tsx
|
|
10
9
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
* React component that renders a filter action for a tree item.
|
|
11
|
+
*
|
|
12
|
+
* The action calls the `onFilter` callback prop when clicked.
|
|
13
|
+
*
|
|
14
|
+
* @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action
|
|
15
|
+
* to tree items.
|
|
16
|
+
*
|
|
17
|
+
* @alpha
|
|
18
|
+
*/
|
|
19
|
+
const TreeNodeFilterAction = memo(function TreeNodeFilterAction(t0) {
|
|
20
|
+
const $ = c(16);
|
|
21
|
+
let actionAttributes;
|
|
22
|
+
let getHierarchyLevelDetails;
|
|
23
|
+
let node;
|
|
24
|
+
let onFilter;
|
|
25
|
+
if ($[0] !== t0) {
|
|
26
|
+
({node, onFilter, getHierarchyLevelDetails, ...actionAttributes} = t0);
|
|
27
|
+
$[0] = t0;
|
|
28
|
+
$[1] = actionAttributes;
|
|
29
|
+
$[2] = getHierarchyLevelDetails;
|
|
30
|
+
$[3] = node;
|
|
31
|
+
$[4] = onFilter;
|
|
32
|
+
} else {
|
|
33
|
+
actionAttributes = $[1];
|
|
34
|
+
getHierarchyLevelDetails = $[2];
|
|
35
|
+
node = $[3];
|
|
36
|
+
onFilter = $[4];
|
|
37
|
+
}
|
|
38
|
+
const { localizedStrings } = useLocalizationContext();
|
|
39
|
+
const { filterHierarchyLevel, filterHierarchyLevelActiveDescription } = localizedStrings;
|
|
40
|
+
let t1;
|
|
41
|
+
if ($[5] !== getHierarchyLevelDetails || $[6] !== node.id || $[7] !== onFilter) {
|
|
42
|
+
t1 = () => {
|
|
43
|
+
const hierarchyLevelDetails = getHierarchyLevelDetails(node.id);
|
|
44
|
+
hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);
|
|
45
|
+
};
|
|
46
|
+
$[5] = getHierarchyLevelDetails;
|
|
47
|
+
$[6] = node.id;
|
|
48
|
+
$[7] = onFilter;
|
|
49
|
+
$[8] = t1;
|
|
50
|
+
} else t1 = $[8];
|
|
51
|
+
const handleClick = t1;
|
|
52
|
+
const t2 = node.isFiltered ? true : void 0;
|
|
53
|
+
const t3 = node.isFiltered ? filterHierarchyLevelActiveDescription : void 0;
|
|
54
|
+
const t4 = !onFilter || !node.isFilterable;
|
|
55
|
+
let t5;
|
|
56
|
+
if ($[9] !== actionAttributes || $[10] !== filterHierarchyLevel || $[11] !== handleClick || $[12] !== t2 || $[13] !== t3 || $[14] !== t4) {
|
|
57
|
+
t5 = /* @__PURE__ */ jsx(TreeActionBase, {
|
|
58
|
+
...actionAttributes,
|
|
59
|
+
label: filterHierarchyLevel,
|
|
60
|
+
onClick: handleClick,
|
|
61
|
+
icon: filterSvg,
|
|
62
|
+
visible: t2,
|
|
63
|
+
dot: t3,
|
|
64
|
+
hide: t4
|
|
65
|
+
});
|
|
66
|
+
$[9] = actionAttributes;
|
|
67
|
+
$[10] = filterHierarchyLevel;
|
|
68
|
+
$[11] = handleClick;
|
|
69
|
+
$[12] = t2;
|
|
70
|
+
$[13] = t3;
|
|
71
|
+
$[14] = t4;
|
|
72
|
+
$[15] = t5;
|
|
73
|
+
} else t5 = $[15];
|
|
74
|
+
return t5;
|
|
28
75
|
});
|
|
76
|
+
|
|
77
|
+
//#endregion
|
|
78
|
+
export { TreeNodeFilterAction };
|
|
29
79
|
//# sourceMappingURL=TreeNodeFilterAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeFilterAction.js","
|
|
1
|
+
{"version":3,"file":"TreeNodeFilterAction.js","names":["memo","useCallback","filterSvg","useLocalizationContext","TreeActionBase","NamedExoticComponent","HierarchyLevelDetails","TreeRendererProps","TreeNode","TreeActionBaseAttributes","TreeNodeFilterActionProps","onFilter","hierarchyLevelDetails","Pick","TreeNodeFilterAction","node","t0","$","_c","actionAttributes","getHierarchyLevelDetails","localizedStrings","filterHierarchyLevel","filterHierarchyLevelActiveDescription","t1","id","handleClick","t2","isFiltered","undefined","t3","t4","isFilterable","t5"],"sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeFilterAction.tsx"],"sourcesContent":["/*---------------------------------------------------------------------------------------------\n * Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n * See LICENSE.md in the project root for license terms and full copyright notice.\n *--------------------------------------------------------------------------------------------*/\n\nimport { memo, useCallback } from \"react\";\nimport filterSvg from \"@stratakit/icons/filter.svg\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\n\nimport type { NamedExoticComponent } from \"react\";\nimport type { HierarchyLevelDetails, TreeRendererProps } from \"../Renderers.js\";\nimport type { TreeNode } from \"../TreeNode.js\";\nimport type { TreeActionBaseAttributes } from \"./TreeAction.js\";\n\n/** @alpha */\ntype TreeNodeFilterActionProps = {\n /**\n * Action to perform when the filter button is clicked for this node.\n */\n onFilter?: (hierarchyLevelDetails: HierarchyLevelDetails) => void;\n} & TreeActionBaseAttributes &\n Pick<TreeRendererProps, \"getHierarchyLevelDetails\">;\n\n/**\n * React component that renders a filter action for a tree item.\n *\n * The action calls the `onFilter` callback prop when clicked.\n *\n * @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action\n * to tree items.\n *\n * @alpha\n */\nexport const TreeNodeFilterAction: NamedExoticComponent<TreeNodeFilterActionProps & { node: TreeNode }> = memo(function TreeNodeFilterAction({\n node,\n onFilter,\n getHierarchyLevelDetails,\n ...actionAttributes\n}: TreeNodeFilterActionProps & { node: TreeNode }) {\n const { localizedStrings } = useLocalizationContext();\n const { filterHierarchyLevel, filterHierarchyLevelActiveDescription } = localizedStrings;\n\n const handleClick = useCallback(() => {\n const hierarchyLevelDetails = getHierarchyLevelDetails(node.id);\n hierarchyLevelDetails && onFilter?.(hierarchyLevelDetails);\n }, [node, getHierarchyLevelDetails, onFilter]);\n\n return (\n <TreeActionBase\n {...actionAttributes}\n label={filterHierarchyLevel}\n onClick={handleClick}\n icon={filterSvg}\n visible={node.isFiltered ? true : undefined}\n dot={node.isFiltered ? filterHierarchyLevelActiveDescription : undefined}\n hide={!onFilter || !node.isFilterable}\n />\n );\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAac,uBAA6Fd,KAAK,SAAAc,qBAAAE,IAAA;CAAA,MAAAC,IAAAC,EAAA,GAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAL;CAAA,IAAAJ;AAAA,KAAAM,EAAA,OAAAD,IAAA;AAA8B,GAAA,CAAAD,MAAAJ,UAAAS,6BAAAD,oBAAAH;AAK5FC,IAAA,KAAAD;AAAAC,IAAA,KAAAE;AAAAF,IAAA,KAAAG;AAAAH,IAAA,KAAAF;AAAAE,IAAA,KAAAN;QAAA;AAAAQ,qBAAAF,EAAA;AAAAG,6BAAAH,EAAA;AAAAF,SAAAE,EAAA;AAAAN,aAAAM,EAAA;;CAC/C,MAAA,EAAAI,qBAA6BlB,wBAAwB;CACrD,MAAA,EAAAmB,sBAAAC,0CAAwEF;CAAiB,IAAAG;AAAA,KAAAP,EAAA,OAAAG,4BAAAH,EAAA,OAAAF,KAAAU,MAAAR,EAAA,OAAAN,UAAA;AAEzDa,aAAA;GAC9B,MAAAZ,wBAA8BQ,yBAAyBL,KAAIU,GAAI;AAC/Db,4BAAyBD,WAAWC,sBAAsB;;AAC3DK,IAAA,KAAAG;AAAAH,IAAA,KAAAF,KAAAU;AAAAR,IAAA,KAAAN;AAAAM,IAAA,KAAAO;OAAAA,MAAAP,EAAA;CAHD,MAAAS,cAAoBF;CAWP,MAAAG,KAAAZ,KAAIa,aAAJ,OAAAC;CACJ,MAAAC,KAAAf,KAAIa,aAAJL,wCAAAM;CACC,MAAAE,KAAA,CAACpB,YAAD,CAAcI,KAAIiB;CAAa,IAAAC;AAAA,KAAAhB,EAAA,OAAAE,oBAAAF,EAAA,QAAAK,wBAAAL,EAAA,QAAAS,eAAAT,EAAA,QAAAU,MAAAV,EAAA,QAAAa,MAAAb,EAAA,QAAAc,IAAA;AAPvCE,OAAA,oBAAC;GAAc,GACTd;GACGG,OAAAA;GACEI,SAAAA;GACHxB,MAAAA;GACG,SAAAyB;GACJ,KAAAG;GACC,MAAAC;IACN;AAAAd,IAAA,KAAAE;AAAAF,IAAA,MAAAK;AAAAL,IAAA,MAAAS;AAAAT,IAAA,MAAAU;AAAAV,IAAA,MAAAa;AAAAb,IAAA,MAAAc;AAAAd,IAAA,MAAAgB;OAAAA,MAAAhB,EAAA;AAAA,QARFgB;EAUF"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { PropsWithChildren } from "react";
|
|
2
1
|
import { TreeNode } from "../TreeNode.js";
|
|
3
2
|
import { TreeActionBaseAttributes } from "./TreeAction.js";
|
|
3
|
+
import { NamedExoticComponent, PropsWithChildren } from "react";
|
|
4
|
+
import "react/jsx-runtime";
|
|
5
|
+
|
|
6
|
+
//#region src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.d.ts
|
|
4
7
|
/**
|
|
5
8
|
* React component that renders a rename action for a tree item.
|
|
6
9
|
*
|
|
@@ -12,46 +15,19 @@ import { TreeActionBaseAttributes } from "./TreeAction.js";
|
|
|
12
15
|
*
|
|
13
16
|
* @alpha
|
|
14
17
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
declare const TreeNodeRenameAction: NamedExoticComponent<TreeActionBaseAttributes & {
|
|
19
|
+
node: TreeNode;
|
|
17
20
|
}>;
|
|
18
21
|
/** @alpha */
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
interface TreeNodeEditingProps {
|
|
23
|
+
/**
|
|
24
|
+
* A callback that is invoked when node label is changed. Should be used together
|
|
25
|
+
* with `<TreeNodeRenameAction />` to enter label editing mode.
|
|
26
|
+
*/
|
|
27
|
+
onLabelChanged: (newLabel: string) => void;
|
|
28
|
+
labelValidationHint?: string;
|
|
29
|
+
validate?: (newLabel: string) => boolean;
|
|
27
30
|
}
|
|
28
|
-
|
|
29
|
-
export
|
|
30
|
-
nodeId: string;
|
|
31
|
-
commit: (newLabel: string) => void;
|
|
32
|
-
labelValidationHint?: string;
|
|
33
|
-
validate?: (newLabel: string) => boolean;
|
|
34
|
-
}
|
|
35
|
-
interface TreeNodeRenameContext {
|
|
36
|
-
renameParameters?: RenameParameters;
|
|
37
|
-
startRename: (node: TreeNode) => void;
|
|
38
|
-
canRename: (node: TreeNode) => boolean;
|
|
39
|
-
cancelRename: () => void;
|
|
40
|
-
}
|
|
41
|
-
/** @internal */
|
|
42
|
-
export declare const useTreeNodeRenameContext: () => TreeNodeRenameContext | undefined;
|
|
43
|
-
/** @internal */
|
|
44
|
-
export declare function TreeNodeRenameContextProvider({ value, children }: PropsWithChildren<{
|
|
45
|
-
value: TreeNodeRenameContext;
|
|
46
|
-
}>): import("react/jsx-runtime").JSX.Element;
|
|
47
|
-
/** @internal */
|
|
48
|
-
export declare function useTreeNodeRenameContextValue({ getEditingProps }: {
|
|
49
|
-
getEditingProps?: (node: TreeNode) => TreeNodeEditingProps | undefined;
|
|
50
|
-
}): {
|
|
51
|
-
renameParameters: RenameParameters | undefined;
|
|
52
|
-
cancelRename: () => void;
|
|
53
|
-
startRename: (node: TreeNode) => void;
|
|
54
|
-
canRename: (node: TreeNode) => boolean;
|
|
55
|
-
};
|
|
56
|
-
export {};
|
|
31
|
+
//#endregion
|
|
32
|
+
export { TreeNodeEditingProps, TreeNodeRenameAction };
|
|
57
33
|
//# sourceMappingURL=TreeNodeRenameAction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenameAction.d.ts","
|
|
1
|
+
{"version":3,"file":"TreeNodeRenameAction.d.ts","names":[],"sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.tsx"],"mappings":";;;;;;;;;AAyBA;;;;;;;;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"}
|
|
@@ -1,71 +1,150 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/*---------------------------------------------------------------------------------------------
|
|
3
|
-
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
|
|
4
|
-
* See LICENSE.md in the project root for license terms and full copyright notice.
|
|
5
|
-
*--------------------------------------------------------------------------------------------*/
|
|
6
|
-
import { createContext, memo, useCallback, useContext, useMemo, useState } from "react";
|
|
7
|
-
import renameSvg from "@stratakit/icons/rename.svg";
|
|
8
|
-
import { useLocalizationContext } from "./LocalizationContext.js";
|
|
9
1
|
import { TreeActionBase } from "./TreeAction.js";
|
|
2
|
+
import { useLocalizationContext } from "./LocalizationContext.js";
|
|
3
|
+
import { c } from "react-compiler-runtime";
|
|
4
|
+
import { createContext, memo, useContext, useState } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import renameSvg from "@stratakit/icons/rename.svg";
|
|
7
|
+
|
|
8
|
+
//#region src/presentation-hierarchies-react/stratakit/TreeNodeRenameAction.tsx
|
|
10
9
|
/**
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
10
|
+
* React component that renders a rename action for a tree item.
|
|
11
|
+
*
|
|
12
|
+
* The tree component must have `getEditingProps.onLabelChanged` prop set to enable renaming functionality. When
|
|
13
|
+
* rename is completed, the `onLabelChanged` function is called to make the actual data update.
|
|
14
|
+
*
|
|
15
|
+
* @see `getMenuActions`, `getInlineActions`, `getContextMenuActions` props of `TreeRenderer` to add this action
|
|
16
|
+
* to tree items.
|
|
17
|
+
*
|
|
18
|
+
* @alpha
|
|
19
|
+
*/
|
|
20
|
+
const TreeNodeRenameAction = memo(function TreeNodeRenameAction(t0) {
|
|
21
|
+
const $ = c(14);
|
|
22
|
+
let actionAttributes;
|
|
23
|
+
let node;
|
|
24
|
+
if ($[0] !== t0) {
|
|
25
|
+
({node, ...actionAttributes} = t0);
|
|
26
|
+
$[0] = t0;
|
|
27
|
+
$[1] = actionAttributes;
|
|
28
|
+
$[2] = node;
|
|
29
|
+
} else {
|
|
30
|
+
actionAttributes = $[1];
|
|
31
|
+
node = $[2];
|
|
32
|
+
}
|
|
33
|
+
const { localizedStrings } = useLocalizationContext();
|
|
34
|
+
const context = useTreeNodeRenameContext();
|
|
35
|
+
const { rename } = localizedStrings;
|
|
36
|
+
let t1;
|
|
37
|
+
if ($[3] !== context || $[4] !== node) {
|
|
38
|
+
t1 = context?.canRename(node) ?? false;
|
|
39
|
+
$[3] = context;
|
|
40
|
+
$[4] = node;
|
|
41
|
+
$[5] = t1;
|
|
42
|
+
} else t1 = $[5];
|
|
43
|
+
const canRename = t1;
|
|
44
|
+
const startRename = context?.startRename;
|
|
45
|
+
let t2;
|
|
46
|
+
if ($[6] !== node || $[7] !== startRename) {
|
|
47
|
+
t2 = () => {
|
|
48
|
+
startRename?.(node);
|
|
49
|
+
};
|
|
50
|
+
$[6] = node;
|
|
51
|
+
$[7] = startRename;
|
|
52
|
+
$[8] = t2;
|
|
53
|
+
} else t2 = $[8];
|
|
54
|
+
const handleClick = t2;
|
|
55
|
+
const t3 = !canRename;
|
|
56
|
+
let t4;
|
|
57
|
+
if ($[9] !== actionAttributes || $[10] !== handleClick || $[11] !== rename || $[12] !== t3) {
|
|
58
|
+
t4 = /* @__PURE__ */ jsx(TreeActionBase, {
|
|
59
|
+
...actionAttributes,
|
|
60
|
+
label: rename,
|
|
61
|
+
onClick: handleClick,
|
|
62
|
+
icon: renameSvg,
|
|
63
|
+
hide: t3
|
|
64
|
+
});
|
|
65
|
+
$[9] = actionAttributes;
|
|
66
|
+
$[10] = handleClick;
|
|
67
|
+
$[11] = rename;
|
|
68
|
+
$[12] = t3;
|
|
69
|
+
$[13] = t4;
|
|
70
|
+
} else t4 = $[13];
|
|
71
|
+
return t4;
|
|
31
72
|
});
|
|
32
|
-
const treeNodeRenameContext = createContext(
|
|
73
|
+
const treeNodeRenameContext = createContext(void 0);
|
|
33
74
|
/** @internal */
|
|
34
|
-
|
|
35
|
-
|
|
75
|
+
const useTreeNodeRenameContext = () => {
|
|
76
|
+
return useContext(treeNodeRenameContext);
|
|
36
77
|
};
|
|
37
78
|
/** @internal */
|
|
38
|
-
|
|
39
|
-
|
|
79
|
+
function TreeNodeRenameContextProvider(t0) {
|
|
80
|
+
const $ = c(3);
|
|
81
|
+
const { value, children } = t0;
|
|
82
|
+
let t1;
|
|
83
|
+
if ($[0] !== children || $[1] !== value) {
|
|
84
|
+
t1 = /* @__PURE__ */ jsx(treeNodeRenameContext.Provider, {
|
|
85
|
+
value,
|
|
86
|
+
children
|
|
87
|
+
});
|
|
88
|
+
$[0] = children;
|
|
89
|
+
$[1] = value;
|
|
90
|
+
$[2] = t1;
|
|
91
|
+
} else t1 = $[2];
|
|
92
|
+
return t1;
|
|
40
93
|
}
|
|
41
94
|
/** @internal */
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
95
|
+
function useTreeNodeRenameContextValue(t0) {
|
|
96
|
+
const $ = c(9);
|
|
97
|
+
const { getEditingProps } = t0;
|
|
98
|
+
const [renameParameters, setRenameParameters] = useState(void 0);
|
|
99
|
+
let t1;
|
|
100
|
+
if ($[0] !== getEditingProps) {
|
|
101
|
+
t1 = (node) => {
|
|
102
|
+
const { onLabelChanged, labelValidationHint, validate } = getEditingProps?.(node) ?? {};
|
|
103
|
+
if (onLabelChanged) setRenameParameters({
|
|
104
|
+
nodeId: node.id,
|
|
105
|
+
commit: (newLabel) => {
|
|
106
|
+
onLabelChanged(newLabel);
|
|
107
|
+
setRenameParameters(void 0);
|
|
108
|
+
},
|
|
109
|
+
labelValidationHint,
|
|
110
|
+
validate
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
$[0] = getEditingProps;
|
|
114
|
+
$[1] = t1;
|
|
115
|
+
} else t1 = $[1];
|
|
116
|
+
const startRename = t1;
|
|
117
|
+
let t2;
|
|
118
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
119
|
+
t2 = () => {
|
|
120
|
+
setRenameParameters(void 0);
|
|
121
|
+
};
|
|
122
|
+
$[2] = t2;
|
|
123
|
+
} else t2 = $[2];
|
|
124
|
+
const cancelRename = t2;
|
|
125
|
+
let t3;
|
|
126
|
+
if ($[3] !== getEditingProps) {
|
|
127
|
+
t3 = (node_0) => getEditingProps?.(node_0)?.onLabelChanged !== void 0;
|
|
128
|
+
$[3] = getEditingProps;
|
|
129
|
+
$[4] = t3;
|
|
130
|
+
} else t3 = $[4];
|
|
131
|
+
const canRename = t3;
|
|
132
|
+
let t4;
|
|
133
|
+
if ($[5] !== canRename || $[6] !== renameParameters || $[7] !== startRename) {
|
|
134
|
+
t4 = {
|
|
135
|
+
renameParameters,
|
|
136
|
+
cancelRename,
|
|
137
|
+
startRename,
|
|
138
|
+
canRename
|
|
139
|
+
};
|
|
140
|
+
$[5] = canRename;
|
|
141
|
+
$[6] = renameParameters;
|
|
142
|
+
$[7] = startRename;
|
|
143
|
+
$[8] = t4;
|
|
144
|
+
} else t4 = $[8];
|
|
145
|
+
return t4;
|
|
70
146
|
}
|
|
147
|
+
|
|
148
|
+
//#endregion
|
|
149
|
+
export { TreeNodeRenameAction, TreeNodeRenameContextProvider, useTreeNodeRenameContext, useTreeNodeRenameContextValue };
|
|
71
150
|
//# sourceMappingURL=TreeNodeRenameAction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenameAction.js","
|
|
1
|
+
{"version":3,"file":"TreeNodeRenameAction.js","names":["createContext","memo","useCallback","useContext","useMemo","useState","renameSvg","useLocalizationContext","TreeActionBase","NamedExoticComponent","PropsWithChildren","TreeNode","TreeActionBaseAttributes","TreeNodeRenameAction","node","t0","$","_c","actionAttributes","localizedStrings","context","useTreeNodeRenameContext","rename","t1","canRename","startRename","t2","handleClick","t3","t4","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 renameSvg from \"@stratakit/icons/rename.svg\";\nimport { useLocalizationContext } from \"./LocalizationContext.js\";\nimport { TreeActionBase } from \"./TreeAction.js\";\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 { localizedStrings } = useLocalizationContext();\n const context = useTreeNodeRenameContext();\n const { rename } = localizedStrings;\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":"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"}
|
|
@@ -1,46 +1,18 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import
|
|
1
|
+
import "../TreeNode.js";
|
|
2
|
+
import "../Renderers.js";
|
|
3
|
+
import { ComponentPropsWithoutRef, FC, ReactNode, RefAttributes } from "react";
|
|
3
4
|
import { Tree } from "@stratakit/structures";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
interface TreeNodeRendererOwnProps extends Pick<TreeRendererProps, "expandNode" | "reloadTree"> {
|
|
8
|
-
/** Node that is rendered. */
|
|
9
|
-
node: TreeNode;
|
|
10
|
-
/**
|
|
11
|
-
* Menu actions for tree item.
|
|
12
|
-
* Must be an array of `<TreeActionBase />` or `<Divider />` elements.
|
|
13
|
-
*/
|
|
14
|
-
menuActions?: ReactNode[];
|
|
15
|
-
/**
|
|
16
|
-
* Inline actions for tree item.
|
|
17
|
-
* Must be an array of `<TreeActionBase />` elements.
|
|
18
|
-
* Max 2 items.
|
|
19
|
-
*/
|
|
20
|
-
inlineActions?: ReactNode[];
|
|
21
|
-
/**
|
|
22
|
-
* Context menu actions for tree item.
|
|
23
|
-
* Must be an array of `<TreeActionBase />` or `<Divider />` elements.
|
|
24
|
-
*/
|
|
25
|
-
contextMenuActions?: ReactNode[];
|
|
26
|
-
}
|
|
5
|
+
import "./TreeNodeRenderer.css";
|
|
6
|
+
|
|
7
|
+
//#region src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.d.ts
|
|
27
8
|
/** @alpha */
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
9
|
+
type StrataKitTreeItemProps = Omit<ComponentPropsWithoutRef<typeof Tree.Item>, "actions" | "inlineActions" | "expanded" | "onExpandedChange" | "icon" | "unstable_decorations" | "error"> & {
|
|
10
|
+
/**
|
|
11
|
+
* Used to render elements between expander and label.
|
|
12
|
+
* E.g. icons, color picker, etc.
|
|
13
|
+
*/
|
|
14
|
+
decorations?: ReactNode;
|
|
34
15
|
};
|
|
35
|
-
|
|
36
|
-
export
|
|
37
|
-
/**
|
|
38
|
-
* A component that renders given `FlatTreeNode` using the `Tree.Item` component from `@itwin/itwinui-react`. The
|
|
39
|
-
* `FlatTreeNode` objects for this renderer are generally created using the `useFlatTreeNodeList` hook.
|
|
40
|
-
*
|
|
41
|
-
* @internal
|
|
42
|
-
*/
|
|
43
|
-
export declare const StrataKitTreeNodeRenderer: FC<PropsWithRef<TreeNodeRendererProps & RefAttributes<HTMLElement>>>;
|
|
44
|
-
export declare const PlaceholderNode: FC<PropsWithRef<Pick<StrataKitTreeItemProps, "style" | "aria-level" | "aria-posinset" | "aria-setsize"> & RefAttributes<HTMLElement>>>;
|
|
45
|
-
export {};
|
|
16
|
+
//#endregion
|
|
17
|
+
export { StrataKitTreeItemProps };
|
|
46
18
|
//# sourceMappingURL=TreeNodeRenderer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeNodeRenderer.d.ts","
|
|
1
|
+
{"version":3,"file":"TreeNodeRenderer.d.ts","names":[],"sources":["../../../../src/presentation-hierarchies-react/stratakit/TreeNodeRenderer.tsx"],"mappings":";;;;;;;;KA6CY,sBAAA,GAAyB,IAAA,CACnC,wBAAA,QAAgC,IAAA,CAAK,IAAA;;;;;EAOrC,WAAA,GAAc,SAAA;AAAA"}
|