vgapp 1.4.4 → 1.4.6
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 +270 -270
- package/app/langs/en/buttons.json +17 -17
- package/app/langs/en/messages.json +36 -36
- package/app/langs/ru/buttons.json +17 -17
- package/app/langs/ru/messages.json +36 -36
- package/app/modules/vgalert/js/vgalert.js +266 -266
- package/app/modules/vgalert/scss/_variables.scss +16 -16
- package/app/modules/vgalert/scss/vgalert.scss +107 -107
- package/app/modules/vgcollapse/scss/_variables.scss +7 -7
- package/app/modules/vgcollapse/scss/vgcollapse.scss +5 -5
- package/app/modules/vgdropdown/scss/_variables.scss +14 -14
- package/app/modules/vgdropdown/scss/vgdropdown.scss +5 -5
- package/app/modules/vgdynamictable/index.js +4 -4
- package/app/modules/vgdynamictable/js/filters.js +21 -21
- package/app/modules/vgdynamictable/js/fixed.js +179 -179
- package/app/modules/vgdynamictable/js/options.js +3 -3
- package/app/modules/vgdynamictable/js/pagination.js +1 -1
- package/app/modules/vgdynamictable/js/search.js +12 -12
- package/app/modules/vgdynamictable/js/skeleton.js +27 -19
- package/app/modules/vgdynamictable/js/sortable.js +71 -71
- package/app/modules/vgdynamictable/js/summary-footer.js +28 -28
- package/app/modules/vgdynamictable/js/table-url-state.js +31 -31
- package/app/modules/vgdynamictable/js/utils/common.js +48 -48
- package/app/modules/vgdynamictable/js/vgdynamictable.js +79 -79
- package/app/modules/vgdynamictable/scss/_actions.scss +19 -19
- package/app/modules/vgdynamictable/scss/_pagination.scss +5 -5
- package/app/modules/vgdynamictable/scss/_skeleton.scss +11 -11
- package/app/modules/vgdynamictable/scss/_sortable.scss +28 -28
- package/app/modules/vgdynamictable/scss/_table.scss +7 -30
- package/app/modules/vgdynamictable/scss/_variables.scss +46 -46
- package/app/modules/vgdynamictable/scss/vgdynamictable.scss +28 -36
- package/app/modules/vgfilepreview/js/i18n.js +56 -56
- package/app/modules/vgfilepreview/js/renderers/image-modal.js +145 -145
- package/app/modules/vgfilepreview/js/renderers/image.js +92 -92
- package/app/modules/vgfilepreview/js/renderers/index.js +19 -19
- package/app/modules/vgfilepreview/js/renderers/office-modal.js +168 -168
- package/app/modules/vgfilepreview/js/renderers/office.js +79 -79
- package/app/modules/vgfilepreview/js/renderers/pdf-modal.js +260 -260
- package/app/modules/vgfilepreview/js/renderers/pdf.js +76 -76
- package/app/modules/vgfilepreview/js/renderers/playlist.js +71 -71
- package/app/modules/vgfilepreview/js/renderers/text-modal.js +343 -343
- package/app/modules/vgfilepreview/js/renderers/text.js +83 -83
- package/app/modules/vgfilepreview/js/renderers/video-modal.js +272 -272
- package/app/modules/vgfilepreview/js/renderers/video.js +80 -80
- package/app/modules/vgfilepreview/js/renderers/zip-modal.js +522 -522
- package/app/modules/vgfilepreview/js/renderers/zip.js +89 -89
- package/app/modules/vgfilepreview/js/vgfilepreview.js +7 -7
- package/app/modules/vgfilepreview/readme.md +68 -68
- package/app/modules/vgfilepreview/scss/_variables.scss +115 -115
- package/app/modules/vgfilepreview/scss/vgfilepreview.scss +463 -463
- package/app/modules/vgfiles/js/droppable.js +20 -9
- package/app/modules/vgfiles/js/render.js +153 -153
- package/app/modules/vgfiles/js/vgfiles.js +104 -104
- package/app/modules/vgfiles/readme.md +123 -123
- package/app/modules/vgfiles/scss/_mixins.scss +9 -9
- package/app/modules/vgfiles/scss/_variables.scss +41 -41
- package/app/modules/vgfiles/scss/vgfiles.scss +161 -161
- package/app/modules/vgformsender/js/hideshowpass.js +21 -16
- package/app/modules/vgformsender/js/vgformsender.js +4 -6
- package/app/modules/vgformsender/readme.md +1 -1
- package/app/modules/vgformsender/scss/_variables.scss +5 -5
- package/app/modules/vgformsender/scss/vgformsender.scss +42 -42
- package/app/modules/vglawcookie/js/vglawcookie.js +11 -8
- package/app/modules/vglawcookie/scss/_variables.scss +13 -13
- package/app/modules/vglawcookie/scss/vglawcookie.scss +5 -5
- package/app/modules/vgmodal/js/vgmodal.interaction.js +216 -216
- package/app/modules/vgmodal/js/vgmodal.js +355 -355
- package/app/modules/vgmodal/js/vgmodal.minimized.js +227 -227
- package/app/modules/vgmodal/scss/_variables.scss +17 -17
- package/app/modules/vgmodal/scss/vgmodal.scss +77 -77
- package/app/modules/vgnav/js/vgnav.js +180 -180
- package/app/modules/vgnav/scss/_breakpoints.scss +36 -36
- package/app/modules/vgnav/scss/_hamburger.scss +5 -5
- package/app/modules/vgnav/scss/_placement.scss +5 -5
- package/app/modules/vgnav/scss/_toggle.scss +5 -5
- package/app/modules/vgnav/scss/_variables.scss +26 -26
- package/app/modules/vgnav/scss/vgnav.scss +41 -41
- package/app/modules/vgnestable/README.md +39 -39
- package/app/modules/vgnestable/js/vgnestable.js +358 -358
- package/app/modules/vgnestable/scss/_variables.scss +35 -35
- package/app/modules/vgnestable/scss/vgnestable.scss +55 -55
- package/app/modules/vgrangeslider/js/skins.js +222 -222
- package/app/modules/vgrangeslider/js/vgrangeslider.js +704 -704
- package/app/modules/vgrangeslider/scss/_variables.scss +55 -55
- package/app/modules/vgrangeslider/scss/vgrangeslider.scss +239 -239
- package/app/modules/vgrollup/scss/_variables.scss +15 -15
- package/app/modules/vgrollup/scss/vgrollup.scss +6 -6
- package/app/modules/vgselect/js/vgselect.js +129 -129
- package/app/modules/vgselect/readme.md +11 -11
- package/app/modules/vgselect/scss/_variables.scss +50 -50
- package/app/modules/vgselect/scss/vgselect.scss +48 -48
- package/app/modules/vgsidebar/js/vgsidebar.js +79 -79
- package/app/modules/vgsidebar/scss/_variables.scss +10 -10
- package/app/modules/vgsidebar/scss/vgsidebar.scss +5 -5
- package/app/modules/vgtabs/scss/_variables.scss +23 -23
- package/app/modules/vgtabs/scss/vgtabs.scss +5 -5
- package/app/modules/vgtoast/scss/_variables.scss +13 -13
- package/app/modules/vgtoast/scss/vgtoast.scss +5 -5
- package/app/modules/vgtooltip/js/vgtooltip.js +107 -51
- package/app/modules/vgtooltip/scss/_variables.scss +10 -10
- package/app/modules/vgtooltip/scss/vgtooltip.scss +5 -5
- package/app/utils/js/components/audio-metadata.js +240 -240
- package/app/utils/js/components/backdrop.js +116 -116
- package/app/utils/js/components/file-icon.js +109 -109
- package/app/utils/js/components/file-preview.js +304 -304
- package/app/utils/js/components/sanitize.js +150 -150
- package/app/utils/js/components/video-metadata.js +140 -140
- package/app/utils/scss/_backdrop.scss +5 -5
- package/app/utils/scss/_theme-default.scss +12 -12
- package/app/utils/scss/_theme.scss +7 -7
- package/app/utils/scss/_tokens.scss +170 -170
- package/app/utils/scss/default.scss +9 -9
- package/app/utils/scss/functions.scss +21 -21
- package/app/utils/scss/index.scss +4 -4
- package/app/utils/scss/mixin.scss +16 -16
- package/app/utils/scss/variables.scss +105 -105
- package/app/vgapp.js +295 -295
- package/build/vgapp.css +1 -1
- package/build/vgapp.css.map +1 -1
- package/build/vgapp.js +1 -1
- package/build/vgapp.js.map +1 -1
- package/index.scss +20 -20
- package/package.json +4 -2
|
@@ -12,10 +12,10 @@ const NAME_KEY = "vg.nestable";
|
|
|
12
12
|
|
|
13
13
|
const SELECTOR_DATA_TOGGLE = '[data-vg-toggle="nestable"]';
|
|
14
14
|
|
|
15
|
-
const CLASS_ITEM_DRAGGING = "is-dragging";
|
|
16
|
-
const CLASS_ITEM_GHOST = "is-drag-ghost";
|
|
17
|
-
const CLASS_DISABLED = "is-disabled";
|
|
18
|
-
const CLASS_ITEM_DISABLED = "is-drag-disabled";
|
|
15
|
+
const CLASS_ITEM_DRAGGING = "is-dragging";
|
|
16
|
+
const CLASS_ITEM_GHOST = "is-drag-ghost";
|
|
17
|
+
const CLASS_DISABLED = "is-disabled";
|
|
18
|
+
const CLASS_ITEM_DISABLED = "is-drag-disabled";
|
|
19
19
|
const CLASS_PLACEHOLDER = "vg-nestable-placeholder";
|
|
20
20
|
const CLASS_PLACEHOLDER_HIDDEN = "vg-nestable-placeholder-hidden";
|
|
21
21
|
const CLASS_DRAG_ELEMENT = "vg-nestable-drag-element";
|
|
@@ -24,13 +24,13 @@ const CLASS_INNER = "vg-nestable-inner";
|
|
|
24
24
|
const CLASS_HANDLE = "vg-nestable-handle";
|
|
25
25
|
const CLASS_HANDLE_ICON = "vg-nestable-handle-icon";
|
|
26
26
|
const CLASS_COLLAPSE_TOGGLE = "vg-nestable-collapse-toggle";
|
|
27
|
-
const CLASS_DROP_TARGET = "is-drop-target";
|
|
28
|
-
const CLASS_DROP_DENIED = "is-drop-denied";
|
|
29
|
-
const CLASS_DROP_BEFORE = "is-drop-before";
|
|
30
|
-
const CLASS_DROP_ATTACHABLE = "is-drop-attachable";
|
|
31
|
-
const CLASS_DROP_INSIDE = "is-drop-inside";
|
|
32
|
-
const CLASS_DROP_AFTER = "is-drop-after";
|
|
33
|
-
const CLASS_LIVE_REGION = "vg-nestable-live";
|
|
27
|
+
const CLASS_DROP_TARGET = "is-drop-target";
|
|
28
|
+
const CLASS_DROP_DENIED = "is-drop-denied";
|
|
29
|
+
const CLASS_DROP_BEFORE = "is-drop-before";
|
|
30
|
+
const CLASS_DROP_ATTACHABLE = "is-drop-attachable";
|
|
31
|
+
const CLASS_DROP_INSIDE = "is-drop-inside";
|
|
32
|
+
const CLASS_DROP_AFTER = "is-drop-after";
|
|
33
|
+
const CLASS_LIVE_REGION = "vg-nestable-live";
|
|
34
34
|
|
|
35
35
|
const EVENT_KEY_START = `${NAME_KEY}.start`;
|
|
36
36
|
const EVENT_KEY_CHANGE = `${NAME_KEY}.change`;
|
|
@@ -51,19 +51,19 @@ class VGNestable extends BaseModule {
|
|
|
51
51
|
constructor(element, params = {}) {
|
|
52
52
|
super(element, params);
|
|
53
53
|
|
|
54
|
-
this._params = this._getParams(element, mergeDeepObject({
|
|
55
|
-
disabled: false, // Disable all drag-and-drop for this tree.
|
|
56
|
-
disabledattribute: "data-disabled", // Lock attribute for an item or nested list.
|
|
57
|
-
listselector: ".vg-nestable-list", // Root/nested list for dnd.
|
|
54
|
+
this._params = this._getParams(element, mergeDeepObject({
|
|
55
|
+
disabled: false, // Disable all drag-and-drop for this tree.
|
|
56
|
+
disabledattribute: "data-disabled", // Lock attribute for an item or nested list.
|
|
57
|
+
listselector: ".vg-nestable-list", // Root/nested list for dnd.
|
|
58
58
|
itemselector: ".vg-nestable-item", // Sortable item selector.
|
|
59
59
|
handleselector: ".vg-nestable-handle", // Drag handle selector.
|
|
60
60
|
idattribute: "data-id", // Item id attribute used by serialize().
|
|
61
61
|
childlistclass: "vg-nestable-list", // Class for auto-created child list.
|
|
62
62
|
handleicon: '', // иконка для хендлера
|
|
63
|
-
indent: 18, // Small horizontal gesture (px) that moves the item under the previous sibling.
|
|
63
|
+
indent: 18, // Small horizontal gesture (px) that moves the item under the previous sibling.
|
|
64
64
|
maxdepth: 6, // Maximum nesting depth.
|
|
65
65
|
moveaxis: "default", // Drag direction: default | vertical | horizontal.
|
|
66
|
-
hoverthreshold: 0.25, // Half-height of the central child-drop zone (0.05..0.45).
|
|
66
|
+
hoverthreshold: 0.25, // Half-height of the central child-drop zone (0.05..0.45).
|
|
67
67
|
neighborchangethreshold: 0, // Percentage (0..49) of entering adjacent item before position changes.
|
|
68
68
|
showplaceholder: true, // Show placeholder during drag.
|
|
69
69
|
group: "",
|
|
@@ -109,10 +109,10 @@ class VGNestable extends BaseModule {
|
|
|
109
109
|
this._isDragging = false;
|
|
110
110
|
this._startSnapshot = "";
|
|
111
111
|
this._sourceInstance = this;
|
|
112
|
-
this._lastDropInstance = this;
|
|
113
|
-
this._activeDropList = null;
|
|
114
|
-
this._activeDropItem = null;
|
|
115
|
-
this._dragBaseDepth = 1;
|
|
112
|
+
this._lastDropInstance = this;
|
|
113
|
+
this._activeDropList = null;
|
|
114
|
+
this._activeDropItem = null;
|
|
115
|
+
this._dragBaseDepth = 1;
|
|
116
116
|
|
|
117
117
|
this._mouse = {
|
|
118
118
|
startX: 0,
|
|
@@ -265,9 +265,9 @@ class VGNestable extends BaseModule {
|
|
|
265
265
|
) || null;
|
|
266
266
|
}
|
|
267
267
|
|
|
268
|
-
_canAcceptItem(item, sourceInstance) {
|
|
269
|
-
if (this._isTreeDisabled()) return false;
|
|
270
|
-
const accept = this._params?.accept;
|
|
268
|
+
_canAcceptItem(item, sourceInstance) {
|
|
269
|
+
if (this._isTreeDisabled()) return false;
|
|
270
|
+
const accept = this._params?.accept;
|
|
271
271
|
if (typeof accept !== "function") return true;
|
|
272
272
|
try {
|
|
273
273
|
return !!accept(item, sourceInstance, this);
|
|
@@ -277,21 +277,21 @@ class VGNestable extends BaseModule {
|
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
|
|
280
|
-
refresh() {
|
|
281
|
-
const treeDisabled = this._isTreeDisabled();
|
|
282
|
-
this._element.classList.toggle(CLASS_DISABLED, treeDisabled);
|
|
283
|
-
this._element.setAttribute("aria-disabled", treeDisabled ? "true" : "false");
|
|
284
|
-
|
|
285
|
-
this._getItems().forEach((item) => {
|
|
286
|
-
const handle = this._ensureItemLayout(item);
|
|
287
|
-
const dragDisabled = this._isItemDragDisabled(item);
|
|
288
|
-
item.classList.toggle(CLASS_ITEM_DISABLED, dragDisabled);
|
|
289
|
-
|
|
290
|
-
if (handle) {
|
|
291
|
-
handle.style.cursor = dragDisabled ? "not-allowed" : "grab";
|
|
292
|
-
handle.style.userSelect = "none";
|
|
293
|
-
handle.style.touchAction = "none";
|
|
294
|
-
handle.setAttribute("aria-disabled", dragDisabled ? "true" : "false");
|
|
280
|
+
refresh() {
|
|
281
|
+
const treeDisabled = this._isTreeDisabled();
|
|
282
|
+
this._element.classList.toggle(CLASS_DISABLED, treeDisabled);
|
|
283
|
+
this._element.setAttribute("aria-disabled", treeDisabled ? "true" : "false");
|
|
284
|
+
|
|
285
|
+
this._getItems().forEach((item) => {
|
|
286
|
+
const handle = this._ensureItemLayout(item);
|
|
287
|
+
const dragDisabled = this._isItemDragDisabled(item);
|
|
288
|
+
item.classList.toggle(CLASS_ITEM_DISABLED, dragDisabled);
|
|
289
|
+
|
|
290
|
+
if (handle) {
|
|
291
|
+
handle.style.cursor = dragDisabled ? "not-allowed" : "grab";
|
|
292
|
+
handle.style.userSelect = "none";
|
|
293
|
+
handle.style.touchAction = "none";
|
|
294
|
+
handle.setAttribute("aria-disabled", dragDisabled ? "true" : "false");
|
|
295
295
|
|
|
296
296
|
if (!["BUTTON", "A", "INPUT"].includes(handle.tagName)) {
|
|
297
297
|
handle.setAttribute("role", "button");
|
|
@@ -816,12 +816,12 @@ class VGNestable extends BaseModule {
|
|
|
816
816
|
return !!(handle && item.contains(handle));
|
|
817
817
|
}
|
|
818
818
|
|
|
819
|
-
_startKeyboardDrag(item) {
|
|
820
|
-
if (!item || this._keyboardDraggedItem || this._isItemDragDisabled(item)) {
|
|
821
|
-
if (item && this._isItemDragDisabled(item)) {
|
|
822
|
-
this._announce("This item cannot be moved.");
|
|
823
|
-
}
|
|
824
|
-
return;
|
|
819
|
+
_startKeyboardDrag(item) {
|
|
820
|
+
if (!item || this._keyboardDraggedItem || this._isItemDragDisabled(item)) {
|
|
821
|
+
if (item && this._isItemDragDisabled(item)) {
|
|
822
|
+
this._announce("This item cannot be moved.");
|
|
823
|
+
}
|
|
824
|
+
return;
|
|
825
825
|
}
|
|
826
826
|
|
|
827
827
|
this._keyboardDraggedItem = item;
|
|
@@ -916,19 +916,19 @@ class VGNestable extends BaseModule {
|
|
|
916
916
|
return true;
|
|
917
917
|
}
|
|
918
918
|
|
|
919
|
-
_indentKeyboard(item) {
|
|
919
|
+
_indentKeyboard(item) {
|
|
920
920
|
const parentCandidate = this._getPreviousItem(item);
|
|
921
921
|
if (!parentCandidate || parentCandidate === item || item.contains(parentCandidate)) {
|
|
922
922
|
this._announce("Cannot nest here.");
|
|
923
923
|
return false;
|
|
924
924
|
}
|
|
925
925
|
|
|
926
|
-
const childList = this._getOrCreateChildList(parentCandidate);
|
|
927
|
-
if (this._isListDisabled(childList)) {
|
|
928
|
-
this._announce("This group cannot be changed.");
|
|
929
|
-
return false;
|
|
930
|
-
}
|
|
931
|
-
if (this._isDepthExceeded(childList, item)) {
|
|
926
|
+
const childList = this._getOrCreateChildList(parentCandidate);
|
|
927
|
+
if (this._isListDisabled(childList)) {
|
|
928
|
+
this._announce("This group cannot be changed.");
|
|
929
|
+
return false;
|
|
930
|
+
}
|
|
931
|
+
if (this._isDepthExceeded(childList, item)) {
|
|
932
932
|
this._announce("Maximum nesting depth reached.");
|
|
933
933
|
return false;
|
|
934
934
|
}
|
|
@@ -974,18 +974,18 @@ class VGNestable extends BaseModule {
|
|
|
974
974
|
return "Picked up item. Use arrow keys to move, Enter or Space to drop, Escape to cancel.";
|
|
975
975
|
}
|
|
976
976
|
|
|
977
|
-
_startInteraction(target, clientX, clientY, event) {
|
|
977
|
+
_startInteraction(target, clientX, clientY, event) {
|
|
978
978
|
if (this._keyboardDraggedItem) {
|
|
979
979
|
this._clearKeyboardDragState();
|
|
980
980
|
}
|
|
981
981
|
|
|
982
982
|
const item = target?.closest?.(this._params.itemselector);
|
|
983
|
-
if (!item || !this._rootList.contains(item)) {
|
|
984
|
-
return;
|
|
985
|
-
}
|
|
986
|
-
if (this._isItemDragDisabled(item)) {
|
|
987
|
-
return;
|
|
988
|
-
}
|
|
983
|
+
if (!item || !this._rootList.contains(item)) {
|
|
984
|
+
return;
|
|
985
|
+
}
|
|
986
|
+
if (this._isItemDragDisabled(item)) {
|
|
987
|
+
return;
|
|
988
|
+
}
|
|
989
989
|
|
|
990
990
|
const handleSelector = this._params.handleselector;
|
|
991
991
|
if (handleSelector) {
|
|
@@ -1039,41 +1039,41 @@ class VGNestable extends BaseModule {
|
|
|
1039
1039
|
this._moveDragElement(this._mouse.x, this._mouse.y);
|
|
1040
1040
|
|
|
1041
1041
|
const pointerTarget = this._getPointerTarget(this._mouse.x, this._mouse.y);
|
|
1042
|
-
if (!pointerTarget) {
|
|
1043
|
-
this._setDropListState(null);
|
|
1044
|
-
this._setDropItemState(null);
|
|
1045
|
-
return;
|
|
1046
|
-
}
|
|
1047
|
-
|
|
1048
|
-
const pointerPlaceholder = pointerTarget.closest(`.${CLASS_PLACEHOLDER}`);
|
|
1049
|
-
if (pointerPlaceholder) {
|
|
1050
|
-
const targetInstance = this._findOwnerInstanceByElement(pointerPlaceholder) || this._currentTargetInstance || this;
|
|
1051
|
-
this._tryIndentFromPlaceholder(this._mouse.x, targetInstance);
|
|
1052
|
-
return;
|
|
1053
|
-
}
|
|
1042
|
+
if (!pointerTarget) {
|
|
1043
|
+
this._setDropListState(null);
|
|
1044
|
+
this._setDropItemState(null);
|
|
1045
|
+
return;
|
|
1046
|
+
}
|
|
1047
|
+
|
|
1048
|
+
const pointerPlaceholder = pointerTarget.closest(`.${CLASS_PLACEHOLDER}`);
|
|
1049
|
+
if (pointerPlaceholder) {
|
|
1050
|
+
const targetInstance = this._findOwnerInstanceByElement(pointerPlaceholder) || this._currentTargetInstance || this;
|
|
1051
|
+
this._tryIndentFromPlaceholder(this._mouse.x, targetInstance);
|
|
1052
|
+
return;
|
|
1053
|
+
}
|
|
1054
1054
|
|
|
1055
1055
|
const targetInstance = this._findOwnerInstanceByElement(pointerTarget) || this;
|
|
1056
1056
|
const hoveredItem = pointerTarget.closest(targetInstance._params.itemselector);
|
|
1057
|
-
const list = this._resolveDropList(pointerTarget, hoveredItem, targetInstance);
|
|
1058
|
-
if (!list || !targetInstance._rootList.contains(list)) {
|
|
1059
|
-
this._setDropListState(null);
|
|
1060
|
-
this._setDropItemState(null);
|
|
1061
|
-
return;
|
|
1062
|
-
}
|
|
1063
|
-
const mode = this._resolveMode(this._mouse.x, this._mouse.y, hoveredItem, targetInstance._params);
|
|
1064
|
-
if (targetInstance._isListDisabled(list)) {
|
|
1065
|
-
this._setDropListState(list, true);
|
|
1066
|
-
this._setDropItemState(hoveredItem, mode, true);
|
|
1067
|
-
return;
|
|
1068
|
-
}
|
|
1069
|
-
|
|
1070
|
-
if (!targetInstance._canAcceptItem(this._draggedItem, this._sourceInstance)) {
|
|
1071
|
-
this._setDropListState(list, true);
|
|
1072
|
-
this._setDropItemState(hoveredItem, mode, true);
|
|
1073
|
-
return;
|
|
1074
|
-
}
|
|
1075
|
-
|
|
1076
|
-
this._setDropItemState(hoveredItem, mode);
|
|
1057
|
+
const list = this._resolveDropList(pointerTarget, hoveredItem, targetInstance);
|
|
1058
|
+
if (!list || !targetInstance._rootList.contains(list)) {
|
|
1059
|
+
this._setDropListState(null);
|
|
1060
|
+
this._setDropItemState(null);
|
|
1061
|
+
return;
|
|
1062
|
+
}
|
|
1063
|
+
const mode = this._resolveMode(this._mouse.x, this._mouse.y, hoveredItem, targetInstance._params);
|
|
1064
|
+
if (targetInstance._isListDisabled(list)) {
|
|
1065
|
+
this._setDropListState(list, true);
|
|
1066
|
+
this._setDropItemState(hoveredItem, mode, true);
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
if (!targetInstance._canAcceptItem(this._draggedItem, this._sourceInstance)) {
|
|
1071
|
+
this._setDropListState(list, true);
|
|
1072
|
+
this._setDropItemState(hoveredItem, mode, true);
|
|
1073
|
+
return;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
this._setDropItemState(hoveredItem, mode);
|
|
1077
1077
|
this._emit("move", {
|
|
1078
1078
|
item: this._draggedItem,
|
|
1079
1079
|
hoveredItem,
|
|
@@ -1084,9 +1084,9 @@ class VGNestable extends BaseModule {
|
|
|
1084
1084
|
y: this._mouse.y
|
|
1085
1085
|
}
|
|
1086
1086
|
});
|
|
1087
|
-
if (mode === "keep") {
|
|
1088
|
-
this._setDropListState(list);
|
|
1089
|
-
return;
|
|
1087
|
+
if (mode === "keep") {
|
|
1088
|
+
this._setDropListState(list);
|
|
1089
|
+
return;
|
|
1090
1090
|
}
|
|
1091
1091
|
|
|
1092
1092
|
if (mode === "child") {
|
|
@@ -1111,18 +1111,18 @@ class VGNestable extends BaseModule {
|
|
|
1111
1111
|
}
|
|
1112
1112
|
}
|
|
1113
1113
|
|
|
1114
|
-
if (!parentCandidate) {
|
|
1115
|
-
this._setDropListState(null);
|
|
1116
|
-
this._setDropItemState(null);
|
|
1117
|
-
return;
|
|
1118
|
-
}
|
|
1114
|
+
if (!parentCandidate) {
|
|
1115
|
+
this._setDropListState(null);
|
|
1116
|
+
this._setDropItemState(null);
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
1119
|
|
|
1120
1120
|
const childList = targetInstance._getOrCreateChildList(parentCandidate);
|
|
1121
|
-
if (targetInstance._isDepthExceeded(childList, this._draggedItem)) {
|
|
1122
|
-
this._setDropListState(childList, true);
|
|
1123
|
-
this._setDropItemState(parentCandidate, mode, true);
|
|
1124
|
-
return;
|
|
1125
|
-
}
|
|
1121
|
+
if (targetInstance._isDepthExceeded(childList, this._draggedItem)) {
|
|
1122
|
+
this._setDropListState(childList, true);
|
|
1123
|
+
this._setDropItemState(parentCandidate, mode, true);
|
|
1124
|
+
return;
|
|
1125
|
+
}
|
|
1126
1126
|
|
|
1127
1127
|
this._placePlaceholder(childList, null);
|
|
1128
1128
|
this._setDropListState(childList);
|
|
@@ -1132,18 +1132,18 @@ class VGNestable extends BaseModule {
|
|
|
1132
1132
|
}
|
|
1133
1133
|
|
|
1134
1134
|
if (hoveredItem) {
|
|
1135
|
-
if (hoveredItem === this._draggedItem || this._draggedItem.contains(hoveredItem)) {
|
|
1136
|
-
this._setDropListState(null);
|
|
1137
|
-
this._setDropItemState(null);
|
|
1138
|
-
return;
|
|
1139
|
-
}
|
|
1135
|
+
if (hoveredItem === this._draggedItem || this._draggedItem.contains(hoveredItem)) {
|
|
1136
|
+
this._setDropListState(null);
|
|
1137
|
+
this._setDropItemState(null);
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
1140
|
|
|
1141
1141
|
const targetList = hoveredItem.parentElement;
|
|
1142
|
-
if (targetInstance._isDepthExceeded(targetList, this._draggedItem)) {
|
|
1143
|
-
this._setDropListState(targetList, true);
|
|
1144
|
-
this._setDropItemState(hoveredItem, mode, true);
|
|
1145
|
-
return;
|
|
1146
|
-
}
|
|
1142
|
+
if (targetInstance._isDepthExceeded(targetList, this._draggedItem)) {
|
|
1143
|
+
this._setDropListState(targetList, true);
|
|
1144
|
+
this._setDropItemState(hoveredItem, mode, true);
|
|
1145
|
+
return;
|
|
1146
|
+
}
|
|
1147
1147
|
|
|
1148
1148
|
if (mode === "before") {
|
|
1149
1149
|
this._placePlaceholder(targetList, hoveredItem);
|
|
@@ -1284,10 +1284,10 @@ class VGNestable extends BaseModule {
|
|
|
1284
1284
|
|
|
1285
1285
|
this._isDragging = true;
|
|
1286
1286
|
this._startSnapshot = JSON.stringify(this.serialize());
|
|
1287
|
-
this._sourceInstance = this;
|
|
1288
|
-
this._sourceRoot = this._rootList;
|
|
1289
|
-
this._dragBaseDepth = this._getListDepth(this._draggedItem.parentElement);
|
|
1290
|
-
this._currentTargetInstance = this;
|
|
1287
|
+
this._sourceInstance = this;
|
|
1288
|
+
this._sourceRoot = this._rootList;
|
|
1289
|
+
this._dragBaseDepth = this._getListDepth(this._draggedItem.parentElement);
|
|
1290
|
+
this._currentTargetInstance = this;
|
|
1291
1291
|
this._lastDropInstance = this;
|
|
1292
1292
|
|
|
1293
1293
|
this._placeholder = this._createPlaceholder(this._draggedItem);
|
|
@@ -1381,201 +1381,201 @@ class VGNestable extends BaseModule {
|
|
|
1381
1381
|
return targetInstance._rootList;
|
|
1382
1382
|
}
|
|
1383
1383
|
|
|
1384
|
-
_resolveMode(pointerX, pointerY, hoveredItem, params = this._params) {
|
|
1385
|
-
if (!hoveredItem) {
|
|
1386
|
-
return "append";
|
|
1387
|
-
}
|
|
1388
|
-
|
|
1389
|
-
const rect = this._getItemDropRect(hoveredItem);
|
|
1390
|
-
const offsetY = pointerY - rect.top;
|
|
1391
|
-
// Measure indentation against the hovered row. Nested lists and wide subtrees must not
|
|
1392
|
-
// change the pointer target geometry or force a large horizontal mouse gesture.
|
|
1393
|
-
const offsetX = pointerX - rect.left;
|
|
1394
|
-
const indentValue = parseFloat(params.indent);
|
|
1395
|
-
const indent = Number.isFinite(indentValue) ? indentValue : 0;
|
|
1396
|
-
const grabOffsetX = Math.max(0, Number(this._mouse.grabOffsetX) || 0);
|
|
1397
|
-
const nestTriggerX = grabOffsetX + indent;
|
|
1398
|
-
const moveAxis = this._getMoveAxis(params);
|
|
1399
|
-
const allowVertical = moveAxis !== "horizontal";
|
|
1400
|
-
const allowHorizontal = moveAxis !== "vertical";
|
|
1401
|
-
const neighborThresholdPercent = Math.max(
|
|
1402
|
-
0,
|
|
1403
|
-
Math.min(49, Number(params.neighborchangethreshold || 0))
|
|
1404
|
-
);
|
|
1405
|
-
|
|
1406
|
-
if (neighborThresholdPercent > 0) {
|
|
1407
|
-
const edgeRatio = neighborThresholdPercent / 100;
|
|
1408
|
-
const topBorder = rect.height * edgeRatio;
|
|
1409
|
-
const bottomBorder = rect.height * (1 - edgeRatio);
|
|
1410
|
-
|
|
1411
|
-
if (allowHorizontal && offsetX > nestTriggerX && offsetY > topBorder && offsetY < bottomBorder) {
|
|
1412
|
-
return "child";
|
|
1413
|
-
}
|
|
1414
|
-
|
|
1415
|
-
if (allowVertical && offsetY <= topBorder) {
|
|
1416
|
-
return "before";
|
|
1417
|
-
}
|
|
1418
|
-
|
|
1419
|
-
if (allowVertical && offsetY >= bottomBorder) {
|
|
1420
|
-
return "after";
|
|
1421
|
-
}
|
|
1422
|
-
|
|
1423
|
-
return "keep";
|
|
1424
|
-
}
|
|
1425
|
-
|
|
1426
|
-
const threshold = Math.min(
|
|
1427
|
-
0.45,
|
|
1428
|
-
Math.max(0.05, Number(params.hoverthreshold || 0.25))
|
|
1429
|
-
);
|
|
1430
|
-
|
|
1431
|
-
if (
|
|
1432
|
-
allowHorizontal &&
|
|
1433
|
-
offsetX > nestTriggerX &&
|
|
1434
|
-
offsetY >= rect.height * (0.5 - threshold) &&
|
|
1435
|
-
offsetY <= rect.height * (0.5 + threshold)
|
|
1436
|
-
) {
|
|
1437
|
-
return "child";
|
|
1438
|
-
}
|
|
1439
|
-
|
|
1440
|
-
if (allowVertical && offsetY < rect.height * (0.5 - threshold)) {
|
|
1441
|
-
return "before";
|
|
1442
|
-
}
|
|
1443
|
-
|
|
1444
|
-
if (allowVertical && offsetY > rect.height * (0.5 + threshold)) {
|
|
1445
|
-
return "after";
|
|
1446
|
-
}
|
|
1447
|
-
|
|
1448
|
-
return "keep";
|
|
1449
|
-
}
|
|
1450
|
-
|
|
1451
|
-
_getItemDropRect(item) {
|
|
1452
|
-
const inner = item?.querySelector?.(`:scope > .${CLASS_INNER}`);
|
|
1453
|
-
return (inner || item).getBoundingClientRect();
|
|
1454
|
-
}
|
|
1455
|
-
|
|
1456
|
-
_tryIndentFromPlaceholder(pointerX, targetInstance = this) {
|
|
1457
|
-
if (!this._placeholder || this._getMoveAxis(targetInstance._params) === "vertical") {
|
|
1458
|
-
return false;
|
|
1459
|
-
}
|
|
1460
|
-
|
|
1461
|
-
if (
|
|
1462
|
-
!targetInstance._canAcceptItem(this._draggedItem, this._sourceInstance) ||
|
|
1463
|
-
targetInstance._isListDisabled(this._placeholder.parentElement)
|
|
1464
|
-
) {
|
|
1465
|
-
this._setDropListState(this._placeholder.parentElement, true);
|
|
1466
|
-
this._setDropItemState(null);
|
|
1467
|
-
return false;
|
|
1468
|
-
}
|
|
1469
|
-
|
|
1470
|
-
const indentValue = parseFloat(targetInstance._params.indent);
|
|
1471
|
-
const indent = Number.isFinite(indentValue) ? Math.max(1, indentValue) : 18;
|
|
1472
|
-
const horizontalDistance = Math.max(0, pointerX - this._mouse.startX);
|
|
1473
|
-
const requestedDepth = this._dragBaseDepth + Math.floor(horizontalDistance / indent);
|
|
1474
|
-
let currentList = this._placeholder.parentElement;
|
|
1475
|
-
let currentDepth = targetInstance._getListDepth(currentList);
|
|
1476
|
-
let parentCandidate = null;
|
|
1477
|
-
|
|
1478
|
-
// Moving left promotes the placeholder one level at a time.
|
|
1479
|
-
while (currentDepth > requestedDepth) {
|
|
1480
|
-
const currentParent = currentList.closest(targetInstance._params.itemselector);
|
|
1481
|
-
const parentList = currentParent?.parentElement;
|
|
1482
|
-
if (!currentParent || !parentList) {
|
|
1483
|
-
break;
|
|
1484
|
-
}
|
|
1485
|
-
this._placePlaceholder(parentList, currentParent.nextSibling);
|
|
1486
|
-
currentList = parentList;
|
|
1487
|
-
currentDepth = targetInstance._getListDepth(currentList);
|
|
1488
|
-
}
|
|
1489
|
-
|
|
1490
|
-
// Every additional horizontal step nests under the previous item on that level.
|
|
1491
|
-
while (currentDepth < requestedDepth) {
|
|
1492
|
-
parentCandidate = targetInstance._getPreviousItem(this._placeholder);
|
|
1493
|
-
while (parentCandidate && (parentCandidate === this._draggedItem || this._draggedItem.contains(parentCandidate))) {
|
|
1494
|
-
parentCandidate = targetInstance._getPreviousItem(parentCandidate);
|
|
1495
|
-
}
|
|
1496
|
-
if (!parentCandidate) {
|
|
1497
|
-
break;
|
|
1498
|
-
}
|
|
1499
|
-
|
|
1500
|
-
const childList = targetInstance._getOrCreateChildList(parentCandidate);
|
|
1501
|
-
if (targetInstance._isListDisabled(childList)) {
|
|
1502
|
-
this._setDropListState(childList, true);
|
|
1503
|
-
this._setDropItemState(parentCandidate, "child", true);
|
|
1504
|
-
return false;
|
|
1505
|
-
}
|
|
1506
|
-
if (targetInstance._isDepthExceeded(childList, this._draggedItem)) {
|
|
1507
|
-
this._setDropListState(childList, true);
|
|
1508
|
-
this._setDropItemState(parentCandidate, "child", true);
|
|
1509
|
-
return false;
|
|
1510
|
-
}
|
|
1511
|
-
|
|
1512
|
-
this._placePlaceholder(childList, null);
|
|
1513
|
-
currentList = childList;
|
|
1514
|
-
currentDepth = targetInstance._getListDepth(currentList);
|
|
1515
|
-
}
|
|
1516
|
-
|
|
1517
|
-
const currentParent = currentList.closest(targetInstance._params.itemselector);
|
|
1518
|
-
const nextCandidate = targetInstance._getPreviousItem(this._placeholder);
|
|
1519
|
-
const stepProgress = (horizontalDistance % indent) / indent;
|
|
1520
|
-
if (nextCandidate && nextCandidate !== this._draggedItem && stepProgress >= 0.35) {
|
|
1521
|
-
this._setDropItemState(nextCandidate, "attachable");
|
|
1522
|
-
parentCandidate = nextCandidate;
|
|
1523
|
-
} else if (currentParent) {
|
|
1524
|
-
this._setDropItemState(currentParent, "child");
|
|
1525
|
-
parentCandidate = currentParent;
|
|
1526
|
-
} else if (nextCandidate && nextCandidate !== this._draggedItem) {
|
|
1527
|
-
this._setDropItemState(nextCandidate, "attachable");
|
|
1528
|
-
parentCandidate = nextCandidate;
|
|
1529
|
-
} else {
|
|
1530
|
-
this._setDropItemState(null);
|
|
1531
|
-
}
|
|
1532
|
-
|
|
1533
|
-
this._setDropListState(currentList);
|
|
1534
|
-
this._currentTargetInstance = targetInstance;
|
|
1535
|
-
this._lastDropInstance = targetInstance;
|
|
1536
|
-
this._emit("move", {
|
|
1537
|
-
item: this._draggedItem,
|
|
1538
|
-
hoveredItem: parentCandidate,
|
|
1539
|
-
mode: currentDepth > this._dragBaseDepth ? "child" : "keep",
|
|
1540
|
-
targetInstance,
|
|
1541
|
-
mouse: { x: this._mouse.x, y: this._mouse.y }
|
|
1542
|
-
});
|
|
1543
|
-
return currentDepth > this._dragBaseDepth;
|
|
1544
|
-
}
|
|
1545
|
-
|
|
1546
|
-
_hasDisabledAttribute(element) {
|
|
1547
|
-
if (!element || !this._params.disabledattribute) {
|
|
1548
|
-
return false;
|
|
1549
|
-
}
|
|
1550
|
-
const value = element.getAttribute(this._params.disabledattribute);
|
|
1551
|
-
return value !== null && normalizeData(value === "" ? "true" : value) === true;
|
|
1552
|
-
}
|
|
1553
|
-
|
|
1554
|
-
_isTreeDisabled() {
|
|
1555
|
-
return normalizeData(this._params.disabled) === true || this._hasDisabledAttribute(this._element);
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
_isListDisabled(list) {
|
|
1559
|
-
if (this._isTreeDisabled()) {
|
|
1560
|
-
return true;
|
|
1561
|
-
}
|
|
1562
|
-
|
|
1563
|
-
let currentList = list;
|
|
1564
|
-
while (currentList && this._rootList.contains(currentList)) {
|
|
1565
|
-
if (currentList.matches(this._params.listselector) && this._hasDisabledAttribute(currentList)) {
|
|
1566
|
-
return true;
|
|
1567
|
-
}
|
|
1568
|
-
if (currentList === this._rootList) {
|
|
1569
|
-
break;
|
|
1570
|
-
}
|
|
1571
|
-
currentList = currentList.parentElement?.closest(this._params.listselector) || null;
|
|
1572
|
-
}
|
|
1573
|
-
return false;
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
_isItemDragDisabled(item) {
|
|
1577
|
-
return this._isTreeDisabled() || this._hasDisabledAttribute(item) || this._isListDisabled(item?.parentElement);
|
|
1578
|
-
}
|
|
1384
|
+
_resolveMode(pointerX, pointerY, hoveredItem, params = this._params) {
|
|
1385
|
+
if (!hoveredItem) {
|
|
1386
|
+
return "append";
|
|
1387
|
+
}
|
|
1388
|
+
|
|
1389
|
+
const rect = this._getItemDropRect(hoveredItem);
|
|
1390
|
+
const offsetY = pointerY - rect.top;
|
|
1391
|
+
// Measure indentation against the hovered row. Nested lists and wide subtrees must not
|
|
1392
|
+
// change the pointer target geometry or force a large horizontal mouse gesture.
|
|
1393
|
+
const offsetX = pointerX - rect.left;
|
|
1394
|
+
const indentValue = parseFloat(params.indent);
|
|
1395
|
+
const indent = Number.isFinite(indentValue) ? indentValue : 0;
|
|
1396
|
+
const grabOffsetX = Math.max(0, Number(this._mouse.grabOffsetX) || 0);
|
|
1397
|
+
const nestTriggerX = grabOffsetX + indent;
|
|
1398
|
+
const moveAxis = this._getMoveAxis(params);
|
|
1399
|
+
const allowVertical = moveAxis !== "horizontal";
|
|
1400
|
+
const allowHorizontal = moveAxis !== "vertical";
|
|
1401
|
+
const neighborThresholdPercent = Math.max(
|
|
1402
|
+
0,
|
|
1403
|
+
Math.min(49, Number(params.neighborchangethreshold || 0))
|
|
1404
|
+
);
|
|
1405
|
+
|
|
1406
|
+
if (neighborThresholdPercent > 0) {
|
|
1407
|
+
const edgeRatio = neighborThresholdPercent / 100;
|
|
1408
|
+
const topBorder = rect.height * edgeRatio;
|
|
1409
|
+
const bottomBorder = rect.height * (1 - edgeRatio);
|
|
1410
|
+
|
|
1411
|
+
if (allowHorizontal && offsetX > nestTriggerX && offsetY > topBorder && offsetY < bottomBorder) {
|
|
1412
|
+
return "child";
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
if (allowVertical && offsetY <= topBorder) {
|
|
1416
|
+
return "before";
|
|
1417
|
+
}
|
|
1418
|
+
|
|
1419
|
+
if (allowVertical && offsetY >= bottomBorder) {
|
|
1420
|
+
return "after";
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
return "keep";
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
const threshold = Math.min(
|
|
1427
|
+
0.45,
|
|
1428
|
+
Math.max(0.05, Number(params.hoverthreshold || 0.25))
|
|
1429
|
+
);
|
|
1430
|
+
|
|
1431
|
+
if (
|
|
1432
|
+
allowHorizontal &&
|
|
1433
|
+
offsetX > nestTriggerX &&
|
|
1434
|
+
offsetY >= rect.height * (0.5 - threshold) &&
|
|
1435
|
+
offsetY <= rect.height * (0.5 + threshold)
|
|
1436
|
+
) {
|
|
1437
|
+
return "child";
|
|
1438
|
+
}
|
|
1439
|
+
|
|
1440
|
+
if (allowVertical && offsetY < rect.height * (0.5 - threshold)) {
|
|
1441
|
+
return "before";
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
if (allowVertical && offsetY > rect.height * (0.5 + threshold)) {
|
|
1445
|
+
return "after";
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
return "keep";
|
|
1449
|
+
}
|
|
1450
|
+
|
|
1451
|
+
_getItemDropRect(item) {
|
|
1452
|
+
const inner = item?.querySelector?.(`:scope > .${CLASS_INNER}`);
|
|
1453
|
+
return (inner || item).getBoundingClientRect();
|
|
1454
|
+
}
|
|
1455
|
+
|
|
1456
|
+
_tryIndentFromPlaceholder(pointerX, targetInstance = this) {
|
|
1457
|
+
if (!this._placeholder || this._getMoveAxis(targetInstance._params) === "vertical") {
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1461
|
+
if (
|
|
1462
|
+
!targetInstance._canAcceptItem(this._draggedItem, this._sourceInstance) ||
|
|
1463
|
+
targetInstance._isListDisabled(this._placeholder.parentElement)
|
|
1464
|
+
) {
|
|
1465
|
+
this._setDropListState(this._placeholder.parentElement, true);
|
|
1466
|
+
this._setDropItemState(null);
|
|
1467
|
+
return false;
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
const indentValue = parseFloat(targetInstance._params.indent);
|
|
1471
|
+
const indent = Number.isFinite(indentValue) ? Math.max(1, indentValue) : 18;
|
|
1472
|
+
const horizontalDistance = Math.max(0, pointerX - this._mouse.startX);
|
|
1473
|
+
const requestedDepth = this._dragBaseDepth + Math.floor(horizontalDistance / indent);
|
|
1474
|
+
let currentList = this._placeholder.parentElement;
|
|
1475
|
+
let currentDepth = targetInstance._getListDepth(currentList);
|
|
1476
|
+
let parentCandidate = null;
|
|
1477
|
+
|
|
1478
|
+
// Moving left promotes the placeholder one level at a time.
|
|
1479
|
+
while (currentDepth > requestedDepth) {
|
|
1480
|
+
const currentParent = currentList.closest(targetInstance._params.itemselector);
|
|
1481
|
+
const parentList = currentParent?.parentElement;
|
|
1482
|
+
if (!currentParent || !parentList) {
|
|
1483
|
+
break;
|
|
1484
|
+
}
|
|
1485
|
+
this._placePlaceholder(parentList, currentParent.nextSibling);
|
|
1486
|
+
currentList = parentList;
|
|
1487
|
+
currentDepth = targetInstance._getListDepth(currentList);
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
// Every additional horizontal step nests under the previous item on that level.
|
|
1491
|
+
while (currentDepth < requestedDepth) {
|
|
1492
|
+
parentCandidate = targetInstance._getPreviousItem(this._placeholder);
|
|
1493
|
+
while (parentCandidate && (parentCandidate === this._draggedItem || this._draggedItem.contains(parentCandidate))) {
|
|
1494
|
+
parentCandidate = targetInstance._getPreviousItem(parentCandidate);
|
|
1495
|
+
}
|
|
1496
|
+
if (!parentCandidate) {
|
|
1497
|
+
break;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
const childList = targetInstance._getOrCreateChildList(parentCandidate);
|
|
1501
|
+
if (targetInstance._isListDisabled(childList)) {
|
|
1502
|
+
this._setDropListState(childList, true);
|
|
1503
|
+
this._setDropItemState(parentCandidate, "child", true);
|
|
1504
|
+
return false;
|
|
1505
|
+
}
|
|
1506
|
+
if (targetInstance._isDepthExceeded(childList, this._draggedItem)) {
|
|
1507
|
+
this._setDropListState(childList, true);
|
|
1508
|
+
this._setDropItemState(parentCandidate, "child", true);
|
|
1509
|
+
return false;
|
|
1510
|
+
}
|
|
1511
|
+
|
|
1512
|
+
this._placePlaceholder(childList, null);
|
|
1513
|
+
currentList = childList;
|
|
1514
|
+
currentDepth = targetInstance._getListDepth(currentList);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
const currentParent = currentList.closest(targetInstance._params.itemselector);
|
|
1518
|
+
const nextCandidate = targetInstance._getPreviousItem(this._placeholder);
|
|
1519
|
+
const stepProgress = (horizontalDistance % indent) / indent;
|
|
1520
|
+
if (nextCandidate && nextCandidate !== this._draggedItem && stepProgress >= 0.35) {
|
|
1521
|
+
this._setDropItemState(nextCandidate, "attachable");
|
|
1522
|
+
parentCandidate = nextCandidate;
|
|
1523
|
+
} else if (currentParent) {
|
|
1524
|
+
this._setDropItemState(currentParent, "child");
|
|
1525
|
+
parentCandidate = currentParent;
|
|
1526
|
+
} else if (nextCandidate && nextCandidate !== this._draggedItem) {
|
|
1527
|
+
this._setDropItemState(nextCandidate, "attachable");
|
|
1528
|
+
parentCandidate = nextCandidate;
|
|
1529
|
+
} else {
|
|
1530
|
+
this._setDropItemState(null);
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
this._setDropListState(currentList);
|
|
1534
|
+
this._currentTargetInstance = targetInstance;
|
|
1535
|
+
this._lastDropInstance = targetInstance;
|
|
1536
|
+
this._emit("move", {
|
|
1537
|
+
item: this._draggedItem,
|
|
1538
|
+
hoveredItem: parentCandidate,
|
|
1539
|
+
mode: currentDepth > this._dragBaseDepth ? "child" : "keep",
|
|
1540
|
+
targetInstance,
|
|
1541
|
+
mouse: { x: this._mouse.x, y: this._mouse.y }
|
|
1542
|
+
});
|
|
1543
|
+
return currentDepth > this._dragBaseDepth;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
_hasDisabledAttribute(element) {
|
|
1547
|
+
if (!element || !this._params.disabledattribute) {
|
|
1548
|
+
return false;
|
|
1549
|
+
}
|
|
1550
|
+
const value = element.getAttribute(this._params.disabledattribute);
|
|
1551
|
+
return value !== null && normalizeData(value === "" ? "true" : value) === true;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
_isTreeDisabled() {
|
|
1555
|
+
return normalizeData(this._params.disabled) === true || this._hasDisabledAttribute(this._element);
|
|
1556
|
+
}
|
|
1557
|
+
|
|
1558
|
+
_isListDisabled(list) {
|
|
1559
|
+
if (this._isTreeDisabled()) {
|
|
1560
|
+
return true;
|
|
1561
|
+
}
|
|
1562
|
+
|
|
1563
|
+
let currentList = list;
|
|
1564
|
+
while (currentList && this._rootList.contains(currentList)) {
|
|
1565
|
+
if (currentList.matches(this._params.listselector) && this._hasDisabledAttribute(currentList)) {
|
|
1566
|
+
return true;
|
|
1567
|
+
}
|
|
1568
|
+
if (currentList === this._rootList) {
|
|
1569
|
+
break;
|
|
1570
|
+
}
|
|
1571
|
+
currentList = currentList.parentElement?.closest(this._params.listselector) || null;
|
|
1572
|
+
}
|
|
1573
|
+
return false;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
_isItemDragDisabled(item) {
|
|
1577
|
+
return this._isTreeDisabled() || this._hasDisabledAttribute(item) || this._isListDisabled(item?.parentElement);
|
|
1578
|
+
}
|
|
1579
1579
|
|
|
1580
1580
|
_getPreviousItem(item) {
|
|
1581
1581
|
let sibling = item?.previousElementSibling || null;
|
|
@@ -1740,7 +1740,7 @@ class VGNestable extends BaseModule {
|
|
|
1740
1740
|
}
|
|
1741
1741
|
}
|
|
1742
1742
|
|
|
1743
|
-
_setDropListState(list, denied = false) {
|
|
1743
|
+
_setDropListState(list, denied = false) {
|
|
1744
1744
|
if (this._activeDropList && this._activeDropList !== list) {
|
|
1745
1745
|
this._activeDropList.classList.remove(CLASS_DROP_TARGET, CLASS_DROP_DENIED);
|
|
1746
1746
|
}
|
|
@@ -1752,47 +1752,47 @@ class VGNestable extends BaseModule {
|
|
|
1752
1752
|
|
|
1753
1753
|
list.classList.add(denied ? CLASS_DROP_DENIED : CLASS_DROP_TARGET);
|
|
1754
1754
|
list.classList.remove(denied ? CLASS_DROP_TARGET : CLASS_DROP_DENIED);
|
|
1755
|
-
this._activeDropList = list;
|
|
1756
|
-
}
|
|
1757
|
-
|
|
1758
|
-
_setDropItemState(item, mode = "", denied = false) {
|
|
1759
|
-
const stateClasses = [
|
|
1760
|
-
CLASS_DROP_BEFORE,
|
|
1761
|
-
CLASS_DROP_ATTACHABLE,
|
|
1762
|
-
CLASS_DROP_INSIDE,
|
|
1763
|
-
CLASS_DROP_AFTER,
|
|
1764
|
-
CLASS_DROP_DENIED
|
|
1765
|
-
];
|
|
1766
|
-
|
|
1767
|
-
if (this._activeDropItem && this._activeDropItem !== item) {
|
|
1768
|
-
this._activeDropItem.classList.remove(...stateClasses);
|
|
1769
|
-
}
|
|
1770
|
-
|
|
1771
|
-
if (!item || !["before", "attachable", "child", "after"].includes(mode)) {
|
|
1772
|
-
if (this._activeDropItem) {
|
|
1773
|
-
this._activeDropItem.classList.remove(...stateClasses);
|
|
1774
|
-
}
|
|
1775
|
-
this._activeDropItem = null;
|
|
1776
|
-
return;
|
|
1777
|
-
}
|
|
1778
|
-
|
|
1779
|
-
item.classList.remove(...stateClasses);
|
|
1780
|
-
const modeClass = {
|
|
1781
|
-
before: CLASS_DROP_BEFORE,
|
|
1782
|
-
attachable: CLASS_DROP_ATTACHABLE,
|
|
1783
|
-
child: CLASS_DROP_INSIDE,
|
|
1784
|
-
after: CLASS_DROP_AFTER
|
|
1785
|
-
};
|
|
1786
|
-
item.classList.add(modeClass[mode]);
|
|
1787
|
-
if (denied) {
|
|
1788
|
-
item.classList.add(CLASS_DROP_DENIED);
|
|
1789
|
-
}
|
|
1790
|
-
this._activeDropItem = item;
|
|
1791
|
-
}
|
|
1792
|
-
|
|
1793
|
-
_clearDragState() {
|
|
1794
|
-
this._setDropListState(null);
|
|
1795
|
-
this._setDropItemState(null);
|
|
1755
|
+
this._activeDropList = list;
|
|
1756
|
+
}
|
|
1757
|
+
|
|
1758
|
+
_setDropItemState(item, mode = "", denied = false) {
|
|
1759
|
+
const stateClasses = [
|
|
1760
|
+
CLASS_DROP_BEFORE,
|
|
1761
|
+
CLASS_DROP_ATTACHABLE,
|
|
1762
|
+
CLASS_DROP_INSIDE,
|
|
1763
|
+
CLASS_DROP_AFTER,
|
|
1764
|
+
CLASS_DROP_DENIED
|
|
1765
|
+
];
|
|
1766
|
+
|
|
1767
|
+
if (this._activeDropItem && this._activeDropItem !== item) {
|
|
1768
|
+
this._activeDropItem.classList.remove(...stateClasses);
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1771
|
+
if (!item || !["before", "attachable", "child", "after"].includes(mode)) {
|
|
1772
|
+
if (this._activeDropItem) {
|
|
1773
|
+
this._activeDropItem.classList.remove(...stateClasses);
|
|
1774
|
+
}
|
|
1775
|
+
this._activeDropItem = null;
|
|
1776
|
+
return;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
item.classList.remove(...stateClasses);
|
|
1780
|
+
const modeClass = {
|
|
1781
|
+
before: CLASS_DROP_BEFORE,
|
|
1782
|
+
attachable: CLASS_DROP_ATTACHABLE,
|
|
1783
|
+
child: CLASS_DROP_INSIDE,
|
|
1784
|
+
after: CLASS_DROP_AFTER
|
|
1785
|
+
};
|
|
1786
|
+
item.classList.add(modeClass[mode]);
|
|
1787
|
+
if (denied) {
|
|
1788
|
+
item.classList.add(CLASS_DROP_DENIED);
|
|
1789
|
+
}
|
|
1790
|
+
this._activeDropItem = item;
|
|
1791
|
+
}
|
|
1792
|
+
|
|
1793
|
+
_clearDragState() {
|
|
1794
|
+
this._setDropListState(null);
|
|
1795
|
+
this._setDropItemState(null);
|
|
1796
1796
|
|
|
1797
1797
|
if (this._draggedItem) {
|
|
1798
1798
|
this._draggedItem.classList.remove(CLASS_ITEM_DRAGGING);
|
|
@@ -1825,9 +1825,9 @@ class VGNestable extends BaseModule {
|
|
|
1825
1825
|
this._currentTargetInstance = this;
|
|
1826
1826
|
this._lastDropInstance = this;
|
|
1827
1827
|
this._activePointerId = null;
|
|
1828
|
-
this._activeTouchId = null;
|
|
1829
|
-
this._dragBaseDepth = 1;
|
|
1830
|
-
}
|
|
1828
|
+
this._activeTouchId = null;
|
|
1829
|
+
this._dragBaseDepth = 1;
|
|
1830
|
+
}
|
|
1831
1831
|
|
|
1832
1832
|
_ensureLiveRegion() {
|
|
1833
1833
|
if (!this._element || this._liveRegion) {
|