dragselect 2.7.3 → 3.0.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 +100 -22
- package/LICENSE +690 -0
- package/README.md +2 -1
- package/jest-puppeteer.config.js +13 -3
- package/jest.config.js +5 -0
- package/package.json +40 -46
- package/rollup.config.mjs +82 -0
- package/src/DragSelect.ts +425 -0
- package/src/methods/addModificationObservers.ts +51 -0
- package/src/methods/canScroll.ts +19 -0
- package/src/methods/{createSelectorAreaElement.js → createSelectorAreaElement.ts} +1 -8
- package/src/methods/{createSelectorElement.js → createSelectorElement.ts} +1 -9
- package/src/methods/{debounce.js → debounce.ts} +5 -11
- package/src/methods/ensureArray.ts +13 -0
- package/src/methods/getAllParentNodes.ts +15 -0
- package/src/methods/{getAreaRect.js → getAreaRect.ts} +2 -6
- package/src/methods/getCurrentScroll.ts +14 -0
- package/src/methods/{documentScroll.js → getDocumentScroll.ts} +2 -2
- package/src/methods/{getOverflowEdges.js → getOverflowEdges.ts} +11 -11
- package/src/methods/getPointerPos.ts +9 -0
- package/src/methods/getSelectionRect.ts +29 -0
- package/src/methods/{getSelectorPosition.js → getSelectorPosition.ts} +11 -9
- package/src/methods/{getStylePosition.spec.js → getStylePosition.spec.ts} +9 -9
- package/src/methods/{getStylePosition.js → getStylePosition.ts} +5 -21
- package/src/methods/handleElementPositionAttribute.ts +15 -0
- package/src/methods/handleKeyboardDragPosDifference.ts +35 -0
- package/src/methods/handleSelection.ts +26 -0
- package/src/methods/{handleUnSelection.js → handleUnSelection.ts} +14 -14
- package/src/methods/{hydrateSettings.js → hydrateSettings.ts} +15 -26
- package/src/methods/isCollision.ts +66 -0
- package/src/methods/limitDirection.ts +36 -0
- package/src/methods/moveElement.ts +18 -0
- package/src/methods/{scrollElement.js → scrollElement.ts} +4 -10
- package/src/methods/{setStylePosition.js → setStylePosition.ts} +3 -11
- package/src/methods/subscriberAliases.ts +240 -0
- package/src/methods/updateElementStylePos.ts +7 -0
- package/src/methods/vect2.ts +34 -0
- package/src/modules/Area.ts +169 -0
- package/src/modules/Drag.ts +236 -0
- package/src/modules/{DropZone.js → DropZone.ts} +80 -119
- package/src/modules/DropZones.ts +151 -0
- package/src/modules/Interaction.ts +251 -0
- package/src/modules/PubSub.ts +111 -0
- package/src/modules/SelectableSet.ts +146 -0
- package/src/modules/SelectedSet.ts +92 -0
- package/src/modules/{Selection.js → Selection.ts} +59 -44
- package/src/modules/Selector.ts +81 -0
- package/src/modules/{SelectorArea.js → SelectorArea.ts} +58 -71
- package/src/stores/KeyStore.ts +92 -0
- package/src/stores/PointerStore.ts +194 -0
- package/src/stores/ScrollStore.ts +87 -0
- package/src/stores/SettingsStore.ts +88 -0
- package/src/types.ts +158 -0
- package/tsconfig.json +105 -0
- package/bower.json +0 -24
- package/dist/DragSelect.d.ts +0 -200
- package/dist/DragSelect.es6m.js +0 -3877
- package/dist/DragSelect.js +0 -3885
- package/dist/ds.es6m.min.js +0 -1
- package/dist/ds.min.js +0 -1
- package/dist/methods/addModificationObservers.d.ts +0 -11
- package/dist/methods/canScroll.d.ts +0 -3
- package/dist/methods/createSelectorAreaElement.d.ts +0 -3
- package/dist/methods/createSelectorElement.d.ts +0 -3
- package/dist/methods/debounce.d.ts +0 -3
- package/dist/methods/documentScroll.d.ts +0 -6
- package/dist/methods/getAllParentNodes.d.ts +0 -3
- package/dist/methods/getAreaRect.d.ts +0 -3
- package/dist/methods/getBoundingClientRect.d.ts +0 -4
- package/dist/methods/getCurrentScroll.d.ts +0 -3
- package/dist/methods/getOverflowEdges.d.ts +0 -7
- package/dist/methods/getPointerPos.d.ts +0 -5
- package/dist/methods/getSelectorPosition.d.ts +0 -12
- package/dist/methods/getStylePosition.d.ts +0 -3
- package/dist/methods/handleElementOverflow.d.ts +0 -10
- package/dist/methods/handleElementPositionAttribute.d.ts +0 -6
- package/dist/methods/handleKeyboardDragPosDifference.d.ts +0 -13
- package/dist/methods/handleSelection.d.ts +0 -9
- package/dist/methods/handleUnSelection.d.ts +0 -9
- package/dist/methods/hydrateSettings.d.ts +0 -3
- package/dist/methods/index.d.ts +0 -30
- package/dist/methods/isCollision.d.ts +0 -13
- package/dist/methods/moveElement.d.ts +0 -8
- package/dist/methods/removeModificationObservers.d.ts +0 -3
- package/dist/methods/scrollElement.d.ts +0 -3
- package/dist/methods/setStylePosition.d.ts +0 -3
- package/dist/methods/subscriberAliases.d.ts +0 -14
- package/dist/methods/toArray.d.ts +0 -3
- package/dist/methods/updateElementStylePos.d.ts +0 -8
- package/dist/methods/vect2.d.ts +0 -8
- package/dist/modules/Area.d.ts +0 -80
- package/dist/modules/Drag.d.ts +0 -71
- package/dist/modules/DropZone.d.ts +0 -90
- package/dist/modules/DropZones.d.ts +0 -73
- package/dist/modules/Interaction.d.ts +0 -51
- package/dist/modules/PubSub.d.ts +0 -37
- package/dist/modules/SelectableSet.d.ts +0 -40
- package/dist/modules/SelectedSet.d.ts +0 -29
- package/dist/modules/Selection.d.ts +0 -54
- package/dist/modules/Selector.d.ts +0 -29
- package/dist/modules/SelectorArea.d.ts +0 -58
- package/dist/modules/index.d.ts +0 -11
- package/dist/stores/KeyStore.d.ts +0 -34
- package/dist/stores/PointerStore.d.ts +0 -83
- package/dist/stores/ScrollStore.d.ts +0 -38
- package/dist/stores/SettingsStore.d.ts +0 -39
- package/dist/stores/index.d.ts +0 -5
- package/dist/types.d.ts +0 -276
- package/jsconfig.json +0 -13
- package/rollup.config.js +0 -101
- package/src/DragSelect.js +0 -384
- package/src/methods/addModificationObservers.js +0 -38
- package/src/methods/canScroll.js +0 -20
- package/src/methods/getAllParentNodes.js +0 -17
- package/src/methods/getBoundingClientRect.js +0 -33
- package/src/methods/getCurrentScroll.js +0 -15
- package/src/methods/getPointerPos.js +0 -13
- package/src/methods/handleElementOverflow.js +0 -65
- package/src/methods/handleElementPositionAttribute.js +0 -16
- package/src/methods/handleKeyboardDragPosDifference.js +0 -57
- package/src/methods/handleSelection.js +0 -26
- package/src/methods/index.js +0 -29
- package/src/methods/isCollision.js +0 -58
- package/src/methods/moveElement.js +0 -39
- package/src/methods/removeModificationObservers.js +0 -13
- package/src/methods/subscriberAliases.js +0 -72
- package/src/methods/toArray.js +0 -18
- package/src/methods/updateElementStylePos.js +0 -15
- package/src/methods/vect2.js +0 -54
- package/src/modules/Area.js +0 -183
- package/src/modules/Drag.js +0 -257
- package/src/modules/DropZones.js +0 -161
- package/src/modules/Interaction.js +0 -208
- package/src/modules/PubSub.js +0 -78
- package/src/modules/SelectableSet.js +0 -144
- package/src/modules/SelectedSet.js +0 -69
- package/src/modules/Selector.js +0 -90
- package/src/modules/index.js +0 -10
- package/src/stores/KeyStore.js +0 -83
- package/src/stores/PointerStore.js +0 -218
- package/src/stores/ScrollStore.js +0 -92
- package/src/stores/SettingsStore.js +0 -66
- package/src/stores/index.js +0 -4
- package/src/types.js +0 -100
package/dist/modules/Area.d.ts
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
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"
|
package/dist/modules/Drag.d.ts
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
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"
|
|
@@ -1,90 +0,0 @@
|
|
|
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"
|
|
@@ -1,73 +0,0 @@
|
|
|
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"
|
|
@@ -1,51 +0,0 @@
|
|
|
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"
|
package/dist/modules/PubSub.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
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"
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
/** @param {DSElement} element */
|
|
24
|
-
add(element: DSElement): SelectableSet;
|
|
25
|
-
/** @param {DSElement} element */
|
|
26
|
-
delete(element: DSElement): boolean;
|
|
27
|
-
_onClick: (event: any) => void;
|
|
28
|
-
_onPointer: (event: any) => void;
|
|
29
|
-
/** @param {DSElements} elements */
|
|
30
|
-
addAll: (elements: DSElements) => void;
|
|
31
|
-
/** @param {DSElements} elements */
|
|
32
|
-
deleteAll: (elements: DSElements) => void;
|
|
33
|
-
/** @param {DSElement} element */
|
|
34
|
-
getRect: (element: DSElement) => DSBoundingRect | DOMRect;
|
|
35
|
-
/** @return {DSElements} */
|
|
36
|
-
get elements(): DSElements;
|
|
37
|
-
get rects(): Map<DSElement, DSBoundingRect>;
|
|
38
|
-
}
|
|
39
|
-
import DragSelect from "../DragSelect";
|
|
40
|
-
import "../types"
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
/** @param {DSElement} element */
|
|
12
|
-
add(element: DSElement): SelectedSet;
|
|
13
|
-
/** @param {DSElement} element */
|
|
14
|
-
delete(element: DSElement): boolean;
|
|
15
|
-
/**
|
|
16
|
-
* Adds/Removes an element. If it is already selected = remove, if not = add.
|
|
17
|
-
* @param {DSElement} element
|
|
18
|
-
* @return {DSElement}
|
|
19
|
-
*/
|
|
20
|
-
toggle(element: DSElement): DSElement;
|
|
21
|
-
/** @param {DSElements} elements */
|
|
22
|
-
addAll: (elements: DSElements) => void;
|
|
23
|
-
/** @param {DSElements} elements */
|
|
24
|
-
deleteAll: (elements: DSElements) => void;
|
|
25
|
-
/** @return {DSElements} */
|
|
26
|
-
get elements(): DSElements;
|
|
27
|
-
}
|
|
28
|
-
import DragSelect from "../DragSelect";
|
|
29
|
-
import "../types"
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
export default class Selection {
|
|
2
|
-
/**
|
|
3
|
-
* @constructor Selection
|
|
4
|
-
* @param {{ DS:DragSelect }} p
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
constructor({ DS }: {
|
|
8
|
-
DS: DragSelect;
|
|
9
|
-
});
|
|
10
|
-
/**
|
|
11
|
-
* @type {Set}
|
|
12
|
-
* @private
|
|
13
|
-
* */
|
|
14
|
-
private _prevSelectedSet;
|
|
15
|
-
DS: DragSelect;
|
|
16
|
-
Settings: Settings;
|
|
17
|
-
/**
|
|
18
|
-
* Stores the previous selection (solves #9)
|
|
19
|
-
* @param {DSEvent} event
|
|
20
|
-
* @private
|
|
21
|
-
* */
|
|
22
|
-
private _storePrevious;
|
|
23
|
-
/** @param {{event:DSEvent,isDragging:boolean}} event */
|
|
24
|
-
start: ({ event, isDragging }: {
|
|
25
|
-
event: DSEvent;
|
|
26
|
-
isDragging: boolean;
|
|
27
|
-
}) => void;
|
|
28
|
-
update: ({ isDragging }: {
|
|
29
|
-
isDragging: any;
|
|
30
|
-
}) => void;
|
|
31
|
-
/**
|
|
32
|
-
* Checks if any selectable element is inside selection.
|
|
33
|
-
* @param {boolean} [force]
|
|
34
|
-
* @param {DSEvent} [event]
|
|
35
|
-
* @private
|
|
36
|
-
*/
|
|
37
|
-
private _handleInsideSelection;
|
|
38
|
-
/**
|
|
39
|
-
* Can be overridden to apply further filtering logic after the items to select are identified but before they actually get selected
|
|
40
|
-
* Is expected to return the select / unselect maps in the same shape as passed in
|
|
41
|
-
* @param {{select:Map<DSElement,DSBoundingRect>, unselect:Map<DSElement,DSBoundingRect>, selectorRect:DSBoundingRect}} obj
|
|
42
|
-
* @returns {{select:Map<DSElement,DSBoundingRect>, unselect:Map<DSElement,DSBoundingRect>}}
|
|
43
|
-
*/
|
|
44
|
-
filterSelected: ({ select, unselect, selectorRect }: {
|
|
45
|
-
select: Map<DSElement, DSBoundingRect>;
|
|
46
|
-
unselect: Map<DSElement, DSBoundingRect>;
|
|
47
|
-
selectorRect: DSBoundingRect;
|
|
48
|
-
}) => {
|
|
49
|
-
select: Map<DSElement, DSBoundingRect>;
|
|
50
|
-
unselect: Map<DSElement, DSBoundingRect>;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
import DragSelect from "../DragSelect";
|
|
54
|
-
import "../types"
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
export default class Selector {
|
|
2
|
-
/**
|
|
3
|
-
* @constructor Selector
|
|
4
|
-
* @param {{ DS:DragSelect }} p
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
constructor({ DS }: {
|
|
8
|
-
DS: DragSelect;
|
|
9
|
-
});
|
|
10
|
-
/**
|
|
11
|
-
* @type {DSBoundingRect}
|
|
12
|
-
* @private
|
|
13
|
-
*/
|
|
14
|
-
private _rect;
|
|
15
|
-
DS: DragSelect;
|
|
16
|
-
attachSelector: () => void;
|
|
17
|
-
HTMLNode: HTMLElement;
|
|
18
|
-
start: ({ isDragging }: {
|
|
19
|
-
isDragging: any;
|
|
20
|
-
}) => void;
|
|
21
|
-
stop: () => void;
|
|
22
|
-
/** Moves the selection to the correct place */
|
|
23
|
-
update: ({ isDragging }: {
|
|
24
|
-
isDragging: any;
|
|
25
|
-
}) => void;
|
|
26
|
-
get rect(): DSBoundingRect | DOMRect;
|
|
27
|
-
}
|
|
28
|
-
import DragSelect from "../DragSelect";
|
|
29
|
-
import "../types"
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export default class SelectorArea {
|
|
2
|
-
/**
|
|
3
|
-
* @class SelectorArea
|
|
4
|
-
* @constructor SelectorArea
|
|
5
|
-
* @param {{ DS:DragSelect }} obj
|
|
6
|
-
* @ignore
|
|
7
|
-
*/
|
|
8
|
-
constructor({ DS }: {
|
|
9
|
-
DS: DragSelect;
|
|
10
|
-
});
|
|
11
|
-
/**
|
|
12
|
-
* @type {*}
|
|
13
|
-
* @private
|
|
14
|
-
* */
|
|
15
|
-
private _scrollInterval;
|
|
16
|
-
/**
|
|
17
|
-
* @type {DSBoundingRect}
|
|
18
|
-
* @private
|
|
19
|
-
*/
|
|
20
|
-
private _rect;
|
|
21
|
-
/**
|
|
22
|
-
* @type {DSEdges}
|
|
23
|
-
* @private
|
|
24
|
-
*/
|
|
25
|
-
private currentEdges;
|
|
26
|
-
DS: DragSelect;
|
|
27
|
-
HTMLNode: HTMLDivElement;
|
|
28
|
-
start: () => void;
|
|
29
|
-
/**
|
|
30
|
-
* Adding / Removing elements to document
|
|
31
|
-
* @param {'append'|'remove'} method
|
|
32
|
-
*/
|
|
33
|
-
applyElements: (method?: 'append' | 'remove') => void;
|
|
34
|
-
/** Updates the selectorAreas positions to match the areas */
|
|
35
|
-
updatePos: () => void;
|
|
36
|
-
stop: (remove: any) => void;
|
|
37
|
-
startAutoScroll: () => void;
|
|
38
|
-
/** Creates an interval that auto-scrolls while the cursor is near the edge */
|
|
39
|
-
handleAutoScroll: () => void;
|
|
40
|
-
stopAutoScroll: () => void;
|
|
41
|
-
/**
|
|
42
|
-
* Checks if the element is either inside the Selector Area
|
|
43
|
-
* (as a reachable child or touching the area)
|
|
44
|
-
* @param {DSElement} element
|
|
45
|
-
* @param {DSBoundingRect} [elementRect] - slight performance improvements
|
|
46
|
-
* @returns {boolean}
|
|
47
|
-
*/
|
|
48
|
-
isInside: (element: DSElement, elementRect?: DSBoundingRect) => boolean;
|
|
49
|
-
/**
|
|
50
|
-
* checks if the click was triggered on the area.
|
|
51
|
-
* @param {DSEvent} [event]
|
|
52
|
-
* @returns {boolean}
|
|
53
|
-
*/
|
|
54
|
-
isClicked(event?: DSEvent): boolean;
|
|
55
|
-
get rect(): DSBoundingRect | DOMRect;
|
|
56
|
-
}
|
|
57
|
-
import DragSelect from "../DragSelect";
|
|
58
|
-
import "../types"
|
package/dist/modules/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export { default as Area } from "./Area";
|
|
2
|
-
export { default as Drag } from "./Drag";
|
|
3
|
-
export { default as DropZones } from "./DropZones";
|
|
4
|
-
export { default as Interaction } from "./Interaction";
|
|
5
|
-
export { default as PubSub } from "./PubSub";
|
|
6
|
-
export { default as SelectableSet } from "./SelectableSet";
|
|
7
|
-
export { default as SelectedSet } from "./SelectedSet";
|
|
8
|
-
export { default as Selection } from "./Selection";
|
|
9
|
-
export { default as Selector } from "./Selector";
|
|
10
|
-
export { default as SelectorArea } from "./SelectorArea";
|
|
11
|
-
import "../types"
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export default class KeyStore {
|
|
2
|
-
/**
|
|
3
|
-
* @class KeyStore
|
|
4
|
-
* @constructor KeyStore
|
|
5
|
-
* @param {{DS:DragSelect}} p
|
|
6
|
-
* @ignore
|
|
7
|
-
*/
|
|
8
|
-
constructor({ DS }: {
|
|
9
|
-
DS: DragSelect;
|
|
10
|
-
});
|
|
11
|
-
/**
|
|
12
|
-
* @type {Set<string>}
|
|
13
|
-
* @private
|
|
14
|
-
* */
|
|
15
|
-
private _currentValues;
|
|
16
|
-
/**
|
|
17
|
-
* @type {{control:string,shift:string,meta:string}}
|
|
18
|
-
* @private
|
|
19
|
-
* */
|
|
20
|
-
private _keyMapping;
|
|
21
|
-
DS: DragSelect;
|
|
22
|
-
init: () => void;
|
|
23
|
-
/** @param {KeyboardEvent} event */
|
|
24
|
-
keydown: (event: KeyboardEvent) => void;
|
|
25
|
-
/** @param {KeyboardEvent} event */
|
|
26
|
-
keyup: (event: KeyboardEvent) => void;
|
|
27
|
-
stop: () => void;
|
|
28
|
-
reset: () => void;
|
|
29
|
-
/** @param {KeyboardEvent|MouseEvent|PointerEvent|TouchEvent} [event] */
|
|
30
|
-
isMultiSelectKeyPressed(event?: KeyboardEvent | MouseEvent | PointerEvent | TouchEvent): boolean;
|
|
31
|
-
get currentValues(): string[];
|
|
32
|
-
}
|
|
33
|
-
import DragSelect from "../DragSelect";
|
|
34
|
-
import "../types"
|