@pantograph/sortable 2.0.0 → 2.1.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/README.md +432 -829
- package/Sortable.js +1674 -1957
- package/{src/index.d.ts → index.d.ts} +13 -25
- package/modular/sortable.complete.esm.js +1674 -1957
- package/modular/sortable.core.esm.js +1566 -1913
- package/modular/sortable.esm.js +1674 -1956
- package/package.json +58 -58
- package/{src/plugins.d.ts → plugins.d.ts} +0 -33
- package/Sortable.min.js +0 -2
- package/src/Animation.js +0 -175
- package/src/BrowserInfo.js +0 -12
- package/src/EventDispatcher.js +0 -57
- package/src/PluginManager.js +0 -94
- package/src/Sortable.js +0 -2099
- package/src/utils.js +0 -600
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AutoScrollOptions,
|
|
3
3
|
AutoScrollPlugin,
|
|
4
|
-
MultiDragOptions,
|
|
5
|
-
MultiDragPlugin,
|
|
6
4
|
OnSpillOptions,
|
|
7
5
|
OnSpillPlugin,
|
|
8
6
|
SortablePlugin,
|
|
@@ -13,6 +11,7 @@ import {
|
|
|
13
11
|
} from './plugins'
|
|
14
12
|
|
|
15
13
|
export = Sortable
|
|
14
|
+
export { type Sortable }
|
|
16
15
|
|
|
17
16
|
declare class Sortable {
|
|
18
17
|
public options: Sortable.Options
|
|
@@ -34,7 +33,7 @@ declare class Sortable {
|
|
|
34
33
|
*
|
|
35
34
|
* @example
|
|
36
35
|
*
|
|
37
|
-
* Sortable.mount(
|
|
36
|
+
* Sortable.mount(AutoScroll)
|
|
38
37
|
*/
|
|
39
38
|
static mount(...sortablePlugins: SortablePlugin[]): void
|
|
40
39
|
|
|
@@ -102,7 +101,6 @@ declare namespace Sortable {
|
|
|
102
101
|
export interface Options
|
|
103
102
|
extends SortableOptions,
|
|
104
103
|
AutoScrollOptions,
|
|
105
|
-
MultiDragOptions,
|
|
106
104
|
OnSpillOptions,
|
|
107
105
|
SwapOptions,
|
|
108
106
|
FlatTreeOptions {}
|
|
@@ -111,13 +109,19 @@ declare namespace Sortable {
|
|
|
111
109
|
* A class that all plugins inherit from for the sake of type inference.
|
|
112
110
|
*/
|
|
113
111
|
export class Plugin extends SortablePlugin {}
|
|
114
|
-
export class MultiDrag extends MultiDragPlugin {}
|
|
115
112
|
export class AutoScroll extends AutoScrollPlugin {}
|
|
116
113
|
export class Swap extends SwapPlugin {}
|
|
117
114
|
export class FlatTree extends FlatTreePlugin {}
|
|
118
115
|
export class OnSpill extends OnSpillPlugin {}
|
|
119
116
|
|
|
120
|
-
export interface
|
|
117
|
+
export interface TreeEventParams {
|
|
118
|
+
draggedTreeItemLevel: number
|
|
119
|
+
draggedTreeItemParent: HTMLElement
|
|
120
|
+
draggedTreeItemAfter?: HTMLElement & { level: number }
|
|
121
|
+
draggedTreeItemBefore?: HTMLElement & { level: number }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export interface SortableEvent extends Event, Partial<TreeEventParams> {
|
|
121
125
|
clone: HTMLElement
|
|
122
126
|
/**
|
|
123
127
|
* previous list
|
|
@@ -156,27 +160,11 @@ declare namespace Sortable {
|
|
|
156
160
|
* Pull mode if dragging into another sortable
|
|
157
161
|
*/
|
|
158
162
|
pullMode: 'clone' | boolean | undefined
|
|
159
|
-
/**
|
|
160
|
-
* When MultiDrag is used to sort, this holds a HTMLElement and oldIndex for each item selected.
|
|
161
|
-
*
|
|
162
|
-
* `oldIndicies[number]` is directly related to `newIndicies[number]`
|
|
163
|
-
*
|
|
164
|
-
* If MultiDrag is not used to sort, this array will be empty.
|
|
165
|
-
*/
|
|
166
|
-
oldIndicies: Array<{ multiDragElement: HTMLElement; index: number }>
|
|
167
|
-
/**
|
|
168
|
-
* When MultiDrag is used to sort, this holds a HTMLElement and newIndex for each item.
|
|
169
|
-
*
|
|
170
|
-
* `oldIndicies[number]` is directly related to `newIndicies[number]`
|
|
171
|
-
*
|
|
172
|
-
* If MultiDrag is not used to sort, this array will be empty.
|
|
173
|
-
*/
|
|
174
|
-
newIndicies: Array<{ multiDragElement: HTMLElement; index: number }>
|
|
175
163
|
/** When Swap is used to sort, this will contain the dragging item that was dropped on.*/
|
|
176
164
|
swapItem: HTMLElement | null
|
|
177
165
|
}
|
|
178
166
|
|
|
179
|
-
export interface MoveEvent extends Event {
|
|
167
|
+
export interface MoveEvent extends Event, Partial<TreeEventParams> {
|
|
180
168
|
dragged: HTMLElement
|
|
181
169
|
draggedRect: DOMRect
|
|
182
170
|
from: HTMLElement
|
|
@@ -240,8 +228,8 @@ declare namespace Sortable {
|
|
|
240
228
|
type Direction = 'vertical' | 'horizontal'
|
|
241
229
|
export interface SortableOptions {
|
|
242
230
|
getGhostFallback?: (dragEl: HTMLElement) => HTMLElement
|
|
243
|
-
getPlaceholder?: (dragEl:
|
|
244
|
-
getPlaceholderOnMove?: (event: MoveEvent) => HTMLElement
|
|
231
|
+
getPlaceholder?: (dragEl: SortableEvent) => HTMLElement | undefined
|
|
232
|
+
getPlaceholderOnMove?: (event: MoveEvent) => HTMLElement | undefined
|
|
245
233
|
/**
|
|
246
234
|
* ms, animation speed moving items when sorting, `0` — without animation
|
|
247
235
|
*/
|