@headless-tree/core 0.0.0-20250828231818 → 0.0.0-20250903185807
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 +2 -1
- package/dist/index.d.mts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/index.mjs +4 -0
- package/package.json +14 -1
- package/src/features/drag-and-drop/feature.ts +7 -0
- package/src/features/drag-and-drop/types.ts +6 -0
- package/src/mddocs-entry.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# @headless-tree/core
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20250903185807
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- 72e714b: all NPM deployments will now publish with provenance
|
|
8
8
|
- 215ab4b: add a new symbol that can be used in hotkey configurations "metaorcontrol" that will trigger if either any windows control key or mac meta key is pressed (#141)
|
|
9
|
+
- 51b0dea: Added `isUnorderedDragTarget` as alternative to `isDragTarget` for easier detection of drag type
|
|
9
10
|
- cf845d7: Added new state variable `loadingCheckPropagationItems` to indicate if, in async trees with checkboxes and state propagation enabled, data loading operations are currently loading due to a checkbox propagation taking place
|
|
10
11
|
- 597faad: Checkbox propagation is now supported for trees with async data loaders!
|
|
11
12
|
- b0ee382: triggering a data refetch will now always set the loadingItemData/loadingItemChildrens state variable to the associated items if they where not apart of the cache before
|
package/dist/index.d.mts
CHANGED
|
@@ -75,7 +75,12 @@ type DragAndDropFeatureDef<T> = {
|
|
|
75
75
|
getDragLineStyle: (topOffset?: number, leftOffset?: number) => Record<string, any>;
|
|
76
76
|
};
|
|
77
77
|
itemInstance: {
|
|
78
|
+
/** Checks if the user is dragging in a way which makes this the new parent of the dragged items, either by dragging on top of
|
|
79
|
+
* this item, or by dragging inbetween children of this item. See @{isUnorderedDragTarget} if the latter is undesirable. */
|
|
78
80
|
isDragTarget: () => boolean;
|
|
81
|
+
/** As opposed to @{isDragTarget}, this will not be true if the target is inbetween children of this item. This returns only true
|
|
82
|
+
* if the user is dragging directly on top of this item. */
|
|
83
|
+
isUnorderedDragTarget: () => boolean;
|
|
79
84
|
isDragTargetAbove: () => boolean;
|
|
80
85
|
isDragTargetBelow: () => boolean;
|
|
81
86
|
isDraggingOver: () => boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -75,7 +75,12 @@ type DragAndDropFeatureDef<T> = {
|
|
|
75
75
|
getDragLineStyle: (topOffset?: number, leftOffset?: number) => Record<string, any>;
|
|
76
76
|
};
|
|
77
77
|
itemInstance: {
|
|
78
|
+
/** Checks if the user is dragging in a way which makes this the new parent of the dragged items, either by dragging on top of
|
|
79
|
+
* this item, or by dragging inbetween children of this item. See @{isUnorderedDragTarget} if the latter is undesirable. */
|
|
78
80
|
isDragTarget: () => boolean;
|
|
81
|
+
/** As opposed to @{isDragTarget}, this will not be true if the target is inbetween children of this item. This returns only true
|
|
82
|
+
* if the user is dragging directly on top of this item. */
|
|
83
|
+
isUnorderedDragTarget: () => boolean;
|
|
79
84
|
isDragTargetAbove: () => boolean;
|
|
80
85
|
isDragTargetBelow: () => boolean;
|
|
81
86
|
isDraggingOver: () => boolean;
|
package/dist/index.js
CHANGED
|
@@ -1641,6 +1641,10 @@ var dragAndDropFeature = {
|
|
|
1641
1641
|
const target = tree.getDragTarget();
|
|
1642
1642
|
return target ? target.item.getId() === item.getId() : false;
|
|
1643
1643
|
},
|
|
1644
|
+
isUnorderedDragTarget: ({ tree, item }) => {
|
|
1645
|
+
const target = tree.getDragTarget();
|
|
1646
|
+
return target ? !isOrderedDragTarget(target) && target.item.getId() === item.getId() : false;
|
|
1647
|
+
},
|
|
1644
1648
|
isDragTargetAbove: ({ tree, item }) => {
|
|
1645
1649
|
const target = tree.getDragTarget();
|
|
1646
1650
|
if (!target || !isOrderedDragTarget(target) || target.item !== item.getParent())
|
package/dist/index.mjs
CHANGED
|
@@ -1597,6 +1597,10 @@ var dragAndDropFeature = {
|
|
|
1597
1597
|
const target = tree.getDragTarget();
|
|
1598
1598
|
return target ? target.item.getId() === item.getId() : false;
|
|
1599
1599
|
},
|
|
1600
|
+
isUnorderedDragTarget: ({ tree, item }) => {
|
|
1601
|
+
const target = tree.getDragTarget();
|
|
1602
|
+
return target ? !isOrderedDragTarget(target) && target.item.getId() === item.getId() : false;
|
|
1603
|
+
},
|
|
1600
1604
|
isDragTargetAbove: ({ tree, item }) => {
|
|
1601
1605
|
const target = tree.getDragTarget();
|
|
1602
1606
|
if (!target || !isOrderedDragTarget(target) || target.item !== item.getParent())
|
package/package.json
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@headless-tree/core",
|
|
3
|
-
"
|
|
3
|
+
"description": "The definitive tree component for the Web",
|
|
4
|
+
"keywords": [
|
|
5
|
+
"tree",
|
|
6
|
+
"component",
|
|
7
|
+
"web",
|
|
8
|
+
"headless",
|
|
9
|
+
"ui",
|
|
10
|
+
"react",
|
|
11
|
+
"nested",
|
|
12
|
+
"async",
|
|
13
|
+
"checkbox",
|
|
14
|
+
"hook"
|
|
15
|
+
],
|
|
16
|
+
"version": "0.0.0-20250903185807",
|
|
4
17
|
"main": "dist/index.d.ts",
|
|
5
18
|
"module": "dist/index.mjs",
|
|
6
19
|
"types": "dist/index.d.mts",
|
|
@@ -332,6 +332,13 @@ export const dragAndDropFeature: FeatureImplementation = {
|
|
|
332
332
|
return target ? target.item.getId() === item.getId() : false;
|
|
333
333
|
},
|
|
334
334
|
|
|
335
|
+
isUnorderedDragTarget: ({ tree, item }) => {
|
|
336
|
+
const target = tree.getDragTarget();
|
|
337
|
+
return target
|
|
338
|
+
? !isOrderedDragTarget(target) && target.item.getId() === item.getId()
|
|
339
|
+
: false;
|
|
340
|
+
},
|
|
341
|
+
|
|
335
342
|
isDragTargetAbove: ({ tree, item }) => {
|
|
336
343
|
const target = tree.getDragTarget();
|
|
337
344
|
|
|
@@ -108,7 +108,13 @@ export type DragAndDropFeatureDef<T> = {
|
|
|
108
108
|
) => Record<string, any>;
|
|
109
109
|
};
|
|
110
110
|
itemInstance: {
|
|
111
|
+
/** Checks if the user is dragging in a way which makes this the new parent of the dragged items, either by dragging on top of
|
|
112
|
+
* this item, or by dragging inbetween children of this item. See @{isUnorderedDragTarget} if the latter is undesirable. */
|
|
111
113
|
isDragTarget: () => boolean;
|
|
114
|
+
|
|
115
|
+
/** As opposed to @{isDragTarget}, this will not be true if the target is inbetween children of this item. This returns only true
|
|
116
|
+
* if the user is dragging directly on top of this item. */
|
|
117
|
+
isUnorderedDragTarget: () => boolean;
|
|
112
118
|
isDragTargetAbove: () => boolean;
|
|
113
119
|
isDragTargetBelow: () => boolean;
|
|
114
120
|
isDraggingOver: () => boolean;
|
package/src/mddocs-entry.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { SyncDataLoaderFeatureDef } from "./features/sync-data-loader/types";
|
|
|
10
10
|
import { TreeFeatureDef } from "./features/tree/types";
|
|
11
11
|
import { PropMemoizationFeatureDef } from "./features/prop-memoization/types";
|
|
12
12
|
import { KeyboardDragAndDropFeatureDef } from "./features/keyboard-drag-and-drop/types";
|
|
13
|
+
import type { CheckboxesFeatureDef } from "./features/checkboxes/types";
|
|
13
14
|
|
|
14
15
|
export * from ".";
|
|
15
16
|
|
|
@@ -167,3 +168,15 @@ export type TreeFeatureTreeInstance<T> = TreeFeatureDef<T>["treeInstance"];
|
|
|
167
168
|
/** @interface */
|
|
168
169
|
export type TreeFeatureItemInstance<T> = TreeFeatureDef<T>["itemInstance"];
|
|
169
170
|
export type TreeFeatureHotkeys<T> = TreeFeatureDef<T>["hotkeys"];
|
|
171
|
+
|
|
172
|
+
/** @interface */
|
|
173
|
+
export type CheckboxesFeatureConfig<T> = CheckboxesFeatureDef<T>["config"];
|
|
174
|
+
/** @interface */
|
|
175
|
+
export type CheckboxesFeatureState<T> = CheckboxesFeatureDef<T>["state"];
|
|
176
|
+
/** @interface */
|
|
177
|
+
export type CheckboxesFeatureTreeInstance<T> =
|
|
178
|
+
CheckboxesFeatureDef<T>["treeInstance"];
|
|
179
|
+
/** @interface */
|
|
180
|
+
export type CheckboxesFeatureItemInstance<T> =
|
|
181
|
+
CheckboxesFeatureDef<T>["itemInstance"];
|
|
182
|
+
export type CheckboxesFeatureHotkeys<T> = CheckboxesFeatureDef<T>["hotkeys"];
|