dragselect 3.1.1 → 3.1.4
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 +9 -0
- package/dist/DragSelect.d.ts +11 -1
- package/dist/DragSelect.es6m.js +3886 -0
- package/dist/DragSelect.esm.js +60 -19
- package/dist/DragSelect.js +60 -19
- package/dist/ds.es6m.min.js +1 -0
- package/dist/ds.esm.min.js +1 -1
- package/dist/ds.min.js +1 -1
- package/dist/methods/addModificationObservers.d.ts +11 -0
- package/dist/methods/canScroll.d.ts +3 -0
- package/dist/methods/createSelectorAreaElement.d.ts +3 -0
- package/dist/methods/createSelectorElement.d.ts +3 -0
- package/dist/methods/debounce.d.ts +3 -0
- package/dist/methods/documentScroll.d.ts +6 -0
- package/dist/methods/getAllParentNodes.d.ts +3 -0
- package/dist/methods/getAreaRect.d.ts +3 -0
- package/dist/methods/getBoundingClientRect.d.ts +4 -0
- package/dist/methods/getCurrentScroll.d.ts +3 -0
- package/dist/methods/getOverflowEdges.d.ts +7 -0
- package/dist/methods/getPointerPos.d.ts +5 -0
- package/dist/methods/getSelectorPosition.d.ts +12 -0
- package/dist/methods/getStylePosition.d.ts +3 -0
- package/dist/methods/handleElementOverflow.d.ts +10 -0
- package/dist/methods/handleElementPositionAttribute.d.ts +6 -0
- package/dist/methods/handleKeyboardDragPosDifference.d.ts +13 -0
- package/dist/methods/handleSelection.d.ts +9 -0
- package/dist/methods/handleUnSelection.d.ts +9 -0
- package/dist/methods/hydrateSettings.d.ts +3 -0
- package/dist/methods/index.d.ts +30 -0
- package/dist/methods/isCollision.d.ts +13 -0
- package/dist/methods/moveElement.d.ts +8 -0
- package/dist/methods/removeModificationObservers.d.ts +3 -0
- package/dist/methods/scrollElement.d.ts +3 -0
- package/dist/methods/setStylePosition.d.ts +3 -0
- package/dist/methods/subscriberAliases.d.ts +14 -0
- package/dist/methods/toArray.d.ts +3 -0
- package/dist/methods/updateElementStylePos.d.ts +8 -0
- package/dist/methods/vect2.d.ts +8 -0
- package/dist/modules/Area.d.ts +80 -0
- package/dist/modules/Drag.d.ts +71 -0
- package/dist/modules/DropZone.d.ts +90 -0
- package/dist/modules/DropZones.d.ts +73 -0
- package/dist/modules/Interaction.d.ts +51 -0
- package/dist/modules/PubSub.d.ts +37 -0
- package/dist/modules/SelectableSet.d.ts +43 -0
- package/dist/modules/SelectedSet.d.ts +32 -0
- package/dist/modules/Selection.d.ts +54 -0
- package/dist/modules/Selector.d.ts +29 -0
- package/dist/modules/SelectorArea.d.ts +58 -0
- package/dist/modules/index.d.ts +11 -0
- package/dist/stores/KeyStore.d.ts +34 -0
- package/dist/stores/PointerStore.d.ts +83 -0
- package/dist/stores/ScrollStore.d.ts +38 -0
- package/dist/stores/SettingsStore.d.ts +39 -0
- package/dist/stores/index.d.ts +5 -0
- package/dist/types.d.ts +276 -0
- package/package.json +5 -8
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare function _default({ shiftKey, keyboardDragSpeed, zoom, key, dragKeys, scrollDiff, canScroll, scrollCallback, }: {
|
|
2
|
+
key: string;
|
|
3
|
+
shiftKey: boolean;
|
|
4
|
+
canScroll: boolean;
|
|
5
|
+
keyboardDragSpeed: number;
|
|
6
|
+
zoom: number;
|
|
7
|
+
scrollCallback: ScrollCallback;
|
|
8
|
+
scrollDiff: Vect2;
|
|
9
|
+
dragKeys: DSDragKeys;
|
|
10
|
+
}): Vect2;
|
|
11
|
+
export default _default;
|
|
12
|
+
export type ScrollCallback = Function;
|
|
13
|
+
import "../types"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function _default({ element, force, multiSelectionToggle, SelectedSet, hoverClassName, }: {
|
|
2
|
+
element: DSElement;
|
|
3
|
+
force: boolean;
|
|
4
|
+
multiSelectionToggle: boolean;
|
|
5
|
+
SelectedSet: Set<any>;
|
|
6
|
+
hoverClassName: string;
|
|
7
|
+
}): void;
|
|
8
|
+
export default _default;
|
|
9
|
+
import "../types"
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
declare function _default({ element, force, SelectedSet, PrevSelectedSet, hoverClassName, }: {
|
|
2
|
+
element: DSElement;
|
|
3
|
+
force: boolean;
|
|
4
|
+
SelectedSet: Set<any>;
|
|
5
|
+
PrevSelectedSet: Set<any>;
|
|
6
|
+
hoverClassName: string;
|
|
7
|
+
}): boolean;
|
|
8
|
+
export default _default;
|
|
9
|
+
import "../types"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export * as vect2 from "./vect2";
|
|
2
|
+
export { default as addModificationObservers } from "./addModificationObservers";
|
|
3
|
+
export { default as canScroll } from "./canScroll";
|
|
4
|
+
export { default as createSelectorAreaElement } from "./createSelectorAreaElement";
|
|
5
|
+
export { default as createSelectorElement } from "./createSelectorElement";
|
|
6
|
+
export { default as debounce } from "./debounce";
|
|
7
|
+
export { default as documentScroll } from "./documentScroll";
|
|
8
|
+
export { default as getAllParentNodes } from "./getAllParentNodes";
|
|
9
|
+
export { default as getAreaRect } from "./getAreaRect";
|
|
10
|
+
export { default as getBoundingClientRect } from "./getBoundingClientRect";
|
|
11
|
+
export { default as getCurrentScroll } from "./getCurrentScroll";
|
|
12
|
+
export { default as getOverflowEdges } from "./getOverflowEdges";
|
|
13
|
+
export { default as getPointerPos } from "./getPointerPos";
|
|
14
|
+
export { default as getSelectorPosition } from "./getSelectorPosition";
|
|
15
|
+
export { default as getStylePosition } from "./getStylePosition";
|
|
16
|
+
export { default as handleElementOverflow } from "./handleElementOverflow";
|
|
17
|
+
export { default as handleElementPositionAttribute } from "./handleElementPositionAttribute";
|
|
18
|
+
export { default as handleKeyboardDragPosDifference } from "./handleKeyboardDragPosDifference";
|
|
19
|
+
export { default as handleSelection } from "./handleSelection";
|
|
20
|
+
export { default as handleUnSelection } from "./handleUnSelection";
|
|
21
|
+
export { default as hydrateSettings } from "./hydrateSettings";
|
|
22
|
+
export { default as isCollision } from "./isCollision";
|
|
23
|
+
export { default as moveElement } from "./moveElement";
|
|
24
|
+
export { default as removeModificationObservers } from "./removeModificationObservers";
|
|
25
|
+
export { default as scrollElement } from "./scrollElement";
|
|
26
|
+
export { default as setStylePosition } from "./setStylePosition";
|
|
27
|
+
export { default as subscriberAliases } from "./subscriberAliases";
|
|
28
|
+
export { default as toArray } from "./toArray";
|
|
29
|
+
export { default as updateElementStylePos } from "./updateElementStylePos";
|
|
30
|
+
import "../types"
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
declare function _default(el1: {
|
|
2
|
+
left: number;
|
|
3
|
+
right: number;
|
|
4
|
+
top: number;
|
|
5
|
+
bottom: number;
|
|
6
|
+
}, el2: {
|
|
7
|
+
left: number;
|
|
8
|
+
right: number;
|
|
9
|
+
top: number;
|
|
10
|
+
bottom: number;
|
|
11
|
+
}, percent?: number): boolean;
|
|
12
|
+
export default _default;
|
|
13
|
+
import "../types"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare function _default({ subscribe, publish, Interaction, SelectedSet, DropZones, }: {
|
|
2
|
+
subscribe: DSSubscribe;
|
|
3
|
+
publish: DSPublish;
|
|
4
|
+
Interaction: Interaction;
|
|
5
|
+
SelectedSet: SelectedSet;
|
|
6
|
+
DropZones: DropZones;
|
|
7
|
+
}): void;
|
|
8
|
+
export default _default;
|
|
9
|
+
export type DSSubscribe = Function;
|
|
10
|
+
export type DSPublish = Function;
|
|
11
|
+
import { Interaction } from "../modules";
|
|
12
|
+
import { SelectedSet } from "../modules";
|
|
13
|
+
import { DropZones } from "../modules";
|
|
14
|
+
import "../types"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function calc({ x: x1, y: y1 }: Vect2, operator: '+' | '-' | '*' | '/', { x: x2, y: y2 }: Vect2): Vect2;
|
|
2
|
+
export function rect2vect(rect: {
|
|
3
|
+
left: number;
|
|
4
|
+
top: number;
|
|
5
|
+
}): Vect2;
|
|
6
|
+
export function vect2rect(vect: Vect2, dimension?: number): DSBoundingRect;
|
|
7
|
+
export function num2vect(n: number): Vect2;
|
|
8
|
+
import "../types"
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
export default class Area {
|
|
2
|
+
/**
|
|
3
|
+
* @constructor Area
|
|
4
|
+
* @param {{DS:DragSelect}} p
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
constructor({ DS }: {
|
|
8
|
+
DS: DragSelect;
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* @type {DragSelect}
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
private DS;
|
|
15
|
+
/**
|
|
16
|
+
* @type {{cleanup:() => void}}
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
private _observers;
|
|
20
|
+
/**
|
|
21
|
+
* @type {DSArea}
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
private _node;
|
|
25
|
+
/**
|
|
26
|
+
* @type {DSArea[]}
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
private _parentNodes;
|
|
30
|
+
/**
|
|
31
|
+
* @type {CSSStyleDeclaration}
|
|
32
|
+
* @private
|
|
33
|
+
* */
|
|
34
|
+
private _computedStyle;
|
|
35
|
+
/**
|
|
36
|
+
* @type {{top:number,bottom:number,left:number,right:number}}
|
|
37
|
+
* @private
|
|
38
|
+
* */
|
|
39
|
+
private _computedBorder;
|
|
40
|
+
/**
|
|
41
|
+
* @type {DSBoundingRect}
|
|
42
|
+
* @private
|
|
43
|
+
* */
|
|
44
|
+
private _rect;
|
|
45
|
+
/** @param {DSArea} area */
|
|
46
|
+
setArea: (area: DSArea) => void;
|
|
47
|
+
start: () => void;
|
|
48
|
+
reset: () => void;
|
|
49
|
+
stop: () => void;
|
|
50
|
+
/**
|
|
51
|
+
* Scroll the area in the specified direction
|
|
52
|
+
* @param {Array.<'top'|'bottom'|'left'|'right'|undefined>} directions
|
|
53
|
+
* @param {number} multiplier
|
|
54
|
+
*/
|
|
55
|
+
scroll: (directions: Array<'top' | 'bottom' | 'left' | 'right' | undefined>, multiplier: number) => void;
|
|
56
|
+
get HTMLNode(): DSArea;
|
|
57
|
+
/**
|
|
58
|
+
* The computed border from the element (caches result)
|
|
59
|
+
* @type {{top:number,bottom:number,left:number,right:number}}
|
|
60
|
+
*/
|
|
61
|
+
get computedBorder(): {
|
|
62
|
+
top: number;
|
|
63
|
+
bottom: number;
|
|
64
|
+
left: number;
|
|
65
|
+
right: number;
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* The computed styles from the element (caches result)
|
|
69
|
+
* @type {CSSStyleDeclaration}
|
|
70
|
+
*/
|
|
71
|
+
get computedStyle(): CSSStyleDeclaration;
|
|
72
|
+
/**
|
|
73
|
+
* The element rect (caches result) (without scrollbar or borders)
|
|
74
|
+
* @type {DSBoundingRect}
|
|
75
|
+
*/
|
|
76
|
+
get rect(): DSBoundingRect;
|
|
77
|
+
get parentNodes(): DSArea[];
|
|
78
|
+
}
|
|
79
|
+
import DragSelect from "../DragSelect";
|
|
80
|
+
import "../types"
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export default class Drag {
|
|
2
|
+
/**
|
|
3
|
+
* @constructor Drag
|
|
4
|
+
* @param {{DS:DragSelect}} obj
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
constructor({ DS }: {
|
|
8
|
+
DS: DragSelect;
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* @type {Vect2}
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
private _prevCursorPos;
|
|
15
|
+
/**
|
|
16
|
+
* @type {Vect2}
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
private _prevScrollPos;
|
|
20
|
+
/**
|
|
21
|
+
* @type {DSElements}
|
|
22
|
+
* @private
|
|
23
|
+
*/
|
|
24
|
+
private _elements;
|
|
25
|
+
/**
|
|
26
|
+
* @type {DSDragKeys}
|
|
27
|
+
* @private
|
|
28
|
+
*/
|
|
29
|
+
private _dragKeys;
|
|
30
|
+
/**
|
|
31
|
+
* @type {string[]}
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private _dragKeysFlat;
|
|
35
|
+
/**
|
|
36
|
+
* @type {DSBoundingRect}
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
private _selectionRect;
|
|
40
|
+
DS: DragSelect;
|
|
41
|
+
assignDragkeys: () => void;
|
|
42
|
+
keyboardDrag: ({ event, key }: {
|
|
43
|
+
event: any;
|
|
44
|
+
key: any;
|
|
45
|
+
}) => void;
|
|
46
|
+
keyboardEnd: ({ event, key }: {
|
|
47
|
+
event: any;
|
|
48
|
+
key: any;
|
|
49
|
+
}) => void;
|
|
50
|
+
start: ({ isDragging, isDraggingKeyboard }: {
|
|
51
|
+
isDragging: any;
|
|
52
|
+
isDraggingKeyboard: any;
|
|
53
|
+
}) => void;
|
|
54
|
+
stop: (evt: any) => void;
|
|
55
|
+
update: ({ isDragging, isDraggingKeyboard }: {
|
|
56
|
+
isDragging: any;
|
|
57
|
+
isDraggingKeyboard: any;
|
|
58
|
+
}) => void;
|
|
59
|
+
/**
|
|
60
|
+
* Modify direction value so that the rect of draggable elements
|
|
61
|
+
* does not exceed the boundaries of container rect
|
|
62
|
+
* @param {Vect2} direction
|
|
63
|
+
* @return {Vect2}
|
|
64
|
+
*/
|
|
65
|
+
limitDirection: (direction: Vect2) => Vect2;
|
|
66
|
+
handleZIndex: (add: any) => void;
|
|
67
|
+
get _cursorDiff(): Vect2;
|
|
68
|
+
get _scrollDiff(): Vect2;
|
|
69
|
+
}
|
|
70
|
+
import DragSelect from "../DragSelect";
|
|
71
|
+
import "../types"
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export default class DropZone {
|
|
2
|
+
/**
|
|
3
|
+
* @constructor Drag
|
|
4
|
+
* @param {Object} obj
|
|
5
|
+
* @param {DragSelect} obj.DS
|
|
6
|
+
* @param {string} obj.id
|
|
7
|
+
* @param {DSElement} obj.element
|
|
8
|
+
* @param {DSInputElements} [obj.droppables]
|
|
9
|
+
* @ignore
|
|
10
|
+
*/
|
|
11
|
+
constructor({ DS, id, element, droppables }: {
|
|
12
|
+
DS: DragSelect;
|
|
13
|
+
id: string;
|
|
14
|
+
element: DSElement;
|
|
15
|
+
droppables?: DSInputElements;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* @type {string}
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* @type {DSElement}
|
|
23
|
+
*/
|
|
24
|
+
element: DSElement;
|
|
25
|
+
/**
|
|
26
|
+
* @type {DSElements}
|
|
27
|
+
*/
|
|
28
|
+
_droppables: DSElements;
|
|
29
|
+
/**
|
|
30
|
+
* @type {DOMRect}
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
private _rect;
|
|
34
|
+
/**
|
|
35
|
+
* @type {{cleanup:()=>void}}
|
|
36
|
+
* @private
|
|
37
|
+
*/
|
|
38
|
+
private _observers;
|
|
39
|
+
/**
|
|
40
|
+
* @type {NodeJS.Timeout}
|
|
41
|
+
* @private
|
|
42
|
+
*/
|
|
43
|
+
private _timeout;
|
|
44
|
+
/**
|
|
45
|
+
* @type {DSElements}
|
|
46
|
+
* @private
|
|
47
|
+
*/
|
|
48
|
+
private _itemsDropped;
|
|
49
|
+
/**
|
|
50
|
+
* @type {DSElements}
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
private _itemsInside;
|
|
54
|
+
DS: DragSelect;
|
|
55
|
+
Settings: Settings;
|
|
56
|
+
set droppables(arg: DSElements);
|
|
57
|
+
get droppables(): DSElements;
|
|
58
|
+
/**
|
|
59
|
+
* @param {'add'|'remove'} action
|
|
60
|
+
*/
|
|
61
|
+
setReadyClasses: (action: 'add' | 'remove') => void;
|
|
62
|
+
/**
|
|
63
|
+
* This zone is NOT the target of a drop
|
|
64
|
+
*/
|
|
65
|
+
handleNoDrop: () => void;
|
|
66
|
+
/**
|
|
67
|
+
* This zone IS the target of a drop
|
|
68
|
+
*/
|
|
69
|
+
handleDrop: () => void;
|
|
70
|
+
handleItemsInsideClasses: () => void;
|
|
71
|
+
start: ({ isDragging }: {
|
|
72
|
+
isDragging: any;
|
|
73
|
+
}) => void;
|
|
74
|
+
stop: ({ isDragging }: {
|
|
75
|
+
isDragging: any;
|
|
76
|
+
}) => void;
|
|
77
|
+
destroy(): void;
|
|
78
|
+
isDestroyed: boolean;
|
|
79
|
+
/**
|
|
80
|
+
* @returns {DSDropZone}
|
|
81
|
+
*/
|
|
82
|
+
toObject: () => DSDropZone;
|
|
83
|
+
get rect(): DOMRect;
|
|
84
|
+
get itemsDropped(): DSElements;
|
|
85
|
+
get itemsInside(): DSElements;
|
|
86
|
+
get parentNodes(): DSElements;
|
|
87
|
+
_parentNodes: DSElements;
|
|
88
|
+
}
|
|
89
|
+
import DragSelect from "../DragSelect";
|
|
90
|
+
import "../types"
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
export default class DropZones {
|
|
2
|
+
/**
|
|
3
|
+
* @constructor Drag
|
|
4
|
+
* @param {{DS:DragSelect}} obj
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
constructor({ DS }: {
|
|
8
|
+
DS: DragSelect;
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* Get the drop zone by the zone element
|
|
12
|
+
* @type {Map<DSElement, DropZone>}
|
|
13
|
+
* @private
|
|
14
|
+
*/
|
|
15
|
+
private _zoneByElement;
|
|
16
|
+
/**
|
|
17
|
+
* Get the drop zone by the zone id
|
|
18
|
+
* @type {Map<string, DropZone>}
|
|
19
|
+
* @private
|
|
20
|
+
*/
|
|
21
|
+
private _zoneById;
|
|
22
|
+
/**
|
|
23
|
+
* Get the drop zones by one zone item
|
|
24
|
+
* @type {Map<DSElement,DropZone[]>}
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
27
|
+
private _zonesByDroppable;
|
|
28
|
+
/**
|
|
29
|
+
* Get the drop zones by one zone item
|
|
30
|
+
* @type {DropZone[]}
|
|
31
|
+
* @private
|
|
32
|
+
*/
|
|
33
|
+
private _zones;
|
|
34
|
+
DS: DragSelect;
|
|
35
|
+
Settings: Settings;
|
|
36
|
+
/**
|
|
37
|
+
* @param {Object} obj
|
|
38
|
+
* @param {DSDropZone[]} [obj.dropZones]
|
|
39
|
+
*/
|
|
40
|
+
setDropZones: ({ dropZones }: {
|
|
41
|
+
dropZones?: DSDropZone[];
|
|
42
|
+
}) => void;
|
|
43
|
+
_handleDrop: (target: any) => void;
|
|
44
|
+
/**
|
|
45
|
+
* @param {DSElements} elements
|
|
46
|
+
* @param {Vect2} point
|
|
47
|
+
* @returns {DropZone|undefined}
|
|
48
|
+
*/
|
|
49
|
+
_getZoneByElementsFromPoint: (elements: DSElements, { x, y }: Vect2) => DropZone | undefined;
|
|
50
|
+
stop: ({ isDragging }: {
|
|
51
|
+
isDragging: any;
|
|
52
|
+
}) => void;
|
|
53
|
+
/**
|
|
54
|
+
* @param {string} zoneId
|
|
55
|
+
* @returns {DSElements|void}
|
|
56
|
+
*/
|
|
57
|
+
getItemsDroppedById: (zoneId: string) => DSElements | void;
|
|
58
|
+
/**
|
|
59
|
+
* @param {string} zoneId
|
|
60
|
+
* @param {boolean} addClasses
|
|
61
|
+
* @returns {DSElements|void}
|
|
62
|
+
*/
|
|
63
|
+
getItemsInsideById: (zoneId: string, addClasses: boolean) => DSElements | void;
|
|
64
|
+
/**
|
|
65
|
+
* Returns first DropsZone under current pointer
|
|
66
|
+
* @param {Vect2} [coordinates]
|
|
67
|
+
* @returns {DropZone | undefined}
|
|
68
|
+
*/
|
|
69
|
+
getTarget: (coordinates?: Vect2) => DropZone | undefined;
|
|
70
|
+
}
|
|
71
|
+
import DragSelect from "../DragSelect";
|
|
72
|
+
import DropZone from "./DropZone";
|
|
73
|
+
import "../types"
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export default class Interaction {
|
|
2
|
+
/**
|
|
3
|
+
* @constructor Interaction
|
|
4
|
+
* @param {{DS:DragSelect}} obj
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
constructor({ DS }: {
|
|
8
|
+
DS: DragSelect;
|
|
9
|
+
});
|
|
10
|
+
/** @type {boolean} */
|
|
11
|
+
isInteracting: boolean;
|
|
12
|
+
/** @type {boolean} */
|
|
13
|
+
isDragging: boolean;
|
|
14
|
+
DS: DragSelect;
|
|
15
|
+
Settings: Settings;
|
|
16
|
+
init: () => void;
|
|
17
|
+
_init: () => void;
|
|
18
|
+
/**
|
|
19
|
+
* @param {DSEvent} event
|
|
20
|
+
*/
|
|
21
|
+
_canInteract(event: DSEvent): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @param {DSEvent} event
|
|
24
|
+
*/
|
|
25
|
+
start: (event: DSEvent) => void;
|
|
26
|
+
_start: (event: any) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Drag interaction
|
|
29
|
+
* @param {DSEvent} event
|
|
30
|
+
* @returns {boolean}
|
|
31
|
+
*/
|
|
32
|
+
isDragEvent: (event: DSEvent) => boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Triggers when a node is actively selected: <button> nodes that are pressed via the keyboard.
|
|
35
|
+
* Making DragSelect accessible for everyone!
|
|
36
|
+
* @param {{ event:MouseEvent }} prop
|
|
37
|
+
*/
|
|
38
|
+
onClick: ({ event }: {
|
|
39
|
+
event: MouseEvent;
|
|
40
|
+
}) => void;
|
|
41
|
+
stop: (area?: DSArea) => void;
|
|
42
|
+
update: ({ event, scroll_directions, scroll_multiplier }: {
|
|
43
|
+
event: any;
|
|
44
|
+
scroll_directions: any;
|
|
45
|
+
scroll_multiplier: any;
|
|
46
|
+
}) => void;
|
|
47
|
+
reset: (event: any) => void;
|
|
48
|
+
_reset: (event: any) => void;
|
|
49
|
+
}
|
|
50
|
+
import DragSelect from "../DragSelect";
|
|
51
|
+
import "../types"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export default class PubSub {
|
|
2
|
+
constructor({ DS }: {
|
|
3
|
+
DS: any;
|
|
4
|
+
});
|
|
5
|
+
subscribers: {};
|
|
6
|
+
DS: any;
|
|
7
|
+
/**
|
|
8
|
+
* Subscribe to an event
|
|
9
|
+
* @memberof DragSelect#
|
|
10
|
+
* @function subscribe
|
|
11
|
+
* @param {DSCallbackNames} eventName
|
|
12
|
+
* @param {DSCallback} callback
|
|
13
|
+
* @returns {number} event id, can be used to unsubscribe more efficiently
|
|
14
|
+
*/
|
|
15
|
+
subscribe: (eventName: DSCallbackNames, callback: DSCallback) => number;
|
|
16
|
+
/**
|
|
17
|
+
* Removes event subscription
|
|
18
|
+
* @memberof DragSelect#
|
|
19
|
+
* @function unsubscribe
|
|
20
|
+
* @param {DSCallbackNames} eventName
|
|
21
|
+
* @param {DSCallback} [callback] the callback method signature, has to be exactly the same as when subscribing. Consider using "id" instead.
|
|
22
|
+
* @param {number} [id] event id returned when subscribed (more performant than callback search)
|
|
23
|
+
*/
|
|
24
|
+
unsubscribe: (eventName: DSCallbackNames, callback?: DSCallback, id?: number) => void;
|
|
25
|
+
/**
|
|
26
|
+
* Publishes an event to all subscribers
|
|
27
|
+
* @memberof DragSelect#
|
|
28
|
+
* @function publish
|
|
29
|
+
* @param {DSCallbackNames|DSCallbackNames[]} eventName
|
|
30
|
+
* @param {CallbackObject} data passed to the subscription method
|
|
31
|
+
*/
|
|
32
|
+
publish: (eventName: DSCallbackNames | DSCallbackNames[], data: CallbackObject) => void;
|
|
33
|
+
_publish: (eventName: any, data: any) => void;
|
|
34
|
+
_handlePublish: (subscribers: any, data: any) => void;
|
|
35
|
+
_handlePrePublish: (subscribers: any, data: any) => void;
|
|
36
|
+
}
|
|
37
|
+
import "../types"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export default class SelectableSet extends Set<any> {
|
|
2
|
+
/**
|
|
3
|
+
* @constructor SelectableSet
|
|
4
|
+
* @param {{DS:DragSelect}} obj
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
constructor({ DS }: {
|
|
8
|
+
DS: DragSelect;
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* @type {Map<DSElement,DSBoundingRect>}
|
|
12
|
+
* @private
|
|
13
|
+
*/
|
|
14
|
+
private _rects;
|
|
15
|
+
/**
|
|
16
|
+
* @type {NodeJS.Timeout}
|
|
17
|
+
* @private
|
|
18
|
+
*/
|
|
19
|
+
private _timeout;
|
|
20
|
+
DS: DragSelect;
|
|
21
|
+
Settings: Settings;
|
|
22
|
+
init: () => void;
|
|
23
|
+
/**
|
|
24
|
+
* @param {DSElement} element
|
|
25
|
+
* @return {this}
|
|
26
|
+
* */
|
|
27
|
+
add(element: DSElement): this;
|
|
28
|
+
/** @param {DSElement} element */
|
|
29
|
+
delete(element: DSElement): boolean;
|
|
30
|
+
_onClick: (event: any) => void;
|
|
31
|
+
_onPointer: (event: any) => void;
|
|
32
|
+
/** @param {DSElements} elements */
|
|
33
|
+
addAll: (elements: DSElements) => void;
|
|
34
|
+
/** @param {DSElements} elements */
|
|
35
|
+
deleteAll: (elements: DSElements) => void;
|
|
36
|
+
/** @param {DSElement} element */
|
|
37
|
+
getRect: (element: DSElement) => DSBoundingRect | DOMRect;
|
|
38
|
+
/** @return {DSElements} */
|
|
39
|
+
get elements(): DSElements;
|
|
40
|
+
get rects(): Map<DSElement, DSBoundingRect>;
|
|
41
|
+
}
|
|
42
|
+
import DragSelect from "../DragSelect";
|
|
43
|
+
import "../types"
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export default class SelectedSet extends Set<any> {
|
|
2
|
+
/**
|
|
3
|
+
* @constructor SelectableSet
|
|
4
|
+
* @param {{DS:DragSelect}} obj
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
7
|
+
constructor({ DS }: {
|
|
8
|
+
DS: DragSelect;
|
|
9
|
+
});
|
|
10
|
+
DS: DragSelect;
|
|
11
|
+
/**
|
|
12
|
+
* @param {DSElement} element
|
|
13
|
+
* @return {this}
|
|
14
|
+
* */
|
|
15
|
+
add(element: DSElement): this;
|
|
16
|
+
/** @param {DSElement} element */
|
|
17
|
+
delete(element: DSElement): boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Adds/Removes an element. If it is already selected = remove, if not = add.
|
|
20
|
+
* @param {DSElement} element
|
|
21
|
+
* @return {DSElement}
|
|
22
|
+
*/
|
|
23
|
+
toggle(element: DSElement): DSElement;
|
|
24
|
+
/** @param {DSElements} elements */
|
|
25
|
+
addAll: (elements: DSElements) => void;
|
|
26
|
+
/** @param {DSElements} elements */
|
|
27
|
+
deleteAll: (elements: DSElements) => void;
|
|
28
|
+
/** @return {DSElements} */
|
|
29
|
+
get elements(): DSElements;
|
|
30
|
+
}
|
|
31
|
+
import DragSelect from "../DragSelect";
|
|
32
|
+
import "../types"
|