@itwin/components-react 5.27.1 → 5.28.0
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 +14 -0
- package/lib/cjs/components-react/common/HighlightedText.scss +8 -0
- package/lib/components-react/abstract-types.d.ts +8 -0
- package/lib/components-react/abstract-types.d.ts.map +1 -0
- package/lib/components-react/abstract-types.js +6 -0
- package/lib/components-react/abstract-types.js.map +1 -0
- package/lib/components-react/common/HighlightedText.d.ts +6 -0
- package/lib/components-react/common/HighlightedText.d.ts.map +1 -1
- package/lib/components-react/common/HighlightedText.js +7 -4
- package/lib/components-react/common/HighlightedText.js.map +1 -1
- package/lib/components-react/common/HighlightedText.scss +8 -0
- package/lib/components-react/common/selection/SelectionHandler.d.ts +3 -0
- package/lib/components-react/common/selection/SelectionHandler.d.ts.map +1 -1
- package/lib/components-react/common/selection/SelectionHandler.js.map +1 -1
- package/lib/components-react/common/selection/SelectionModes.d.ts +3 -0
- package/lib/components-react/common/selection/SelectionModes.d.ts.map +1 -1
- package/lib/components-react/common/selection/SelectionModes.js +4 -0
- package/lib/components-react/common/selection/SelectionModes.js.map +1 -1
- package/lib/components-react/editors/CustomNumberEditor.d.ts +1 -0
- package/lib/components-react/editors/CustomNumberEditor.d.ts.map +1 -1
- package/lib/components-react/editors/CustomNumberEditor.js +9 -2
- package/lib/components-react/editors/CustomNumberEditor.js.map +1 -1
- package/lib/components-react/editors/NumericInputEditor.d.ts +1 -0
- package/lib/components-react/editors/NumericInputEditor.d.ts.map +1 -1
- package/lib/components-react/editors/NumericInputEditor.js +7 -0
- package/lib/components-react/editors/NumericInputEditor.js.map +1 -1
- package/lib/components-react/editors/TextEditor.d.ts +1 -0
- package/lib/components-react/editors/TextEditor.d.ts.map +1 -1
- package/lib/components-react/editors/TextEditor.js +9 -2
- package/lib/components-react/editors/TextEditor.js.map +1 -1
- package/lib/components-react/editors/TextareaEditor.d.ts +1 -0
- package/lib/components-react/editors/TextareaEditor.d.ts.map +1 -1
- package/lib/components-react/editors/TextareaEditor.js +7 -0
- package/lib/components-react/editors/TextareaEditor.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.d.ts.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.js +3 -0
- package/lib/components-react/new-editors/interop/old-editors/CustomNumber.js.map +1 -1
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.js +3 -0
- package/lib/components-react/new-editors/interop/old-editors/NumericInput.js.map +1 -1
- package/lib/components-react/tree/HighlightingEngine.d.ts +5 -0
- package/lib/components-react/tree/HighlightingEngine.d.ts.map +1 -1
- package/lib/components-react/tree/HighlightingEngine.js +3 -0
- package/lib/components-react/tree/HighlightingEngine.js.map +1 -1
- package/lib/components-react/tree/ImageLoader.d.ts +2 -0
- package/lib/components-react/tree/ImageLoader.d.ts.map +1 -1
- package/lib/components-react/tree/ImageLoader.js +1 -0
- package/lib/components-react/tree/ImageLoader.js.map +1 -1
- package/lib/components-react/tree/SimpleTreeDataProvider.d.ts +2 -0
- package/lib/components-react/tree/SimpleTreeDataProvider.d.ts.map +1 -1
- package/lib/components-react/tree/SimpleTreeDataProvider.js +1 -0
- package/lib/components-react/tree/SimpleTreeDataProvider.js.map +1 -1
- package/lib/components-react/tree/TreeDataProvider.d.ts +14 -0
- package/lib/components-react/tree/TreeDataProvider.d.ts.map +1 -1
- package/lib/components-react/tree/TreeDataProvider.js +5 -0
- package/lib/components-react/tree/TreeDataProvider.js.map +1 -1
- package/lib/components-react/tree/controlled/Observable.d.ts +9 -0
- package/lib/components-react/tree/controlled/Observable.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/Observable.js +2 -0
- package/lib/components-react/tree/controlled/Observable.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeActions.d.ts +1 -0
- package/lib/components-react/tree/controlled/TreeActions.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/TreeActions.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeEventDispatcher.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/TreeEventDispatcher.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeEventHandler.d.ts +3 -0
- package/lib/components-react/tree/controlled/TreeEventHandler.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/TreeEventHandler.js +2 -0
- package/lib/components-react/tree/controlled/TreeEventHandler.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeEvents.d.ts +7 -0
- package/lib/components-react/tree/controlled/TreeEvents.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/TreeEvents.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeHooks.d.ts +5 -0
- package/lib/components-react/tree/controlled/TreeHooks.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/TreeHooks.js +6 -2
- package/lib/components-react/tree/controlled/TreeHooks.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeModel.d.ts +18 -0
- package/lib/components-react/tree/controlled/TreeModel.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/TreeModel.js +7 -0
- package/lib/components-react/tree/controlled/TreeModel.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeModelSource.d.ts +2 -0
- package/lib/components-react/tree/controlled/TreeModelSource.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/TreeModelSource.js +1 -0
- package/lib/components-react/tree/controlled/TreeModelSource.js.map +1 -1
- package/lib/components-react/tree/controlled/TreeNodeLoader.d.ts +9 -0
- package/lib/components-react/tree/controlled/TreeNodeLoader.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/TreeNodeLoader.js +4 -1
- package/lib/components-react/tree/controlled/TreeNodeLoader.js.map +1 -1
- package/lib/components-react/tree/controlled/component/ControlledTree.d.ts +3 -0
- package/lib/components-react/tree/controlled/component/ControlledTree.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/component/ControlledTree.js +4 -3
- package/lib/components-react/tree/controlled/component/ControlledTree.js.map +1 -1
- package/lib/components-react/tree/controlled/component/NodeContent.d.ts +2 -1
- package/lib/components-react/tree/controlled/component/NodeContent.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/component/NodeContent.js +3 -4
- package/lib/components-react/tree/controlled/component/NodeContent.js.map +1 -1
- package/lib/components-react/tree/controlled/component/TreeNodeEditor.d.ts +3 -0
- package/lib/components-react/tree/controlled/component/TreeNodeEditor.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/component/TreeNodeEditor.js +2 -0
- package/lib/components-react/tree/controlled/component/TreeNodeEditor.js.map +1 -1
- package/lib/components-react/tree/controlled/component/TreeNodeRenderer.d.ts +3 -0
- package/lib/components-react/tree/controlled/component/TreeNodeRenderer.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/component/TreeNodeRenderer.js +5 -7
- package/lib/components-react/tree/controlled/component/TreeNodeRenderer.js.map +1 -1
- package/lib/components-react/tree/controlled/component/TreeRenderer.d.ts +4 -0
- package/lib/components-react/tree/controlled/component/TreeRenderer.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/component/TreeRenderer.js +3 -6
- package/lib/components-react/tree/controlled/component/TreeRenderer.js.map +1 -1
- package/lib/components-react/tree/controlled/internal/SparseTree.d.ts +1 -0
- package/lib/components-react/tree/controlled/internal/SparseTree.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/internal/SparseTree.js +2 -0
- package/lib/components-react/tree/controlled/internal/SparseTree.js.map +1 -1
- package/lib/components-react/tree/controlled/internal/TreeModelMutator.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/internal/TreeModelMutator.js +1 -0
- package/lib/components-react/tree/controlled/internal/TreeModelMutator.js.map +1 -1
- package/lib/components-react/tree/controlled/internal/TreeSelectionManager.d.ts.map +1 -1
- package/lib/components-react/tree/controlled/internal/TreeSelectionManager.js.map +1 -1
- package/lib/components-react.d.ts +2 -0
- package/lib/components-react.d.ts.map +1 -1
- package/lib/components-react.js +1 -0
- package/lib/components-react.js.map +1 -1
- package/lib/esm/components-react/common/HighlightedText.scss +8 -0
- package/package.json +41 -38
|
@@ -17,6 +17,7 @@ import type { Observable, Subscription } from "./Observable.js";
|
|
|
17
17
|
* 'complete' callback if supplied.
|
|
18
18
|
*
|
|
19
19
|
* @public
|
|
20
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
20
21
|
*/
|
|
21
22
|
export interface TreeEvents {
|
|
22
23
|
/** Called when tree node is expanded. */
|
|
@@ -48,6 +49,7 @@ export interface TreeEvents {
|
|
|
48
49
|
/**
|
|
49
50
|
* Data structure that describes tree node event payload.
|
|
50
51
|
* @public
|
|
52
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
51
53
|
*/
|
|
52
54
|
export interface TreeNodeEventArgs {
|
|
53
55
|
/** Id of node that is affected by event. */
|
|
@@ -56,6 +58,7 @@ export interface TreeNodeEventArgs {
|
|
|
56
58
|
/**
|
|
57
59
|
* Data structure that describes tree selection modification event payload.
|
|
58
60
|
* @public
|
|
61
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
59
62
|
*/
|
|
60
63
|
export interface TreeSelectionModificationEventArgs {
|
|
61
64
|
/**
|
|
@@ -67,6 +70,7 @@ export interface TreeSelectionModificationEventArgs {
|
|
|
67
70
|
/**
|
|
68
71
|
* Data structure that describes tree selection change.
|
|
69
72
|
* @public
|
|
73
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
70
74
|
*/
|
|
71
75
|
export interface TreeSelectionChange {
|
|
72
76
|
/** Tree node items that where selected. */
|
|
@@ -77,6 +81,7 @@ export interface TreeSelectionChange {
|
|
|
77
81
|
/**
|
|
78
82
|
* Data structure that describes tree selection replacement event payload.
|
|
79
83
|
* @public
|
|
84
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
80
85
|
*/
|
|
81
86
|
export interface TreeSelectionReplacementEventArgs {
|
|
82
87
|
/**
|
|
@@ -90,6 +95,7 @@ export interface TreeSelectionReplacementEventArgs {
|
|
|
90
95
|
/**
|
|
91
96
|
* Data structure that describes tree checkbox state change event payload.
|
|
92
97
|
* @public
|
|
98
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
93
99
|
*/
|
|
94
100
|
export interface TreeCheckboxStateChangeEventArgs {
|
|
95
101
|
/**
|
|
@@ -101,6 +107,7 @@ export interface TreeCheckboxStateChangeEventArgs {
|
|
|
101
107
|
/**
|
|
102
108
|
* Data structure that describes checkbox state change.
|
|
103
109
|
* @public
|
|
110
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
104
111
|
*/
|
|
105
112
|
export interface CheckboxStateChange {
|
|
106
113
|
/** Tree node item that was affected by checkbox state change. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeEvents.d.ts","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeEvents.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"TreeEvents.d.ts","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeEvents.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEhE;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,UAAU;IACzB,yCAAyC;IACzC,cAAc,CAAC,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAChD,0CAA0C;IAC1C,eAAe,CAAC,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACjD,iDAAiD;IACjD,kBAAkB,CAAC,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACpD,gDAAgD;IAChD,iBAAiB,CAAC,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnD,0DAA0D;IAC1D,qBAAqB,CAAC,CAAC,KAAK,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACvD;;;OAGG;IACH,mBAAmB,CAAC,CAClB,KAAK,EAAE,kCAAkC,GACxC,YAAY,GAAG,SAAS,CAAC;IAC5B;;;OAGG;IACH,mBAAmB,CAAC,CAClB,KAAK,EAAE,iCAAiC,GACvC,YAAY,GAAG,SAAS,CAAC;IAE5B;;;OAGG;IACH,sBAAsB,CAAC,CACrB,KAAK,EAAE,gCAAgC,GACtC,YAAY,GAAG,SAAS,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;GAIG;AACH,MAAM,WAAW,kCAAkC;IACjD;;;OAGG;IACH,aAAa,EAAE,UAAU,CAAC,mBAAmB,CAAC,CAAC;CAChD;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,2CAA2C;IAC3C,iBAAiB,EAAE,YAAY,EAAE,CAAC;IAClC,6CAA6C;IAC7C,mBAAmB,EAAE,YAAY,EAAE,CAAC;CACrC;AAED;;;;GAIG;AACH,MAAM,WAAW,iCAAiC;IAChD;;;OAGG;IACH,YAAY,EAAE,UAAU,CAAC;QAAE,iBAAiB,EAAE,YAAY,EAAE,CAAA;KAAE,CAAC,CAAC;CACjE;AAED;;;;GAIG;AACH,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,YAAY,EAAE,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;CACjD;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,iEAAiE;IACjE,QAAQ,EAAE,YAAY,CAAC;IACvB,iCAAiC;IACjC,QAAQ,EAAE,aAAa,CAAC;CACzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeEvents.js","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeEvents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG","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/** @packageDocumentation\n * @module Tree\n */\n\nimport type { CheckBoxState } from \"../../common/CheckBoxState.js\";\nimport type { TreeNodeItem } from \"../TreeDataProvider.js\";\nimport type { Observable, Subscription } from \"./Observable.js\";\n\n/**\n * Tree events that can occur while interacting with tree.\n *\n * **Note:** Selection and checkbox state change events payload is an Observable.\n * Observable is a stream of data over time (e.g. in case of selection replaced event\n * it is a stream of selected node items arrays). To access data inside stream `subscribe()` method\n * should be called. This method accepts any subset of 'next', 'error' and 'complete' callbacks.\n * Once subscribe is called observable will start emitting data and calls 'next' callback each time new\n * data is emitted. If some selected nodes are not loaded yet they will be loaded and observable will\n * emit loaded node items. When all selected node items are emitted observable completes and calls\n * 'complete' callback if supplied.\n *\n * @public\n */\nexport interface TreeEvents {\n /** Called when tree node is expanded. */\n onNodeExpanded?(event: TreeNodeEventArgs): void;\n /** Called when tree node is collapsed. */\n onNodeCollapsed?(event: TreeNodeEventArgs): void;\n /** Called when selected tree node is clicked. */\n onDelayedNodeClick?(event: TreeNodeEventArgs): void;\n /** Called when a tree node is double-clicked */\n onNodeDoubleClick?(event: TreeNodeEventArgs): void;\n /** Called when selected tree node editor is activated. */\n onNodeEditorActivated?(event: TreeNodeEventArgs): void;\n /**\n * Called when tree selection is modified.\n * If Subscription is returned it can be used to stop event handling by calling `unsubscribe()`.\n */\n onSelectionModified?(\n event: TreeSelectionModificationEventArgs\n ): Subscription | undefined;\n /**\n * Called when tree selection is replaced.\n * If Subscription is returned it can be used to stop event handling by calling `unsubscribe()`.\n */\n onSelectionReplaced?(\n event: TreeSelectionReplacementEventArgs\n ): Subscription | undefined;\n\n /**\n * Called when checkbox states for nodes are changed.\n * If Subscription is returned it can be used to stop event handling by calling `unsubscribe()`.\n */\n onCheckboxStateChanged?(\n event: TreeCheckboxStateChangeEventArgs\n ): Subscription | undefined;\n}\n\n/**\n * Data structure that describes tree node event payload.\n * @public\n */\nexport interface TreeNodeEventArgs {\n /** Id of node that is affected by event. */\n nodeId: string;\n}\n\n/**\n * Data structure that describes tree selection modification event payload.\n * @public\n */\nexport interface TreeSelectionModificationEventArgs {\n /**\n * An observable that emits tree selection changes.\n * It starts emitting values when '.subscribe()' is called.\n */\n modifications: Observable<TreeSelectionChange>;\n}\n\n/**\n * Data structure that describes tree selection change.\n * @public\n */\nexport interface TreeSelectionChange {\n /** Tree node items that where selected. */\n selectedNodeItems: TreeNodeItem[];\n /** Tree node items that where deselected. */\n deselectedNodeItems: TreeNodeItem[];\n}\n\n/**\n * Data structure that describes tree selection replacement event payload.\n * @public\n */\nexport interface TreeSelectionReplacementEventArgs {\n /**\n * An observable that emits tree selection replacements containing selected tree node items.\n * It starts emitting values when '.subscribe()' is called.\n */\n replacements: Observable<{ selectedNodeItems: TreeNodeItem[] }>;\n}\n\n/**\n * Data structure that describes tree checkbox state change event payload.\n * @public\n */\nexport interface TreeCheckboxStateChangeEventArgs {\n /**\n * An observable that emits checkbox state changes.\n * It starts emitting values when '.subscribe()' is called.\n */\n stateChanges: Observable<CheckboxStateChange[]>;\n}\n\n/**\n * Data structure that describes checkbox state change.\n * @public\n */\nexport interface CheckboxStateChange {\n /** Tree node item that was affected by checkbox state change. */\n nodeItem: TreeNodeItem;\n /** New state of the checkbox. */\n newState: CheckBoxState;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TreeEvents.js","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeEvents.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG","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/** @packageDocumentation\n * @module Tree\n */\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport type { CheckBoxState } from \"../../common/CheckBoxState.js\";\nimport type { TreeNodeItem } from \"../TreeDataProvider.js\";\nimport type { Observable, Subscription } from \"./Observable.js\";\n\n/**\n * Tree events that can occur while interacting with tree.\n *\n * **Note:** Selection and checkbox state change events payload is an Observable.\n * Observable is a stream of data over time (e.g. in case of selection replaced event\n * it is a stream of selected node items arrays). To access data inside stream `subscribe()` method\n * should be called. This method accepts any subset of 'next', 'error' and 'complete' callbacks.\n * Once subscribe is called observable will start emitting data and calls 'next' callback each time new\n * data is emitted. If some selected nodes are not loaded yet they will be loaded and observable will\n * emit loaded node items. When all selected node items are emitted observable completes and calls\n * 'complete' callback if supplied.\n *\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeEvents {\n /** Called when tree node is expanded. */\n onNodeExpanded?(event: TreeNodeEventArgs): void;\n /** Called when tree node is collapsed. */\n onNodeCollapsed?(event: TreeNodeEventArgs): void;\n /** Called when selected tree node is clicked. */\n onDelayedNodeClick?(event: TreeNodeEventArgs): void;\n /** Called when a tree node is double-clicked */\n onNodeDoubleClick?(event: TreeNodeEventArgs): void;\n /** Called when selected tree node editor is activated. */\n onNodeEditorActivated?(event: TreeNodeEventArgs): void;\n /**\n * Called when tree selection is modified.\n * If Subscription is returned it can be used to stop event handling by calling `unsubscribe()`.\n */\n onSelectionModified?(\n event: TreeSelectionModificationEventArgs\n ): Subscription | undefined;\n /**\n * Called when tree selection is replaced.\n * If Subscription is returned it can be used to stop event handling by calling `unsubscribe()`.\n */\n onSelectionReplaced?(\n event: TreeSelectionReplacementEventArgs\n ): Subscription | undefined;\n\n /**\n * Called when checkbox states for nodes are changed.\n * If Subscription is returned it can be used to stop event handling by calling `unsubscribe()`.\n */\n onCheckboxStateChanged?(\n event: TreeCheckboxStateChangeEventArgs\n ): Subscription | undefined;\n}\n\n/**\n * Data structure that describes tree node event payload.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeNodeEventArgs {\n /** Id of node that is affected by event. */\n nodeId: string;\n}\n\n/**\n * Data structure that describes tree selection modification event payload.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeSelectionModificationEventArgs {\n /**\n * An observable that emits tree selection changes.\n * It starts emitting values when '.subscribe()' is called.\n */\n modifications: Observable<TreeSelectionChange>;\n}\n\n/**\n * Data structure that describes tree selection change.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeSelectionChange {\n /** Tree node items that where selected. */\n selectedNodeItems: TreeNodeItem[];\n /** Tree node items that where deselected. */\n deselectedNodeItems: TreeNodeItem[];\n}\n\n/**\n * Data structure that describes tree selection replacement event payload.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeSelectionReplacementEventArgs {\n /**\n * An observable that emits tree selection replacements containing selected tree node items.\n * It starts emitting values when '.subscribe()' is called.\n */\n replacements: Observable<{ selectedNodeItems: TreeNodeItem[] }>;\n}\n\n/**\n * Data structure that describes tree checkbox state change event payload.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeCheckboxStateChangeEventArgs {\n /**\n * An observable that emits checkbox state changes.\n * It starts emitting values when '.subscribe()' is called.\n */\n stateChanges: Observable<CheckboxStateChange[]>;\n}\n\n/**\n * Data structure that describes checkbox state change.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface CheckboxStateChange {\n /** Tree node item that was affected by checkbox state change. */\n nodeItem: TreeNodeItem;\n /** New state of the checkbox. */\n newState: CheckBoxState;\n}\n"]}
|
|
@@ -12,6 +12,7 @@ import { PagedTreeNodeLoader, TreeNodeLoader } from "./TreeNodeLoader.js";
|
|
|
12
12
|
* `TreeModelSource`.
|
|
13
13
|
*
|
|
14
14
|
* @public
|
|
15
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
15
16
|
*/
|
|
16
17
|
export declare function useTreeModel(modelSource: TreeModelSource): TreeModel;
|
|
17
18
|
/**
|
|
@@ -19,12 +20,14 @@ export declare function useTreeModel(modelSource: TreeModelSource): TreeModel;
|
|
|
19
20
|
* loader pulls nodes from the data provider and puts them into the model source.
|
|
20
21
|
*
|
|
21
22
|
* @public
|
|
23
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
22
24
|
*/
|
|
23
25
|
export declare function useTreeNodeLoader<TDataProvider extends TreeDataProvider>(dataProvider: TDataProvider, modelSource: TreeModelSource): TreeNodeLoader<TDataProvider>;
|
|
24
26
|
/**
|
|
25
27
|
* Custom hook which creates a paging nodes' loader using the supplied data provider and model source. The loader pulls
|
|
26
28
|
* nodes from the data provider and puts them into the model source.
|
|
27
29
|
* @public
|
|
30
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
28
31
|
*/
|
|
29
32
|
export declare function usePagedTreeNodeLoader<TDataProvider extends TreeDataProvider>(dataProvider: TDataProvider, pageSize: number, modelSource: TreeModelSource): PagedTreeNodeLoader<TDataProvider>;
|
|
30
33
|
/**
|
|
@@ -34,6 +37,7 @@ export declare function usePagedTreeNodeLoader<TDataProvider extends TreeDataPro
|
|
|
34
37
|
* source whenever the data provider changes - that's the reason the hook takes a data provider.
|
|
35
38
|
*
|
|
36
39
|
* @public
|
|
40
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
37
41
|
*/
|
|
38
42
|
export declare function useTreeModelSource(dataProvider: TreeDataProvider): TreeModelSource;
|
|
39
43
|
/**
|
|
@@ -56,6 +60,7 @@ export declare function useTreeEventsHandler<TEventsHandler extends TreeEventHan
|
|
|
56
60
|
*
|
|
57
61
|
* @returns `undefined` on first render and a valid [[TreeEventHandler]] on all subsequent renders.
|
|
58
62
|
* @public
|
|
63
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
59
64
|
*/
|
|
60
65
|
export declare function useControlledTreeEventsHandler<TEventsHandler extends TreeEventHandler>(factoryOrParams: (() => TEventsHandler) | TreeEventHandlerParams): TreeEventHandler | undefined;
|
|
61
66
|
//# sourceMappingURL=TreeHooks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeHooks.d.ts","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeHooks.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"TreeHooks.d.ts","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeHooks.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,eAAe,GAAG,SAAS,CAUpE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,SAAS,gBAAgB,EACtE,YAAY,EAAE,aAAa,EAC3B,WAAW,EAAE,eAAe,iCAM7B;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,aAAa,SAAS,gBAAgB,EAC3E,YAAY,EAAE,aAAa,EAC3B,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,eAAe,sCAM7B;AAED;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,gBAAgB,mBAGhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,SAAS,gBAAgB,EAC1E,eAAe,EAAE,CAAC,MAAM,cAAc,CAAC,GAAG,sBAAsB,oBAOjE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,8BAA8B,CAC5C,cAAc,SAAS,gBAAgB,EACvC,eAAe,EAAE,CAAC,MAAM,cAAc,CAAC,GAAG,sBAAsB,gCAMjE"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Tree
|
|
7
7
|
*/
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
8
9
|
import { useCallback, useEffect, useMemo, useState } from "react";
|
|
9
10
|
import { useDisposable, useOptionalDisposable } from "@itwin/core-react";
|
|
10
11
|
import { TreeEventHandler } from "./TreeEventHandler.js";
|
|
@@ -15,6 +16,7 @@ import { PagedTreeNodeLoader, TreeNodeLoader } from "./TreeNodeLoader.js";
|
|
|
15
16
|
* `TreeModelSource`.
|
|
16
17
|
*
|
|
17
18
|
* @public
|
|
19
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
18
20
|
*/
|
|
19
21
|
export function useTreeModel(modelSource) {
|
|
20
22
|
const [_, setState] = useState({});
|
|
@@ -32,6 +34,7 @@ export function useTreeModel(modelSource) {
|
|
|
32
34
|
* loader pulls nodes from the data provider and puts them into the model source.
|
|
33
35
|
*
|
|
34
36
|
* @public
|
|
37
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
35
38
|
*/
|
|
36
39
|
export function useTreeNodeLoader(dataProvider, modelSource) {
|
|
37
40
|
return useMemo(() => new TreeNodeLoader(dataProvider, modelSource), [dataProvider, modelSource]);
|
|
@@ -40,6 +43,7 @@ export function useTreeNodeLoader(dataProvider, modelSource) {
|
|
|
40
43
|
* Custom hook which creates a paging nodes' loader using the supplied data provider and model source. The loader pulls
|
|
41
44
|
* nodes from the data provider and puts them into the model source.
|
|
42
45
|
* @public
|
|
46
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
43
47
|
*/
|
|
44
48
|
export function usePagedTreeNodeLoader(dataProvider, pageSize, modelSource) {
|
|
45
49
|
return useMemo(() => new PagedTreeNodeLoader(dataProvider, modelSource, pageSize), [dataProvider, modelSource, pageSize]);
|
|
@@ -51,6 +55,7 @@ export function usePagedTreeNodeLoader(dataProvider, pageSize, modelSource) {
|
|
|
51
55
|
* source whenever the data provider changes - that's the reason the hook takes a data provider.
|
|
52
56
|
*
|
|
53
57
|
* @public
|
|
58
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
54
59
|
*/
|
|
55
60
|
export function useTreeModelSource(dataProvider) {
|
|
56
61
|
// need to create new model source every time data provider changes although it does not need data provider to be created.
|
|
@@ -72,7 +77,6 @@ export function useTreeEventsHandler(factoryOrParams) {
|
|
|
72
77
|
return factoryOrParams();
|
|
73
78
|
return new TreeEventHandler(factoryOrParams);
|
|
74
79
|
}, [factoryOrParams]);
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
76
80
|
return useDisposable(factory);
|
|
77
81
|
}
|
|
78
82
|
/**
|
|
@@ -84,6 +88,7 @@ export function useTreeEventsHandler(factoryOrParams) {
|
|
|
84
88
|
*
|
|
85
89
|
* @returns `undefined` on first render and a valid [[TreeEventHandler]] on all subsequent renders.
|
|
86
90
|
* @public
|
|
91
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
87
92
|
*/
|
|
88
93
|
export function useControlledTreeEventsHandler(factoryOrParams) {
|
|
89
94
|
const factory = useCallback(() => {
|
|
@@ -91,7 +96,6 @@ export function useControlledTreeEventsHandler(factoryOrParams) {
|
|
|
91
96
|
return factoryOrParams();
|
|
92
97
|
return new TreeEventHandler(factoryOrParams);
|
|
93
98
|
}, [factoryOrParams]);
|
|
94
|
-
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
95
99
|
return useOptionalDisposable(factory);
|
|
96
100
|
}
|
|
97
101
|
//# sourceMappingURL=TreeHooks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeHooks.js","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeHooks.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E
|
|
1
|
+
{"version":3,"file":"TreeHooks.js","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeHooks.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,qDAAqD;AAErD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAGzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,UAAU,YAAY,CAAC,WAA4B;IACvD,MAAM,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACnC,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,WAAW,GAAG,GAAG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AAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,8BAA8B,CAE5C,eAAgE;IAChE,MAAM,OAAO,GAAG,WAAW,CAAC,GAAqB,EAAE;QACjD,IAAI,OAAO,eAAe,KAAK,UAAU;YAAE,OAAO,eAAe,EAAE,CAAC;QACpE,OAAO,IAAI,gBAAgB,CAAC,eAAe,CAAC,CAAC;IAC/C,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,CAAC;IACtB,OAAO,qBAAqB,CAAC,OAAO,CAAC,CAAC;AACxC,CAAC","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/** @packageDocumentation\n * @module Tree\n */\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport { useCallback, useEffect, useMemo, useState } from \"react\";\nimport { useDisposable, useOptionalDisposable } from \"@itwin/core-react\";\nimport type { TreeDataProvider } from \"../TreeDataProvider.js\";\nimport type { TreeEventHandlerParams } from \"./TreeEventHandler.js\";\nimport { TreeEventHandler } from \"./TreeEventHandler.js\";\nimport type { TreeModel } from \"./TreeModel.js\";\nimport { TreeModelSource } from \"./TreeModelSource.js\";\nimport { PagedTreeNodeLoader, TreeNodeLoader } from \"./TreeNodeLoader.js\";\n\n/**\n * React hook that returns an immutable `TreeModel` whenever it changes in the given\n * `TreeModelSource`.\n *\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function useTreeModel(modelSource: TreeModelSource): TreeModel {\n const [_, setState] = useState({});\n useEffect(() => {\n const forceRender = () => setState({});\n // force one more render when `modelSource` changes in case there were some tree model modifications\n // before listener is added on `onModelChanged` event.\n forceRender();\n return modelSource.onModelChanged.addListener(forceRender);\n }, [modelSource]);\n return modelSource.getModel();\n}\n\n/**\n * Custom hook which creates a nodes' loader using the supplied data provider and model source. The\n * loader pulls nodes from the data provider and puts them into the model source.\n *\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function useTreeNodeLoader<TDataProvider extends TreeDataProvider>(\n dataProvider: TDataProvider,\n modelSource: TreeModelSource\n) {\n return useMemo(\n () => new TreeNodeLoader(dataProvider, modelSource),\n [dataProvider, modelSource]\n );\n}\n\n/**\n * Custom hook which creates a paging nodes' loader using the supplied data provider and model source. The loader pulls\n * nodes from the data provider and puts them into the model source.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function usePagedTreeNodeLoader<TDataProvider extends TreeDataProvider>(\n dataProvider: TDataProvider,\n pageSize: number,\n modelSource: TreeModelSource\n) {\n return useMemo(\n () => new PagedTreeNodeLoader(dataProvider, modelSource, pageSize),\n [dataProvider, modelSource, pageSize]\n );\n}\n\n/**\n * Custom hook which creates a `TreeModelSource`.\n *\n * @note The model source has no direct dependency on the data provider, but we want a fresh model\n * source whenever the data provider changes - that's the reason the hook takes a data provider.\n *\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function useTreeModelSource(dataProvider: TreeDataProvider) {\n // need to create new model source every time data provider changes although it does not need data provider to be created.\n return useMemo(() => new TreeModelSource(), [dataProvider]); // eslint-disable-line react-hooks/exhaustive-deps\n}\n\n/**\n * Custom hook which creates and takes care of disposing a TreeEventsHandler. The input is either a factory method\n * for a custom `TreeEventHandler` implementation or parameters for the default implementation.\n *\n * @note Caller must ensure `factoryOrParams` changes only when a new handler needs to be created. `useCallback` or `useMemo` can\n * be used for that purpose based on whether the input is a factory function or params object.\n *\n * @public\n * @deprecated in 4.9.0. This hook does not work correctly in React 18 Strict mode. Use [[useControlledTreeEventsHandler]] instead.\n */\nexport function useTreeEventsHandler<TEventsHandler extends TreeEventHandler>(\n factoryOrParams: (() => TEventsHandler) | TreeEventHandlerParams\n) {\n const factory = useCallback((): TreeEventHandler => {\n if (typeof factoryOrParams === \"function\") return factoryOrParams();\n return new TreeEventHandler(factoryOrParams);\n }, [factoryOrParams]);\n return useDisposable(factory);\n}\n\n/**\n * Custom hook which creates and takes care of disposing a [[TreeEventHandler]]. The input is either a factory method\n * for a custom [[TreeEventHandler]] implementation or parameters for the default implementation.\n *\n * @note Caller must ensure `factoryOrParams` changes only when a new handler needs to be created. `useCallback` or `useMemo` can\n * be used for that purpose based on whether the input is a factory function or params object.\n *\n * @returns `undefined` on first render and a valid [[TreeEventHandler]] on all subsequent renders.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function useControlledTreeEventsHandler<\n TEventsHandler extends TreeEventHandler\n>(factoryOrParams: (() => TEventsHandler) | TreeEventHandlerParams) {\n const factory = useCallback((): TreeEventHandler => {\n if (typeof factoryOrParams === \"function\") return factoryOrParams();\n return new TreeEventHandler(factoryOrParams);\n }, [factoryOrParams]);\n return useOptionalDisposable(factory);\n}\n"]}
|
|
@@ -9,6 +9,7 @@ import { CheckBoxState } from "../../common/CheckBoxState.js";
|
|
|
9
9
|
/**
|
|
10
10
|
* Immutable data structure that describes tree node.
|
|
11
11
|
* @public
|
|
12
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
12
13
|
*/
|
|
13
14
|
export interface TreeModelNode {
|
|
14
15
|
readonly id: string;
|
|
@@ -29,6 +30,7 @@ export interface TreeModelNode {
|
|
|
29
30
|
/**
|
|
30
31
|
* Immutable data structure that describes checkbox info.
|
|
31
32
|
* @public
|
|
33
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
32
34
|
*/
|
|
33
35
|
export interface CheckBoxInfo {
|
|
34
36
|
readonly state: CheckBoxState;
|
|
@@ -39,6 +41,7 @@ export interface CheckBoxInfo {
|
|
|
39
41
|
/**
|
|
40
42
|
* Mutable data structure that describes tree node.
|
|
41
43
|
* @public
|
|
44
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
42
45
|
*/
|
|
43
46
|
export interface MutableTreeModelNode extends TreeModelNode {
|
|
44
47
|
isLoading: boolean;
|
|
@@ -55,6 +58,7 @@ export interface MutableTreeModelNode extends TreeModelNode {
|
|
|
55
58
|
/**
|
|
56
59
|
* Data structure that holds callbacks used for tree node editing.
|
|
57
60
|
* @public
|
|
61
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
58
62
|
*/
|
|
59
63
|
export interface TreeModelNodeEditingInfo {
|
|
60
64
|
onCommit: (node: TreeModelNode, newValue: string) => void;
|
|
@@ -63,6 +67,7 @@ export interface TreeModelNodeEditingInfo {
|
|
|
63
67
|
/**
|
|
64
68
|
* Mutable data structure that describes checkbox info.
|
|
65
69
|
* @public
|
|
70
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
66
71
|
*/
|
|
67
72
|
export interface MutableCheckBoxInfo extends CheckBoxInfo {
|
|
68
73
|
state: CheckBoxState;
|
|
@@ -73,6 +78,7 @@ export interface MutableCheckBoxInfo extends CheckBoxInfo {
|
|
|
73
78
|
/**
|
|
74
79
|
* Data structure that describes tree node placeholder.
|
|
75
80
|
* @public
|
|
81
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
76
82
|
*/
|
|
77
83
|
export interface TreeModelNodePlaceholder {
|
|
78
84
|
readonly childIndex: number;
|
|
@@ -82,6 +88,7 @@ export interface TreeModelNodePlaceholder {
|
|
|
82
88
|
/**
|
|
83
89
|
* Data structure that describes tree root node.
|
|
84
90
|
* @public
|
|
91
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
85
92
|
*/
|
|
86
93
|
export interface TreeModelRootNode {
|
|
87
94
|
readonly depth: -1;
|
|
@@ -91,6 +98,7 @@ export interface TreeModelRootNode {
|
|
|
91
98
|
/**
|
|
92
99
|
* Data structure that describes input used to create tree node.
|
|
93
100
|
* @public
|
|
101
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
94
102
|
*/
|
|
95
103
|
export interface TreeModelNodeInput {
|
|
96
104
|
readonly description?: string;
|
|
@@ -105,31 +113,37 @@ export interface TreeModelNodeInput {
|
|
|
105
113
|
/**
|
|
106
114
|
* Type definition of all tree model nodes.
|
|
107
115
|
* @public
|
|
116
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
108
117
|
*/
|
|
109
118
|
export type TreeModelNodeType = TreeModelNode | TreeModelNodePlaceholder | TreeModelRootNode;
|
|
110
119
|
/**
|
|
111
120
|
* Checks if object is [[TreeModelNode]]
|
|
112
121
|
* @public
|
|
122
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
113
123
|
*/
|
|
114
124
|
export declare function isTreeModelNode(obj: TreeModelNodeType | undefined): obj is TreeModelNode;
|
|
115
125
|
/**
|
|
116
126
|
* Checks if object is [[TreeModelNodePlaceholder]]
|
|
117
127
|
* @public
|
|
128
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
118
129
|
*/
|
|
119
130
|
export declare function isTreeModelNodePlaceholder(obj: TreeModelNodeType | undefined): obj is TreeModelNodePlaceholder;
|
|
120
131
|
/**
|
|
121
132
|
* Checks if object is [[TreeModelRootNode]]
|
|
122
133
|
* @public
|
|
134
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
123
135
|
*/
|
|
124
136
|
export declare function isTreeModelRootNode(obj: TreeModelNodeType | undefined): obj is TreeModelRootNode;
|
|
125
137
|
/**
|
|
126
138
|
* Type definition of tree node item data.
|
|
127
139
|
* @public
|
|
140
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
128
141
|
*/
|
|
129
142
|
export type TreeNodeItemData = ImmediatelyLoadedTreeNodeItem & DelayLoadedTreeNodeItem;
|
|
130
143
|
/**
|
|
131
144
|
* Data structure that describes set of visible tree nodes as a flat list.
|
|
132
145
|
* @public
|
|
146
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
133
147
|
*/
|
|
134
148
|
export interface VisibleTreeNodes extends Iterable<TreeModelNode | TreeModelNodePlaceholder> {
|
|
135
149
|
getNumNodes(): number;
|
|
@@ -141,6 +155,7 @@ export interface VisibleTreeNodes extends Iterable<TreeModelNode | TreeModelNode
|
|
|
141
155
|
/**
|
|
142
156
|
* Data structure that describes tree model.
|
|
143
157
|
* @public
|
|
158
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
144
159
|
*/
|
|
145
160
|
export interface TreeModel {
|
|
146
161
|
getRootNode(): TreeModelRootNode;
|
|
@@ -154,6 +169,7 @@ export interface TreeModel {
|
|
|
154
169
|
/**
|
|
155
170
|
* Mutable tree model which holds nodes and allows adding or removing them.
|
|
156
171
|
* @public
|
|
172
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
157
173
|
*/
|
|
158
174
|
export declare class MutableTreeModel implements TreeModel {
|
|
159
175
|
[immerable]: boolean;
|
|
@@ -220,11 +236,13 @@ export declare class MutableTreeModel implements TreeModel {
|
|
|
220
236
|
/**
|
|
221
237
|
* Generates flat list of visible nodes in the tree model.
|
|
222
238
|
* @public
|
|
239
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
223
240
|
*/
|
|
224
241
|
export declare function computeVisibleNodes(model: TreeModel): VisibleTreeNodes;
|
|
225
242
|
/**
|
|
226
243
|
* Traverses the tree and collects visible descendants.
|
|
227
244
|
* @public
|
|
245
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
228
246
|
*/
|
|
229
247
|
export declare function getVisibleDescendants(model: TreeModel, parentNode: TreeModelNode | TreeModelRootNode, result?: Array<TreeModelNode | TreeModelNodePlaceholder>): Array<TreeModelNode | TreeModelNodePlaceholder>;
|
|
230
248
|
//# sourceMappingURL=TreeModel.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeModel.d.ts","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeModel.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"TreeModel.d.ts","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeModel.ts"],"names":[],"mappings":"AAIA;;GAEG;AAIH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EACV,uBAAuB,EACvB,6BAA6B,EAC7B,YAAY,EACb,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IAEzC,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC;IAC/B,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAEvC,+FAA+F;IAC/F,QAAQ,CAAC,WAAW,CAAC,EAAE,wBAAwB,CAAC;IAEhD,QAAQ,CAAC,QAAQ,EAAE,YAAY,CAAC;IAEhC,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;CA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BAAgB,CAkBtE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,aAAa,GAAG,iBAAiB,EAC7C,MAAM,GAAE,KAAK,CAAC,aAAa,GAAG,wBAAwB,CAAM,GAC3D,KAAK,CAAC,aAAa,GAAG,wBAAwB,CAAC,CAkCjD"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
/** @packageDocumentation
|
|
6
6
|
* @module Tree
|
|
7
7
|
*/
|
|
8
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
8
9
|
import { immerable } from "immer";
|
|
9
10
|
import cloneDeep from "lodash/cloneDeep.js";
|
|
10
11
|
import { assert } from "@itwin/core-bentley";
|
|
@@ -13,6 +14,7 @@ import { CheckBoxState } from "../../common/CheckBoxState.js";
|
|
|
13
14
|
/**
|
|
14
15
|
* Checks if object is [[TreeModelNode]]
|
|
15
16
|
* @public
|
|
17
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
16
18
|
*/
|
|
17
19
|
export function isTreeModelNode(obj) {
|
|
18
20
|
return (obj !== undefined &&
|
|
@@ -22,6 +24,7 @@ export function isTreeModelNode(obj) {
|
|
|
22
24
|
/**
|
|
23
25
|
* Checks if object is [[TreeModelNodePlaceholder]]
|
|
24
26
|
* @public
|
|
27
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
25
28
|
*/
|
|
26
29
|
export function isTreeModelNodePlaceholder(obj) {
|
|
27
30
|
return obj !== undefined && "childIndex" in obj;
|
|
@@ -29,6 +32,7 @@ export function isTreeModelNodePlaceholder(obj) {
|
|
|
29
32
|
/**
|
|
30
33
|
* Checks if object is [[TreeModelRootNode]]
|
|
31
34
|
* @public
|
|
35
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
32
36
|
*/
|
|
33
37
|
export function isTreeModelRootNode(obj) {
|
|
34
38
|
return (obj !== undefined &&
|
|
@@ -38,6 +42,7 @@ export function isTreeModelRootNode(obj) {
|
|
|
38
42
|
/**
|
|
39
43
|
* Mutable tree model which holds nodes and allows adding or removing them.
|
|
40
44
|
* @public
|
|
45
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
41
46
|
*/
|
|
42
47
|
export class MutableTreeModel {
|
|
43
48
|
[immerable] = true;
|
|
@@ -277,6 +282,7 @@ export class MutableTreeModel {
|
|
|
277
282
|
/**
|
|
278
283
|
* Generates flat list of visible nodes in the tree model.
|
|
279
284
|
* @public
|
|
285
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
280
286
|
*/
|
|
281
287
|
export function computeVisibleNodes(model) {
|
|
282
288
|
const result = getVisibleDescendants(model, model.getRootNode());
|
|
@@ -296,6 +302,7 @@ export function computeVisibleNodes(model) {
|
|
|
296
302
|
/**
|
|
297
303
|
* Traverses the tree and collects visible descendants.
|
|
298
304
|
* @public
|
|
305
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
299
306
|
*/
|
|
300
307
|
export function getVisibleDescendants(model, parentNode, result = []) {
|
|
301
308
|
const children = model.getChildren(parentNode.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeModel.js","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAQ7C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AA4H9D;;;GAGG;AACH,MAAM,UAAU,eAAe,CAC7B,GAAkC;IAElC,OAAO,CACL,GAAG,KAAK,SAAS;QACjB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AC;YACH,CAAC;QACH,CAAC;QACD,EAAE,KAAK,CAAC;IACV,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAS,YAAY,CACnB,MAAiB,EACjB,MAAwB,EACxB,QAA4B;IAE5B,MAAM,CAAC,cAAc,CACnB,QAAQ,EACR,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAE,CAAC;SACxE,WAAW,CACf,CAAC;IACF,KAAK,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,MAAM;SAClC,WAAW,CAAC,QAAQ,CAAC;QACtB,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAE,CAAC;QACtC,MAAM,CAAC,WAAW,CAChB,QAAQ,EACR,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAC1C,KAAK,CACN,CAAC;QACF,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;AACH,CAAC","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/** @packageDocumentation\n * @module Tree\n */\n\nimport { immerable } from \"immer\";\nimport cloneDeep from \"lodash/cloneDeep.js\";\nimport { assert } from \"@itwin/core-bentley\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n DelayLoadedTreeNodeItem,\n ImmediatelyLoadedTreeNodeItem,\n TreeNodeItem,\n} from \"../TreeDataProvider.js\";\nimport type { SparseArray } from \"./internal/SparseTree.js\";\nimport { SparseTree } from \"./internal/SparseTree.js\";\nimport { CheckBoxState } from \"../../common/CheckBoxState.js\";\n\n/**\n * Immutable data structure that describes tree node.\n * @public\n */\nexport interface TreeModelNode {\n readonly id: string;\n readonly parentId: string | undefined;\n readonly depth: number;\n\n readonly isLoading?: boolean;\n readonly numChildren: number | undefined;\n\n readonly description: string | undefined;\n readonly isExpanded: boolean;\n readonly label: PropertyRecord;\n readonly isSelected: boolean;\n readonly isSelectionDisabled?: boolean;\n\n /** Specifies that node is in editing mode. It holds callbacks that are used by node editor. */\n readonly editingInfo?: TreeModelNodeEditingInfo;\n\n readonly checkbox: CheckBoxInfo;\n\n readonly item: TreeNodeItem;\n}\n\n/**\n * Immutable data structure that describes checkbox info.\n * @public\n */\nexport interface CheckBoxInfo {\n readonly state: CheckBoxState;\n readonly tooltip?: string;\n readonly isDisabled: boolean;\n readonly isVisible: boolean;\n}\n\n/**\n * Mutable data structure that describes tree node.\n * @public\n */\nexport interface MutableTreeModelNode extends TreeModelNode {\n isLoading: boolean;\n\n description: string;\n isExpanded: boolean;\n label: PropertyRecord;\n isSelected: boolean;\n isSelectionDisabled?: boolean;\n\n /** Specifies that node is in editing mode. It holds callbacks that are used by node editor. */\n editingInfo?: TreeModelNodeEditingInfo;\n\n checkbox: MutableCheckBoxInfo;\n\n item: TreeNodeItem;\n}\n\n/**\n * Data structure that holds callbacks used for tree node editing.\n * @public\n */\nexport interface TreeModelNodeEditingInfo {\n onCommit: (node: TreeModelNode, newValue: string) => void;\n onCancel: () => void;\n}\n\n/**\n * Mutable data structure that describes checkbox info.\n * @public\n */\nexport interface MutableCheckBoxInfo extends CheckBoxInfo {\n state: CheckBoxState;\n tooltip?: string;\n isDisabled: boolean;\n isVisible: boolean;\n}\n\n/**\n * Data structure that describes tree node placeholder.\n * @public\n */\nexport interface TreeModelNodePlaceholder {\n readonly childIndex: number;\n readonly depth: number;\n readonly parentId?: string;\n}\n\n/**\n * Data structure that describes tree root node.\n * @public\n */\nexport interface TreeModelRootNode {\n readonly depth: -1;\n readonly id: undefined;\n readonly numChildren: number | undefined;\n}\n\n/**\n * Data structure that describes input used to create tree node.\n * @public\n */\nexport interface TreeModelNodeInput {\n readonly description?: string;\n readonly isExpanded: boolean;\n readonly id: string;\n readonly item: TreeNodeItem;\n readonly label: PropertyRecord;\n readonly isLoading: boolean;\n readonly numChildren?: number;\n readonly isSelected: boolean;\n}\n\n/**\n * Type definition of all tree model nodes.\n * @public\n */\nexport type TreeModelNodeType =\n | TreeModelNode\n | TreeModelNodePlaceholder\n | TreeModelRootNode;\n\n/**\n * Checks if object is [[TreeModelNode]]\n * @public\n */\nexport function isTreeModelNode(\n obj: TreeModelNodeType | undefined\n): obj is TreeModelNode {\n return (\n obj !== undefined &&\n !isTreeModelNodePlaceholder(obj) &&\n !isTreeModelRootNode(obj)\n );\n}\n\n/**\n * Checks if object is [[TreeModelNodePlaceholder]]\n * @public\n */\nexport function isTreeModelNodePlaceholder(\n obj: TreeModelNodeType | undefined\n): obj is TreeModelNodePlaceholder {\n return obj !== undefined && \"childIndex\" in obj;\n}\n\n/**\n * Checks if object is [[TreeModelRootNode]]\n * @public\n */\nexport function isTreeModelRootNode(\n obj: TreeModelNodeType | undefined\n): obj is TreeModelRootNode {\n return (\n obj !== undefined &&\n (obj as TreeModelRootNode).id === undefined &&\n !(\"childIndex\" in obj)\n );\n}\n\n/**\n * Type definition of tree node item data.\n * @public\n */\nexport type TreeNodeItemData = ImmediatelyLoadedTreeNodeItem &\n DelayLoadedTreeNodeItem;\n\n/**\n * Data structure that describes set of visible tree nodes as a flat list.\n * @public\n */\nexport interface VisibleTreeNodes\n extends Iterable<TreeModelNode | TreeModelNodePlaceholder> {\n getNumNodes(): number;\n getAtIndex(\n index: number\n ): TreeModelNode | TreeModelNodePlaceholder | undefined;\n getModel(): TreeModel;\n getNumRootNodes(): number | undefined;\n getIndexOfNode(nodeId: string): number;\n}\n\n/**\n * Data structure that describes tree model.\n * @public\n */\nexport interface TreeModel {\n getRootNode(): TreeModelRootNode;\n\n getNode(id: string): TreeModelNode | undefined;\n getNode(\n parentId: string | undefined,\n childIndex: number\n ): TreeModelNode | TreeModelNodePlaceholder | undefined;\n getNode(\n nodeId: string | undefined,\n childIndex?: number\n ): TreeModelNode | TreeModelNodePlaceholder | TreeModelRootNode | undefined;\n\n getChildren(parentId: string | undefined): SparseArray<string> | undefined;\n getChildOffset(\n parentId: string | undefined,\n childId: string\n ): number | undefined;\n\n iterateTreeModelNodes(parentId?: string): IterableIterator<TreeModelNode>;\n}\n\n/**\n * Mutable tree model which holds nodes and allows adding or removing them.\n * @public\n */\nexport class MutableTreeModel implements TreeModel {\n public [immerable] = true;\n\n private _tree = new SparseTree<MutableTreeModelNode>();\n private _rootNode: TreeModelRootNode = {\n depth: -1,\n id: undefined,\n numChildren: undefined,\n };\n\n public constructor(seed?: TreeModel) {\n if (!seed) {\n return;\n }\n\n cloneSubtree(seed, this, undefined);\n }\n\n /** Returns root node of a tree. This node is not visible and is there to allow having multiple visible root nodes. */\n public getRootNode(): TreeModelRootNode {\n return this._rootNode;\n }\n\n /** Returns tree node or placeholder for node that is not loaded yet.\n * @returns node, node placeholder or undefined if node is not found in model.\n */\n public getNode(id: string): MutableTreeModelNode | undefined;\n public getNode(\n parentId: string | undefined,\n childIndex: number\n ): MutableTreeModelNode | TreeModelNodePlaceholder | undefined;\n public getNode(\n nodeId: string | undefined,\n childIndex?: number\n ): MutableTreeModelNode | TreeModelNodePlaceholder | undefined {\n if (childIndex === undefined) {\n return this._tree.getNode(nodeId!);\n }\n\n const children = this._tree.getChildren(nodeId);\n const childId =\n children !== undefined ? children.get(childIndex) : undefined;\n if (childId !== undefined) {\n return this._tree.getNode(childId);\n }\n\n const parentNode =\n nodeId === undefined ? this._rootNode : this._tree.getNode(nodeId);\n if (parentNode !== undefined) {\n return {\n childIndex,\n depth: parentNode.depth + 1,\n parentId: nodeId,\n };\n }\n\n return undefined;\n }\n\n /** Returns children for specific parent.\n * @param parentId id of parent node.\n * @returns children of parent node or root nodes if undefined is passed as parent id.\n */\n public getChildren(\n parentId: string | undefined\n ): SparseArray<string> | undefined {\n return this._tree.getChildren(parentId);\n }\n\n /** Returns children offset in children array for specific parent. */\n public getChildOffset(\n parentId: string | undefined,\n childId: string\n ): number | undefined {\n return this._tree.getChildOffset(parentId, childId);\n }\n\n /**\n * Sets children for parent node starting from the specific offset.\n * If offset overlaps with already added nodes, the overlapping nodes are overwritten.\n */\n public setChildren(\n parentId: string | undefined,\n nodeInputs: TreeModelNodeInput[],\n offset: number\n ): void {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n if (parentNode === undefined) return;\n\n const children: MutableTreeModelNode[] = [];\n for (const input of nodeInputs) {\n const child = MutableTreeModel.createTreeModelNode(parentNode, input);\n children.push(child);\n }\n\n this._tree.setChildren(parentNode.id, children, offset);\n MutableTreeModel.setNumChildrenForNode(\n parentNode,\n this._tree.getChildren(parentNode.id)\n );\n }\n\n /**\n * Inserts child in the specified position.\n * If offset is higher then current length of children array, the length is increased.\n */\n public insertChild(\n parentId: string | undefined,\n childNodeInput: TreeModelNodeInput,\n offset: number\n ): void {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n if (parentNode === undefined) return;\n\n const child = MutableTreeModel.createTreeModelNode(\n parentNode,\n childNodeInput\n );\n\n this._tree.insertChild(parentNode.id, child, offset);\n MutableTreeModel.setNumChildrenForNode(\n parentNode,\n this._tree.getChildren(parentNode.id)\n );\n }\n\n /**\n * Changes the id of target node.\n * @returns `true` on success, `false` otherwise.\n */\n public changeNodeId(currentId: string, newId: string): boolean {\n const node = this.getNode(currentId);\n if (node === undefined) {\n return false;\n }\n\n if (currentId === newId) {\n return true;\n }\n\n const index = this.getChildOffset(node.parentId, currentId);\n assert(index !== undefined);\n\n if (!this._tree.setNodeId(node.parentId, index, newId)) {\n return false;\n }\n\n (node.id as string) = newId; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion\n for (const [childId] of this.getChildren(newId)?.iterateValues() ?? []) {\n const child = this.getNode(childId);\n assert(child !== undefined);\n (child.parentId as string) = newId;\n }\n\n return true;\n }\n\n /**\n * Transfers node along with its children to a new location. Fails if destination has undefined child count.\n * @param sourceNodeId Node that is being moved.\n * @param targetParentId Node that will receive a new child.\n * @param targetIndex Insertion location among target's *current* children.\n * @returns `true` on success, `false` otherwise.\n */\n public moveNode(\n sourceNodeId: string,\n targetParentId: string | undefined,\n targetIndex: number\n ): boolean {\n const sourceNode = this.getNode(sourceNodeId);\n if (sourceNode === undefined) {\n return false;\n }\n\n const targetParent =\n targetParentId === undefined\n ? this._rootNode\n : this.getNode(targetParentId);\n if (targetParent === undefined || targetParent.numChildren === undefined) {\n return false;\n }\n\n if (\n targetParentId !== undefined &&\n this.areNodesRelated(sourceNodeId, targetParentId)\n ) {\n return false;\n }\n\n this._tree.moveNode(\n sourceNode.parentId,\n sourceNodeId,\n targetParentId,\n targetIndex\n );\n\n const sourceParent =\n sourceNode.parentId === undefined\n ? this._rootNode\n : this.getNode(sourceNode.parentId);\n assert(sourceParent !== undefined);\n MutableTreeModel.setNumChildrenForNode(\n sourceParent,\n this._tree.getChildren(sourceNode.parentId)\n );\n MutableTreeModel.setNumChildrenForNode(\n targetParent,\n this._tree.getChildren(targetParentId)\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (sourceNode.parentId as string | undefined) = targetParentId;\n\n const updateDepths = (parentId: string, depth: number) => {\n const node = this.getNode(parentId);\n assert(node !== undefined);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (node.depth as number) = depth;\n for (const [nodeId] of this.getChildren(parentId)?.iterateValues() ??\n []) {\n updateDepths(nodeId, depth + 1);\n }\n };\n\n updateDepths(sourceNodeId, targetParent.depth + 1);\n return true;\n }\n\n private areNodesRelated(\n ancestorNodeId: string,\n descendantNodeId: string\n ): boolean {\n const node = this.getNode(descendantNodeId);\n if (node === undefined || node.parentId === undefined) {\n return false;\n }\n\n return node.parentId === ancestorNodeId\n ? true\n : this.areNodesRelated(ancestorNodeId, node.parentId);\n }\n\n /**\n * Sets the number of child nodes a parent is expected to contain. All child nodes of this parent will be subsequently\n * removed.\n */\n public setNumChildren(\n parentId: string | undefined,\n numChildren: number | undefined\n ): void {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n if (parentNode === undefined) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (parentNode.numChildren as number | undefined) = numChildren;\n this._tree.setNumChildren(parentId, numChildren ?? 0);\n }\n\n /** Removes children specified by id.\n * @param parentId id of the parent node.\n * @param child child node id or index that should be removed.\n */\n public removeChild(\n parentId: string | undefined,\n child: string | number\n ): void {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n this._tree.removeChild(parentId, child);\n\n if (parentNode)\n MutableTreeModel.setNumChildrenForNode(\n parentNode,\n this._tree.getChildren(parentNode.id)\n );\n }\n\n /** Removes all children for parent specified by id.\n * @param parentId id of parent node or undefined to remove root nodes.\n */\n public clearChildren(parentId: string | undefined) {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n if (parentNode !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (parentNode.numChildren as number | undefined) = undefined;\n }\n this._tree.deleteSubtree(parentId, false);\n }\n\n /** Iterates over all nodes present in the tree model. */\n public *iterateTreeModelNodes(\n parentId?: string\n ): IterableIterator<MutableTreeModelNode> {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n function* iterateDescendants(\n subParentId: string | undefined\n ): IterableIterator<MutableTreeModelNode> {\n const children = _this.getChildren(subParentId);\n if (children === undefined) {\n return;\n }\n\n for (const [nodeId] of children.iterateValues()) {\n const node = _this.getNode(nodeId);\n if (node !== undefined) {\n yield node;\n yield* iterateDescendants(nodeId);\n }\n }\n }\n\n yield* iterateDescendants(parentId);\n }\n\n private static setNumChildrenForNode(\n node: TreeModelRootNode | MutableTreeModelNode,\n children: SparseArray<string> | undefined\n ) {\n const numChildren = children ? children.getLength() : undefined;\n if (node.numChildren === numChildren) return;\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (node.numChildren as number | undefined) = numChildren;\n }\n\n private static createTreeModelNode(\n parentNode: TreeModelNode | TreeModelRootNode,\n input: TreeModelNodeInput\n ): MutableTreeModelNode {\n return {\n id: input.id,\n parentId: parentNode.id,\n depth: parentNode.depth + 1,\n\n isLoading: input.isLoading,\n numChildren: input.numChildren,\n\n description: input.description || \"\",\n isExpanded: input.isExpanded,\n label: input.label,\n isSelected: input.isSelected,\n isSelectionDisabled: input.item.isSelectionDisabled,\n\n checkbox: {\n state: input.item.checkBoxState || CheckBoxState.Off,\n isDisabled: !!input.item.isCheckboxDisabled,\n isVisible: !!input.item.isCheckboxVisible,\n },\n\n item: cloneDeep(input.item),\n };\n }\n}\n\n/**\n * Generates flat list of visible nodes in the tree model.\n * @public\n */\nexport function computeVisibleNodes(model: TreeModel): VisibleTreeNodes {\n const result = getVisibleDescendants(model, model.getRootNode());\n return {\n getNumNodes: () => result.length,\n getAtIndex: (\n index: number\n ): TreeModelNode | TreeModelNodePlaceholder | undefined => {\n return result[index];\n },\n getModel: () => model,\n getNumRootNodes: () => model.getRootNode().numChildren,\n [Symbol.iterator]: () => result[Symbol.iterator](),\n getIndexOfNode: (nodeId: string): number => {\n return result.findIndex(\n (visibleNode) => (visibleNode as TreeModelNode).id === nodeId\n );\n },\n };\n}\n\n/**\n * Traverses the tree and collects visible descendants.\n * @public\n */\nexport function getVisibleDescendants(\n model: TreeModel,\n parentNode: TreeModelNode | TreeModelRootNode,\n result: Array<TreeModelNode | TreeModelNodePlaceholder> = []\n): Array<TreeModelNode | TreeModelNodePlaceholder> {\n const children = model.getChildren(parentNode.id);\n if (!children) {\n return result;\n }\n\n let index = 0;\n for (const childId of children) {\n if (childId === undefined) {\n result.push({\n parentId: parentNode.id,\n depth: parentNode.depth + 1,\n childIndex: index,\n });\n } else {\n const childNode = model.getNode(childId);\n if (childNode === undefined) {\n // node was disposed\n result.push({\n parentId: parentNode.id,\n depth: parentNode.depth + 1,\n childIndex: index,\n });\n } else {\n result.push(childNode);\n if (childNode.isExpanded && childNode.numChildren !== undefined) {\n getVisibleDescendants(model, childNode, result);\n }\n }\n }\n ++index;\n }\n\n return result;\n}\n\nfunction cloneSubtree(\n source: TreeModel,\n target: MutableTreeModel,\n parentId: string | undefined\n): void {\n target.setNumChildren(\n parentId,\n (parentId === undefined ? source.getRootNode() : source.getNode(parentId)!)\n .numChildren\n );\n for (const [childId, index] of source\n .getChildren(parentId)\n ?.iterateValues() ?? []) {\n const node = source.getNode(childId)!;\n target.setChildren(\n parentId,\n [{ ...node, isLoading: !!node.isLoading }],\n index\n );\n cloneSubtree(source, target, childId);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"TreeModel.js","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeModel.ts"],"names":[],"mappings":"AAAA;;;gGAGgG;AAChG;;GAEG;AAEH,qDAAqD;AAErD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,SAAS,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAQ7C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAqI9D;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC7B,GAAkC;IAElC,OAAO,CACL,GAAG,KAAK,SAAS;QACjB,CAAC,0BAA0B,CAAC,GAAG,CAAC;QAChC,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAC1B,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,0BAA0B,CACxC,GAAkC;IAElC,OAAO,GAAG,KAAK,SAAS,IAAI,YAAY,IAAI,GAAG,CAAC;AAClD,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,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AAE,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAE,CAAC;SACxE,WAAW,CACf,CAAC;IACF,KAAK,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,MAAM;SAClC,WAAW,CAAC,QAAQ,CAAC;QACtB,EAAE,aAAa,EAAE,IAAI,EAAE,EAAE,CAAC;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAE,CAAC;QACtC,MAAM,CAAC,WAAW,CAChB,QAAQ,EACR,CAAC,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,EAC1C,KAAK,CACN,CAAC;QACF,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,CAAC;AACH,CAAC","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/** @packageDocumentation\n * @module Tree\n */\n\n/* eslint-disable @typescript-eslint/no-deprecated */\n\nimport { immerable } from \"immer\";\nimport cloneDeep from \"lodash/cloneDeep.js\";\nimport { assert } from \"@itwin/core-bentley\";\nimport type { PropertyRecord } from \"@itwin/appui-abstract\";\nimport type {\n DelayLoadedTreeNodeItem,\n ImmediatelyLoadedTreeNodeItem,\n TreeNodeItem,\n} from \"../TreeDataProvider.js\";\nimport type { SparseArray } from \"./internal/SparseTree.js\";\nimport { SparseTree } from \"./internal/SparseTree.js\";\nimport { CheckBoxState } from \"../../common/CheckBoxState.js\";\n\n/**\n * Immutable data structure that describes tree node.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeModelNode {\n readonly id: string;\n readonly parentId: string | undefined;\n readonly depth: number;\n\n readonly isLoading?: boolean;\n readonly numChildren: number | undefined;\n\n readonly description: string | undefined;\n readonly isExpanded: boolean;\n readonly label: PropertyRecord;\n readonly isSelected: boolean;\n readonly isSelectionDisabled?: boolean;\n\n /** Specifies that node is in editing mode. It holds callbacks that are used by node editor. */\n readonly editingInfo?: TreeModelNodeEditingInfo;\n\n readonly checkbox: CheckBoxInfo;\n\n readonly item: TreeNodeItem;\n}\n\n/**\n * Immutable data structure that describes checkbox info.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface CheckBoxInfo {\n readonly state: CheckBoxState;\n readonly tooltip?: string;\n readonly isDisabled: boolean;\n readonly isVisible: boolean;\n}\n\n/**\n * Mutable data structure that describes tree node.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface MutableTreeModelNode extends TreeModelNode {\n isLoading: boolean;\n\n description: string;\n isExpanded: boolean;\n label: PropertyRecord;\n isSelected: boolean;\n isSelectionDisabled?: boolean;\n\n /** Specifies that node is in editing mode. It holds callbacks that are used by node editor. */\n editingInfo?: TreeModelNodeEditingInfo;\n\n checkbox: MutableCheckBoxInfo;\n\n item: TreeNodeItem;\n}\n\n/**\n * Data structure that holds callbacks used for tree node editing.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeModelNodeEditingInfo {\n onCommit: (node: TreeModelNode, newValue: string) => void;\n onCancel: () => void;\n}\n\n/**\n * Mutable data structure that describes checkbox info.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface MutableCheckBoxInfo extends CheckBoxInfo {\n state: CheckBoxState;\n tooltip?: string;\n isDisabled: boolean;\n isVisible: boolean;\n}\n\n/**\n * Data structure that describes tree node placeholder.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeModelNodePlaceholder {\n readonly childIndex: number;\n readonly depth: number;\n readonly parentId?: string;\n}\n\n/**\n * Data structure that describes tree root node.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeModelRootNode {\n readonly depth: -1;\n readonly id: undefined;\n readonly numChildren: number | undefined;\n}\n\n/**\n * Data structure that describes input used to create tree node.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeModelNodeInput {\n readonly description?: string;\n readonly isExpanded: boolean;\n readonly id: string;\n readonly item: TreeNodeItem;\n readonly label: PropertyRecord;\n readonly isLoading: boolean;\n readonly numChildren?: number;\n readonly isSelected: boolean;\n}\n\n/**\n * Type definition of all tree model nodes.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport type TreeModelNodeType =\n | TreeModelNode\n | TreeModelNodePlaceholder\n | TreeModelRootNode;\n\n/**\n * Checks if object is [[TreeModelNode]]\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function isTreeModelNode(\n obj: TreeModelNodeType | undefined\n): obj is TreeModelNode {\n return (\n obj !== undefined &&\n !isTreeModelNodePlaceholder(obj) &&\n !isTreeModelRootNode(obj)\n );\n}\n\n/**\n * Checks if object is [[TreeModelNodePlaceholder]]\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function isTreeModelNodePlaceholder(\n obj: TreeModelNodeType | undefined\n): obj is TreeModelNodePlaceholder {\n return obj !== undefined && \"childIndex\" in obj;\n}\n\n/**\n * Checks if object is [[TreeModelRootNode]]\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function isTreeModelRootNode(\n obj: TreeModelNodeType | undefined\n): obj is TreeModelRootNode {\n return (\n obj !== undefined &&\n (obj as TreeModelRootNode).id === undefined &&\n !(\"childIndex\" in obj)\n );\n}\n\n/**\n * Type definition of tree node item data.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport type TreeNodeItemData = ImmediatelyLoadedTreeNodeItem &\n DelayLoadedTreeNodeItem;\n\n/**\n * Data structure that describes set of visible tree nodes as a flat list.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface VisibleTreeNodes\n extends Iterable<TreeModelNode | TreeModelNodePlaceholder> {\n getNumNodes(): number;\n getAtIndex(\n index: number\n ): TreeModelNode | TreeModelNodePlaceholder | undefined;\n getModel(): TreeModel;\n getNumRootNodes(): number | undefined;\n getIndexOfNode(nodeId: string): number;\n}\n\n/**\n * Data structure that describes tree model.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport interface TreeModel {\n getRootNode(): TreeModelRootNode;\n\n getNode(id: string): TreeModelNode | undefined;\n getNode(\n parentId: string | undefined,\n childIndex: number\n ): TreeModelNode | TreeModelNodePlaceholder | undefined;\n getNode(\n nodeId: string | undefined,\n childIndex?: number\n ): TreeModelNode | TreeModelNodePlaceholder | TreeModelRootNode | undefined;\n\n getChildren(parentId: string | undefined): SparseArray<string> | undefined;\n getChildOffset(\n parentId: string | undefined,\n childId: string\n ): number | undefined;\n\n iterateTreeModelNodes(parentId?: string): IterableIterator<TreeModelNode>;\n}\n\n/**\n * Mutable tree model which holds nodes and allows adding or removing them.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport class MutableTreeModel implements TreeModel {\n public [immerable] = true;\n\n private _tree = new SparseTree<MutableTreeModelNode>();\n private _rootNode: TreeModelRootNode = {\n depth: -1,\n id: undefined,\n numChildren: undefined,\n };\n\n public constructor(seed?: TreeModel) {\n if (!seed) {\n return;\n }\n\n cloneSubtree(seed, this, undefined);\n }\n\n /** Returns root node of a tree. This node is not visible and is there to allow having multiple visible root nodes. */\n public getRootNode(): TreeModelRootNode {\n return this._rootNode;\n }\n\n /** Returns tree node or placeholder for node that is not loaded yet.\n * @returns node, node placeholder or undefined if node is not found in model.\n */\n public getNode(id: string): MutableTreeModelNode | undefined;\n public getNode(\n parentId: string | undefined,\n childIndex: number\n ): MutableTreeModelNode | TreeModelNodePlaceholder | undefined;\n public getNode(\n nodeId: string | undefined,\n childIndex?: number\n ): MutableTreeModelNode | TreeModelNodePlaceholder | undefined {\n if (childIndex === undefined) {\n return this._tree.getNode(nodeId!);\n }\n\n const children = this._tree.getChildren(nodeId);\n const childId =\n children !== undefined ? children.get(childIndex) : undefined;\n if (childId !== undefined) {\n return this._tree.getNode(childId);\n }\n\n const parentNode =\n nodeId === undefined ? this._rootNode : this._tree.getNode(nodeId);\n if (parentNode !== undefined) {\n return {\n childIndex,\n depth: parentNode.depth + 1,\n parentId: nodeId,\n };\n }\n\n return undefined;\n }\n\n /** Returns children for specific parent.\n * @param parentId id of parent node.\n * @returns children of parent node or root nodes if undefined is passed as parent id.\n */\n public getChildren(\n parentId: string | undefined\n ): SparseArray<string> | undefined {\n return this._tree.getChildren(parentId);\n }\n\n /** Returns children offset in children array for specific parent. */\n public getChildOffset(\n parentId: string | undefined,\n childId: string\n ): number | undefined {\n return this._tree.getChildOffset(parentId, childId);\n }\n\n /**\n * Sets children for parent node starting from the specific offset.\n * If offset overlaps with already added nodes, the overlapping nodes are overwritten.\n */\n public setChildren(\n parentId: string | undefined,\n nodeInputs: TreeModelNodeInput[],\n offset: number\n ): void {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n if (parentNode === undefined) return;\n\n const children: MutableTreeModelNode[] = [];\n for (const input of nodeInputs) {\n const child = MutableTreeModel.createTreeModelNode(parentNode, input);\n children.push(child);\n }\n\n this._tree.setChildren(parentNode.id, children, offset);\n MutableTreeModel.setNumChildrenForNode(\n parentNode,\n this._tree.getChildren(parentNode.id)\n );\n }\n\n /**\n * Inserts child in the specified position.\n * If offset is higher then current length of children array, the length is increased.\n */\n public insertChild(\n parentId: string | undefined,\n childNodeInput: TreeModelNodeInput,\n offset: number\n ): void {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n if (parentNode === undefined) return;\n\n const child = MutableTreeModel.createTreeModelNode(\n parentNode,\n childNodeInput\n );\n\n this._tree.insertChild(parentNode.id, child, offset);\n MutableTreeModel.setNumChildrenForNode(\n parentNode,\n this._tree.getChildren(parentNode.id)\n );\n }\n\n /**\n * Changes the id of target node.\n * @returns `true` on success, `false` otherwise.\n */\n public changeNodeId(currentId: string, newId: string): boolean {\n const node = this.getNode(currentId);\n if (node === undefined) {\n return false;\n }\n\n if (currentId === newId) {\n return true;\n }\n\n const index = this.getChildOffset(node.parentId, currentId);\n assert(index !== undefined);\n\n if (!this._tree.setNodeId(node.parentId, index, newId)) {\n return false;\n }\n\n (node.id as string) = newId; // eslint-disable-line @typescript-eslint/no-unnecessary-type-assertion\n for (const [childId] of this.getChildren(newId)?.iterateValues() ?? []) {\n const child = this.getNode(childId);\n assert(child !== undefined);\n (child.parentId as string) = newId;\n }\n\n return true;\n }\n\n /**\n * Transfers node along with its children to a new location. Fails if destination has undefined child count.\n * @param sourceNodeId Node that is being moved.\n * @param targetParentId Node that will receive a new child.\n * @param targetIndex Insertion location among target's *current* children.\n * @returns `true` on success, `false` otherwise.\n */\n public moveNode(\n sourceNodeId: string,\n targetParentId: string | undefined,\n targetIndex: number\n ): boolean {\n const sourceNode = this.getNode(sourceNodeId);\n if (sourceNode === undefined) {\n return false;\n }\n\n const targetParent =\n targetParentId === undefined\n ? this._rootNode\n : this.getNode(targetParentId);\n if (targetParent === undefined || targetParent.numChildren === undefined) {\n return false;\n }\n\n if (\n targetParentId !== undefined &&\n this.areNodesRelated(sourceNodeId, targetParentId)\n ) {\n return false;\n }\n\n this._tree.moveNode(\n sourceNode.parentId,\n sourceNodeId,\n targetParentId,\n targetIndex\n );\n\n const sourceParent =\n sourceNode.parentId === undefined\n ? this._rootNode\n : this.getNode(sourceNode.parentId);\n assert(sourceParent !== undefined);\n MutableTreeModel.setNumChildrenForNode(\n sourceParent,\n this._tree.getChildren(sourceNode.parentId)\n );\n MutableTreeModel.setNumChildrenForNode(\n targetParent,\n this._tree.getChildren(targetParentId)\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (sourceNode.parentId as string | undefined) = targetParentId;\n\n const updateDepths = (parentId: string, depth: number) => {\n const node = this.getNode(parentId);\n assert(node !== undefined);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (node.depth as number) = depth;\n for (const [nodeId] of this.getChildren(parentId)?.iterateValues() ??\n []) {\n updateDepths(nodeId, depth + 1);\n }\n };\n\n updateDepths(sourceNodeId, targetParent.depth + 1);\n return true;\n }\n\n private areNodesRelated(\n ancestorNodeId: string,\n descendantNodeId: string\n ): boolean {\n const node = this.getNode(descendantNodeId);\n if (node === undefined || node.parentId === undefined) {\n return false;\n }\n\n return node.parentId === ancestorNodeId\n ? true\n : this.areNodesRelated(ancestorNodeId, node.parentId);\n }\n\n /**\n * Sets the number of child nodes a parent is expected to contain. All child nodes of this parent will be subsequently\n * removed.\n */\n public setNumChildren(\n parentId: string | undefined,\n numChildren: number | undefined\n ): void {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n if (parentNode === undefined) {\n return;\n }\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (parentNode.numChildren as number | undefined) = numChildren;\n this._tree.setNumChildren(parentId, numChildren ?? 0);\n }\n\n /** Removes children specified by id.\n * @param parentId id of the parent node.\n * @param child child node id or index that should be removed.\n */\n public removeChild(\n parentId: string | undefined,\n child: string | number\n ): void {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n this._tree.removeChild(parentId, child);\n\n if (parentNode)\n MutableTreeModel.setNumChildrenForNode(\n parentNode,\n this._tree.getChildren(parentNode.id)\n );\n }\n\n /** Removes all children for parent specified by id.\n * @param parentId id of parent node or undefined to remove root nodes.\n */\n public clearChildren(parentId: string | undefined) {\n const parentNode =\n parentId === undefined ? this._rootNode : this._tree.getNode(parentId);\n if (parentNode !== undefined) {\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (parentNode.numChildren as number | undefined) = undefined;\n }\n this._tree.deleteSubtree(parentId, false);\n }\n\n /** Iterates over all nodes present in the tree model. */\n public *iterateTreeModelNodes(\n parentId?: string\n ): IterableIterator<MutableTreeModelNode> {\n // eslint-disable-next-line @typescript-eslint/no-this-alias\n const _this = this;\n function* iterateDescendants(\n subParentId: string | undefined\n ): IterableIterator<MutableTreeModelNode> {\n const children = _this.getChildren(subParentId);\n if (children === undefined) {\n return;\n }\n\n for (const [nodeId] of children.iterateValues()) {\n const node = _this.getNode(nodeId);\n if (node !== undefined) {\n yield node;\n yield* iterateDescendants(nodeId);\n }\n }\n }\n\n yield* iterateDescendants(parentId);\n }\n\n private static setNumChildrenForNode(\n node: TreeModelRootNode | MutableTreeModelNode,\n children: SparseArray<string> | undefined\n ) {\n const numChildren = children ? children.getLength() : undefined;\n if (node.numChildren === numChildren) return;\n\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-assertion\n (node.numChildren as number | undefined) = numChildren;\n }\n\n private static createTreeModelNode(\n parentNode: TreeModelNode | TreeModelRootNode,\n input: TreeModelNodeInput\n ): MutableTreeModelNode {\n return {\n id: input.id,\n parentId: parentNode.id,\n depth: parentNode.depth + 1,\n\n isLoading: input.isLoading,\n numChildren: input.numChildren,\n\n description: input.description || \"\",\n isExpanded: input.isExpanded,\n label: input.label,\n isSelected: input.isSelected,\n isSelectionDisabled: input.item.isSelectionDisabled,\n\n checkbox: {\n state: input.item.checkBoxState || CheckBoxState.Off,\n isDisabled: !!input.item.isCheckboxDisabled,\n isVisible: !!input.item.isCheckboxVisible,\n },\n\n item: cloneDeep(input.item),\n };\n }\n}\n\n/**\n * Generates flat list of visible nodes in the tree model.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function computeVisibleNodes(model: TreeModel): VisibleTreeNodes {\n const result = getVisibleDescendants(model, model.getRootNode());\n return {\n getNumNodes: () => result.length,\n getAtIndex: (\n index: number\n ): TreeModelNode | TreeModelNodePlaceholder | undefined => {\n return result[index];\n },\n getModel: () => model,\n getNumRootNodes: () => model.getRootNode().numChildren,\n [Symbol.iterator]: () => result[Symbol.iterator](),\n getIndexOfNode: (nodeId: string): number => {\n return result.findIndex(\n (visibleNode) => (visibleNode as TreeModelNode).id === nodeId\n );\n },\n };\n}\n\n/**\n * Traverses the tree and collects visible descendants.\n * @public\n * @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.\n */\nexport function getVisibleDescendants(\n model: TreeModel,\n parentNode: TreeModelNode | TreeModelRootNode,\n result: Array<TreeModelNode | TreeModelNodePlaceholder> = []\n): Array<TreeModelNode | TreeModelNodePlaceholder> {\n const children = model.getChildren(parentNode.id);\n if (!children) {\n return result;\n }\n\n let index = 0;\n for (const childId of children) {\n if (childId === undefined) {\n result.push({\n parentId: parentNode.id,\n depth: parentNode.depth + 1,\n childIndex: index,\n });\n } else {\n const childNode = model.getNode(childId);\n if (childNode === undefined) {\n // node was disposed\n result.push({\n parentId: parentNode.id,\n depth: parentNode.depth + 1,\n childIndex: index,\n });\n } else {\n result.push(childNode);\n if (childNode.isExpanded && childNode.numChildren !== undefined) {\n getVisibleDescendants(model, childNode, result);\n }\n }\n }\n ++index;\n }\n\n return result;\n}\n\nfunction cloneSubtree(\n source: TreeModel,\n target: MutableTreeModel,\n parentId: string | undefined\n): void {\n target.setNumChildren(\n parentId,\n (parentId === undefined ? source.getRootNode() : source.getNode(parentId)!)\n .numChildren\n );\n for (const [childId, index] of source\n .getChildren(parentId)\n ?.iterateValues() ?? []) {\n const node = source.getNode(childId)!;\n target.setChildren(\n parentId,\n [{ ...node, isLoading: !!node.isLoading }],\n index\n );\n cloneSubtree(source, target, childId);\n }\n}\n"]}
|
|
@@ -7,6 +7,7 @@ import { MutableTreeModel } from "./TreeModel.js";
|
|
|
7
7
|
/**
|
|
8
8
|
* Data structure that describes changes which happened to the tree model
|
|
9
9
|
* @public
|
|
10
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
10
11
|
*/
|
|
11
12
|
export interface TreeModelChanges {
|
|
12
13
|
addedNodeIds: string[];
|
|
@@ -17,6 +18,7 @@ export interface TreeModelChanges {
|
|
|
17
18
|
* Controls tree model.
|
|
18
19
|
* It is used to modify model and inform when tree model changes.
|
|
19
20
|
* @public
|
|
21
|
+
* @deprecated in 5.28.0. Use Tree component from `@stratakit/structures` instead.
|
|
20
22
|
*/
|
|
21
23
|
export declare class TreeModelSource {
|
|
22
24
|
private _model;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TreeModelSource.d.ts","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeModelSource.ts"],"names":[],"mappings":"AAIA;;GAEG;
|
|
1
|
+
{"version":3,"file":"TreeModelSource.d.ts","sourceRoot":"","sources":["../../../../src/components-react/tree/controlled/TreeModelSource.ts"],"names":[],"mappings":"AAIA;;GAEG;AAMH,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,cAAc,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;GAKG;AACH,qBAAa,eAAe;IAId,OAAO,CAAC,MAAM;IAH1B,8DAA8D;IACvD,cAAc,2CAAkD;gBAEnD,MAAM,GAAE,gBAAyC;IAErE;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,GAAG,IAAI;IAoBrE,0BAA0B;IACnB,QAAQ,IAAI,SAAS;IAI5B,OAAO,CAAC,mBAAmB;CAyC5B"}
|