fluid-dnd 1.0.0-beta.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/LICENSE +21 -0
- package/README.md +65 -0
- package/dist/core/HandlerPublisher.d.ts +6 -0
- package/dist/core/configHandler.d.ts +14 -0
- package/dist/core/dragAndDrop.d.ts +4 -0
- package/dist/core/index.d.ts +149 -0
- package/dist/core/useDraggable.d.ts +3 -0
- package/dist/core/useDroppable.d.ts +3 -0
- package/dist/core/utils/GetStyles.d.ts +44 -0
- package/dist/core/utils/ParseStyles.d.ts +7 -0
- package/dist/core/utils/SetStyles.d.ts +19 -0
- package/dist/core/utils/SetTransform.d.ts +7 -0
- package/dist/core/utils/classes.d.ts +9 -0
- package/dist/core/utils/config.d.ts +3 -0
- package/dist/core/utils/dom/classList.d.ts +8 -0
- package/dist/core/utils/droppableConfigurator.d.ts +22 -0
- package/dist/core/utils/events/emitEvents.d.ts +11 -0
- package/dist/core/utils/index.d.ts +10 -0
- package/dist/core/utils/observer.d.ts +1 -0
- package/dist/core/utils/scroll.d.ts +4 -0
- package/dist/core/utils/tempChildren.d.ts +5 -0
- package/dist/core/utils/touchDevice.d.ts +3 -0
- package/dist/core/utils/translate/GetTranslateBeforeDropping.d.ts +6 -0
- package/dist/core/utils/translate/GetTranslationByDraggingAndEvent.d.ts +6 -0
- package/dist/fluid-dnd.js +1241 -0
- package/dist/fluid-dnd.umd.cjs +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/svelte/index.d.ts +2 -0
- package/dist/svelte/useDragAndDrop.d.ts +4 -0
- package/dist/svelte/utils/SvelteListCondig.d.ts +13 -0
- package/dist/vue/index.d.ts +2 -0
- package/dist/vue/useDragAndDrop.d.ts +3 -0
- package/dist/vue/utils/DropMethods.d.ts +5 -0
- package/dist/vue/utils/VueListCondig.d.ts +13 -0
- package/package.json +92 -0
package/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 Carlos Jorge Rodriguez
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
@@ -0,0 +1,65 @@
|
|
1
|
+
<h1 align="center">
|
2
|
+
<img src="https://github.com/carlosjorger/vue-fluid-dnd/assets/50055316/dab15832-5290-42ca-b425-db177a2e589e" alt="Icon" width="150" height="140" />
|
3
|
+
<br>Fluid DnD<br>
|
4
|
+
</h1>
|
5
|
+
|
6
|
+
<div align="center">
|
7
|
+
|
8
|
+

