@vuu-ui/vuu-utils 4.0.1 → 4.1.1
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/package.json +7 -8
- package/src/column-utils.js +6 -1
- package/src/tree-utils.js +2 -2
- package/src/vendor/@dnd-kit/abstract/index.d.ts +114 -32
- package/src/vendor/@dnd-kit/abstract/index.js +430 -280
- package/src/vendor/@dnd-kit/abstract/index.js.map +1 -1
- package/src/vendor/@dnd-kit/abstract/modifiers.d.ts +7 -7
- package/src/vendor/@dnd-kit/abstract/modifiers.js.map +1 -1
- package/src/vendor/@dnd-kit/abstract/package.json +8 -3
- package/src/vendor/@dnd-kit/collision/dist/index.js +10 -3
- package/src/vendor/@dnd-kit/collision/package.json +8 -3
- package/src/vendor/@dnd-kit/dom/index.d.ts +225 -126
- package/src/vendor/@dnd-kit/dom/index.js +998 -484
- package/src/vendor/@dnd-kit/dom/index.js.map +1 -1
- package/src/vendor/@dnd-kit/dom/modifiers.d.ts +1 -1
- package/src/vendor/@dnd-kit/dom/package.json +11 -5
- package/src/vendor/@dnd-kit/dom/plugins/debug.js +10 -7
- package/src/vendor/@dnd-kit/dom/plugins/debug.js.map +1 -1
- package/src/vendor/@dnd-kit/dom/sortable.d.ts +45 -11
- package/src/vendor/@dnd-kit/dom/sortable.js +203 -54
- package/src/vendor/@dnd-kit/dom/sortable.js.map +1 -1
- package/src/vendor/@dnd-kit/dom/utilities.d.ts +82 -10
- package/src/vendor/@dnd-kit/dom/utilities.js +249 -95
- package/src/vendor/@dnd-kit/dom/utilities.js.map +1 -1
- package/src/vendor/@dnd-kit/geometry/package.json +7 -2
- package/src/vendor/@dnd-kit/react/hooks.js +61 -38
- package/src/vendor/@dnd-kit/react/hooks.js.map +1 -0
- package/src/vendor/@dnd-kit/react/index.d.ts +18 -9
- package/src/vendor/@dnd-kit/react/index.js +100 -59
- package/src/vendor/@dnd-kit/react/index.js.map +1 -0
- package/src/vendor/@dnd-kit/react/package.json +17 -5
- package/src/vendor/@dnd-kit/react/sortable.d.ts +1 -1
- package/src/vendor/@dnd-kit/react/sortable.js +24 -10
- package/src/vendor/@dnd-kit/react/sortable.js.map +1 -0
- package/src/vendor/@dnd-kit/react/utilities.js.map +1 -0
- package/src/vendor/@dnd-kit/state/dist/index.js +1 -1
- package/src/vendor/@dnd-kit/state/package.json +6 -1
- package/src/vendor/@preact/signals-core/dist/signals-core.js +1 -1
- package/src/vendor/@preact/signals-core/dist/signals-core.js.map +1 -1
- package/types/ThemeProvider.d.ts +1 -1
- package/types/column-utils.d.ts +2 -1
- package/types/context-definitions/DataProvider.d.ts +1 -1
- package/types/context-definitions/DataSourceProvider.d.ts +1 -1
- package/types/filters/filter-utils.d.ts +1 -0
- package/types/tree-types.d.ts +5 -0
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WeakStore, effect, batch, untracked, reactive } from '../state/dist/index.js';
|
|
2
|
+
import { Plugin, resolveCustomizable } from '../abstract/index.js';
|
|
2
3
|
import { closestCorners, defaultCollisionDetection } from '../collision/dist/index.js';
|
|
3
|
-
import { Scroller, Draggable, Droppable } from './index.js';
|
|
4
|
-
import { isKeyboardEvent, DOMRectangle, getVisibleBoundingRectangle, scrollIntoViewIfNeeded, getComputedStyles, computeTranslate, animateTransform, ProxiedElements } from './utilities.js';
|
|
5
|
-
import { Plugin } from '../abstract/index.js';
|
|
4
|
+
import { Scroller, Draggable, Droppable, Feedback } from './index.js';
|
|
5
|
+
import { isKeyboardEvent, DOMRectangle, getVisibleBoundingRectangle, scrollIntoViewIfNeeded, getComputedStyles, computeTranslate, prefersReducedMotion, getWindow, animateTransform, ProxiedElements } from './utilities.js';
|
|
6
6
|
import { Rectangle } from '../geometry/dist/index.js';
|
|
7
7
|
|
|
8
8
|
var __create = Object.create;
|
|
@@ -86,6 +86,9 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
|
|
|
86
86
|
function isSortable(element) {
|
|
87
87
|
return element instanceof SortableDroppable || element instanceof SortableDraggable;
|
|
88
88
|
}
|
|
89
|
+
function isSortableOperation(operation) {
|
|
90
|
+
return isSortable(operation.source) && isSortable(operation.target);
|
|
91
|
+
}
|
|
89
92
|
|
|
90
93
|
// src/sortable/plugins/SortableKeyboardPlugin.ts
|
|
91
94
|
var TOLERANCE = 10;
|
|
@@ -248,6 +251,13 @@ function arrayMove(array, from, to) {
|
|
|
248
251
|
newArray.splice(to, 0, newArray.splice(from, 1)[0]);
|
|
249
252
|
return newArray;
|
|
250
253
|
}
|
|
254
|
+
function getRecordKey(items, id) {
|
|
255
|
+
const key = String(id);
|
|
256
|
+
return Object.prototype.hasOwnProperty.call(items, key) ? key : void 0;
|
|
257
|
+
}
|
|
258
|
+
function hasSortableIndices(source) {
|
|
259
|
+
return "initialIndex" in source && typeof source.initialIndex === "number" && "index" in source && typeof source.index === "number";
|
|
260
|
+
}
|
|
251
261
|
function mutate(items, event, mutation) {
|
|
252
262
|
var _a, _b;
|
|
253
263
|
const { source, target, canceled } = event.operation;
|
|
@@ -255,11 +265,20 @@ function mutate(items, event, mutation) {
|
|
|
255
265
|
if ("preventDefault" in event) event.preventDefault();
|
|
256
266
|
return items;
|
|
257
267
|
}
|
|
258
|
-
const findIndex = (item, id) => item === id || typeof item === "object" && "id" in item && item.id === id;
|
|
268
|
+
const findIndex = (item, id) => item === id || item !== null && typeof item === "object" && "id" in item && item.id === id;
|
|
259
269
|
if (Array.isArray(items)) {
|
|
260
270
|
const sourceIndex2 = items.findIndex((item) => findIndex(item, source.id));
|
|
261
271
|
const targetIndex2 = items.findIndex((item) => findIndex(item, target.id));
|
|
262
272
|
if (sourceIndex2 === -1 || targetIndex2 === -1) {
|
|
273
|
+
if (hasSortableIndices(source)) {
|
|
274
|
+
const from = source.initialIndex;
|
|
275
|
+
const to = source.index;
|
|
276
|
+
if (from === to || from < 0 || from >= items.length) {
|
|
277
|
+
if ("preventDefault" in event) event.preventDefault();
|
|
278
|
+
return items;
|
|
279
|
+
}
|
|
280
|
+
return mutation(items, from, to);
|
|
281
|
+
}
|
|
263
282
|
return items;
|
|
264
283
|
}
|
|
265
284
|
if (!canceled && "index" in source && typeof source.index === "number") {
|
|
@@ -292,17 +311,80 @@ function mutate(items, event, mutation) {
|
|
|
292
311
|
break;
|
|
293
312
|
}
|
|
294
313
|
}
|
|
314
|
+
if (sourceIndex === -1 && hasSortableIndices(source)) {
|
|
315
|
+
const srcParent = source.initialGroup == null ? void 0 : getRecordKey(items, source.initialGroup);
|
|
316
|
+
const srcIndex = source.initialIndex;
|
|
317
|
+
const tgtParent = source.group == null ? void 0 : getRecordKey(items, source.group);
|
|
318
|
+
const tgtIndex = source.index;
|
|
319
|
+
if (srcParent == null || tgtParent == null) {
|
|
320
|
+
if ("preventDefault" in event) event.preventDefault();
|
|
321
|
+
return items;
|
|
322
|
+
}
|
|
323
|
+
if (srcParent === tgtParent && srcIndex === tgtIndex) {
|
|
324
|
+
if ("preventDefault" in event) event.preventDefault();
|
|
325
|
+
return items;
|
|
326
|
+
}
|
|
327
|
+
if (srcParent === tgtParent) {
|
|
328
|
+
return __spreadProps2(__spreadValues2({}, items), {
|
|
329
|
+
[srcParent]: mutation(items[srcParent], srcIndex, tgtIndex)
|
|
330
|
+
});
|
|
331
|
+
}
|
|
332
|
+
const sourceItem2 = items[srcParent][srcIndex];
|
|
333
|
+
return __spreadProps2(__spreadValues2({}, items), {
|
|
334
|
+
[srcParent]: [
|
|
335
|
+
...items[srcParent].slice(0, srcIndex),
|
|
336
|
+
...items[srcParent].slice(srcIndex + 1)
|
|
337
|
+
],
|
|
338
|
+
[tgtParent]: [
|
|
339
|
+
...items[tgtParent].slice(0, tgtIndex),
|
|
340
|
+
sourceItem2,
|
|
341
|
+
...items[tgtParent].slice(tgtIndex)
|
|
342
|
+
]
|
|
343
|
+
});
|
|
344
|
+
}
|
|
295
345
|
if (!source.manager) return items;
|
|
296
346
|
const { dragOperation } = source.manager;
|
|
297
347
|
const position = (_b = (_a = dragOperation.shape) == null ? void 0 : _a.current.center) != null ? _b : dragOperation.position.current;
|
|
298
348
|
if (targetParent == null) {
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
349
|
+
const targetKey = getRecordKey(items, target.id);
|
|
350
|
+
if (targetKey != null) {
|
|
351
|
+
const insertionIndex = target.shape && position.y > target.shape.center.y ? items[targetKey].length : 0;
|
|
352
|
+
targetParent = targetKey;
|
|
302
353
|
targetIndex = insertionIndex;
|
|
303
354
|
}
|
|
304
355
|
}
|
|
305
356
|
if (sourceParent == null || targetParent == null || sourceParent === targetParent && sourceIndex === targetIndex) {
|
|
357
|
+
if (sourceParent != null && sourceParent === targetParent && sourceIndex === targetIndex && hasSortableIndices(source)) {
|
|
358
|
+
const sourceGroupParent = source.group == null ? void 0 : getRecordKey(items, source.group);
|
|
359
|
+
const hasGroupChanged = source.group != null && sourceGroupParent !== sourceParent;
|
|
360
|
+
const hasIndexChanged = source.index !== sourceIndex;
|
|
361
|
+
if (hasGroupChanged || hasIndexChanged) {
|
|
362
|
+
const reconciledTargetParent = source.group == null ? sourceParent : sourceGroupParent;
|
|
363
|
+
if (reconciledTargetParent != null) {
|
|
364
|
+
if (sourceParent === reconciledTargetParent) {
|
|
365
|
+
return __spreadProps2(__spreadValues2({}, items), {
|
|
366
|
+
[sourceParent]: mutation(
|
|
367
|
+
items[sourceParent],
|
|
368
|
+
sourceIndex,
|
|
369
|
+
source.index
|
|
370
|
+
)
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
const sourceItem2 = items[sourceParent][sourceIndex];
|
|
374
|
+
return __spreadProps2(__spreadValues2({}, items), {
|
|
375
|
+
[sourceParent]: [
|
|
376
|
+
...items[sourceParent].slice(0, sourceIndex),
|
|
377
|
+
...items[sourceParent].slice(sourceIndex + 1)
|
|
378
|
+
],
|
|
379
|
+
[reconciledTargetParent]: [
|
|
380
|
+
...items[reconciledTargetParent].slice(0, source.index),
|
|
381
|
+
sourceItem2,
|
|
382
|
+
...items[reconciledTargetParent].slice(source.index)
|
|
383
|
+
]
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
306
388
|
if ("preventDefault" in event) event.preventDefault();
|
|
307
389
|
return items;
|
|
308
390
|
}
|
|
@@ -329,6 +411,31 @@ function mutate(items, event, mutation) {
|
|
|
329
411
|
function move(items, event) {
|
|
330
412
|
return mutate(items, event, arrayMove);
|
|
331
413
|
}
|
|
414
|
+
|
|
415
|
+
// src/sortable/plugins/OptimisticSortingPlugin.helpers.ts
|
|
416
|
+
function getSortableIndices(instances) {
|
|
417
|
+
const sortableIndices = /* @__PURE__ */ new Map();
|
|
418
|
+
for (const [, group] of instances) {
|
|
419
|
+
for (const sortable of group) {
|
|
420
|
+
sortableIndices.set(sortable.id, sortable.index);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return sortableIndices;
|
|
424
|
+
}
|
|
425
|
+
function hasChanged(snapshotIndices, instances, newInstances) {
|
|
426
|
+
var _a;
|
|
427
|
+
for (const [group, sortables] of instances) {
|
|
428
|
+
for (const sortable of sortables) {
|
|
429
|
+
const index = snapshotIndices.get(sortable.id);
|
|
430
|
+
if (sortable.index !== index || sortable.group !== group || !((_a = newInstances.get(group)) == null ? void 0 : _a.has(sortable))) {
|
|
431
|
+
return true;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
return false;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
// src/sortable/plugins/OptimisticSortingPlugin.ts
|
|
332
439
|
var defaultGroup = "__default__";
|
|
333
440
|
var OptimisticSortingPlugin = class extends Plugin {
|
|
334
441
|
constructor(manager) {
|
|
@@ -347,9 +454,6 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
347
454
|
instances.add(sortable);
|
|
348
455
|
}
|
|
349
456
|
}
|
|
350
|
-
for (const [group, instances] of sortableInstances) {
|
|
351
|
-
sortableInstances.set(group, new Set(sort(instances)));
|
|
352
|
-
}
|
|
353
457
|
return sortableInstances;
|
|
354
458
|
};
|
|
355
459
|
const unsubscribe = [
|
|
@@ -366,6 +470,7 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
366
470
|
return;
|
|
367
471
|
}
|
|
368
472
|
const instances = getSortableInstances();
|
|
473
|
+
const sortableIndices = getSortableIndices(instances);
|
|
369
474
|
const sameGroup = source.sortable.group === target.sortable.group;
|
|
370
475
|
const sourceInstances = instances.get(source.sortable.group);
|
|
371
476
|
const targetInstances = sameGroup ? sourceInstances : instances.get(target.sortable.group);
|
|
@@ -373,15 +478,10 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
373
478
|
queueMicrotask(() => {
|
|
374
479
|
if (event.defaultPrevented) return;
|
|
375
480
|
manager2.renderer.rendering.then(() => {
|
|
376
|
-
var _a, _b
|
|
481
|
+
var _a, _b;
|
|
377
482
|
const newInstances = getSortableInstances();
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
for (const [index, sortable] of entries) {
|
|
381
|
-
if (sortable.index !== index || sortable.group !== group || !((_a = newInstances.get(group)) == null ? void 0 : _a.has(sortable))) {
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
}
|
|
483
|
+
if (hasChanged(sortableIndices, instances, newInstances)) {
|
|
484
|
+
return;
|
|
385
485
|
}
|
|
386
486
|
const sourceElement = source.sortable.element;
|
|
387
487
|
const targetElement = target.sortable.element;
|
|
@@ -393,8 +493,8 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
393
493
|
}
|
|
394
494
|
const orderedSourceSortables = sort(sourceInstances);
|
|
395
495
|
const orderedTargetSortables = sameGroup ? orderedSourceSortables : sort(targetInstances);
|
|
396
|
-
const sourceGroup = (
|
|
397
|
-
const targetGroup = (
|
|
496
|
+
const sourceGroup = (_a = source.sortable.group) != null ? _a : defaultGroup;
|
|
497
|
+
const targetGroup = (_b = target.sortable.group) != null ? _b : defaultGroup;
|
|
398
498
|
const state = {
|
|
399
499
|
[sourceGroup]: orderedSourceSortables,
|
|
400
500
|
[targetGroup]: orderedTargetSortables
|
|
@@ -434,29 +534,31 @@ var OptimisticSortingPlugin = class extends Plugin {
|
|
|
434
534
|
}
|
|
435
535
|
queueMicrotask(() => {
|
|
436
536
|
const instances = getSortableInstances();
|
|
537
|
+
const sortableIndices = getSortableIndices(instances);
|
|
437
538
|
const initialGroupInstances = instances.get(
|
|
438
539
|
source.sortable.initialGroup
|
|
439
540
|
);
|
|
440
541
|
if (!initialGroupInstances) return;
|
|
441
542
|
manager2.renderer.rendering.then(() => {
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
if (sortable.index !== index || sortable.group !== group) {
|
|
446
|
-
return;
|
|
447
|
-
}
|
|
448
|
-
}
|
|
543
|
+
const newInstances = getSortableInstances();
|
|
544
|
+
if (hasChanged(sortableIndices, instances, newInstances)) {
|
|
545
|
+
return;
|
|
449
546
|
}
|
|
450
|
-
const
|
|
547
|
+
const currentSortables = sort(initialGroupInstances);
|
|
548
|
+
const initialSortables = sort(
|
|
549
|
+
initialGroupInstances,
|
|
550
|
+
sortByInitialIndex
|
|
551
|
+
);
|
|
451
552
|
const sourceElement = source.sortable.element;
|
|
452
|
-
const
|
|
553
|
+
const initialPosition = initialSortables.indexOf(source.sortable);
|
|
554
|
+
const target = currentSortables[initialPosition];
|
|
453
555
|
const targetElement = target == null ? void 0 : target.element;
|
|
454
556
|
if (!target || !targetElement || !sourceElement) {
|
|
455
557
|
return;
|
|
456
558
|
}
|
|
457
559
|
reorder(sourceElement, target.index, targetElement, source.index);
|
|
458
560
|
batch(() => {
|
|
459
|
-
for (const
|
|
561
|
+
for (const sortableInstances of instances.values()) {
|
|
460
562
|
const entries = Array.from(sortableInstances).values();
|
|
461
563
|
for (const sortable of entries) {
|
|
462
564
|
sortable.index = sortable.initialIndex;
|
|
@@ -482,8 +584,11 @@ function reorder(sourceElement, sourceIndex, targetElement, targetIndex) {
|
|
|
482
584
|
function sortByIndex(a, b) {
|
|
483
585
|
return a.index - b.index;
|
|
484
586
|
}
|
|
485
|
-
function
|
|
486
|
-
return
|
|
587
|
+
function sortByInitialIndex(a, b) {
|
|
588
|
+
return a.initialIndex - b.initialIndex;
|
|
589
|
+
}
|
|
590
|
+
function sort(instances, sortFn = sortByIndex) {
|
|
591
|
+
return Array.from(instances).sort(sortFn);
|
|
487
592
|
}
|
|
488
593
|
|
|
489
594
|
// src/sortable/sortable.ts
|
|
@@ -496,6 +601,22 @@ var defaultSortableTransition = {
|
|
|
496
601
|
easing: "cubic-bezier(0.25, 1, 0.5, 1)",
|
|
497
602
|
idle: false
|
|
498
603
|
};
|
|
604
|
+
function resolveSortableTransition(transition) {
|
|
605
|
+
return transition === null ? null : __spreadValues(__spreadValues({}, defaultSortableTransition), transition);
|
|
606
|
+
}
|
|
607
|
+
function normalizeDisabled(disabled) {
|
|
608
|
+
var _a, _b;
|
|
609
|
+
if (typeof disabled === "boolean") {
|
|
610
|
+
return {
|
|
611
|
+
draggable: disabled,
|
|
612
|
+
droppable: disabled
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
return {
|
|
616
|
+
draggable: (_a = disabled == null ? void 0 : disabled.draggable) != null ? _a : false,
|
|
617
|
+
droppable: (_b = disabled == null ? void 0 : disabled.droppable) != null ? _b : false
|
|
618
|
+
};
|
|
619
|
+
}
|
|
499
620
|
var store = new WeakStore();
|
|
500
621
|
var _group_dec, _index_dec, _init, _index, _previousGroup, _previousIndex, _group, _element;
|
|
501
622
|
_index_dec = [reactive], _group_dec = [reactive];
|
|
@@ -529,14 +650,16 @@ var Sortable2 = class {
|
|
|
529
650
|
};
|
|
530
651
|
var _b = _a, {
|
|
531
652
|
effects: inputEffects = () => [],
|
|
653
|
+
disabled,
|
|
532
654
|
group,
|
|
533
655
|
index,
|
|
534
656
|
sensors,
|
|
535
657
|
type,
|
|
536
658
|
transition = defaultSortableTransition,
|
|
537
|
-
plugins
|
|
659
|
+
plugins: pluginsInput
|
|
538
660
|
} = _b, input = __objRest(_b, [
|
|
539
661
|
"effects",
|
|
662
|
+
"disabled",
|
|
540
663
|
"group",
|
|
541
664
|
"index",
|
|
542
665
|
"sensors",
|
|
@@ -544,14 +667,22 @@ var Sortable2 = class {
|
|
|
544
667
|
"transition",
|
|
545
668
|
"plugins"
|
|
546
669
|
]);
|
|
547
|
-
|
|
670
|
+
const plugins = resolveCustomizable(pluginsInput, defaultPlugins);
|
|
671
|
+
const disabledState = normalizeDisabled(disabled);
|
|
672
|
+
this.droppable = new SortableDroppable(
|
|
673
|
+
__spreadProps(__spreadValues({}, input), { disabled: disabledState.droppable }),
|
|
674
|
+
manager,
|
|
675
|
+
this
|
|
676
|
+
);
|
|
548
677
|
this.draggable = new SortableDraggable(
|
|
549
678
|
__spreadProps(__spreadValues({}, input), {
|
|
679
|
+
disabled: disabledState.draggable,
|
|
680
|
+
plugins,
|
|
550
681
|
effects: () => [
|
|
551
682
|
() => {
|
|
552
683
|
var _a2, _b2, _c;
|
|
553
684
|
const status = (_a2 = this.manager) == null ? void 0 : _a2.dragOperation.status;
|
|
554
|
-
if ((status == null ? void 0 : status.
|
|
685
|
+
if ((status == null ? void 0 : status.initializationPending) && this.id === ((_c = (_b2 = this.manager) == null ? void 0 : _b2.dragOperation.source) == null ? void 0 : _c.id)) {
|
|
555
686
|
store.clear(this.manager);
|
|
556
687
|
}
|
|
557
688
|
if (status == null ? void 0 : status.dragging) {
|
|
@@ -576,18 +707,14 @@ var Sortable2 = class {
|
|
|
576
707
|
}
|
|
577
708
|
},
|
|
578
709
|
() => {
|
|
710
|
+
var _a2, _b2;
|
|
579
711
|
const { target } = this;
|
|
580
|
-
const {
|
|
581
|
-
|
|
712
|
+
const { isDragSource } = this.draggable;
|
|
713
|
+
const feedback = (_b2 = (_a2 = this.draggable.pluginConfig(Feedback)) == null ? void 0 : _a2.feedback) != null ? _b2 : "default";
|
|
714
|
+
if (feedback === "move" && isDragSource) {
|
|
582
715
|
this.droppable.disabled = !target;
|
|
583
716
|
}
|
|
584
717
|
},
|
|
585
|
-
() => {
|
|
586
|
-
const { manager: manager2 } = this;
|
|
587
|
-
for (const plugin of plugins) {
|
|
588
|
-
manager2 == null ? void 0 : manager2.registry.register(plugin);
|
|
589
|
-
}
|
|
590
|
-
},
|
|
591
718
|
...inputEffects()
|
|
592
719
|
],
|
|
593
720
|
type,
|
|
@@ -627,6 +754,11 @@ var Sortable2 = class {
|
|
|
627
754
|
if (!element) {
|
|
628
755
|
return;
|
|
629
756
|
}
|
|
757
|
+
for (const animation of element.getAnimations()) {
|
|
758
|
+
if ("transitionProperty" in animation && (animation.transitionProperty === "transform" || animation.transitionProperty === "translate" || animation.transitionProperty === "scale")) {
|
|
759
|
+
animation.cancel();
|
|
760
|
+
}
|
|
761
|
+
}
|
|
630
762
|
const updatedShape = this.refreshShape();
|
|
631
763
|
if (!updatedShape) {
|
|
632
764
|
return;
|
|
@@ -639,6 +771,7 @@ var Sortable2 = class {
|
|
|
639
771
|
const currentTranslate = computeTranslate(element, translate, false);
|
|
640
772
|
const finalTranslate = computeTranslate(element, translate);
|
|
641
773
|
if (delta.x || delta.y) {
|
|
774
|
+
const resolvedTransition = prefersReducedMotion(getWindow(element)) ? __spreadProps(__spreadValues({}, transition), { duration: 0 }) : transition;
|
|
642
775
|
animateTransform({
|
|
643
776
|
element,
|
|
644
777
|
keyframes: {
|
|
@@ -647,7 +780,7 @@ var Sortable2 = class {
|
|
|
647
780
|
`${finalTranslate.x}px ${finalTranslate.y}px ${finalTranslate.z}`
|
|
648
781
|
]
|
|
649
782
|
},
|
|
650
|
-
options:
|
|
783
|
+
options: resolvedTransition
|
|
651
784
|
}).then(() => {
|
|
652
785
|
if (!manager.dragOperation.status.dragging) {
|
|
653
786
|
this.droppable.shape = void 0;
|
|
@@ -699,15 +832,18 @@ var Sortable2 = class {
|
|
|
699
832
|
return this.draggable.element;
|
|
700
833
|
}
|
|
701
834
|
get disabled() {
|
|
702
|
-
|
|
835
|
+
const { disabled: draggable } = this.draggable;
|
|
836
|
+
const { disabled: droppable } = this.droppable;
|
|
837
|
+
return draggable === droppable ? draggable : { draggable, droppable };
|
|
703
838
|
}
|
|
704
|
-
set
|
|
705
|
-
this.draggable.
|
|
839
|
+
set plugins(value) {
|
|
840
|
+
this.draggable.plugins = resolveCustomizable(value, defaultPlugins);
|
|
706
841
|
}
|
|
707
842
|
set disabled(value) {
|
|
843
|
+
const disabled = normalizeDisabled(value);
|
|
708
844
|
batch(() => {
|
|
709
|
-
this.droppable.disabled =
|
|
710
|
-
this.draggable.disabled =
|
|
845
|
+
this.droppable.disabled = disabled.droppable;
|
|
846
|
+
this.draggable.disabled = disabled.draggable;
|
|
711
847
|
});
|
|
712
848
|
}
|
|
713
849
|
set data(data) {
|
|
@@ -720,10 +856,8 @@ var Sortable2 = class {
|
|
|
720
856
|
this.draggable.handle = handle;
|
|
721
857
|
}
|
|
722
858
|
set id(id) {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
this.draggable.id = id;
|
|
726
|
-
});
|
|
859
|
+
this.droppable.id = id;
|
|
860
|
+
this.draggable.id = id;
|
|
727
861
|
}
|
|
728
862
|
get id() {
|
|
729
863
|
return this.droppable.id;
|
|
@@ -809,14 +943,29 @@ var SortableDraggable = class extends Draggable {
|
|
|
809
943
|
get index() {
|
|
810
944
|
return this.sortable.index;
|
|
811
945
|
}
|
|
946
|
+
get initialIndex() {
|
|
947
|
+
return this.sortable.initialIndex;
|
|
948
|
+
}
|
|
949
|
+
get group() {
|
|
950
|
+
return this.sortable.group;
|
|
951
|
+
}
|
|
952
|
+
get initialGroup() {
|
|
953
|
+
return this.sortable.initialGroup;
|
|
954
|
+
}
|
|
812
955
|
};
|
|
813
956
|
var SortableDroppable = class extends Droppable {
|
|
814
957
|
constructor(input, manager, sortable) {
|
|
815
958
|
super(input, manager);
|
|
816
959
|
this.sortable = sortable;
|
|
817
960
|
}
|
|
961
|
+
get index() {
|
|
962
|
+
return this.sortable.index;
|
|
963
|
+
}
|
|
964
|
+
get group() {
|
|
965
|
+
return this.sortable.group;
|
|
966
|
+
}
|
|
818
967
|
};
|
|
819
968
|
|
|
820
|
-
export { OptimisticSortingPlugin, Sortable2 as Sortable, SortableKeyboardPlugin, defaultSortableTransition, isSortable };
|
|
969
|
+
export { OptimisticSortingPlugin, Sortable2 as Sortable, SortableDraggable, SortableDroppable, SortableKeyboardPlugin, defaultSortableTransition, isSortable, isSortableOperation, resolveSortableTransition };
|
|
821
970
|
//# sourceMappingURL=sortable.js.map
|
|
822
971
|
//# sourceMappingURL=sortable.js.map
|