MCPcopy
hub / github.com/SortableJS/Sortable / Sortable

Function Sortable

Sortable.js:1061–1156  ·  view source on GitHub ↗

* @class Sortable * @param {HTMLElement} el * @param {Object} [options]

(el, options)

Source from the content-addressed store, hash-verified

1059 * @param {Object} [options]
1060 */
1061 function Sortable(el, options) {
1062 if (!(el && el.nodeType && el.nodeType === 1)) {
1063 throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el));
1064 }
1065 this.el = el; // root element
1066 this.options = options = _extends({}, options);
1067
1068 // Export instance
1069 el[expando] = this;
1070 var defaults = {
1071 group: null,
1072 sort: true,
1073 disabled: false,
1074 store: null,
1075 handle: null,
1076 draggable: /^[uo]l$/i.test(el.nodeName) ? '>li' : '>*',
1077 swapThreshold: 1,
1078 // percentage; 0 <= x <= 1
1079 invertSwap: false,
1080 // invert always
1081 invertedSwapThreshold: null,
1082 // will be set to same as swapThreshold if default
1083 removeCloneOnHide: true,
1084 direction: function direction() {
1085 return _detectDirection(el, this.options);
1086 },
1087 ghostClass: 'sortable-ghost',
1088 chosenClass: 'sortable-chosen',
1089 dragClass: 'sortable-drag',
1090 ignore: 'a, img',
1091 filter: null,
1092 preventOnFilter: true,
1093 animation: 0,
1094 easing: null,
1095 setData: function setData(dataTransfer, dragEl) {
1096 dataTransfer.setData('Text', dragEl.textContent);
1097 },
1098 dropBubble: false,
1099 dragoverBubble: false,
1100 dataIdAttr: 'data-id',
1101 delay: 0,
1102 delayOnTouchOnly: false,
1103 touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1,
1104 forceFallback: false,
1105 fallbackClass: 'sortable-fallback',
1106 fallbackOnBody: false,
1107 fallbackTolerance: 0,
1108 fallbackOffset: {
1109 x: 0,
1110 y: 0
1111 },
1112 // Disabled on Safari: #1571; Enabled on Safari IOS: #2244
1113 supportPointer: Sortable.supportPointer !== false && 'PointerEvent' in window && (!Safari || IOS),
1114 emptyInsertThreshold: 5
1115 };
1116 PluginManager.initializePlugins(this, el, defaults);
1117
1118 // Set default options

Callers

nothing calls this directly

Calls 5

_extendsFunction · 0.70
_detectDirectionFunction · 0.70
_prepareGroupFunction · 0.70
onFunction · 0.70
AnimationStateManagerFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…