|
9
|
+
[](https://github.com/carlosjorger/vue-fluid-dnd/blob/main/LICENSE)
|
10
|
+
[](https://www.npmjs.com/package/vue-fluid-dnd)
|
11
|
+

|
12
|
+

|
13
|
+
[](https://twitter.com/carlosjorgerc)
|
14
|
+
[](https://codeclimate.com/github/carlosjorger/vue-fluid-dnd/test_coverage)
|
15
|
+
|
16
|
+
</div>
|
17
|
+
|
18
|
+
Vue Fluid DnD is a [**fluid**, **smooth** and **versatil** drag and drop
|
19
|
+
library for lists on Vue 3](https://vue-fluid-dnd.netlify.app/). It's a**lightweight** tool ~7 Kb (gzip) with no depenencies. This library is a **Vue Draggable Next** alternative if you looking for a better ui experience.
|
20
|
+
|
21
|
+
<img src="https://github.com/user-attachments/assets/b350f9a4-7dd7-40ca-ae3f-ecca166a9081" width="100%"/>
|
22
|
+
|
23
|
+
## π§° Features
|
24
|
+
|
25
|
+
- β
**Fully customizable π¨**.
|
26
|
+
- β
**Zero dependencies πͺΆ**.
|
27
|
+
- β
**Work with horizontalβ‘οΈand vertical list :arrow_down:**.
|
28
|
+
- β
**Mouse π and touch ππ± (mobile, tablet and so on) support**.
|
29
|
+
- β
**Nice documentation π and examples**.
|
30
|
+
- β
**Fully tested π§ͺ, typed and reliable**.
|
31
|
+
|
32
|
+
## β¨ Inspirations
|
33
|
+
|
34
|
+
- β
π₯ Animations by [react-beautiful-dnd](https://github.com/atlassian/react-beautiful-dnd)
|
35
|
+
- β
π¨ Api by [Drag & Drop by Formkit](https://drag-and-drop.formkit.com/)
|
36
|
+
- β
π§° Features by [Vue.Draggable](https://github.com/SortableJS/Vue.Draggable)
|
37
|
+
|
38
|
+
## π Getting Started
|
39
|
+
|
40
|
+
1. **Install fluid-dnd:**
|
41
|
+
|
42
|
+
```bash
|
43
|
+
# with npm:
|
44
|
+
npm i fluid-dnd
|
45
|
+
|
46
|
+
# with yarn:
|
47
|
+
yarn add fluid-dnd
|
48
|
+
|
49
|
+
# with pnpm:
|
50
|
+
pnpm i fluid-dnd
|
51
|
+
```
|
52
|
+
|
53
|
+
3. **Documentation**
|
54
|
+
|
55
|
+
- π Check out all the [docs](https://vue-fluid-dnd.netlify.app/).
|
56
|
+
- π οΈ Edit the previous [here](https://codesandbox.io/s/nifty-hooks-5plkpl).
|
57
|
+
- π See others examples [here](https://vue-fluid-dnd.netlify.app/example/vertical-list/single-vertical-list/).
|
58
|
+
|
59
|
+
## π€ Contributing
|
60
|
+
|
61
|
+
If you're interested in contributing to [vue-fluid-dnd](https://github.com/carlosjorger/vue-fluid-dnd), please read our contributing docs before submitting a pull request [CONTRIBUTING](./CONTRIBUTING.md).
|
62
|
+
|
63
|
+
## π License
|
64
|
+
|
65
|
+
- [MIT](https://github.com/carlosjorger/vue-fluid-dnd/blob/main/LICENSE).
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { ElementScroll } from "../../index";
|
2
|
+
import { CoreConfig } from ".";
|
3
|
+
export type DroppableConfig<T> = {
|
4
|
+
droppable: HTMLElement;
|
5
|
+
config: CoreConfig<T>;
|
6
|
+
scroll: ElementScroll;
|
7
|
+
};
|
8
|
+
export default class ConfigHandler {
|
9
|
+
static configs: DroppableConfig<any>[];
|
10
|
+
static addConfig<T>(droppable: HTMLElement, config: CoreConfig<T>): void;
|
11
|
+
static removeObsoleteConfigs: () => void;
|
12
|
+
static updateScrolls(currentDroppable: Element, droppableGroupClass: string | null): void;
|
13
|
+
static getConfig(curerntDroppable: Element): DroppableConfig<any> | undefined;
|
14
|
+
}
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { ListCondig } from ".";
|
2
|
+
import { Config } from ".";
|
3
|
+
import HandlerPublisher from "@/core/HandlerPublisher";
|
4
|
+
export default function dragAndDrop<T>(listCondig: ListCondig<T>, handlerPublisher: HandlerPublisher, config?: Config<T>, indexAttr?: string): readonly [(index: number) => void, (index: number, value: T) => void, (parent: HTMLElement | undefined) => void];
|
@@ -0,0 +1,149 @@
|
|
1
|
+
import { DraggableElement } from "index";
|
2
|
+
export interface ListCondig<T> {
|
3
|
+
removeAtEvent: (index: number) => T | undefined;
|
4
|
+
insertEvent: (index: number, value: T) => void;
|
5
|
+
getLength: () => number;
|
6
|
+
getValue: (index: number) => T;
|
7
|
+
insertToListEmpty: (config: CoreConfig<T>, index: number, value: T) => void;
|
8
|
+
}
|
9
|
+
export interface DragStartEventData<T> {
|
10
|
+
index: number;
|
11
|
+
element: Element;
|
12
|
+
value: T;
|
13
|
+
}
|
14
|
+
export interface DragEndEventData<T> {
|
15
|
+
index: number;
|
16
|
+
value: T;
|
17
|
+
}
|
18
|
+
export declare const HORIZONTAL = "horizontal";
|
19
|
+
export declare const VERTICAL = "vertical";
|
20
|
+
/**
|
21
|
+
* The direction of the list to sort.
|
22
|
+
* @public
|
23
|
+
*/
|
24
|
+
export type Direction = typeof HORIZONTAL | typeof VERTICAL;
|
25
|
+
/**
|
26
|
+
* Configuration of the drag and drop.
|
27
|
+
* @public
|
28
|
+
*/
|
29
|
+
export interface Config<T> {
|
30
|
+
/**
|
31
|
+
* The direction of the list to sort.
|
32
|
+
*/
|
33
|
+
direction?: Direction;
|
34
|
+
/**
|
35
|
+
* The CSS selector of the drag handler element inside of the draggable element.
|
36
|
+
*/
|
37
|
+
handlerSelector?: string;
|
38
|
+
/**
|
39
|
+
* The CSS class that is setted when a element is dragged.
|
40
|
+
*/
|
41
|
+
draggingClass?: string;
|
42
|
+
/**
|
43
|
+
* The CSS class that is setted on a droppable element when the current element is dragged over it.
|
44
|
+
*/
|
45
|
+
droppableClass?: string;
|
46
|
+
/**
|
47
|
+
* The CSS class that is setted when a element is removed.
|
48
|
+
*/
|
49
|
+
removingClass?: string;
|
50
|
+
/**
|
51
|
+
* The CSS class that is setted when a element is start inserting.
|
52
|
+
*/
|
53
|
+
insertingFromClass?: string;
|
54
|
+
/**
|
55
|
+
* Delay time before removing an element in milisecond.
|
56
|
+
*/
|
57
|
+
delayBeforeRemove?: number;
|
58
|
+
/**
|
59
|
+
* Delay time before inserting an element in milisecond.
|
60
|
+
*/
|
61
|
+
delayBeforeInsert?: number;
|
62
|
+
/**
|
63
|
+
* A function that returns whether a given element of the list is draggable.
|
64
|
+
*/
|
65
|
+
isDraggable?: (element: HTMLElement) => boolean;
|
66
|
+
/**
|
67
|
+
* A function that returns whether a given element of the list is draggable.
|
68
|
+
*/
|
69
|
+
onDragStart?: (element: DragStartEventData<T>) => void;
|
70
|
+
/**
|
71
|
+
* A function that returns whether a given element of the list is draggable.
|
72
|
+
*/
|
73
|
+
onDragEnd?: (element: DragEndEventData<T>) => void;
|
74
|
+
/**
|
75
|
+
* Name of the group of the share droppables.
|
76
|
+
*/
|
77
|
+
droppableGroup?: string;
|
78
|
+
/**
|
79
|
+
* The duration of the animations in milisecond.
|
80
|
+
*/
|
81
|
+
animationDuration?: number;
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* onDrop event function.
|
85
|
+
* @public
|
86
|
+
*/
|
87
|
+
export type OnDropEvent = (source: DraggableElement, destination: DraggableElement) => void;
|
88
|
+
export type OnRemoveAtEvent<T> = (index: number) => T | undefined;
|
89
|
+
export type OnInsertEvent<T> = (index: number, value: T) => void;
|
90
|
+
export type OnGetLength = () => number;
|
91
|
+
export type OnGetValue<T> = (index: number) => T;
|
92
|
+
export type CoreConfig<T> = {
|
93
|
+
/**
|
94
|
+
* The direction of the list to sort.
|
95
|
+
*/
|
96
|
+
direction: Direction;
|
97
|
+
/**
|
98
|
+
* The CSS selector of the drag handler element inside of the draggable element.
|
99
|
+
*/
|
100
|
+
handlerSelector: string;
|
101
|
+
/**
|
102
|
+
* The CSS class that is setted when a element is dragged.
|
103
|
+
*/
|
104
|
+
draggingClass: string;
|
105
|
+
/**
|
106
|
+
* The CSS class that is setted on a droppable element when the current element is dragged over it.
|
107
|
+
*/
|
108
|
+
droppableClass: string;
|
109
|
+
/**
|
110
|
+
* The CSS class that is setted when a element is removed.
|
111
|
+
*/
|
112
|
+
removingClass: string;
|
113
|
+
/**
|
114
|
+
* The CSS class that is setted when a element is start inserting.
|
115
|
+
*/
|
116
|
+
insertingFromClass: string;
|
117
|
+
/**
|
118
|
+
* Delay time before removing an element in milisecond.
|
119
|
+
*/
|
120
|
+
delayBeforeRemove: number;
|
121
|
+
/**
|
122
|
+
* Delay time before inserting an element in milisecond.
|
123
|
+
*/
|
124
|
+
delayBeforeInsert: number;
|
125
|
+
/**
|
126
|
+
* A function that returns whether a given element of the list is draggable
|
127
|
+
*/
|
128
|
+
isDraggable: (element: HTMLElement) => boolean;
|
129
|
+
/**
|
130
|
+
* A function that is called when the draggable element starts being dragged.
|
131
|
+
*/
|
132
|
+
onDragStart: (element: DragStartEventData<T>) => void;
|
133
|
+
/**
|
134
|
+
* A function that is called when the draggable element is dropped.
|
135
|
+
*/
|
136
|
+
onDragEnd: (element: DragEndEventData<T>) => void;
|
137
|
+
/**
|
138
|
+
* Name of the group of the share droppables
|
139
|
+
*/
|
140
|
+
droppableGroup?: string;
|
141
|
+
/**
|
142
|
+
* The duration of the animations in milisecond
|
143
|
+
*/
|
144
|
+
animationDuration: number;
|
145
|
+
onRemoveAtEvent: OnRemoveAtEvent<T>;
|
146
|
+
onInsertEvent: OnInsertEvent<T>;
|
147
|
+
onGetLegth: OnGetLength;
|
148
|
+
onGetValue: OnGetValue<T>;
|
149
|
+
};
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { CoreConfig } from ".";
|
2
|
+
import HandlerPublisher from "./HandlerPublisher";
|
3
|
+
export default function useDraggable<T>(draggableElement: HTMLElement, index: number, config: CoreConfig<T>, parent: HTMLElement, handlerPublisher: HandlerPublisher): readonly [(targetIndex: number) => void, (targetIndex: number, value: T) => void];
|
@@ -0,0 +1,3 @@
|
|
1
|
+
import { CoreConfig } from ".";
|
2
|
+
import HandlerPublisher from "./HandlerPublisher";
|
3
|
+
export default function useDroppable<T>(coreConfig: CoreConfig<T>, handlerPublisher: HandlerPublisher, droppable?: HTMLElement, indexAttr?: string): readonly [((targetIndex: number) => void)[], ((targetIndex: number, value: T) => void)[]];
|
@@ -0,0 +1,44 @@
|
|
1
|
+
import { Direction } from "..";
|
2
|
+
import { BeforeMargin, AfterMargin, BorderWidth, PaddingBefore, Before } from "../../../index";
|
3
|
+
export declare const getWindowScroll: () => {
|
4
|
+
scrollX: number;
|
5
|
+
scrollY: number;
|
6
|
+
};
|
7
|
+
export declare const parseFloatEmpty: (value: string) => number;
|
8
|
+
export declare const parseIntEmpty: (value: string | null) => number;
|
9
|
+
export declare const getTransform: (element: Element) => {
|
10
|
+
x: number;
|
11
|
+
y: number;
|
12
|
+
};
|
13
|
+
export declare const draggableIsOutside: (draggable: Element, droppable: Element) => boolean;
|
14
|
+
export declare const hasIntersection: (element1: Element, element2: Element) => boolean;
|
15
|
+
export declare const getValueFromProperty: (element: HTMLElement | Element | undefined | null, property: PaddingBefore | BorderWidth | BeforeMargin | AfterMargin | Before) => number;
|
16
|
+
export declare const getScrollElement: (element: HTMLElement) => {
|
17
|
+
scrollLeft: number;
|
18
|
+
scrollTop: number;
|
19
|
+
};
|
20
|
+
export declare const getPropByDirection: (direction: Direction) => {
|
21
|
+
readonly beforeMargin: "marginTop" | "marginLeft";
|
22
|
+
readonly afterMargin: "marginBottom" | "marginRight";
|
23
|
+
readonly borderBeforeWidth: "borderTopWidth" | "borderLeftWidth";
|
24
|
+
readonly before: "left" | "top";
|
25
|
+
readonly after: "right" | "down";
|
26
|
+
readonly gap: "columnGap" | "rowGap";
|
27
|
+
readonly distance: "width" | "height";
|
28
|
+
readonly axis: "x" | "y";
|
29
|
+
readonly offset: "offsetX" | "offsetY";
|
30
|
+
readonly scroll: "scrollX" | "scrollY";
|
31
|
+
readonly scrollElement: "scrollLeft" | "scrollTop";
|
32
|
+
readonly page: "pageX" | "pageY";
|
33
|
+
readonly inner: "innerWidth" | "innerHeight";
|
34
|
+
readonly offsetElement: "offsetLeft" | "offsetTop";
|
35
|
+
readonly scrollDistance: "scrollWidth" | "scrollHeight";
|
36
|
+
readonly clientDistance: "clientWidth" | "clientHeight";
|
37
|
+
readonly paddingBefore: "paddingLeft" | "paddingTop";
|
38
|
+
readonly getRect: (element: Element) => DOMRect;
|
39
|
+
};
|
40
|
+
export declare const getSiblings: (current: HTMLElement, parent: HTMLElement) => readonly [Element[], number, HTMLElement];
|
41
|
+
export declare const getGroupDroppables: (currentDroppable: HTMLElement, droppableGroup?: string) => Element[];
|
42
|
+
export declare const getParentDraggableChildren: (parent: HTMLElement) => Element[];
|
43
|
+
export declare const getSiblingsByParent: (current: HTMLElement, parent: HTMLElement) => readonly [Element[], number, HTMLElement];
|
44
|
+
export declare const getNearestFixedParentPosition: (element: Element, direction: Direction) => number;
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { GapStyle } from "../../../index";
|
2
|
+
import { Direction } from "..";
|
3
|
+
export declare const getNumberFromPixels: (pixels: string | undefined) => number;
|
4
|
+
export declare const computeGapPixels: (element: Element, gapType: GapStyle) => number;
|
5
|
+
export declare const gapAndDisplayInformation: (element: Element | null, gapStyle: GapStyle) => [number, boolean];
|
6
|
+
export declare const getBeforeStyles: (element: HTMLElement) => [number, number];
|
7
|
+
export declare const getGapPixels: (element: HTMLElement, direction: Direction) => number;
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import { DragMouseTouchEvent, fixedSize } from "../../../index";
|
2
|
+
type onTouchEvent = "ontouchstart" | "ontouchmove" | "ontouchend";
|
3
|
+
declare const onMouseEvents: readonly ["onmouseup", "onmousedown", "onmousemove"];
|
4
|
+
type onMouseEvent = (typeof onMouseEvents)[number];
|
5
|
+
type TouchEventType = "touchstart" | "touchmove" | "touchend";
|
6
|
+
declare const mouseEvents: readonly ["mouseup", "mousedown", "mousemove"];
|
7
|
+
type MouseEventType = (typeof mouseEvents)[number];
|
8
|
+
type DragEventCallback = (event: DragMouseTouchEvent) => void;
|
9
|
+
export declare const setSizeStyles: (element: HTMLElement | undefined | null, height: number, width: number) => void;
|
10
|
+
export declare const fixSizeStyle: (element: HTMLElement | undefined | null) => void;
|
11
|
+
export declare const moveTranslate: (element: Element | undefined | null, height: number, width: number) => void;
|
12
|
+
export declare const assignDraggingEvent: (element: HTMLElement, onEvent: onMouseEvent | onTouchEvent, callback: DragEventCallback | null) => void;
|
13
|
+
export declare const addDragMouseToucEventListener: (event: TouchEventType | MouseEventType, callback: DragEventCallback | null) => void;
|
14
|
+
export declare const convetEventToDragMouseTouchEvent: (event: MouseEvent | TouchEvent) => DragMouseTouchEvent;
|
15
|
+
export declare const setTranistion: (element: Element | undefined, duration: number, timingFunction?: string, types?: string) => void;
|
16
|
+
export declare const setEventWithInterval: (element: Element | undefined, eventName: "onscroll", callback: () => void) => void;
|
17
|
+
export declare const AddCssStylesToElement: (node: ParentNode, cssCodes: string[]) => void;
|
18
|
+
export declare const setCustomFixedSize: (element: HTMLElement | undefined, fixedProps?: fixedSize) => void;
|
19
|
+
export {};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { DragMouseTouchEvent, TransformEvent } from "../../../index";
|
2
|
+
import { Direction } from "..";
|
3
|
+
export declare const useTransform: (draggedElement: HTMLElement) => readonly [(element: HTMLElement, parent: HTMLElement, pagePosition: {
|
4
|
+
pageX: number;
|
5
|
+
pageY: number;
|
6
|
+
}, direction?: Direction) => void, (event: DragMouseTouchEvent, element: HTMLElement) => void];
|
7
|
+
export declare const getTransformState: (event: TransformEvent, element: HTMLElement, draggable: Element) => [number, number, number, number];
|
@@ -0,0 +1,9 @@
|
|
1
|
+
export declare const DRAGGABLE_CLASS = "draggable";
|
2
|
+
export declare const DROPPABLE_CLASS = "droppable";
|
3
|
+
export declare const HANDLER_CLASS = "handler-class";
|
4
|
+
export declare const DRAGGING_CLASS = "dragging";
|
5
|
+
export declare const DRAGGING_HANDLER_CLASS = "dragging-handler-class";
|
6
|
+
export declare const DROPPING_CLASS = "dropping";
|
7
|
+
export declare const GRABBING_CLASS = "grabbing";
|
8
|
+
export declare const GRAB_CLASS = "grab";
|
9
|
+
export declare const DISABLE_TRANSITION = "disable-transition";
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare const containClass: (element: Element, cssClass: string) => boolean;
|
2
|
+
export declare const toggleClass: (element: Element, cssClass: string, force?: boolean) => void;
|
3
|
+
export declare const addClass: (element: Element, cssClass: string) => void;
|
4
|
+
export declare const removeClass: (element: Element, cssClass: string) => void;
|
5
|
+
export declare const containstClasses: (element: HTMLElement, classes: string) => boolean;
|
6
|
+
export declare const getClassesSelector: (classes: string | null) => string;
|
7
|
+
export declare const addMultipleClasses: (element: HTMLElement, classes: string | null) => void;
|
8
|
+
export declare const getClassesList: (classes: string | null | undefined) => string[];
|
@@ -0,0 +1,22 @@
|
|
1
|
+
import { DroppableConfig } from "../configHandler";
|
2
|
+
import { DragMouseTouchEvent } from "../../../index";
|
3
|
+
export declare class DroppableConfigurator<T> {
|
4
|
+
initial: DroppableConfig<any> | undefined;
|
5
|
+
current: DroppableConfig<T> | undefined;
|
6
|
+
private parent;
|
7
|
+
private draggableElement;
|
8
|
+
private groupClass;
|
9
|
+
private dragEvent;
|
10
|
+
private changeDroppable;
|
11
|
+
constructor(draggableElement: HTMLElement, droppableGroupClass: string | null, parent: HTMLElement, setTransformDragEvent: () => void, changeDroppable: (newdDroppableConfig: DroppableConfig<T> | undefined, oldDroppableConfig: DroppableConfig<T> | undefined) => void);
|
12
|
+
private getDraggableAncestor;
|
13
|
+
private getElementBelow;
|
14
|
+
private getCurrent;
|
15
|
+
private isOutsideOfAllDroppables;
|
16
|
+
private isNotInsideAnotherDroppable;
|
17
|
+
private onScrollEvent;
|
18
|
+
private setOnScroll;
|
19
|
+
getCurrentConfig(event: DragMouseTouchEvent): DroppableConfig<any> | DroppableConfig<T> | undefined;
|
20
|
+
updateConfig(event: DragMouseTouchEvent): void;
|
21
|
+
isOutside(event: DragMouseTouchEvent, hiddenDraggable?: boolean): boolean;
|
22
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { WindowScroll } from "../../../../index";
|
2
|
+
import { CoreConfig } from "../..";
|
3
|
+
import { DRAG_EVENT, START_DRAG_EVENT, START_DROP_EVENT } from "..";
|
4
|
+
import { DroppableConfig } from "../../configHandler";
|
5
|
+
import HandlerPublisher from '../../HandlerPublisher';
|
6
|
+
type DraggingEvent = typeof DRAG_EVENT | typeof START_DRAG_EVENT;
|
7
|
+
type DragAndDropEvent = DraggingEvent | DropEvent;
|
8
|
+
type DropEvent = "drop" | typeof START_DROP_EVENT;
|
9
|
+
export default function useEmitEvents<T>(currentConfig: CoreConfig<T>, index: number, parent: HTMLElement, droppableGroupClass: string | null, handlerPublisher: HandlerPublisher, endDraggingAction: () => void): readonly [(draggedElement: HTMLElement, event: DragAndDropEvent, initialWindowScroll: WindowScroll, droppableConfig: DroppableConfig<T> | undefined, positionOnSourceDroppable?: number) => void, (targetIndex: number, draggedElement: HTMLElement, droppableConfig: DroppableConfig<T>, onFinishRemoveEvent: (element: HTMLElement) => void) => void, (targetIndex: number, draggedElement: HTMLElement, droppable: HTMLElement, value: T, startInserting: () => void) => void, (draggedElement: HTMLElement) => void, (element: Element, force: boolean) => void];
|
10
|
+
export declare const insertToListEmpty: <T>(config: CoreConfig<T>, droppable: HTMLElement | undefined, targetIndex: number, value: T) => void;
|
11
|
+
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
export declare const START_DRAG_EVENT = "startDrag";
|
2
|
+
export declare const DRAG_EVENT = "drag";
|
3
|
+
export declare const START_DROP_EVENT = "startDrop";
|
4
|
+
export declare const DROP_EVENT = "drop";
|
5
|
+
export declare const TEMP_CHILD_CLASS = "temp-child";
|
6
|
+
export declare const draggableTargetTimingFunction = "cubic-bezier(0.2, 0, 0, 1)";
|
7
|
+
export type DraggingEvent = typeof DRAG_EVENT | typeof START_DRAG_EVENT;
|
8
|
+
export type DropEvent = typeof DROP_EVENT | typeof START_DROP_EVENT;
|
9
|
+
export type DragAndDropEvent = DraggingEvent | DropEvent | "remove" | "insert";
|
10
|
+
export declare const IsDropEvent: (event: DragAndDropEvent) => event is DropEvent;
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare const observeMutation: (callback: (observer: MutationObserver, mutation: MutationRecord) => void, element: Element, options?: MutationObserverInit) => MutationObserver;
|
@@ -0,0 +1,4 @@
|
|
1
|
+
import { ElementScroll } from "index";
|
2
|
+
import { Direction } from "..";
|
3
|
+
export declare const scrollByDirection: (element: HTMLElement, direction: Direction, scrollAmount: number) => void;
|
4
|
+
export declare const scrollPercent: (direction: Direction, droppable: HTMLElement, droppableScroll: ElementScroll) => number;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import { DroppableConfig } from "../configHandler";
|
2
|
+
export declare const addTempChild: <T>(draggedElement: HTMLElement | undefined, parent: Element, ifStartDragging: boolean, droppableConfig?: DroppableConfig<T>, addingAnimationDuration?: number) => void;
|
3
|
+
export declare const addTempChildOnInsert: <T>(draggedElement: HTMLElement | undefined, ifStartDragging: boolean, droppableConfig?: DroppableConfig<T>) => void;
|
4
|
+
export declare const removeTempChildrens: (droppable: HTMLElement, parent: HTMLElement, droppableGroupClass: string | null, animationDuration: number, draggedElementIsOutside?: boolean) => void;
|
5
|
+
export declare const removeTempChild: (parent: HTMLElement, animationDuration: number, isAnimated?: boolean) => void;
|
@@ -0,0 +1,3 @@
|
|
1
|
+
export declare const isTouchEvent: (event: MouseEvent | TouchEvent) => event is TouchEvent;
|
2
|
+
export declare const IsHTMLElement: (element: Element | undefined) => element is HTMLElement;
|
3
|
+
export declare const IsMouseEvent: (event: MouseEvent | TouchEvent) => event is MouseEvent;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Direction } from "../..";
|
2
|
+
import { Translate, WindowScroll } from "../../../../index";
|
3
|
+
export default function getTranslateBeforeDropping(direction: Direction, siblings: Element[], sourceIndex: number, targetIndex: number, scroll: WindowScroll, previousScroll: {
|
4
|
+
scrollLeft: number;
|
5
|
+
scrollTop: number;
|
6
|
+
}, initialWindowScroll: WindowScroll, droppable: HTMLElement, draggable?: HTMLElement): Translate;
|
@@ -0,0 +1,6 @@
|
|
1
|
+
import { Direction } from "../..";
|
2
|
+
import { DragAndDropEvent } from "..";
|
3
|
+
export default function getTranslationByDraggingAndEvent(current: HTMLElement, event: DragAndDropEvent, direction: Direction, droppable: HTMLElement, previousElement?: Element | null, nextElement?: Element | null): {
|
4
|
+
height: number;
|
5
|
+
width: number;
|
6
|
+
};
|