react-native-tree-multi-select 2.0.13 → 3.0.0-beta.2
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/README.md +151 -0
- package/lib/module/TreeView.js +32 -2
- package/lib/module/TreeView.js.map +1 -1
- package/lib/module/components/DragOverlay.js +104 -0
- package/lib/module/components/DragOverlay.js.map +1 -0
- package/lib/module/components/DropIndicator.js +79 -0
- package/lib/module/components/DropIndicator.js.map +1 -0
- package/lib/module/components/NodeList.js +288 -33
- package/lib/module/components/NodeList.js.map +1 -1
- package/lib/module/helpers/index.js +1 -0
- package/lib/module/helpers/index.js.map +1 -1
- package/lib/module/helpers/moveTreeNode.helper.js +96 -0
- package/lib/module/helpers/moveTreeNode.helper.js.map +1 -0
- package/lib/module/helpers/toggleCheckbox.helper.js +88 -0
- package/lib/module/helpers/toggleCheckbox.helper.js.map +1 -1
- package/lib/module/hooks/useDragDrop.js +683 -0
- package/lib/module/hooks/useDragDrop.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/store/treeView.store.js +22 -1
- package/lib/module/store/treeView.store.js.map +1 -1
- package/lib/module/types/dragDrop.types.js +4 -0
- package/lib/module/types/dragDrop.types.js.map +1 -0
- package/lib/typescript/src/TreeView.d.ts.map +1 -1
- package/lib/typescript/src/components/DragOverlay.d.ts +13 -0
- package/lib/typescript/src/components/DragOverlay.d.ts.map +1 -0
- package/lib/typescript/src/components/DropIndicator.d.ts +13 -0
- package/lib/typescript/src/components/DropIndicator.d.ts.map +1 -0
- package/lib/typescript/src/components/NodeList.d.ts.map +1 -1
- package/lib/typescript/src/helpers/index.d.ts +1 -0
- package/lib/typescript/src/helpers/index.d.ts.map +1 -1
- package/lib/typescript/src/helpers/moveTreeNode.helper.d.ts +13 -0
- package/lib/typescript/src/helpers/moveTreeNode.helper.d.ts.map +1 -0
- package/lib/typescript/src/helpers/toggleCheckbox.helper.d.ts +6 -0
- package/lib/typescript/src/helpers/toggleCheckbox.helper.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useDragDrop.d.ts +40 -0
- package/lib/typescript/src/hooks/useDragDrop.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/store/treeView.store.d.ts +9 -0
- package/lib/typescript/src/store/treeView.store.d.ts.map +1 -1
- package/lib/typescript/src/types/dragDrop.types.d.ts +21 -0
- package/lib/typescript/src/types/dragDrop.types.d.ts.map +1 -0
- package/lib/typescript/src/types/treeView.types.d.ts +94 -0
- package/lib/typescript/src/types/treeView.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/TreeView.tsx +34 -0
- package/src/components/DragOverlay.tsx +114 -0
- package/src/components/DropIndicator.tsx +95 -0
- package/src/components/NodeList.tsx +327 -30
- package/src/helpers/index.ts +2 -1
- package/src/helpers/moveTreeNode.helper.ts +105 -0
- package/src/helpers/toggleCheckbox.helper.ts +96 -0
- package/src/hooks/useDragDrop.ts +835 -0
- package/src/index.tsx +19 -2
- package/src/store/treeView.store.ts +36 -0
- package/src/types/dragDrop.types.ts +23 -0
- package/src/types/treeView.types.ts +110 -0
package/README.md
CHANGED
|
@@ -44,6 +44,7 @@ Make sure to follow the native-related installation instructions for these depen
|
|
|
44
44
|
- 🌳 **Multi-Level Selection**: Select individual nodes or entire branches with ease.
|
|
45
45
|
- 📦 **Supports Large Datasets**: Efficiently handles large trees without much performance degradation.
|
|
46
46
|
- 🔒 **TypeScript Support**: Full TypeScript support for better developer experience.
|
|
47
|
+
- 🔀 **Drag-and-Drop**: Long-press to drag nodes and reorder or nest them anywhere in the tree.
|
|
47
48
|
- 💻 **Cross-Platform**: Works seamlessly across iOS, Android, and web (with React Native Web).
|
|
48
49
|
|
|
49
50
|
## Usage
|
|
@@ -112,6 +113,46 @@ export function TreeViewUsageExample(){
|
|
|
112
113
|
}
|
|
113
114
|
```
|
|
114
115
|
|
|
116
|
+
### Drag-and-Drop Usage
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
import {
|
|
120
|
+
TreeView,
|
|
121
|
+
type TreeNode,
|
|
122
|
+
type TreeViewRef,
|
|
123
|
+
type DragEndEvent
|
|
124
|
+
} from 'react-native-tree-multi-select';
|
|
125
|
+
|
|
126
|
+
const myData: TreeNode[] = [...];
|
|
127
|
+
|
|
128
|
+
export function DragDropExample(){
|
|
129
|
+
const [data, setData] = React.useState<TreeNode[]>(myData);
|
|
130
|
+
const treeViewRef = React.useRef<TreeViewRef | null>(null);
|
|
131
|
+
|
|
132
|
+
const handleDragEnd = (event: DragEndEvent) => {
|
|
133
|
+
// event.newTreeData contains the reordered tree — just set it
|
|
134
|
+
setData(event.newTreeData);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
return(
|
|
138
|
+
<TreeView
|
|
139
|
+
ref={treeViewRef}
|
|
140
|
+
data={data}
|
|
141
|
+
onCheck={(checked, indeterminate) => { /* ... */ }}
|
|
142
|
+
onExpand={(expanded) => { /* ... */ }}
|
|
143
|
+
dragEnabled={true}
|
|
144
|
+
onDragEnd={handleDragEnd}
|
|
145
|
+
/>
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Long-press a node to start dragging. Drag over other nodes to see drop indicators. Drop above/below to reorder as siblings, or drop inside a parent node to nest it. The tree auto-scrolls when dragging near the edges.
|
|
151
|
+
|
|
152
|
+
For visual customizations (overlay styles, indicator colors, or fully custom components), see the [`dragDropCustomizations`](#dragdropcustomizationsid) prop.
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
115
156
|
### Properties
|
|
116
157
|
|
|
117
158
|
#### TreeViewProps`<ID = string>`
|
|
@@ -134,6 +175,14 @@ export function TreeViewUsageExample(){
|
|
|
134
175
|
| `ExpandCollapseIconComponent` | `ComponentType<`[ExpandIconProps](#expandiconprops)`>` | No | A custom expand/collapse icon component |
|
|
135
176
|
| `ExpandCollapseTouchableComponent` | `ComponentType<`[TouchableOpacityProps](https://reactnative.dev/docs/touchableopacity#props)`>` | No | A custom expand/collapse touchable component |
|
|
136
177
|
| `CustomNodeRowComponent` | `React.ComponentType<`[NodeRowProps](#noderowpropsid--string)`<ID>>` | No | Custom row item component |
|
|
178
|
+
| `dragEnabled` | `boolean` | No | Enable drag-and-drop reordering |
|
|
179
|
+
| `onDragEnd` | `(event: `[DragEndEvent](#dragendeventid--string)`<ID>) => void` | No | Callback fired after a node is dropped at a new position |
|
|
180
|
+
| `longPressDuration` | `number` | No | Long press duration in ms to start drag (default: 400) |
|
|
181
|
+
| `autoScrollThreshold` | `number` | No | Distance from edge (px) to trigger auto-scroll (default: 60) |
|
|
182
|
+
| `autoScrollSpeed` | `number` | No | Speed multiplier for auto-scroll (default: 1.0) |
|
|
183
|
+
| `dragOverlayOffset` | `number` | No | Overlay offset from the finger, in item-height units (default: -1, i.e. one row above finger) |
|
|
184
|
+
| `autoExpandDelay` | `number` | No | Delay in ms before auto-expanding a collapsed node during drag hover (default: 800) |
|
|
185
|
+
| `dragDropCustomizations` | [DragDropCustomizations](#dragdropcustomizationsid)`<ID>` | No | Customizations for drag-and-drop visuals (overlay, indicator, opacity) |
|
|
137
186
|
|
|
138
187
|
##### Notes
|
|
139
188
|
|
|
@@ -262,6 +311,107 @@ Type: `boolean` OR `"indeterminate"`
|
|
|
262
311
|
| `isExpanded` | `boolean` | Yes | Whether the node is expanded or not |
|
|
263
312
|
| `onCheck` | `() => void` | Yes | Function to be called when the checkbox is pressed |
|
|
264
313
|
| `onExpand` | `() => void` | Yes | Function to be called when the expand button is pressed |
|
|
314
|
+
| `isDragTarget` | `boolean` | No | Whether this node is the current drop target during drag |
|
|
315
|
+
| `isDragging` | `boolean` | No | Whether a drag operation is in progress |
|
|
316
|
+
| `isDraggedNode`| `boolean` | No | Whether this node is the one being dragged |
|
|
317
|
+
|
|
318
|
+
---
|
|
319
|
+
|
|
320
|
+
#### DragEndEvent`<ID = string>`
|
|
321
|
+
|
|
322
|
+
*The event object passed to the `onDragEnd` callback after a successful drop.*
|
|
323
|
+
|
|
324
|
+
| Property | Type | Description |
|
|
325
|
+
| --------------- | --------------------------------------- | ------------------------------------------------------------ |
|
|
326
|
+
| `draggedNodeId` | `ID` | The id of the node that was dragged |
|
|
327
|
+
| `targetNodeId` | `ID` | The id of the target node where the dragged node was dropped |
|
|
328
|
+
| `position` | [DropPosition](#dropposition) | Where relative to the target: `above`/`below` = sibling, `inside` = child |
|
|
329
|
+
| `newTreeData` | `TreeNode<ID>[]` | The reordered tree data after the move |
|
|
330
|
+
|
|
331
|
+
#### DropPosition
|
|
332
|
+
|
|
333
|
+
Type: `"above"` | `"below"` | `"inside"`
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
#### DragDropCustomizations`<ID>`
|
|
338
|
+
|
|
339
|
+
*Customizations for drag-and-drop visuals.*
|
|
340
|
+
|
|
341
|
+
| Property | Type | Required | Description |
|
|
342
|
+
| ------------------------------ | ------------------------------------------------------------------------------------- | -------- | ----------------------------------------------------------------- |
|
|
343
|
+
| `draggedNodeOpacity` | `number` | No | Opacity of the dragged node and invalid targets (default: 0.3) |
|
|
344
|
+
| `dropIndicatorStyleProps` | [DropIndicatorStyleProps](#dropindicatorstyleprops) | No | Style props for the built-in drop indicator |
|
|
345
|
+
| `dragOverlayStyleProps` | [DragOverlayStyleProps](#dragoverlaystyleprops) | No | Style props for the drag overlay (lifted node ghost) |
|
|
346
|
+
| `CustomDropIndicatorComponent` | `ComponentType<`[DropIndicatorComponentProps](#dropindicatorcomponentprops)`>` | No | Fully custom drop indicator component |
|
|
347
|
+
| `CustomDragOverlayComponent` | `ComponentType<`[DragOverlayComponentProps](#dragoverlaycomponentpropsid--string)`<ID>>`| No | Fully custom drag overlay component |
|
|
348
|
+
|
|
349
|
+
---
|
|
350
|
+
|
|
351
|
+
#### DropIndicatorStyleProps
|
|
352
|
+
|
|
353
|
+
*Style props for customizing the built-in drop indicator appearance.*
|
|
354
|
+
|
|
355
|
+
| Property | Type | Required | Description |
|
|
356
|
+
| --------------------- | -------- | -------- | -------------------------------------------------------------- |
|
|
357
|
+
| `lineColor` | `string` | No | Color of the line indicator for above/below (default: `"#0078FF"`) |
|
|
358
|
+
| `lineThickness` | `number` | No | Thickness of the line indicator (default: 3) |
|
|
359
|
+
| `circleSize` | `number` | No | Diameter of the circle at the line's start (default: 10) |
|
|
360
|
+
| `highlightColor` | `string` | No | Background color of the "inside" highlight (default: `"rgba(0, 120, 255, 0.15)"`) |
|
|
361
|
+
| `highlightBorderColor`| `string` | No | Border color of the "inside" highlight (default: `"rgba(0, 120, 255, 0.5)"`) |
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
#### DragOverlayStyleProps
|
|
366
|
+
|
|
367
|
+
*Style props for customizing the drag overlay (the "lifted" node ghost).*
|
|
368
|
+
|
|
369
|
+
| Property | Type | Required | Description |
|
|
370
|
+
| --------------- | ---------------------- | -------- | ------------------------------------------------ |
|
|
371
|
+
| `backgroundColor`| `string` | No | Background color (default: `"rgba(255, 255, 255, 0.95)"`) |
|
|
372
|
+
| `shadowColor` | `string` | No | Shadow color (default: `"#000"`) |
|
|
373
|
+
| `shadowOpacity` | `number` | No | Shadow opacity (default: 0.25) |
|
|
374
|
+
| `shadowRadius` | `number` | No | Shadow radius (default: 4) |
|
|
375
|
+
| `elevation` | `number` | No | Android elevation (default: 10) |
|
|
376
|
+
| `style` | `StyleProp<ViewStyle>` | No | Custom style applied to the overlay container |
|
|
377
|
+
|
|
378
|
+
---
|
|
379
|
+
|
|
380
|
+
#### DropIndicatorComponentProps
|
|
381
|
+
|
|
382
|
+
*Props passed to a custom drop indicator component (when using `CustomDropIndicatorComponent`).*
|
|
383
|
+
|
|
384
|
+
| Property | Type | Required | Description |
|
|
385
|
+
| ---------- | ----------------------------- | -------- | ------------------------------------------------------------ |
|
|
386
|
+
| `position` | [DropPosition](#dropposition) | Yes | Whether the indicator is above, below, or inside the target |
|
|
387
|
+
|
|
388
|
+
---
|
|
389
|
+
|
|
390
|
+
#### DragOverlayComponentProps`<ID = string>`
|
|
391
|
+
|
|
392
|
+
*Props passed to a custom drag overlay component (when using `CustomDragOverlayComponent`).*
|
|
393
|
+
|
|
394
|
+
| Property | Type | Required | Description |
|
|
395
|
+
| -------- | --------------- | -------- | ------------------------------ |
|
|
396
|
+
| `node` | `TreeNode<ID>` | Yes | The node being dragged |
|
|
397
|
+
| `level` | `number` | Yes | The nesting level of the node |
|
|
398
|
+
|
|
399
|
+
---
|
|
400
|
+
|
|
401
|
+
### Exported Utilities
|
|
402
|
+
|
|
403
|
+
#### `moveTreeNode`
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
moveTreeNode<ID>(
|
|
407
|
+
data: TreeNode<ID>[],
|
|
408
|
+
draggedNodeId: ID,
|
|
409
|
+
targetNodeId: ID,
|
|
410
|
+
position: DropPosition
|
|
411
|
+
): TreeNode<ID>[]
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
Moves a node within a tree structure. Returns a new tree (no mutation). Useful if you want to perform tree moves manually outside of the `onDragEnd` callback.
|
|
265
415
|
|
|
266
416
|
---
|
|
267
417
|
|
|
@@ -274,6 +424,7 @@ Type: `boolean` OR `"indeterminate"`
|
|
|
274
424
|
- [x] Ref function to programatically expand/collapse a certain node
|
|
275
425
|
- [x] Ref function to programatically un/check a certain node
|
|
276
426
|
- [x] Ref function to auto-scroll to a certain node's position - available in 1.9.0+
|
|
427
|
+
- [x] Drag-and-drop reordering with customizable visuals
|
|
277
428
|
|
|
278
429
|
If you do not see what you want in the planned feature list, raise a feature request.
|
|
279
430
|
|
package/lib/module/TreeView.js
CHANGED
|
@@ -8,6 +8,7 @@ import usePreviousState from "./utils/usePreviousState.js";
|
|
|
8
8
|
import { useShallow } from "zustand/react/shallow";
|
|
9
9
|
import useDeepCompareEffect from "./utils/useDeepCompareEffect.js";
|
|
10
10
|
import { typedMemo } from "./utils/typedMemo.js";
|
|
11
|
+
import { fastIsEqual } from "fast-is-equal";
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
function _innerTreeView(props, ref) {
|
|
13
14
|
const {
|
|
@@ -24,7 +25,15 @@ function _innerTreeView(props, ref) {
|
|
|
24
25
|
CheckboxComponent,
|
|
25
26
|
ExpandCollapseIconComponent,
|
|
26
27
|
ExpandCollapseTouchableComponent,
|
|
27
|
-
CustomNodeRowComponent
|
|
28
|
+
CustomNodeRowComponent,
|
|
29
|
+
dragEnabled,
|
|
30
|
+
onDragEnd,
|
|
31
|
+
longPressDuration,
|
|
32
|
+
autoScrollThreshold,
|
|
33
|
+
autoScrollSpeed,
|
|
34
|
+
dragOverlayOffset,
|
|
35
|
+
autoExpandDelay,
|
|
36
|
+
dragDropCustomizations
|
|
28
37
|
} = props;
|
|
29
38
|
const storeId = useId();
|
|
30
39
|
const {
|
|
@@ -69,7 +78,20 @@ function _innerTreeView(props, ref) {
|
|
|
69
78
|
}));
|
|
70
79
|
const scrollToNodeHandlerRef = React.useRef(null);
|
|
71
80
|
const prevSearchText = usePreviousState(searchText);
|
|
81
|
+
const internalDataRef = React.useRef(null);
|
|
82
|
+
|
|
83
|
+
// Wrap onDragEnd to set internalDataRef before calling consumer's callback
|
|
84
|
+
const wrappedOnDragEnd = React.useCallback(event => {
|
|
85
|
+
internalDataRef.current = event.newTreeData;
|
|
86
|
+
onDragEnd?.(event);
|
|
87
|
+
}, [onDragEnd]);
|
|
72
88
|
useDeepCompareEffect(() => {
|
|
89
|
+
// If data matches what was set internally from a drag-drop, skip reinitialize
|
|
90
|
+
if (internalDataRef.current !== null && fastIsEqual(data, internalDataRef.current)) {
|
|
91
|
+
internalDataRef.current = null;
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
internalDataRef.current = null;
|
|
73
95
|
cleanUpTreeViewStore();
|
|
74
96
|
updateInitialTreeViewData(data);
|
|
75
97
|
if (selectionPropagation) setSelectionPropagation(selectionPropagation);
|
|
@@ -139,7 +161,15 @@ function _innerTreeView(props, ref) {
|
|
|
139
161
|
CheckboxComponent: CheckboxComponent,
|
|
140
162
|
ExpandCollapseIconComponent: ExpandCollapseIconComponent,
|
|
141
163
|
ExpandCollapseTouchableComponent: ExpandCollapseTouchableComponent,
|
|
142
|
-
CustomNodeRowComponent: CustomNodeRowComponent
|
|
164
|
+
CustomNodeRowComponent: CustomNodeRowComponent,
|
|
165
|
+
dragEnabled: dragEnabled,
|
|
166
|
+
onDragEnd: wrappedOnDragEnd,
|
|
167
|
+
longPressDuration: longPressDuration,
|
|
168
|
+
autoScrollThreshold: autoScrollThreshold,
|
|
169
|
+
autoScrollSpeed: autoScrollSpeed,
|
|
170
|
+
dragOverlayOffset: dragOverlayOffset,
|
|
171
|
+
autoExpandDelay: autoExpandDelay,
|
|
172
|
+
dragDropCustomizations: dragDropCustomizations
|
|
143
173
|
});
|
|
144
174
|
}
|
|
145
175
|
const _TreeView = /*#__PURE__*/React.forwardRef(_innerTreeView);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["React","startTransition","useId","NodeList","selectAll","selectAllFiltered","unselectAll","unselectAllFiltered","initializeNodeMaps","expandAll","collapseAll","toggleCheckboxes","expandNodes","collapseNodes","getTreeViewStore","useTreeViewStore","usePreviousState","useShallow","useDeepCompareEffect","typedMemo","jsx","_jsx","_innerTreeView","props","ref","data","onCheck","onExpand","selectionPropagation","preselectedIds","preExpandedIds","initialScrollNodeID","treeFlashListProps","checkBoxViewStyleProps","indentationMultiplier","CheckboxComponent","ExpandCollapseIconComponent","ExpandCollapseTouchableComponent","CustomNodeRowComponent","storeId","expanded","updateExpanded","initialTreeViewData","updateInitialTreeViewData","searchText","updateSearchText","updateSearchKeys","checked","indeterminate","setSelectionPropagation","cleanUpTreeViewStore","state","useImperativeHandle","ids","selectNodes","unselectNodes","setSearchText","scrollToNodeID","getChildToParentMap","scrollToNodeHandlerRef","useRef","prevSearchText","
|
|
1
|
+
{"version":3,"names":["React","startTransition","useId","NodeList","selectAll","selectAllFiltered","unselectAll","unselectAllFiltered","initializeNodeMaps","expandAll","collapseAll","toggleCheckboxes","expandNodes","collapseNodes","getTreeViewStore","useTreeViewStore","usePreviousState","useShallow","useDeepCompareEffect","typedMemo","fastIsEqual","jsx","_jsx","_innerTreeView","props","ref","data","onCheck","onExpand","selectionPropagation","preselectedIds","preExpandedIds","initialScrollNodeID","treeFlashListProps","checkBoxViewStyleProps","indentationMultiplier","CheckboxComponent","ExpandCollapseIconComponent","ExpandCollapseTouchableComponent","CustomNodeRowComponent","dragEnabled","onDragEnd","longPressDuration","autoScrollThreshold","autoScrollSpeed","dragOverlayOffset","autoExpandDelay","dragDropCustomizations","storeId","expanded","updateExpanded","initialTreeViewData","updateInitialTreeViewData","searchText","updateSearchText","updateSearchKeys","checked","indeterminate","setSelectionPropagation","cleanUpTreeViewStore","state","useImperativeHandle","ids","selectNodes","unselectNodes","setSearchText","scrollToNodeID","getChildToParentMap","scrollToNodeHandlerRef","useRef","prevSearchText","internalDataRef","wrappedOnDragEnd","useCallback","event","current","newTreeData","text","keys","params","treeViewStore","getState","childToParentMap","getIds","node","children","length","id","flatMap","item","useEffect","Array","from","Set","_TreeView","forwardRef","TreeView"],"sourceRoot":"../../src","sources":["TreeView.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,eAAe,EAAEC,KAAK,QAAQ,OAAO;AAMrD,OAAOC,QAAQ,MAAM,0BAAuB;AAC5C,SACCC,SAAS,EACTC,iBAAiB,EACjBC,WAAW,EACXC,mBAAmB,EACnBC,kBAAkB,EAClBC,SAAS,EACTC,WAAW,EACXC,gBAAgB,EAChBC,WAAW,EACXC,aAAa,QACP,oBAAW;AAClB,SAASC,gBAAgB,EAAEC,gBAAgB,QAAQ,2BAAwB;AAC3E,OAAOC,gBAAgB,MAAM,6BAA0B;AACvD,SAASC,UAAU,QAAQ,uBAAuB;AAClD,OAAOC,oBAAoB,MAAM,iCAA8B;AAC/D,SAAS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C1B,CAAC,CAAC;IACH;EACD,CAAC,EAAE,CACFV,MAAM,EACNhC,mBAAmB,EACnBmB,cAAc,EACdjB,UAAU,EACVH,cAAc,CACd,CAAC;EAEFlD,KAAK,CAAC0F,SAAS,CAAC,MAAM;IACrB,OAAO,MAAM;MACZ/B,oBAAoB,CAAC,CAAC;IACvB,CAAC;EACF,CAAC,EAAE,CAACA,oBAAoB,CAAC,CAAC;EAE1B,oBACCrC,IAAA,CAACnB,QAAQ;IACR6C,OAAO,EAAEA,OAAQ;IAEjBoB,sBAAsB,EAAEA,sBAAuB;IAC/CpC,mBAAmB,EAAEA,mBAAoB;IAEzCC,kBAAkB,EAAEA,kBAAmB;IACvCC,sBAAsB,EAAEA,sBAAuB;IAC/CC,qBAAqB,EAAEA,qBAAsB;IAE7CC,iBAAiB,EAAEA,iBAAkB;IACrCC,2BAA2B,EAAEA,2BAA4B;IACzDC,gCAAgC,EAAEA,gCAAiC;IAEnEC,sBAAsB,EAAEA,sBAAuB;IAE/CC,WAAW,EAAEA,WAAY;IACzBC,SAAS,EAAE+B,gBAAiB;IAC5B9B,iBAAiB,EAAEA,iBAAkB;IACrCC,mBAAmB,EAAEA,mBAAoB;IACzCC,eAAe,EAAEA,eAAgB;IACjCC,iBAAiB,EAAEA,iBAAkB;IACrCC,eAAe,EAAEA,eAAgB;IACjCC,sBAAsB,EAAEA;EAAuB,CAC/C,CAAC;AAEJ;AAEA,MAAM+C,SAAS,gBAAG9F,KAAK,CAAC+F,UAAU,CAACxE,cAAc,CAEX;AAEtC,OAAO,MAAMyE,QAAQ,GAAG7E,SAAS,CAAmB2E,SAAS,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Animated, StyleSheet, View } from "react-native";
|
|
5
|
+
import { CheckboxView } from "./CheckboxView.js";
|
|
6
|
+
import { CustomExpandCollapseIcon } from "./CustomExpandCollapseIcon.js";
|
|
7
|
+
import { defaultIndentationMultiplier } from "../constants/treeView.constants.js";
|
|
8
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
+
function _DragOverlay(props) {
|
|
10
|
+
const {
|
|
11
|
+
overlayY,
|
|
12
|
+
overlayX,
|
|
13
|
+
node,
|
|
14
|
+
level,
|
|
15
|
+
indentationMultiplier = defaultIndentationMultiplier,
|
|
16
|
+
CheckboxComponent = CheckboxView,
|
|
17
|
+
ExpandCollapseIconComponent = CustomExpandCollapseIcon,
|
|
18
|
+
CustomNodeRowComponent,
|
|
19
|
+
checkBoxViewStyleProps,
|
|
20
|
+
dragDropCustomizations
|
|
21
|
+
} = props;
|
|
22
|
+
const overlayStyleProps = dragDropCustomizations?.dragOverlayStyleProps;
|
|
23
|
+
const CustomOverlay = dragDropCustomizations?.CustomDragOverlayComponent;
|
|
24
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
25
|
+
pointerEvents: "none",
|
|
26
|
+
style: [styles.overlay, overlayStyleProps && {
|
|
27
|
+
...(overlayStyleProps.backgroundColor != null && {
|
|
28
|
+
backgroundColor: overlayStyleProps.backgroundColor
|
|
29
|
+
}),
|
|
30
|
+
...(overlayStyleProps.shadowColor != null && {
|
|
31
|
+
shadowColor: overlayStyleProps.shadowColor
|
|
32
|
+
}),
|
|
33
|
+
...(overlayStyleProps.shadowOpacity != null && {
|
|
34
|
+
shadowOpacity: overlayStyleProps.shadowOpacity
|
|
35
|
+
}),
|
|
36
|
+
...(overlayStyleProps.shadowRadius != null && {
|
|
37
|
+
shadowRadius: overlayStyleProps.shadowRadius
|
|
38
|
+
}),
|
|
39
|
+
...(overlayStyleProps.elevation != null && {
|
|
40
|
+
elevation: overlayStyleProps.elevation
|
|
41
|
+
})
|
|
42
|
+
}, overlayStyleProps?.style, {
|
|
43
|
+
transform: [{
|
|
44
|
+
translateX: overlayX
|
|
45
|
+
}, {
|
|
46
|
+
translateY: overlayY
|
|
47
|
+
}]
|
|
48
|
+
}],
|
|
49
|
+
children: CustomOverlay ? /*#__PURE__*/_jsx(CustomOverlay, {
|
|
50
|
+
node: node,
|
|
51
|
+
level: level
|
|
52
|
+
}) : CustomNodeRowComponent ? /*#__PURE__*/_jsx(CustomNodeRowComponent, {
|
|
53
|
+
node: node,
|
|
54
|
+
level: level,
|
|
55
|
+
checkedValue: false,
|
|
56
|
+
isExpanded: false,
|
|
57
|
+
onCheck: () => {},
|
|
58
|
+
onExpand: () => {}
|
|
59
|
+
}) : /*#__PURE__*/_jsxs(View, {
|
|
60
|
+
style: [styles.nodeRow, {
|
|
61
|
+
paddingStart: level * indentationMultiplier
|
|
62
|
+
}],
|
|
63
|
+
children: [/*#__PURE__*/_jsx(CheckboxComponent, {
|
|
64
|
+
text: node.name,
|
|
65
|
+
onValueChange: () => {},
|
|
66
|
+
value: false,
|
|
67
|
+
...checkBoxViewStyleProps
|
|
68
|
+
}), node.children?.length ? /*#__PURE__*/_jsx(View, {
|
|
69
|
+
style: styles.expandArrow,
|
|
70
|
+
children: /*#__PURE__*/_jsx(ExpandCollapseIconComponent, {
|
|
71
|
+
isExpanded: false
|
|
72
|
+
})
|
|
73
|
+
}) : null]
|
|
74
|
+
})
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
export const DragOverlay = /*#__PURE__*/React.memo(_DragOverlay);
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
overlay: {
|
|
80
|
+
position: "absolute",
|
|
81
|
+
left: 0,
|
|
82
|
+
right: 0,
|
|
83
|
+
zIndex: 9999,
|
|
84
|
+
elevation: 10,
|
|
85
|
+
shadowColor: "#000",
|
|
86
|
+
shadowOffset: {
|
|
87
|
+
width: 0,
|
|
88
|
+
height: 2
|
|
89
|
+
},
|
|
90
|
+
shadowOpacity: 0.25,
|
|
91
|
+
shadowRadius: 4,
|
|
92
|
+
backgroundColor: "rgba(255, 255, 255, 0.95)"
|
|
93
|
+
},
|
|
94
|
+
nodeRow: {
|
|
95
|
+
flex: 1,
|
|
96
|
+
flexDirection: "row",
|
|
97
|
+
alignItems: "center",
|
|
98
|
+
minWidth: "100%"
|
|
99
|
+
},
|
|
100
|
+
expandArrow: {
|
|
101
|
+
flex: 1
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
//# sourceMappingURL=DragOverlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Animated","StyleSheet","View","CheckboxView","CustomExpandCollapseIcon","defaultIndentationMultiplier","jsx","_jsx","jsxs","_jsxs","_DragOverlay","props","overlayY","overlayX","node","level","indentationMultiplier","CheckboxComponent","ExpandCollapseIconComponent","CustomNodeRowComponent","checkBoxViewStyleProps","dragDropCustomizations","overlayStyleProps","dragOverlayStyleProps","CustomOverlay","CustomDragOverlayComponent","pointerEvents","style","styles","overlay","backgroundColor","shadowColor","shadowOpacity","shadowRadius","elevation","transform","translateX","translateY","children","checkedValue","isExpanded","onCheck","onExpand","nodeRow","paddingStart","text","name","onValueChange","value","length","expandArrow","DragOverlay","memo","create","position","left","right","zIndex","shadowOffset","width","height","flex","flexDirection","alignItems","minWidth"],"sourceRoot":"../../../src","sources":["components/DragOverlay.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,UAAU,EAAEC,IAAI,QAAQ,cAAc;AAQzD,SAASC,YAAY,QAAQ,mBAAgB;AAC7C,SAASC,wBAAwB,QAAQ,+BAA4B;AACrE,SAASC,4BAA4B,QAAQ,oCAAiC;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAU/E,SAASC,YAAYA,CAAKC,KAA2B,EAAE;EACnD,MAAM;IACFC,QAAQ;IACRC,QAAQ;IACRC,IAAI;IACJC,KAAK;IACLC,qBAAqB,GAAGX,4BAA4B;IACpDY,iBAAiB,GAAGd,YAAsD;IAC1Ee,2BAA2B,GAAGd,wBAAwB;IACtDe,sBAAsB;IACtBC,sBAAsB;IAC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ACd,CAAC;EACDd,WAAW,EAAE;IACTW,IAAI,EAAE;EACV;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { Animated, View, StyleSheet } from "react-native";
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
export const DropIndicator = /*#__PURE__*/React.memo(function DropIndicator(props) {
|
|
7
|
+
const {
|
|
8
|
+
position,
|
|
9
|
+
overlayY,
|
|
10
|
+
itemHeight,
|
|
11
|
+
targetLevel,
|
|
12
|
+
indentationMultiplier
|
|
13
|
+
} = props;
|
|
14
|
+
const indent = targetLevel * indentationMultiplier;
|
|
15
|
+
if (position === "inside") {
|
|
16
|
+
return /*#__PURE__*/_jsx(Animated.View, {
|
|
17
|
+
pointerEvents: "none",
|
|
18
|
+
style: [styles.highlightIndicator, {
|
|
19
|
+
transform: [{
|
|
20
|
+
translateY: overlayY
|
|
21
|
+
}],
|
|
22
|
+
height: itemHeight,
|
|
23
|
+
left: indent
|
|
24
|
+
}]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// For "above", the line is at the overlay's top edge (offset 0)
|
|
29
|
+
// For "below", the line is at the overlay's bottom edge (offset +itemHeight)
|
|
30
|
+
const lineOffset = position === "above" ? 0 : itemHeight;
|
|
31
|
+
return /*#__PURE__*/_jsxs(Animated.View, {
|
|
32
|
+
pointerEvents: "none",
|
|
33
|
+
style: [styles.lineContainer, {
|
|
34
|
+
transform: [{
|
|
35
|
+
translateY: Animated.add(overlayY, lineOffset - 1)
|
|
36
|
+
}],
|
|
37
|
+
left: indent
|
|
38
|
+
}],
|
|
39
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
40
|
+
style: styles.lineCircle
|
|
41
|
+
}), /*#__PURE__*/_jsx(View, {
|
|
42
|
+
style: styles.line
|
|
43
|
+
})]
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
const styles = StyleSheet.create({
|
|
47
|
+
highlightIndicator: {
|
|
48
|
+
position: "absolute",
|
|
49
|
+
left: 0,
|
|
50
|
+
right: 0,
|
|
51
|
+
backgroundColor: "rgba(0, 200, 0, 0.2)",
|
|
52
|
+
borderWidth: 2,
|
|
53
|
+
borderColor: "rgba(0, 200, 0, 0.6)",
|
|
54
|
+
borderRadius: 4,
|
|
55
|
+
zIndex: 9998
|
|
56
|
+
},
|
|
57
|
+
lineContainer: {
|
|
58
|
+
position: "absolute",
|
|
59
|
+
right: 0,
|
|
60
|
+
flexDirection: "row",
|
|
61
|
+
alignItems: "center",
|
|
62
|
+
height: 3,
|
|
63
|
+
zIndex: 9998
|
|
64
|
+
},
|
|
65
|
+
lineCircle: {
|
|
66
|
+
width: 10,
|
|
67
|
+
height: 10,
|
|
68
|
+
borderRadius: 5,
|
|
69
|
+
backgroundColor: "#00CC00",
|
|
70
|
+
marginLeft: -5,
|
|
71
|
+
marginTop: -4
|
|
72
|
+
},
|
|
73
|
+
line: {
|
|
74
|
+
flex: 1,
|
|
75
|
+
height: 3,
|
|
76
|
+
backgroundColor: "#00CC00"
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=DropIndicator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","Animated","View","StyleSheet","jsx","_jsx","jsxs","_jsxs","DropIndicator","memo","props","position","overlayY","itemHeight","targetLevel","indentationMultiplier","indent","pointerEvents","style","styles","highlightIndicator","transform","translateY","height","left","lineOffset","lineContainer","add","children","lineCircle","line","create","right","backgroundColor","borderWidth","borderColor","borderRadius","zIndex","flexDirection","alignItems","width","marginLeft","marginTop","flex"],"sourceRoot":"../../../src","sources":["components/DropIndicator.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,SAASC,QAAQ,EAAEC,IAAI,EAAEC,UAAU,QAAQ,cAAc;AAAC,SAA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