From 093ade096fc767e9d8c3ed11d8e8998e60cb9077 Mon Sep 17 00:00:00 2001 From: Arthur Monney Date: Fri, 29 Mar 2024 23:47:08 +0100 Subject: [PATCH] Categories - update categories features and setup filament forms & table --- packages/admin/config/components/account.php | 2 +- packages/admin/config/components/brand.php | 2 +- packages/admin/config/components/category.php | 12 +- packages/admin/config/components/setting.php | 2 +- packages/admin/package.json | 6 +- packages/admin/public/shopper.css | 10 + packages/admin/public/shopper.js | 2355 ++++++++++++++++- .../admin/resources/js/components/sortable.js | 137 + packages/admin/resources/js/index.js | 59 +- packages/admin/resources/lang/en/words.php | 2 + packages/admin/resources/lang/fr/words.php | 2 + .../components/breadcrumb/index.blade.php | 8 +- .../views/components/empty-state.blade.php | 2 +- .../components/form-slider-over.blade.php | 35 + .../views/components/forms/filepond.blade.php | 48 - .../forms/option-category.blade.php | 7 - .../views/components/forms/seo.blade.php | 56 - .../views/components/heading.blade.php | 2 +- .../components/theme-switcher/index.blade.php | 2 +- .../components/categories/_form.blade.php | 91 - .../components/categories/create.blade.php | 25 - .../components/categories/edit.blade.php | 25 - .../modals/re-order-categories.blade.php | 55 - .../livewire/pages/brand/create.blade.php | 14 - .../category/index.blade.php} | 15 +- .../livewire/slide-overs/brand-form.blade.php | 43 +- .../slide-overs/category-form.blade.php | 6 + .../slide-overs/create-team-member.blade.php | 61 +- .../slide-overs/re-order-categories.blade.php | 69 + .../tables/cells/brands/name.blade.php | 9 - .../tables/cells/categories/name.blade.php | 24 +- .../views/pages/categories/index.blade.php | 3 - packages/admin/routes/admin/category.php | 7 - packages/admin/routes/admin/setting.php | 2 +- packages/admin/routes/cpanel.php | 10 +- .../admin/src/Components/Form/SeoField.php | 23 + .../Ecommerce/CategoryController.php | 35 - .../Livewire/Components/Categories/Browse.php | 19 - .../Livewire/Components/Categories/Create.php | 50 - .../Livewire/Components/Categories/Edit.php | 72 - .../Components/Categories/UseForm.php | 63 - .../admin/src/Livewire/Pages/Brand/Index.php | 6 +- .../src/Livewire/Pages/Category/Index.php | 155 ++ .../src/Livewire/SlideOvers/BrandForm.php | 15 +- .../src/Livewire/SlideOvers/CategoryForm.php | 131 + .../ReOrderCategories.php | 30 +- .../admin/src/Observers/CategoryObserver.php | 30 + .../src/Providers/FeatureServiceProvider.php | 11 +- .../core/src/Contracts/RepositoryContract.php | 2 +- packages/core/src/Models/Category.php | 11 + .../core/src/Repositories/BaseRepository.php | 4 +- 51 files changed, 3059 insertions(+), 806 deletions(-) create mode 100644 packages/admin/resources/js/components/sortable.js create mode 100644 packages/admin/resources/views/components/form-slider-over.blade.php delete mode 100755 packages/admin/resources/views/components/forms/filepond.blade.php delete mode 100755 packages/admin/resources/views/components/forms/option-category.blade.php delete mode 100755 packages/admin/resources/views/components/forms/seo.blade.php delete mode 100755 packages/admin/resources/views/livewire/components/categories/_form.blade.php delete mode 100755 packages/admin/resources/views/livewire/components/categories/create.blade.php delete mode 100755 packages/admin/resources/views/livewire/components/categories/edit.blade.php delete mode 100755 packages/admin/resources/views/livewire/modals/re-order-categories.blade.php delete mode 100755 packages/admin/resources/views/livewire/pages/brand/create.blade.php rename packages/admin/resources/views/livewire/{components/categories/browse.blade.php => pages/category/index.blade.php} (97%) mode change 100755 => 100644 create mode 100644 packages/admin/resources/views/livewire/slide-overs/category-form.blade.php create mode 100755 packages/admin/resources/views/livewire/slide-overs/re-order-categories.blade.php delete mode 100755 packages/admin/resources/views/livewire/tables/cells/brands/name.blade.php delete mode 100755 packages/admin/resources/views/pages/categories/index.blade.php delete mode 100644 packages/admin/routes/admin/category.php create mode 100644 packages/admin/src/Components/Form/SeoField.php delete mode 100755 packages/admin/src/Http/Controllers/Ecommerce/CategoryController.php delete mode 100755 packages/admin/src/Livewire/Components/Categories/Browse.php delete mode 100755 packages/admin/src/Livewire/Components/Categories/Create.php delete mode 100755 packages/admin/src/Livewire/Components/Categories/Edit.php delete mode 100755 packages/admin/src/Livewire/Components/Categories/UseForm.php create mode 100755 packages/admin/src/Livewire/Pages/Category/Index.php create mode 100644 packages/admin/src/Livewire/SlideOvers/CategoryForm.php rename packages/admin/src/Livewire/{Modals => SlideOvers}/ReOrderCategories.php (59%) create mode 100644 packages/admin/src/Observers/CategoryObserver.php diff --git a/packages/admin/config/components/account.php b/packages/admin/config/components/account.php index 54ed1c9e8..e5c4db2f8 100644 --- a/packages/admin/config/components/account.php +++ b/packages/admin/config/components/account.php @@ -14,7 +14,7 @@ */ 'pages' => [ - 'index' => Pages\Account::class, + 'account-index' => Pages\Account::class, ], /* diff --git a/packages/admin/config/components/brand.php b/packages/admin/config/components/brand.php index 5ee96276a..c3513606c 100644 --- a/packages/admin/config/components/brand.php +++ b/packages/admin/config/components/brand.php @@ -13,7 +13,7 @@ */ 'pages' => [ - 'index' => Livewire\Pages\Brand\Index::class, + 'brand-index' => Livewire\Pages\Brand\Index::class, ], /* diff --git a/packages/admin/config/components/category.php b/packages/admin/config/components/category.php index 11672f3dc..3e8483d26 100644 --- a/packages/admin/config/components/category.php +++ b/packages/admin/config/components/category.php @@ -3,7 +3,6 @@ declare(strict_types=1); use Shopper\Livewire; -use Shopper\Livewire\Components; return [ @@ -13,7 +12,9 @@ |-------------------------------------------------------------------------- */ - 'pages' => [], + 'pages' => [ + 'category-index' => Livewire\Pages\Category\Index::class, + ], /* |-------------------------------------------------------------------------- @@ -22,11 +23,8 @@ */ 'components' => [ - 'categories.browse' => Components\Categories\Browse::class, - 'categories.create' => Components\Categories\Create::class, - 'categories.edit' => Components\Categories\Edit::class, - - 'modals.re-order-categories' => Livewire\Modals\ReOrderCategories::class, + 'slide-overs.category-form' => Livewire\SlideOvers\CategoryForm::class, + 'slide-overs.re-order-categories' => Livewire\SlideOvers\ReOrderCategories::class, ], ]; diff --git a/packages/admin/config/components/setting.php b/packages/admin/config/components/setting.php index cf951dfc9..c5ae44193 100644 --- a/packages/admin/config/components/setting.php +++ b/packages/admin/config/components/setting.php @@ -15,7 +15,7 @@ */ 'pages' => [ - 'index' => Pages\Settings\Index::class, + 'setting-index' => Pages\Settings\Index::class, 'general' => Pages\Settings\General::class, 'inventory-index' => Pages\Settings\Inventories\Browse::class, 'inventory-create' => Pages\Settings\Inventories\Create::class, diff --git a/packages/admin/package.json b/packages/admin/package.json index a6f81e3cb..567822c90 100755 --- a/packages/admin/package.json +++ b/packages/admin/package.json @@ -20,8 +20,6 @@ "autoprefixer": "^10.4.2", "choices.js": "^9.0.1", "esbuild": "^0.20.2", - "filepond": "^4.30.3", - "flatpickr": "^4.6.13", "intl-tel-input": "^17.0.19", "lodash": "^4.17.13", "npm-run-all": "^4.1.5", @@ -33,8 +31,6 @@ "prettier-plugin-tailwindcss": "^0.5.10", "resolve-url-loader": "^2.3.1", "sortablejs": "^1.15.0", - "tailwindcss": "^3.4.1", - "tom-select": "^2.3.1", - "trix": "^2.0.5" + "tailwindcss": "^3.4.1" } } diff --git a/packages/admin/public/shopper.css b/packages/admin/public/shopper.css index 9b92fbd06..e69764c16 100755 --- a/packages/admin/public/shopper.css +++ b/packages/admin/public/shopper.css @@ -4045,6 +4045,10 @@ html { margin-top: auto; } +.ml-6 { + margin-left: 1.5rem; +} + .line-clamp-\[--line-clamp\] { overflow: hidden; display: -webkit-box; @@ -5155,6 +5159,12 @@ html { margin-bottom: calc(2rem * var(--tw-space-y-reverse)); } +.space-y-1\.5 > :not([hidden]) ~ :not([hidden]) { + --tw-space-y-reverse: 0; + margin-top: calc(0.375rem * calc(1 - var(--tw-space-y-reverse))); + margin-bottom: calc(0.375rem * var(--tw-space-y-reverse)); +} + .divide-x > :not([hidden]) ~ :not([hidden]) { --tw-divide-x-reverse: 0; border-right-width: calc(1px * var(--tw-divide-x-reverse)); diff --git a/packages/admin/public/shopper.js b/packages/admin/public/shopper.js index 12812203d..b8cce50b1 100755 --- a/packages/admin/public/shopper.js +++ b/packages/admin/public/shopper.js @@ -144,10 +144,2351 @@ }; var panel_default = SlideOverPanel; + // node_modules/sortablejs/modular/sortable.esm.js + function ownKeys(object, enumerableOnly) { + var keys = Object.keys(object); + if (Object.getOwnPropertySymbols) { + var symbols = Object.getOwnPropertySymbols(object); + if (enumerableOnly) { + symbols = symbols.filter(function(sym) { + return Object.getOwnPropertyDescriptor(object, sym).enumerable; + }); + } + keys.push.apply(keys, symbols); + } + return keys; + } + function _objectSpread2(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) { + ownKeys(Object(source), true).forEach(function(key) { + _defineProperty(target, key, source[key]); + }); + } else if (Object.getOwnPropertyDescriptors) { + Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); + } else { + ownKeys(Object(source)).forEach(function(key) { + Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); + }); + } + } + return target; + } + function _typeof(obj) { + "@babel/helpers - typeof"; + if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { + _typeof = function(obj2) { + return typeof obj2; + }; + } else { + _typeof = function(obj2) { + return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; + }; + } + return _typeof(obj); + } + function _defineProperty(obj, key, value) { + if (key in obj) { + Object.defineProperty(obj, key, { + value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function _extends() { + _extends = Object.assign || function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + return target; + }; + return _extends.apply(this, arguments); + } + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) + return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) + continue; + target[key] = source[key]; + } + return target; + } + function _objectWithoutProperties(source, excluded) { + if (source == null) + return {}; + var target = _objectWithoutPropertiesLoose(source, excluded); + var key, i; + if (Object.getOwnPropertySymbols) { + var sourceSymbolKeys = Object.getOwnPropertySymbols(source); + for (i = 0; i < sourceSymbolKeys.length; i++) { + key = sourceSymbolKeys[i]; + if (excluded.indexOf(key) >= 0) + continue; + if (!Object.prototype.propertyIsEnumerable.call(source, key)) + continue; + target[key] = source[key]; + } + } + return target; + } + var version = "1.15.2"; + function userAgent(pattern) { + if (typeof window !== "undefined" && window.navigator) { + return !!/* @__PURE__ */ navigator.userAgent.match(pattern); + } + } + var IE11OrLess = userAgent(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i); + var Edge = userAgent(/Edge/i); + var FireFox = userAgent(/firefox/i); + var Safari = userAgent(/safari/i) && !userAgent(/chrome/i) && !userAgent(/android/i); + var IOS = userAgent(/iP(ad|od|hone)/i); + var ChromeForAndroid = userAgent(/chrome/i) && userAgent(/android/i); + var captureMode = { + capture: false, + passive: false + }; + function on(el, event, fn) { + el.addEventListener(event, fn, !IE11OrLess && captureMode); + } + function off(el, event, fn) { + el.removeEventListener(event, fn, !IE11OrLess && captureMode); + } + function matches(el, selector) { + if (!selector) + return; + selector[0] === ">" && (selector = selector.substring(1)); + if (el) { + try { + if (el.matches) { + return el.matches(selector); + } else if (el.msMatchesSelector) { + return el.msMatchesSelector(selector); + } else if (el.webkitMatchesSelector) { + return el.webkitMatchesSelector(selector); + } + } catch (_) { + return false; + } + } + return false; + } + function getParentOrHost(el) { + return el.host && el !== document && el.host.nodeType ? el.host : el.parentNode; + } + function closest(el, selector, ctx, includeCTX) { + if (el) { + ctx = ctx || document; + do { + if (selector != null && (selector[0] === ">" ? el.parentNode === ctx && matches(el, selector) : matches(el, selector)) || includeCTX && el === ctx) { + return el; + } + if (el === ctx) + break; + } while (el = getParentOrHost(el)); + } + return null; + } + var R_SPACE = /\s+/g; + function toggleClass(el, name, state) { + if (el && name) { + if (el.classList) { + el.classList[state ? "add" : "remove"](name); + } else { + var className = (" " + el.className + " ").replace(R_SPACE, " ").replace(" " + name + " ", " "); + el.className = (className + (state ? " " + name : "")).replace(R_SPACE, " "); + } + } + } + function css(el, prop, val) { + var style = el && el.style; + if (style) { + if (val === void 0) { + if (document.defaultView && document.defaultView.getComputedStyle) { + val = document.defaultView.getComputedStyle(el, ""); + } else if (el.currentStyle) { + val = el.currentStyle; + } + return prop === void 0 ? val : val[prop]; + } else { + if (!(prop in style) && prop.indexOf("webkit") === -1) { + prop = "-webkit-" + prop; + } + style[prop] = val + (typeof val === "string" ? "" : "px"); + } + } + } + function matrix(el, selfOnly) { + var appliedTransforms = ""; + if (typeof el === "string") { + appliedTransforms = el; + } else { + do { + var transform = css(el, "transform"); + if (transform && transform !== "none") { + appliedTransforms = transform + " " + appliedTransforms; + } + } while (!selfOnly && (el = el.parentNode)); + } + var matrixFn = window.DOMMatrix || window.WebKitCSSMatrix || window.CSSMatrix || window.MSCSSMatrix; + return matrixFn && new matrixFn(appliedTransforms); + } + function find(ctx, tagName, iterator) { + if (ctx) { + var list = ctx.getElementsByTagName(tagName), i = 0, n = list.length; + if (iterator) { + for (; i < n; i++) { + iterator(list[i], i); + } + } + return list; + } + return []; + } + function getWindowScrollingElement() { + var scrollingElement = document.scrollingElement; + if (scrollingElement) { + return scrollingElement; + } else { + return document.documentElement; + } + } + function getRect(el, relativeToContainingBlock, relativeToNonStaticParent, undoScale, container) { + if (!el.getBoundingClientRect && el !== window) + return; + var elRect, top, left, bottom, right, height, width; + if (el !== window && el.parentNode && el !== getWindowScrollingElement()) { + elRect = el.getBoundingClientRect(); + top = elRect.top; + left = elRect.left; + bottom = elRect.bottom; + right = elRect.right; + height = elRect.height; + width = elRect.width; + } else { + top = 0; + left = 0; + bottom = window.innerHeight; + right = window.innerWidth; + height = window.innerHeight; + width = window.innerWidth; + } + if ((relativeToContainingBlock || relativeToNonStaticParent) && el !== window) { + container = container || el.parentNode; + if (!IE11OrLess) { + do { + if (container && container.getBoundingClientRect && (css(container, "transform") !== "none" || relativeToNonStaticParent && css(container, "position") !== "static")) { + var containerRect = container.getBoundingClientRect(); + top -= containerRect.top + parseInt(css(container, "border-top-width")); + left -= containerRect.left + parseInt(css(container, "border-left-width")); + bottom = top + elRect.height; + right = left + elRect.width; + break; + } + } while (container = container.parentNode); + } + } + if (undoScale && el !== window) { + var elMatrix = matrix(container || el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d; + if (elMatrix) { + top /= scaleY; + left /= scaleX; + width /= scaleX; + height /= scaleY; + bottom = top + height; + right = left + width; + } + } + return { + top, + left, + bottom, + right, + width, + height + }; + } + function isScrolledPast(el, elSide, parentSide) { + var parent = getParentAutoScrollElement(el, true), elSideVal = getRect(el)[elSide]; + while (parent) { + var parentSideVal = getRect(parent)[parentSide], visible = void 0; + if (parentSide === "top" || parentSide === "left") { + visible = elSideVal >= parentSideVal; + } else { + visible = elSideVal <= parentSideVal; + } + if (!visible) + return parent; + if (parent === getWindowScrollingElement()) + break; + parent = getParentAutoScrollElement(parent, false); + } + return false; + } + function getChild(el, childNum, options, includeDragEl) { + var currentChild = 0, i = 0, children = el.children; + while (i < children.length) { + if (children[i].style.display !== "none" && children[i] !== Sortable.ghost && (includeDragEl || children[i] !== Sortable.dragged) && closest(children[i], options.draggable, el, false)) { + if (currentChild === childNum) { + return children[i]; + } + currentChild++; + } + i++; + } + return null; + } + function lastChild(el, selector) { + var last = el.lastElementChild; + while (last && (last === Sortable.ghost || css(last, "display") === "none" || selector && !matches(last, selector))) { + last = last.previousElementSibling; + } + return last || null; + } + function index(el, selector) { + var index2 = 0; + if (!el || !el.parentNode) { + return -1; + } + while (el = el.previousElementSibling) { + if (el.nodeName.toUpperCase() !== "TEMPLATE" && el !== Sortable.clone && (!selector || matches(el, selector))) { + index2++; + } + } + return index2; + } + function getRelativeScrollOffset(el) { + var offsetLeft = 0, offsetTop = 0, winScroller = getWindowScrollingElement(); + if (el) { + do { + var elMatrix = matrix(el), scaleX = elMatrix.a, scaleY = elMatrix.d; + offsetLeft += el.scrollLeft * scaleX; + offsetTop += el.scrollTop * scaleY; + } while (el !== winScroller && (el = el.parentNode)); + } + return [offsetLeft, offsetTop]; + } + function indexOfObject(arr, obj) { + for (var i in arr) { + if (!arr.hasOwnProperty(i)) + continue; + for (var key in obj) { + if (obj.hasOwnProperty(key) && obj[key] === arr[i][key]) + return Number(i); + } + } + return -1; + } + function getParentAutoScrollElement(el, includeSelf) { + if (!el || !el.getBoundingClientRect) + return getWindowScrollingElement(); + var elem = el; + var gotSelf = false; + do { + if (elem.clientWidth < elem.scrollWidth || elem.clientHeight < elem.scrollHeight) { + var elemCSS = css(elem); + if (elem.clientWidth < elem.scrollWidth && (elemCSS.overflowX == "auto" || elemCSS.overflowX == "scroll") || elem.clientHeight < elem.scrollHeight && (elemCSS.overflowY == "auto" || elemCSS.overflowY == "scroll")) { + if (!elem.getBoundingClientRect || elem === document.body) + return getWindowScrollingElement(); + if (gotSelf || includeSelf) + return elem; + gotSelf = true; + } + } + } while (elem = elem.parentNode); + return getWindowScrollingElement(); + } + function extend(dst, src) { + if (dst && src) { + for (var key in src) { + if (src.hasOwnProperty(key)) { + dst[key] = src[key]; + } + } + } + return dst; + } + function isRectEqual(rect1, rect2) { + return Math.round(rect1.top) === Math.round(rect2.top) && Math.round(rect1.left) === Math.round(rect2.left) && Math.round(rect1.height) === Math.round(rect2.height) && Math.round(rect1.width) === Math.round(rect2.width); + } + var _throttleTimeout; + function throttle(callback, ms) { + return function() { + if (!_throttleTimeout) { + var args = arguments, _this = this; + if (args.length === 1) { + callback.call(_this, args[0]); + } else { + callback.apply(_this, args); + } + _throttleTimeout = setTimeout(function() { + _throttleTimeout = void 0; + }, ms); + } + }; + } + function cancelThrottle() { + clearTimeout(_throttleTimeout); + _throttleTimeout = void 0; + } + function scrollBy(el, x, y) { + el.scrollLeft += x; + el.scrollTop += y; + } + function clone(el) { + var Polymer = window.Polymer; + var $ = window.jQuery || window.Zepto; + if (Polymer && Polymer.dom) { + return Polymer.dom(el).cloneNode(true); + } else if ($) { + return $(el).clone(true)[0]; + } else { + return el.cloneNode(true); + } + } + function getChildContainingRectFromElement(container, options, ghostEl2) { + var rect = {}; + Array.from(container.children).forEach(function(child) { + var _rect$left, _rect$top, _rect$right, _rect$bottom; + if (!closest(child, options.draggable, container, false) || child.animated || child === ghostEl2) + return; + var childRect = getRect(child); + rect.left = Math.min((_rect$left = rect.left) !== null && _rect$left !== void 0 ? _rect$left : Infinity, childRect.left); + rect.top = Math.min((_rect$top = rect.top) !== null && _rect$top !== void 0 ? _rect$top : Infinity, childRect.top); + rect.right = Math.max((_rect$right = rect.right) !== null && _rect$right !== void 0 ? _rect$right : -Infinity, childRect.right); + rect.bottom = Math.max((_rect$bottom = rect.bottom) !== null && _rect$bottom !== void 0 ? _rect$bottom : -Infinity, childRect.bottom); + }); + rect.width = rect.right - rect.left; + rect.height = rect.bottom - rect.top; + rect.x = rect.left; + rect.y = rect.top; + return rect; + } + var expando = "Sortable" + (/* @__PURE__ */ new Date()).getTime(); + function AnimationStateManager() { + var animationStates = [], animationCallbackId; + return { + captureAnimationState: function captureAnimationState() { + animationStates = []; + if (!this.options.animation) + return; + var children = [].slice.call(this.el.children); + children.forEach(function(child) { + if (css(child, "display") === "none" || child === Sortable.ghost) + return; + animationStates.push({ + target: child, + rect: getRect(child) + }); + var fromRect = _objectSpread2({}, animationStates[animationStates.length - 1].rect); + if (child.thisAnimationDuration) { + var childMatrix = matrix(child, true); + if (childMatrix) { + fromRect.top -= childMatrix.f; + fromRect.left -= childMatrix.e; + } + } + child.fromRect = fromRect; + }); + }, + addAnimationState: function addAnimationState(state) { + animationStates.push(state); + }, + removeAnimationState: function removeAnimationState(target) { + animationStates.splice(indexOfObject(animationStates, { + target + }), 1); + }, + animateAll: function animateAll(callback) { + var _this = this; + if (!this.options.animation) { + clearTimeout(animationCallbackId); + if (typeof callback === "function") + callback(); + return; + } + var animating = false, animationTime = 0; + animationStates.forEach(function(state) { + var time = 0, target = state.target, fromRect = target.fromRect, toRect = getRect(target), prevFromRect = target.prevFromRect, prevToRect = target.prevToRect, animatingRect = state.rect, targetMatrix = matrix(target, true); + if (targetMatrix) { + toRect.top -= targetMatrix.f; + toRect.left -= targetMatrix.e; + } + target.toRect = toRect; + if (target.thisAnimationDuration) { + if (isRectEqual(prevFromRect, toRect) && !isRectEqual(fromRect, toRect) && // Make sure animatingRect is on line between toRect & fromRect + (animatingRect.top - toRect.top) / (animatingRect.left - toRect.left) === (fromRect.top - toRect.top) / (fromRect.left - toRect.left)) { + time = calculateRealTime(animatingRect, prevFromRect, prevToRect, _this.options); + } + } + if (!isRectEqual(toRect, fromRect)) { + target.prevFromRect = fromRect; + target.prevToRect = toRect; + if (!time) { + time = _this.options.animation; + } + _this.animate(target, animatingRect, toRect, time); + } + if (time) { + animating = true; + animationTime = Math.max(animationTime, time); + clearTimeout(target.animationResetTimer); + target.animationResetTimer = setTimeout(function() { + target.animationTime = 0; + target.prevFromRect = null; + target.fromRect = null; + target.prevToRect = null; + target.thisAnimationDuration = null; + }, time); + target.thisAnimationDuration = time; + } + }); + clearTimeout(animationCallbackId); + if (!animating) { + if (typeof callback === "function") + callback(); + } else { + animationCallbackId = setTimeout(function() { + if (typeof callback === "function") + callback(); + }, animationTime); + } + animationStates = []; + }, + animate: function animate(target, currentRect, toRect, duration) { + if (duration) { + css(target, "transition", ""); + css(target, "transform", ""); + var elMatrix = matrix(this.el), scaleX = elMatrix && elMatrix.a, scaleY = elMatrix && elMatrix.d, translateX = (currentRect.left - toRect.left) / (scaleX || 1), translateY = (currentRect.top - toRect.top) / (scaleY || 1); + target.animatingX = !!translateX; + target.animatingY = !!translateY; + css(target, "transform", "translate3d(" + translateX + "px," + translateY + "px,0)"); + this.forRepaintDummy = repaint(target); + css(target, "transition", "transform " + duration + "ms" + (this.options.easing ? " " + this.options.easing : "")); + css(target, "transform", "translate3d(0,0,0)"); + typeof target.animated === "number" && clearTimeout(target.animated); + target.animated = setTimeout(function() { + css(target, "transition", ""); + css(target, "transform", ""); + target.animated = false; + target.animatingX = false; + target.animatingY = false; + }, duration); + } + } + }; + } + function repaint(target) { + return target.offsetWidth; + } + function calculateRealTime(animatingRect, fromRect, toRect, options) { + return Math.sqrt(Math.pow(fromRect.top - animatingRect.top, 2) + Math.pow(fromRect.left - animatingRect.left, 2)) / Math.sqrt(Math.pow(fromRect.top - toRect.top, 2) + Math.pow(fromRect.left - toRect.left, 2)) * options.animation; + } + var plugins = []; + var defaults = { + initializeByDefault: true + }; + var PluginManager = { + mount: function mount(plugin) { + for (var option2 in defaults) { + if (defaults.hasOwnProperty(option2) && !(option2 in plugin)) { + plugin[option2] = defaults[option2]; + } + } + plugins.forEach(function(p) { + if (p.pluginName === plugin.pluginName) { + throw "Sortable: Cannot mount plugin ".concat(plugin.pluginName, " more than once"); + } + }); + plugins.push(plugin); + }, + pluginEvent: function pluginEvent(eventName, sortable, evt) { + var _this = this; + this.eventCanceled = false; + evt.cancel = function() { + _this.eventCanceled = true; + }; + var eventNameGlobal = eventName + "Global"; + plugins.forEach(function(plugin) { + if (!sortable[plugin.pluginName]) + return; + if (sortable[plugin.pluginName][eventNameGlobal]) { + sortable[plugin.pluginName][eventNameGlobal](_objectSpread2({ + sortable + }, evt)); + } + if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) { + sortable[plugin.pluginName][eventName](_objectSpread2({ + sortable + }, evt)); + } + }); + }, + initializePlugins: function initializePlugins(sortable, el, defaults2, options) { + plugins.forEach(function(plugin) { + var pluginName = plugin.pluginName; + if (!sortable.options[pluginName] && !plugin.initializeByDefault) + return; + var initialized = new plugin(sortable, el, sortable.options); + initialized.sortable = sortable; + initialized.options = sortable.options; + sortable[pluginName] = initialized; + _extends(defaults2, initialized.defaults); + }); + for (var option2 in sortable.options) { + if (!sortable.options.hasOwnProperty(option2)) + continue; + var modified = this.modifyOption(sortable, option2, sortable.options[option2]); + if (typeof modified !== "undefined") { + sortable.options[option2] = modified; + } + } + }, + getEventProperties: function getEventProperties(name, sortable) { + var eventProperties = {}; + plugins.forEach(function(plugin) { + if (typeof plugin.eventProperties !== "function") + return; + _extends(eventProperties, plugin.eventProperties.call(sortable[plugin.pluginName], name)); + }); + return eventProperties; + }, + modifyOption: function modifyOption(sortable, name, value) { + var modifiedValue; + plugins.forEach(function(plugin) { + if (!sortable[plugin.pluginName]) + return; + if (plugin.optionListeners && typeof plugin.optionListeners[name] === "function") { + modifiedValue = plugin.optionListeners[name].call(sortable[plugin.pluginName], value); + } + }); + return modifiedValue; + } + }; + function dispatchEvent(_ref) { + var sortable = _ref.sortable, rootEl2 = _ref.rootEl, name = _ref.name, targetEl = _ref.targetEl, cloneEl2 = _ref.cloneEl, toEl = _ref.toEl, fromEl = _ref.fromEl, oldIndex2 = _ref.oldIndex, newIndex2 = _ref.newIndex, oldDraggableIndex2 = _ref.oldDraggableIndex, newDraggableIndex2 = _ref.newDraggableIndex, originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, extraEventProperties = _ref.extraEventProperties; + sortable = sortable || rootEl2 && rootEl2[expando]; + if (!sortable) + return; + var evt, options = sortable.options, onName = "on" + name.charAt(0).toUpperCase() + name.substr(1); + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent(name, { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent("Event"); + evt.initEvent(name, true, true); + } + evt.to = toEl || rootEl2; + evt.from = fromEl || rootEl2; + evt.item = targetEl || rootEl2; + evt.clone = cloneEl2; + evt.oldIndex = oldIndex2; + evt.newIndex = newIndex2; + evt.oldDraggableIndex = oldDraggableIndex2; + evt.newDraggableIndex = newDraggableIndex2; + evt.originalEvent = originalEvent; + evt.pullMode = putSortable2 ? putSortable2.lastPutMode : void 0; + var allEventProperties = _objectSpread2(_objectSpread2({}, extraEventProperties), PluginManager.getEventProperties(name, sortable)); + for (var option2 in allEventProperties) { + evt[option2] = allEventProperties[option2]; + } + if (rootEl2) { + rootEl2.dispatchEvent(evt); + } + if (options[onName]) { + options[onName].call(sortable, evt); + } + } + var _excluded = ["evt"]; + var pluginEvent2 = function pluginEvent3(eventName, sortable) { + var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, originalEvent = _ref.evt, data = _objectWithoutProperties(_ref, _excluded); + PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2({ + dragEl, + parentEl, + ghostEl, + rootEl, + nextEl, + lastDownEl, + cloneEl, + cloneHidden, + dragStarted: moved, + putSortable, + activeSortable: Sortable.active, + originalEvent, + oldIndex, + oldDraggableIndex, + newIndex, + newDraggableIndex, + hideGhostForTarget: _hideGhostForTarget, + unhideGhostForTarget: _unhideGhostForTarget, + cloneNowHidden: function cloneNowHidden() { + cloneHidden = true; + }, + cloneNowShown: function cloneNowShown() { + cloneHidden = false; + }, + dispatchSortableEvent: function dispatchSortableEvent(name) { + _dispatchEvent({ + sortable, + name, + originalEvent + }); + } + }, data)); + }; + function _dispatchEvent(info) { + dispatchEvent(_objectSpread2({ + putSortable, + cloneEl, + targetEl: dragEl, + rootEl, + oldIndex, + oldDraggableIndex, + newIndex, + newDraggableIndex + }, info)); + } + var dragEl; + var parentEl; + var ghostEl; + var rootEl; + var nextEl; + var lastDownEl; + var cloneEl; + var cloneHidden; + var oldIndex; + var newIndex; + var oldDraggableIndex; + var newDraggableIndex; + var activeGroup; + var putSortable; + var awaitingDragStarted = false; + var ignoreNextClick = false; + var sortables = []; + var tapEvt; + var touchEvt; + var lastDx; + var lastDy; + var tapDistanceLeft; + var tapDistanceTop; + var moved; + var lastTarget; + var lastDirection; + var pastFirstInvertThresh = false; + var isCircumstantialInvert = false; + var targetMoveDistance; + var ghostRelativeParent; + var ghostRelativeParentInitialScroll = []; + var _silent = false; + var savedInputChecked = []; + var documentExists = typeof document !== "undefined"; + var PositionGhostAbsolutely = IOS; + var CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float"; + var supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div"); + var supportCssPointerEvents = function() { + if (!documentExists) + return; + if (IE11OrLess) { + return false; + } + var el = document.createElement("x"); + el.style.cssText = "pointer-events:auto"; + return el.style.pointerEvents === "auto"; + }(); + var _detectDirection = function _detectDirection2(el, options) { + var elCSS = css(el), elWidth = parseInt(elCSS.width) - parseInt(elCSS.paddingLeft) - parseInt(elCSS.paddingRight) - parseInt(elCSS.borderLeftWidth) - parseInt(elCSS.borderRightWidth), child1 = getChild(el, 0, options), child2 = getChild(el, 1, options), firstChildCSS = child1 && css(child1), secondChildCSS = child2 && css(child2), firstChildWidth = firstChildCSS && parseInt(firstChildCSS.marginLeft) + parseInt(firstChildCSS.marginRight) + getRect(child1).width, secondChildWidth = secondChildCSS && parseInt(secondChildCSS.marginLeft) + parseInt(secondChildCSS.marginRight) + getRect(child2).width; + if (elCSS.display === "flex") { + return elCSS.flexDirection === "column" || elCSS.flexDirection === "column-reverse" ? "vertical" : "horizontal"; + } + if (elCSS.display === "grid") { + return elCSS.gridTemplateColumns.split(" ").length <= 1 ? "vertical" : "horizontal"; + } + if (child1 && firstChildCSS["float"] && firstChildCSS["float"] !== "none") { + var touchingSideChild2 = firstChildCSS["float"] === "left" ? "left" : "right"; + return child2 && (secondChildCSS.clear === "both" || secondChildCSS.clear === touchingSideChild2) ? "vertical" : "horizontal"; + } + return child1 && (firstChildCSS.display === "block" || firstChildCSS.display === "flex" || firstChildCSS.display === "table" || firstChildCSS.display === "grid" || firstChildWidth >= elWidth && elCSS[CSSFloatProperty] === "none" || child2 && elCSS[CSSFloatProperty] === "none" && firstChildWidth + secondChildWidth > elWidth) ? "vertical" : "horizontal"; + }; + var _dragElInRowColumn = function _dragElInRowColumn2(dragRect, targetRect, vertical) { + var dragElS1Opp = vertical ? dragRect.left : dragRect.top, dragElS2Opp = vertical ? dragRect.right : dragRect.bottom, dragElOppLength = vertical ? dragRect.width : dragRect.height, targetS1Opp = vertical ? targetRect.left : targetRect.top, targetS2Opp = vertical ? targetRect.right : targetRect.bottom, targetOppLength = vertical ? targetRect.width : targetRect.height; + return dragElS1Opp === targetS1Opp || dragElS2Opp === targetS2Opp || dragElS1Opp + dragElOppLength / 2 === targetS1Opp + targetOppLength / 2; + }; + var _detectNearestEmptySortable = function _detectNearestEmptySortable2(x, y) { + var ret; + sortables.some(function(sortable) { + var threshold = sortable[expando].options.emptyInsertThreshold; + if (!threshold || lastChild(sortable)) + return; + var rect = getRect(sortable), insideHorizontally = x >= rect.left - threshold && x <= rect.right + threshold, insideVertically = y >= rect.top - threshold && y <= rect.bottom + threshold; + if (insideHorizontally && insideVertically) { + return ret = sortable; + } + }); + return ret; + }; + var _prepareGroup = function _prepareGroup2(options) { + function toFn(value, pull) { + return function(to, from, dragEl2, evt) { + var sameGroup = to.options.group.name && from.options.group.name && to.options.group.name === from.options.group.name; + if (value == null && (pull || sameGroup)) { + return true; + } else if (value == null || value === false) { + return false; + } else if (pull && value === "clone") { + return value; + } else if (typeof value === "function") { + return toFn(value(to, from, dragEl2, evt), pull)(to, from, dragEl2, evt); + } else { + var otherGroup = (pull ? to : from).options.group.name; + return value === true || typeof value === "string" && value === otherGroup || value.join && value.indexOf(otherGroup) > -1; + } + }; + } + var group = {}; + var originalGroup = options.group; + if (!originalGroup || _typeof(originalGroup) != "object") { + originalGroup = { + name: originalGroup + }; + } + group.name = originalGroup.name; + group.checkPull = toFn(originalGroup.pull, true); + group.checkPut = toFn(originalGroup.put); + group.revertClone = originalGroup.revertClone; + options.group = group; + }; + var _hideGhostForTarget = function _hideGhostForTarget2() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, "display", "none"); + } + }; + var _unhideGhostForTarget = function _unhideGhostForTarget2() { + if (!supportCssPointerEvents && ghostEl) { + css(ghostEl, "display", ""); + } + }; + if (documentExists && !ChromeForAndroid) { + document.addEventListener("click", function(evt) { + if (ignoreNextClick) { + evt.preventDefault(); + evt.stopPropagation && evt.stopPropagation(); + evt.stopImmediatePropagation && evt.stopImmediatePropagation(); + ignoreNextClick = false; + return false; + } + }, true); + } + var nearestEmptyInsertDetectEvent = function nearestEmptyInsertDetectEvent2(evt) { + if (dragEl) { + evt = evt.touches ? evt.touches[0] : evt; + var nearest = _detectNearestEmptySortable(evt.clientX, evt.clientY); + if (nearest) { + var event = {}; + for (var i in evt) { + if (evt.hasOwnProperty(i)) { + event[i] = evt[i]; + } + } + event.target = event.rootEl = nearest; + event.preventDefault = void 0; + event.stopPropagation = void 0; + nearest[expando]._onDragOver(event); + } + } + }; + var _checkOutsideTargetEl = function _checkOutsideTargetEl2(evt) { + if (dragEl) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); + } + }; + function Sortable(el, options) { + if (!(el && el.nodeType && el.nodeType === 1)) { + throw "Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(el)); + } + this.el = el; + this.options = options = _extends({}, options); + el[expando] = this; + var defaults2 = { + group: null, + sort: true, + disabled: false, + store: null, + handle: null, + draggable: /^[uo]l$/i.test(el.nodeName) ? ">li" : ">*", + swapThreshold: 1, + // percentage; 0 <= x <= 1 + invertSwap: false, + // invert always + invertedSwapThreshold: null, + // will be set to same as swapThreshold if default + removeCloneOnHide: true, + direction: function direction() { + return _detectDirection(el, this.options); + }, + ghostClass: "sortable-ghost", + chosenClass: "sortable-chosen", + dragClass: "sortable-drag", + ignore: "a, img", + filter: null, + preventOnFilter: true, + animation: 0, + easing: null, + setData: function setData(dataTransfer, dragEl2) { + dataTransfer.setData("Text", dragEl2.textContent); + }, + dropBubble: false, + dragoverBubble: false, + dataIdAttr: "data-id", + delay: 0, + delayOnTouchOnly: false, + touchStartThreshold: (Number.parseInt ? Number : window).parseInt(window.devicePixelRatio, 10) || 1, + forceFallback: false, + fallbackClass: "sortable-fallback", + fallbackOnBody: false, + fallbackTolerance: 0, + fallbackOffset: { + x: 0, + y: 0 + }, + supportPointer: Sortable.supportPointer !== false && "PointerEvent" in window && !Safari, + emptyInsertThreshold: 5 + }; + PluginManager.initializePlugins(this, el, defaults2); + for (var name in defaults2) { + !(name in options) && (options[name] = defaults2[name]); + } + _prepareGroup(options); + for (var fn in this) { + if (fn.charAt(0) === "_" && typeof this[fn] === "function") { + this[fn] = this[fn].bind(this); + } + } + this.nativeDraggable = options.forceFallback ? false : supportDraggable; + if (this.nativeDraggable) { + this.options.touchStartThreshold = 1; + } + if (options.supportPointer) { + on(el, "pointerdown", this._onTapStart); + } else { + on(el, "mousedown", this._onTapStart); + on(el, "touchstart", this._onTapStart); + } + if (this.nativeDraggable) { + on(el, "dragover", this); + on(el, "dragenter", this); + } + sortables.push(this.el); + options.store && options.store.get && this.sort(options.store.get(this) || []); + _extends(this, AnimationStateManager()); + } + Sortable.prototype = /** @lends Sortable.prototype */ + { + constructor: Sortable, + _isOutsideThisEl: function _isOutsideThisEl(target) { + if (!this.el.contains(target) && target !== this.el) { + lastTarget = null; + } + }, + _getDirection: function _getDirection(evt, target) { + return typeof this.options.direction === "function" ? this.options.direction.call(this, evt, target, dragEl) : this.options.direction; + }, + _onTapStart: function _onTapStart(evt) { + if (!evt.cancelable) + return; + var _this = this, el = this.el, options = this.options, preventOnFilter = options.preventOnFilter, type = evt.type, touch = evt.touches && evt.touches[0] || evt.pointerType && evt.pointerType === "touch" && evt, target = (touch || evt).target, originalTarget = evt.target.shadowRoot && (evt.path && evt.path[0] || evt.composedPath && evt.composedPath()[0]) || target, filter = options.filter; + _saveInputCheckedState(el); + if (dragEl) { + return; + } + if (/mousedown|pointerdown/.test(type) && evt.button !== 0 || options.disabled) { + return; + } + if (originalTarget.isContentEditable) { + return; + } + if (!this.nativeDraggable && Safari && target && target.tagName.toUpperCase() === "SELECT") { + return; + } + target = closest(target, options.draggable, el, false); + if (target && target.animated) { + return; + } + if (lastDownEl === target) { + return; + } + oldIndex = index(target); + oldDraggableIndex = index(target, options.draggable); + if (typeof filter === "function") { + if (filter.call(this, evt, target, this)) { + _dispatchEvent({ + sortable: _this, + rootEl: originalTarget, + name: "filter", + targetEl: target, + toEl: el, + fromEl: el + }); + pluginEvent2("filter", _this, { + evt + }); + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; + } + } else if (filter) { + filter = filter.split(",").some(function(criteria) { + criteria = closest(originalTarget, criteria.trim(), el, false); + if (criteria) { + _dispatchEvent({ + sortable: _this, + rootEl: criteria, + name: "filter", + targetEl: target, + fromEl: el, + toEl: el + }); + pluginEvent2("filter", _this, { + evt + }); + return true; + } + }); + if (filter) { + preventOnFilter && evt.cancelable && evt.preventDefault(); + return; + } + } + if (options.handle && !closest(originalTarget, options.handle, el, false)) { + return; + } + this._prepareDragStart(evt, touch, target); + }, + _prepareDragStart: function _prepareDragStart(evt, touch, target) { + var _this = this, el = _this.el, options = _this.options, ownerDocument = el.ownerDocument, dragStartFn; + if (target && !dragEl && target.parentNode === el) { + var dragRect = getRect(target); + rootEl = el; + dragEl = target; + parentEl = dragEl.parentNode; + nextEl = dragEl.nextSibling; + lastDownEl = target; + activeGroup = options.group; + Sortable.dragged = dragEl; + tapEvt = { + target: dragEl, + clientX: (touch || evt).clientX, + clientY: (touch || evt).clientY + }; + tapDistanceLeft = tapEvt.clientX - dragRect.left; + tapDistanceTop = tapEvt.clientY - dragRect.top; + this._lastX = (touch || evt).clientX; + this._lastY = (touch || evt).clientY; + dragEl.style["will-change"] = "all"; + dragStartFn = function dragStartFn2() { + pluginEvent2("delayEnded", _this, { + evt + }); + if (Sortable.eventCanceled) { + _this._onDrop(); + return; + } + _this._disableDelayedDragEvents(); + if (!FireFox && _this.nativeDraggable) { + dragEl.draggable = true; + } + _this._triggerDragStart(evt, touch); + _dispatchEvent({ + sortable: _this, + name: "choose", + originalEvent: evt + }); + toggleClass(dragEl, options.chosenClass, true); + }; + options.ignore.split(",").forEach(function(criteria) { + find(dragEl, criteria.trim(), _disableDraggable); + }); + on(ownerDocument, "dragover", nearestEmptyInsertDetectEvent); + on(ownerDocument, "mousemove", nearestEmptyInsertDetectEvent); + on(ownerDocument, "touchmove", nearestEmptyInsertDetectEvent); + on(ownerDocument, "mouseup", _this._onDrop); + on(ownerDocument, "touchend", _this._onDrop); + on(ownerDocument, "touchcancel", _this._onDrop); + if (FireFox && this.nativeDraggable) { + this.options.touchStartThreshold = 4; + dragEl.draggable = true; + } + pluginEvent2("delayStart", this, { + evt + }); + if (options.delay && (!options.delayOnTouchOnly || touch) && (!this.nativeDraggable || !(Edge || IE11OrLess))) { + if (Sortable.eventCanceled) { + this._onDrop(); + return; + } + on(ownerDocument, "mouseup", _this._disableDelayedDrag); + on(ownerDocument, "touchend", _this._disableDelayedDrag); + on(ownerDocument, "touchcancel", _this._disableDelayedDrag); + on(ownerDocument, "mousemove", _this._delayedDragTouchMoveHandler); + on(ownerDocument, "touchmove", _this._delayedDragTouchMoveHandler); + options.supportPointer && on(ownerDocument, "pointermove", _this._delayedDragTouchMoveHandler); + _this._dragStartTimer = setTimeout(dragStartFn, options.delay); + } else { + dragStartFn(); + } + } + }, + _delayedDragTouchMoveHandler: function _delayedDragTouchMoveHandler(e) { + var touch = e.touches ? e.touches[0] : e; + if (Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) >= Math.floor(this.options.touchStartThreshold / (this.nativeDraggable && window.devicePixelRatio || 1))) { + this._disableDelayedDrag(); + } + }, + _disableDelayedDrag: function _disableDelayedDrag() { + dragEl && _disableDraggable(dragEl); + clearTimeout(this._dragStartTimer); + this._disableDelayedDragEvents(); + }, + _disableDelayedDragEvents: function _disableDelayedDragEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, "mouseup", this._disableDelayedDrag); + off(ownerDocument, "touchend", this._disableDelayedDrag); + off(ownerDocument, "touchcancel", this._disableDelayedDrag); + off(ownerDocument, "mousemove", this._delayedDragTouchMoveHandler); + off(ownerDocument, "touchmove", this._delayedDragTouchMoveHandler); + off(ownerDocument, "pointermove", this._delayedDragTouchMoveHandler); + }, + _triggerDragStart: function _triggerDragStart(evt, touch) { + touch = touch || evt.pointerType == "touch" && evt; + if (!this.nativeDraggable || touch) { + if (this.options.supportPointer) { + on(document, "pointermove", this._onTouchMove); + } else if (touch) { + on(document, "touchmove", this._onTouchMove); + } else { + on(document, "mousemove", this._onTouchMove); + } + } else { + on(dragEl, "dragend", this); + on(rootEl, "dragstart", this._onDragStart); + } + try { + if (document.selection) { + _nextTick(function() { + document.selection.empty(); + }); + } else { + window.getSelection().removeAllRanges(); + } + } catch (err) { + } + }, + _dragStarted: function _dragStarted(fallback, evt) { + awaitingDragStarted = false; + if (rootEl && dragEl) { + pluginEvent2("dragStarted", this, { + evt + }); + if (this.nativeDraggable) { + on(document, "dragover", _checkOutsideTargetEl); + } + var options = this.options; + !fallback && toggleClass(dragEl, options.dragClass, false); + toggleClass(dragEl, options.ghostClass, true); + Sortable.active = this; + fallback && this._appendGhost(); + _dispatchEvent({ + sortable: this, + name: "start", + originalEvent: evt + }); + } else { + this._nulling(); + } + }, + _emulateDragOver: function _emulateDragOver() { + if (touchEvt) { + this._lastX = touchEvt.clientX; + this._lastY = touchEvt.clientY; + _hideGhostForTarget(); + var target = document.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + var parent = target; + while (target && target.shadowRoot) { + target = target.shadowRoot.elementFromPoint(touchEvt.clientX, touchEvt.clientY); + if (target === parent) + break; + parent = target; + } + dragEl.parentNode[expando]._isOutsideThisEl(target); + if (parent) { + do { + if (parent[expando]) { + var inserted = void 0; + inserted = parent[expando]._onDragOver({ + clientX: touchEvt.clientX, + clientY: touchEvt.clientY, + target, + rootEl: parent + }); + if (inserted && !this.options.dragoverBubble) { + break; + } + } + target = parent; + } while (parent = parent.parentNode); + } + _unhideGhostForTarget(); + } + }, + _onTouchMove: function _onTouchMove(evt) { + if (tapEvt) { + var options = this.options, fallbackTolerance = options.fallbackTolerance, fallbackOffset = options.fallbackOffset, touch = evt.touches ? evt.touches[0] : evt, ghostMatrix = ghostEl && matrix(ghostEl, true), scaleX = ghostEl && ghostMatrix && ghostMatrix.a, scaleY = ghostEl && ghostMatrix && ghostMatrix.d, relativeScrollOffset = PositionGhostAbsolutely && ghostRelativeParent && getRelativeScrollOffset(ghostRelativeParent), dx = (touch.clientX - tapEvt.clientX + fallbackOffset.x) / (scaleX || 1) + (relativeScrollOffset ? relativeScrollOffset[0] - ghostRelativeParentInitialScroll[0] : 0) / (scaleX || 1), dy = (touch.clientY - tapEvt.clientY + fallbackOffset.y) / (scaleY || 1) + (relativeScrollOffset ? relativeScrollOffset[1] - ghostRelativeParentInitialScroll[1] : 0) / (scaleY || 1); + if (!Sortable.active && !awaitingDragStarted) { + if (fallbackTolerance && Math.max(Math.abs(touch.clientX - this._lastX), Math.abs(touch.clientY - this._lastY)) < fallbackTolerance) { + return; + } + this._onDragStart(evt, true); + } + if (ghostEl) { + if (ghostMatrix) { + ghostMatrix.e += dx - (lastDx || 0); + ghostMatrix.f += dy - (lastDy || 0); + } else { + ghostMatrix = { + a: 1, + b: 0, + c: 0, + d: 1, + e: dx, + f: dy + }; + } + var cssMatrix = "matrix(".concat(ghostMatrix.a, ",").concat(ghostMatrix.b, ",").concat(ghostMatrix.c, ",").concat(ghostMatrix.d, ",").concat(ghostMatrix.e, ",").concat(ghostMatrix.f, ")"); + css(ghostEl, "webkitTransform", cssMatrix); + css(ghostEl, "mozTransform", cssMatrix); + css(ghostEl, "msTransform", cssMatrix); + css(ghostEl, "transform", cssMatrix); + lastDx = dx; + lastDy = dy; + touchEvt = touch; + } + evt.cancelable && evt.preventDefault(); + } + }, + _appendGhost: function _appendGhost() { + if (!ghostEl) { + var container = this.options.fallbackOnBody ? document.body : rootEl, rect = getRect(dragEl, true, PositionGhostAbsolutely, true, container), options = this.options; + if (PositionGhostAbsolutely) { + ghostRelativeParent = container; + while (css(ghostRelativeParent, "position") === "static" && css(ghostRelativeParent, "transform") === "none" && ghostRelativeParent !== document) { + ghostRelativeParent = ghostRelativeParent.parentNode; + } + if (ghostRelativeParent !== document.body && ghostRelativeParent !== document.documentElement) { + if (ghostRelativeParent === document) + ghostRelativeParent = getWindowScrollingElement(); + rect.top += ghostRelativeParent.scrollTop; + rect.left += ghostRelativeParent.scrollLeft; + } else { + ghostRelativeParent = getWindowScrollingElement(); + } + ghostRelativeParentInitialScroll = getRelativeScrollOffset(ghostRelativeParent); + } + ghostEl = dragEl.cloneNode(true); + toggleClass(ghostEl, options.ghostClass, false); + toggleClass(ghostEl, options.fallbackClass, true); + toggleClass(ghostEl, options.dragClass, true); + css(ghostEl, "transition", ""); + css(ghostEl, "transform", ""); + css(ghostEl, "box-sizing", "border-box"); + css(ghostEl, "margin", 0); + css(ghostEl, "top", rect.top); + css(ghostEl, "left", rect.left); + css(ghostEl, "width", rect.width); + css(ghostEl, "height", rect.height); + css(ghostEl, "opacity", "0.8"); + css(ghostEl, "position", PositionGhostAbsolutely ? "absolute" : "fixed"); + css(ghostEl, "zIndex", "100000"); + css(ghostEl, "pointerEvents", "none"); + Sortable.ghost = ghostEl; + container.appendChild(ghostEl); + css(ghostEl, "transform-origin", tapDistanceLeft / parseInt(ghostEl.style.width) * 100 + "% " + tapDistanceTop / parseInt(ghostEl.style.height) * 100 + "%"); + } + }, + _onDragStart: function _onDragStart(evt, fallback) { + var _this = this; + var dataTransfer = evt.dataTransfer; + var options = _this.options; + pluginEvent2("dragStart", this, { + evt + }); + if (Sortable.eventCanceled) { + this._onDrop(); + return; + } + pluginEvent2("setupClone", this); + if (!Sortable.eventCanceled) { + cloneEl = clone(dragEl); + cloneEl.removeAttribute("id"); + cloneEl.draggable = false; + cloneEl.style["will-change"] = ""; + this._hideClone(); + toggleClass(cloneEl, this.options.chosenClass, false); + Sortable.clone = cloneEl; + } + _this.cloneId = _nextTick(function() { + pluginEvent2("clone", _this); + if (Sortable.eventCanceled) + return; + if (!_this.options.removeCloneOnHide) { + rootEl.insertBefore(cloneEl, dragEl); + } + _this._hideClone(); + _dispatchEvent({ + sortable: _this, + name: "clone" + }); + }); + !fallback && toggleClass(dragEl, options.dragClass, true); + if (fallback) { + ignoreNextClick = true; + _this._loopId = setInterval(_this._emulateDragOver, 50); + } else { + off(document, "mouseup", _this._onDrop); + off(document, "touchend", _this._onDrop); + off(document, "touchcancel", _this._onDrop); + if (dataTransfer) { + dataTransfer.effectAllowed = "move"; + options.setData && options.setData.call(_this, dataTransfer, dragEl); + } + on(document, "drop", _this); + css(dragEl, "transform", "translateZ(0)"); + } + awaitingDragStarted = true; + _this._dragStartId = _nextTick(_this._dragStarted.bind(_this, fallback, evt)); + on(document, "selectstart", _this); + moved = true; + if (Safari) { + css(document.body, "user-select", "none"); + } + }, + // Returns true - if no further action is needed (either inserted or another condition) + _onDragOver: function _onDragOver(evt) { + var el = this.el, target = evt.target, dragRect, targetRect, revert, options = this.options, group = options.group, activeSortable = Sortable.active, isOwner = activeGroup === group, canSort = options.sort, fromSortable = putSortable || activeSortable, vertical, _this = this, completedFired = false; + if (_silent) + return; + function dragOverEvent(name, extra) { + pluginEvent2(name, _this, _objectSpread2({ + evt, + isOwner, + axis: vertical ? "vertical" : "horizontal", + revert, + dragRect, + targetRect, + canSort, + fromSortable, + target, + completed, + onMove: function onMove(target2, after2) { + return _onMove(rootEl, el, dragEl, dragRect, target2, getRect(target2), evt, after2); + }, + changed + }, extra)); + } + function capture() { + dragOverEvent("dragOverAnimationCapture"); + _this.captureAnimationState(); + if (_this !== fromSortable) { + fromSortable.captureAnimationState(); + } + } + function completed(insertion) { + dragOverEvent("dragOverCompleted", { + insertion + }); + if (insertion) { + if (isOwner) { + activeSortable._hideClone(); + } else { + activeSortable._showClone(_this); + } + if (_this !== fromSortable) { + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : activeSortable.options.ghostClass, false); + toggleClass(dragEl, options.ghostClass, true); + } + if (putSortable !== _this && _this !== Sortable.active) { + putSortable = _this; + } else if (_this === Sortable.active && putSortable) { + putSortable = null; + } + if (fromSortable === _this) { + _this._ignoreWhileAnimating = target; + } + _this.animateAll(function() { + dragOverEvent("dragOverAnimationComplete"); + _this._ignoreWhileAnimating = null; + }); + if (_this !== fromSortable) { + fromSortable.animateAll(); + fromSortable._ignoreWhileAnimating = null; + } + } + if (target === dragEl && !dragEl.animated || target === el && !target.animated) { + lastTarget = null; + } + if (!options.dragoverBubble && !evt.rootEl && target !== document) { + dragEl.parentNode[expando]._isOutsideThisEl(evt.target); + !insertion && nearestEmptyInsertDetectEvent(evt); + } + !options.dragoverBubble && evt.stopPropagation && evt.stopPropagation(); + return completedFired = true; + } + function changed() { + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + _dispatchEvent({ + sortable: _this, + name: "change", + toEl: el, + newIndex, + newDraggableIndex, + originalEvent: evt + }); + } + if (evt.preventDefault !== void 0) { + evt.cancelable && evt.preventDefault(); + } + target = closest(target, options.draggable, el, true); + dragOverEvent("dragOver"); + if (Sortable.eventCanceled) + return completedFired; + if (dragEl.contains(evt.target) || target.animated && target.animatingX && target.animatingY || _this._ignoreWhileAnimating === target) { + return completed(false); + } + ignoreNextClick = false; + if (activeSortable && !options.disabled && (isOwner ? canSort || (revert = parentEl !== rootEl) : putSortable === this || (this.lastPutMode = activeGroup.checkPull(this, activeSortable, dragEl, evt)) && group.checkPut(this, activeSortable, dragEl, evt))) { + vertical = this._getDirection(evt, target) === "vertical"; + dragRect = getRect(dragEl); + dragOverEvent("dragOverValid"); + if (Sortable.eventCanceled) + return completedFired; + if (revert) { + parentEl = rootEl; + capture(); + this._hideClone(); + dragOverEvent("revert"); + if (!Sortable.eventCanceled) { + if (nextEl) { + rootEl.insertBefore(dragEl, nextEl); + } else { + rootEl.appendChild(dragEl); + } + } + return completed(true); + } + var elLastChild = lastChild(el, options.draggable); + if (!elLastChild || _ghostIsLast(evt, vertical, this) && !elLastChild.animated) { + if (elLastChild === dragEl) { + return completed(false); + } + if (elLastChild && el === evt.target) { + target = elLastChild; + } + if (target) { + targetRect = getRect(target); + } + if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, !!target) !== false) { + capture(); + if (elLastChild && elLastChild.nextSibling) { + el.insertBefore(dragEl, elLastChild.nextSibling); + } else { + el.appendChild(dragEl); + } + parentEl = el; + changed(); + return completed(true); + } + } else if (elLastChild && _ghostIsFirst(evt, vertical, this)) { + var firstChild = getChild(el, 0, options, true); + if (firstChild === dragEl) { + return completed(false); + } + target = firstChild; + targetRect = getRect(target); + if (_onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, false) !== false) { + capture(); + el.insertBefore(dragEl, firstChild); + parentEl = el; + changed(); + return completed(true); + } + } else if (target.parentNode === el) { + targetRect = getRect(target); + var direction = 0, targetBeforeFirstSwap, differentLevel = dragEl.parentNode !== el, differentRowCol = !_dragElInRowColumn(dragEl.animated && dragEl.toRect || dragRect, target.animated && target.toRect || targetRect, vertical), side1 = vertical ? "top" : "left", scrolledPastTop = isScrolledPast(target, "top", "top") || isScrolledPast(dragEl, "top", "top"), scrollBefore = scrolledPastTop ? scrolledPastTop.scrollTop : void 0; + if (lastTarget !== target) { + targetBeforeFirstSwap = targetRect[side1]; + pastFirstInvertThresh = false; + isCircumstantialInvert = !differentRowCol && options.invertSwap || differentLevel; + } + direction = _getSwapDirection(evt, target, targetRect, vertical, differentRowCol ? 1 : options.swapThreshold, options.invertedSwapThreshold == null ? options.swapThreshold : options.invertedSwapThreshold, isCircumstantialInvert, lastTarget === target); + var sibling; + if (direction !== 0) { + var dragIndex = index(dragEl); + do { + dragIndex -= direction; + sibling = parentEl.children[dragIndex]; + } while (sibling && (css(sibling, "display") === "none" || sibling === ghostEl)); + } + if (direction === 0 || sibling === target) { + return completed(false); + } + lastTarget = target; + lastDirection = direction; + var nextSibling = target.nextElementSibling, after = false; + after = direction === 1; + var moveVector = _onMove(rootEl, el, dragEl, dragRect, target, targetRect, evt, after); + if (moveVector !== false) { + if (moveVector === 1 || moveVector === -1) { + after = moveVector === 1; + } + _silent = true; + setTimeout(_unsilent, 30); + capture(); + if (after && !nextSibling) { + el.appendChild(dragEl); + } else { + target.parentNode.insertBefore(dragEl, after ? nextSibling : target); + } + if (scrolledPastTop) { + scrollBy(scrolledPastTop, 0, scrollBefore - scrolledPastTop.scrollTop); + } + parentEl = dragEl.parentNode; + if (targetBeforeFirstSwap !== void 0 && !isCircumstantialInvert) { + targetMoveDistance = Math.abs(targetBeforeFirstSwap - getRect(target)[side1]); + } + changed(); + return completed(true); + } + } + if (el.contains(dragEl)) { + return completed(false); + } + } + return false; + }, + _ignoreWhileAnimating: null, + _offMoveEvents: function _offMoveEvents() { + off(document, "mousemove", this._onTouchMove); + off(document, "touchmove", this._onTouchMove); + off(document, "pointermove", this._onTouchMove); + off(document, "dragover", nearestEmptyInsertDetectEvent); + off(document, "mousemove", nearestEmptyInsertDetectEvent); + off(document, "touchmove", nearestEmptyInsertDetectEvent); + }, + _offUpEvents: function _offUpEvents() { + var ownerDocument = this.el.ownerDocument; + off(ownerDocument, "mouseup", this._onDrop); + off(ownerDocument, "touchend", this._onDrop); + off(ownerDocument, "pointerup", this._onDrop); + off(ownerDocument, "touchcancel", this._onDrop); + off(document, "selectstart", this); + }, + _onDrop: function _onDrop(evt) { + var el = this.el, options = this.options; + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + pluginEvent2("drop", this, { + evt + }); + parentEl = dragEl && dragEl.parentNode; + newIndex = index(dragEl); + newDraggableIndex = index(dragEl, options.draggable); + if (Sortable.eventCanceled) { + this._nulling(); + return; + } + awaitingDragStarted = false; + isCircumstantialInvert = false; + pastFirstInvertThresh = false; + clearInterval(this._loopId); + clearTimeout(this._dragStartTimer); + _cancelNextTick(this.cloneId); + _cancelNextTick(this._dragStartId); + if (this.nativeDraggable) { + off(document, "drop", this); + off(el, "dragstart", this._onDragStart); + } + this._offMoveEvents(); + this._offUpEvents(); + if (Safari) { + css(document.body, "user-select", ""); + } + css(dragEl, "transform", ""); + if (evt) { + if (moved) { + evt.cancelable && evt.preventDefault(); + !options.dropBubble && evt.stopPropagation(); + } + ghostEl && ghostEl.parentNode && ghostEl.parentNode.removeChild(ghostEl); + if (rootEl === parentEl || putSortable && putSortable.lastPutMode !== "clone") { + cloneEl && cloneEl.parentNode && cloneEl.parentNode.removeChild(cloneEl); + } + if (dragEl) { + if (this.nativeDraggable) { + off(dragEl, "dragend", this); + } + _disableDraggable(dragEl); + dragEl.style["will-change"] = ""; + if (moved && !awaitingDragStarted) { + toggleClass(dragEl, putSortable ? putSortable.options.ghostClass : this.options.ghostClass, false); + } + toggleClass(dragEl, this.options.chosenClass, false); + _dispatchEvent({ + sortable: this, + name: "unchoose", + toEl: parentEl, + newIndex: null, + newDraggableIndex: null, + originalEvent: evt + }); + if (rootEl !== parentEl) { + if (newIndex >= 0) { + _dispatchEvent({ + rootEl: parentEl, + name: "add", + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); + _dispatchEvent({ + sortable: this, + name: "remove", + toEl: parentEl, + originalEvent: evt + }); + _dispatchEvent({ + rootEl: parentEl, + name: "sort", + toEl: parentEl, + fromEl: rootEl, + originalEvent: evt + }); + _dispatchEvent({ + sortable: this, + name: "sort", + toEl: parentEl, + originalEvent: evt + }); + } + putSortable && putSortable.save(); + } else { + if (newIndex !== oldIndex) { + if (newIndex >= 0) { + _dispatchEvent({ + sortable: this, + name: "update", + toEl: parentEl, + originalEvent: evt + }); + _dispatchEvent({ + sortable: this, + name: "sort", + toEl: parentEl, + originalEvent: evt + }); + } + } + } + if (Sortable.active) { + if (newIndex == null || newIndex === -1) { + newIndex = oldIndex; + newDraggableIndex = oldDraggableIndex; + } + _dispatchEvent({ + sortable: this, + name: "end", + toEl: parentEl, + originalEvent: evt + }); + this.save(); + } + } + } + this._nulling(); + }, + _nulling: function _nulling() { + pluginEvent2("nulling", this); + rootEl = dragEl = parentEl = ghostEl = nextEl = cloneEl = lastDownEl = cloneHidden = tapEvt = touchEvt = moved = newIndex = newDraggableIndex = oldIndex = oldDraggableIndex = lastTarget = lastDirection = putSortable = activeGroup = Sortable.dragged = Sortable.ghost = Sortable.clone = Sortable.active = null; + savedInputChecked.forEach(function(el) { + el.checked = true; + }); + savedInputChecked.length = lastDx = lastDy = 0; + }, + handleEvent: function handleEvent(evt) { + switch (evt.type) { + case "drop": + case "dragend": + this._onDrop(evt); + break; + case "dragenter": + case "dragover": + if (dragEl) { + this._onDragOver(evt); + _globalDragOver(evt); + } + break; + case "selectstart": + evt.preventDefault(); + break; + } + }, + /** + * Serializes the item into an array of string. + * @returns {String[]} + */ + toArray: function toArray() { + var order = [], el, children = this.el.children, i = 0, n = children.length, options = this.options; + for (; i < n; i++) { + el = children[i]; + if (closest(el, options.draggable, this.el, false)) { + order.push(el.getAttribute(options.dataIdAttr) || _generateId(el)); + } + } + return order; + }, + /** + * Sorts the elements according to the array. + * @param {String[]} order order of the items + */ + sort: function sort(order, useAnimation) { + var items = {}, rootEl2 = this.el; + this.toArray().forEach(function(id, i) { + var el = rootEl2.children[i]; + if (closest(el, this.options.draggable, rootEl2, false)) { + items[id] = el; + } + }, this); + useAnimation && this.captureAnimationState(); + order.forEach(function(id) { + if (items[id]) { + rootEl2.removeChild(items[id]); + rootEl2.appendChild(items[id]); + } + }); + useAnimation && this.animateAll(); + }, + /** + * Save the current sorting + */ + save: function save() { + var store = this.options.store; + store && store.set && store.set(this); + }, + /** + * For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree. + * @param {HTMLElement} el + * @param {String} [selector] default: `options.draggable` + * @returns {HTMLElement|null} + */ + closest: function closest$1(el, selector) { + return closest(el, selector || this.options.draggable, this.el, false); + }, + /** + * Set/get option + * @param {string} name + * @param {*} [value] + * @returns {*} + */ + option: function option(name, value) { + var options = this.options; + if (value === void 0) { + return options[name]; + } else { + var modifiedValue = PluginManager.modifyOption(this, name, value); + if (typeof modifiedValue !== "undefined") { + options[name] = modifiedValue; + } else { + options[name] = value; + } + if (name === "group") { + _prepareGroup(options); + } + } + }, + /** + * Destroy + */ + destroy: function destroy() { + pluginEvent2("destroy", this); + var el = this.el; + el[expando] = null; + off(el, "mousedown", this._onTapStart); + off(el, "touchstart", this._onTapStart); + off(el, "pointerdown", this._onTapStart); + if (this.nativeDraggable) { + off(el, "dragover", this); + off(el, "dragenter", this); + } + Array.prototype.forEach.call(el.querySelectorAll("[draggable]"), function(el2) { + el2.removeAttribute("draggable"); + }); + this._onDrop(); + this._disableDelayedDragEvents(); + sortables.splice(sortables.indexOf(this.el), 1); + this.el = el = null; + }, + _hideClone: function _hideClone() { + if (!cloneHidden) { + pluginEvent2("hideClone", this); + if (Sortable.eventCanceled) + return; + css(cloneEl, "display", "none"); + if (this.options.removeCloneOnHide && cloneEl.parentNode) { + cloneEl.parentNode.removeChild(cloneEl); + } + cloneHidden = true; + } + }, + _showClone: function _showClone(putSortable2) { + if (putSortable2.lastPutMode !== "clone") { + this._hideClone(); + return; + } + if (cloneHidden) { + pluginEvent2("showClone", this); + if (Sortable.eventCanceled) + return; + if (dragEl.parentNode == rootEl && !this.options.group.revertClone) { + rootEl.insertBefore(cloneEl, dragEl); + } else if (nextEl) { + rootEl.insertBefore(cloneEl, nextEl); + } else { + rootEl.appendChild(cloneEl); + } + if (this.options.group.revertClone) { + this.animate(dragEl, cloneEl); + } + css(cloneEl, "display", ""); + cloneHidden = false; + } + } + }; + function _globalDragOver(evt) { + if (evt.dataTransfer) { + evt.dataTransfer.dropEffect = "move"; + } + evt.cancelable && evt.preventDefault(); + } + function _onMove(fromEl, toEl, dragEl2, dragRect, targetEl, targetRect, originalEvent, willInsertAfter) { + var evt, sortable = fromEl[expando], onMoveFn = sortable.options.onMove, retVal; + if (window.CustomEvent && !IE11OrLess && !Edge) { + evt = new CustomEvent("move", { + bubbles: true, + cancelable: true + }); + } else { + evt = document.createEvent("Event"); + evt.initEvent("move", true, true); + } + evt.to = toEl; + evt.from = fromEl; + evt.dragged = dragEl2; + evt.draggedRect = dragRect; + evt.related = targetEl || toEl; + evt.relatedRect = targetRect || getRect(toEl); + evt.willInsertAfter = willInsertAfter; + evt.originalEvent = originalEvent; + fromEl.dispatchEvent(evt); + if (onMoveFn) { + retVal = onMoveFn.call(sortable, evt, originalEvent); + } + return retVal; + } + function _disableDraggable(el) { + el.draggable = false; + } + function _unsilent() { + _silent = false; + } + function _ghostIsFirst(evt, vertical, sortable) { + var firstElRect = getRect(getChild(sortable.el, 0, sortable.options, true)); + var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl); + var spacer = 10; + return vertical ? evt.clientX < childContainingRect.left - spacer || evt.clientY < firstElRect.top && evt.clientX < firstElRect.right : evt.clientY < childContainingRect.top - spacer || evt.clientY < firstElRect.bottom && evt.clientX < firstElRect.left; + } + function _ghostIsLast(evt, vertical, sortable) { + var lastElRect = getRect(lastChild(sortable.el, sortable.options.draggable)); + var childContainingRect = getChildContainingRectFromElement(sortable.el, sortable.options, ghostEl); + var spacer = 10; + return vertical ? evt.clientX > childContainingRect.right + spacer || evt.clientY > lastElRect.bottom && evt.clientX > lastElRect.left : evt.clientY > childContainingRect.bottom + spacer || evt.clientX > lastElRect.right && evt.clientY > lastElRect.top; + } + function _getSwapDirection(evt, target, targetRect, vertical, swapThreshold, invertedSwapThreshold, invertSwap, isLastTarget) { + var mouseOnAxis = vertical ? evt.clientY : evt.clientX, targetLength = vertical ? targetRect.height : targetRect.width, targetS1 = vertical ? targetRect.top : targetRect.left, targetS2 = vertical ? targetRect.bottom : targetRect.right, invert = false; + if (!invertSwap) { + if (isLastTarget && targetMoveDistance < targetLength * swapThreshold) { + if (!pastFirstInvertThresh && (lastDirection === 1 ? mouseOnAxis > targetS1 + targetLength * invertedSwapThreshold / 2 : mouseOnAxis < targetS2 - targetLength * invertedSwapThreshold / 2)) { + pastFirstInvertThresh = true; + } + if (!pastFirstInvertThresh) { + if (lastDirection === 1 ? mouseOnAxis < targetS1 + targetMoveDistance : mouseOnAxis > targetS2 - targetMoveDistance) { + return -lastDirection; + } + } else { + invert = true; + } + } else { + if (mouseOnAxis > targetS1 + targetLength * (1 - swapThreshold) / 2 && mouseOnAxis < targetS2 - targetLength * (1 - swapThreshold) / 2) { + return _getInsertDirection(target); + } + } + } + invert = invert || invertSwap; + if (invert) { + if (mouseOnAxis < targetS1 + targetLength * invertedSwapThreshold / 2 || mouseOnAxis > targetS2 - targetLength * invertedSwapThreshold / 2) { + return mouseOnAxis > targetS1 + targetLength / 2 ? 1 : -1; + } + } + return 0; + } + function _getInsertDirection(target) { + if (index(dragEl) < index(target)) { + return 1; + } else { + return -1; + } + } + function _generateId(el) { + var str = el.tagName + el.className + el.src + el.href + el.textContent, i = str.length, sum = 0; + while (i--) { + sum += str.charCodeAt(i); + } + return sum.toString(36); + } + function _saveInputCheckedState(root) { + savedInputChecked.length = 0; + var inputs = root.getElementsByTagName("input"); + var idx = inputs.length; + while (idx--) { + var el = inputs[idx]; + el.checked && savedInputChecked.push(el); + } + } + function _nextTick(fn) { + return setTimeout(fn, 0); + } + function _cancelNextTick(id) { + return clearTimeout(id); + } + if (documentExists) { + on(document, "touchmove", function(evt) { + if ((Sortable.active || awaitingDragStarted) && evt.cancelable) { + evt.preventDefault(); + } + }); + } + Sortable.utils = { + on, + off, + css, + find, + is: function is(el, selector) { + return !!closest(el, selector, el, false); + }, + extend, + throttle, + closest, + toggleClass, + clone, + index, + nextTick: _nextTick, + cancelNextTick: _cancelNextTick, + detectDirection: _detectDirection, + getChild + }; + Sortable.get = function(element) { + return element[expando]; + }; + Sortable.mount = function() { + for (var _len = arguments.length, plugins2 = new Array(_len), _key = 0; _key < _len; _key++) { + plugins2[_key] = arguments[_key]; + } + if (plugins2[0].constructor === Array) + plugins2 = plugins2[0]; + plugins2.forEach(function(plugin) { + if (!plugin.prototype || !plugin.prototype.constructor) { + throw "Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(plugin)); + } + if (plugin.utils) + Sortable.utils = _objectSpread2(_objectSpread2({}, Sortable.utils), plugin.utils); + PluginManager.mount(plugin); + }); + }; + Sortable.create = function(el, options) { + return new Sortable(el, options); + }; + Sortable.version = version; + var autoScrolls = []; + var scrollEl; + var scrollRootEl; + var scrolling = false; + var lastAutoScrollX; + var lastAutoScrollY; + var touchEvt$1; + var pointerElemChangedInterval; + function AutoScrollPlugin() { + function AutoScroll() { + this.defaults = { + scroll: true, + forceAutoScrollFallback: false, + scrollSensitivity: 30, + scrollSpeed: 10, + bubbleScroll: true + }; + for (var fn in this) { + if (fn.charAt(0) === "_" && typeof this[fn] === "function") { + this[fn] = this[fn].bind(this); + } + } + } + AutoScroll.prototype = { + dragStarted: function dragStarted(_ref) { + var originalEvent = _ref.originalEvent; + if (this.sortable.nativeDraggable) { + on(document, "dragover", this._handleAutoScroll); + } else { + if (this.options.supportPointer) { + on(document, "pointermove", this._handleFallbackAutoScroll); + } else if (originalEvent.touches) { + on(document, "touchmove", this._handleFallbackAutoScroll); + } else { + on(document, "mousemove", this._handleFallbackAutoScroll); + } + } + }, + dragOverCompleted: function dragOverCompleted(_ref2) { + var originalEvent = _ref2.originalEvent; + if (!this.options.dragOverBubble && !originalEvent.rootEl) { + this._handleAutoScroll(originalEvent); + } + }, + drop: function drop3() { + if (this.sortable.nativeDraggable) { + off(document, "dragover", this._handleAutoScroll); + } else { + off(document, "pointermove", this._handleFallbackAutoScroll); + off(document, "touchmove", this._handleFallbackAutoScroll); + off(document, "mousemove", this._handleFallbackAutoScroll); + } + clearPointerElemChangedInterval(); + clearAutoScrolls(); + cancelThrottle(); + }, + nulling: function nulling() { + touchEvt$1 = scrollRootEl = scrollEl = scrolling = pointerElemChangedInterval = lastAutoScrollX = lastAutoScrollY = null; + autoScrolls.length = 0; + }, + _handleFallbackAutoScroll: function _handleFallbackAutoScroll(evt) { + this._handleAutoScroll(evt, true); + }, + _handleAutoScroll: function _handleAutoScroll(evt, fallback) { + var _this = this; + var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, elem = document.elementFromPoint(x, y); + touchEvt$1 = evt; + if (fallback || this.options.forceAutoScrollFallback || Edge || IE11OrLess || Safari) { + autoScroll(evt, this.options, elem, fallback); + var ogElemScroller = getParentAutoScrollElement(elem, true); + if (scrolling && (!pointerElemChangedInterval || x !== lastAutoScrollX || y !== lastAutoScrollY)) { + pointerElemChangedInterval && clearPointerElemChangedInterval(); + pointerElemChangedInterval = setInterval(function() { + var newElem = getParentAutoScrollElement(document.elementFromPoint(x, y), true); + if (newElem !== ogElemScroller) { + ogElemScroller = newElem; + clearAutoScrolls(); + } + autoScroll(evt, _this.options, newElem, fallback); + }, 10); + lastAutoScrollX = x; + lastAutoScrollY = y; + } + } else { + if (!this.options.bubbleScroll || getParentAutoScrollElement(elem, true) === getWindowScrollingElement()) { + clearAutoScrolls(); + return; + } + autoScroll(evt, this.options, getParentAutoScrollElement(elem, false), false); + } + } + }; + return _extends(AutoScroll, { + pluginName: "scroll", + initializeByDefault: true + }); + } + function clearAutoScrolls() { + autoScrolls.forEach(function(autoScroll2) { + clearInterval(autoScroll2.pid); + }); + autoScrolls = []; + } + function clearPointerElemChangedInterval() { + clearInterval(pointerElemChangedInterval); + } + var autoScroll = throttle(function(evt, options, rootEl2, isFallback) { + if (!options.scroll) + return; + var x = (evt.touches ? evt.touches[0] : evt).clientX, y = (evt.touches ? evt.touches[0] : evt).clientY, sens = options.scrollSensitivity, speed = options.scrollSpeed, winScroller = getWindowScrollingElement(); + var scrollThisInstance = false, scrollCustomFn; + if (scrollRootEl !== rootEl2) { + scrollRootEl = rootEl2; + clearAutoScrolls(); + scrollEl = options.scroll; + scrollCustomFn = options.scrollFn; + if (scrollEl === true) { + scrollEl = getParentAutoScrollElement(rootEl2, true); + } + } + var layersOut = 0; + var currentParent = scrollEl; + do { + var el = currentParent, rect = getRect(el), top = rect.top, bottom = rect.bottom, left = rect.left, right = rect.right, width = rect.width, height = rect.height, canScrollX = void 0, canScrollY = void 0, scrollWidth = el.scrollWidth, scrollHeight = el.scrollHeight, elCSS = css(el), scrollPosX = el.scrollLeft, scrollPosY = el.scrollTop; + if (el === winScroller) { + canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll" || elCSS.overflowX === "visible"); + canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll" || elCSS.overflowY === "visible"); + } else { + canScrollX = width < scrollWidth && (elCSS.overflowX === "auto" || elCSS.overflowX === "scroll"); + canScrollY = height < scrollHeight && (elCSS.overflowY === "auto" || elCSS.overflowY === "scroll"); + } + var vx = canScrollX && (Math.abs(right - x) <= sens && scrollPosX + width < scrollWidth) - (Math.abs(left - x) <= sens && !!scrollPosX); + var vy = canScrollY && (Math.abs(bottom - y) <= sens && scrollPosY + height < scrollHeight) - (Math.abs(top - y) <= sens && !!scrollPosY); + if (!autoScrolls[layersOut]) { + for (var i = 0; i <= layersOut; i++) { + if (!autoScrolls[i]) { + autoScrolls[i] = {}; + } + } + } + if (autoScrolls[layersOut].vx != vx || autoScrolls[layersOut].vy != vy || autoScrolls[layersOut].el !== el) { + autoScrolls[layersOut].el = el; + autoScrolls[layersOut].vx = vx; + autoScrolls[layersOut].vy = vy; + clearInterval(autoScrolls[layersOut].pid); + if (vx != 0 || vy != 0) { + scrollThisInstance = true; + autoScrolls[layersOut].pid = setInterval(function() { + if (isFallback && this.layer === 0) { + Sortable.active._onTouchMove(touchEvt$1); + } + var scrollOffsetY = autoScrolls[this.layer].vy ? autoScrolls[this.layer].vy * speed : 0; + var scrollOffsetX = autoScrolls[this.layer].vx ? autoScrolls[this.layer].vx * speed : 0; + if (typeof scrollCustomFn === "function") { + if (scrollCustomFn.call(Sortable.dragged.parentNode[expando], scrollOffsetX, scrollOffsetY, evt, touchEvt$1, autoScrolls[this.layer].el) !== "continue") { + return; + } + } + scrollBy(autoScrolls[this.layer].el, scrollOffsetX, scrollOffsetY); + }.bind({ + layer: layersOut + }), 24); + } + } + layersOut++; + } while (options.bubbleScroll && currentParent !== winScroller && (currentParent = getParentAutoScrollElement(currentParent, false))); + scrolling = scrollThisInstance; + }, 30); + var drop = function drop2(_ref) { + var originalEvent = _ref.originalEvent, putSortable2 = _ref.putSortable, dragEl2 = _ref.dragEl, activeSortable = _ref.activeSortable, dispatchSortableEvent = _ref.dispatchSortableEvent, hideGhostForTarget = _ref.hideGhostForTarget, unhideGhostForTarget = _ref.unhideGhostForTarget; + if (!originalEvent) + return; + var toSortable = putSortable2 || activeSortable; + hideGhostForTarget(); + var touch = originalEvent.changedTouches && originalEvent.changedTouches.length ? originalEvent.changedTouches[0] : originalEvent; + var target = document.elementFromPoint(touch.clientX, touch.clientY); + unhideGhostForTarget(); + if (toSortable && !toSortable.el.contains(target)) { + dispatchSortableEvent("spill"); + this.onSpill({ + dragEl: dragEl2, + putSortable: putSortable2 + }); + } + }; + function Revert() { + } + Revert.prototype = { + startIndex: null, + dragStart: function dragStart(_ref2) { + var oldDraggableIndex2 = _ref2.oldDraggableIndex; + this.startIndex = oldDraggableIndex2; + }, + onSpill: function onSpill(_ref3) { + var dragEl2 = _ref3.dragEl, putSortable2 = _ref3.putSortable; + this.sortable.captureAnimationState(); + if (putSortable2) { + putSortable2.captureAnimationState(); + } + var nextSibling = getChild(this.sortable.el, this.startIndex, this.options); + if (nextSibling) { + this.sortable.el.insertBefore(dragEl2, nextSibling); + } else { + this.sortable.el.appendChild(dragEl2); + } + this.sortable.animateAll(); + if (putSortable2) { + putSortable2.animateAll(); + } + }, + drop + }; + _extends(Revert, { + pluginName: "revertOnSpill" + }); + function Remove() { + } + Remove.prototype = { + onSpill: function onSpill2(_ref4) { + var dragEl2 = _ref4.dragEl, putSortable2 = _ref4.putSortable; + var parentSortable = putSortable2 || this.sortable; + parentSortable.captureAnimationState(); + dragEl2.parentNode && dragEl2.parentNode.removeChild(dragEl2); + parentSortable.animateAll(); + }, + drop + }; + _extends(Remove, { + pluginName: "removeOnSpill" + }); + Sortable.mount(new AutoScrollPlugin()); + Sortable.mount(Remove, Revert); + var sortable_esm_default = Sortable; + + // resources/js/components/sortable.js + window.Sortable = sortable_esm_default; + if (typeof window.Livewire === "undefined") { + throw "Livewire Sortable Plugin: window.Livewire is undefined. Make sure @livewireScripts is placed above this script include"; + } + var moveEndMorphMarker = (el) => { + const endMorphMarker = Array.from(el.childNodes).filter((childNode) => { + return childNode.nodeType === 8 && ["[if ENDBLOCK]> { + if (directive.modifiers.length > 0) { + return; + } + let options = {}; + if (el.hasAttribute("wire:sortable.options")) { + options = new Function(`return ${el.getAttribute("wire:sortable.options")};`)(); + } + el.livewire_sortable = window.Sortable.create(el, { + sort: true, + ...options, + draggable: "[wire\\:sortable\\.item]", + handle: el.querySelector("[wire\\:sortable\\.handle]") ? "[wire\\:sortable\\.handle]" : null, + dataIdAttr: "wire:sortable.item", + group: { + pull: false, + put: false, + ...options.group, + name: el.getAttribute("wire:sortable") + }, + store: { + ...options.store, + set: function(sortable) { + let items = sortable.toArray().map((value, index2) => { + return { + order: index2 + 1, + value + }; + }); + moveEndMorphMarker(el); + component.$wire.call(directive.method, items); + } + } + }); + let hasSetHandleCorrectly = el.querySelector("[wire\\:sortable\\.item]") !== null; + if (hasSetHandleCorrectly) { + return; + } + const currentComponent = component; + Livewire.hook("commit", ({ component: component2, succeed }) => { + if (component2.id !== currentComponent.id) { + return; + } + if (hasSetHandleCorrectly) { + return; + } + succeed(() => { + queueMicrotask(() => { + el.livewire_sortable.option("handle", el.querySelector("[wire\\:sortable\\.handle]") ? "[wire\\:sortable\\.handle]" : null); + hasSetHandleCorrectly = el.querySelector("[wire\\:sortable\\.item]") !== null; + }); + }); + }); + }); + Livewire.directive("sortable-group", ({ el, directive, component }) => { + if (!directive.modifiers.includes("item-group")) { + return; + } + let options = {}; + if (el.hasAttribute("wire:sortable-group.options")) { + options = new Function(`return ${el.getAttribute("wire:sortable-group.options")};`)(); + } + el.livewire_sortable = window.Sortable.create(el, { + sort: true, + ...options, + draggable: "[wire\\:sortable-group\\.item]", + handle: "[wire\\:sortable-group\\.handle]", + dataIdAttr: "wire:sortable-group.item", + group: { + pull: true, + put: true, + ...options.group, + name: el.closest("[wire\\:sortable-group]").getAttribute("wire:sortable-group") + }, + onSort: (evt) => { + if (evt.to !== evt.from && el === evt.from) { + return; + } + let masterEl = el.closest("[wire\\:sortable-group]"); + let groups = Array.from(masterEl.querySelectorAll("[wire\\:sortable-group\\.item-group]")).map((el2, index2) => { + moveEndMorphMarker(el2); + return { + order: index2 + 1, + value: el2.getAttribute("wire:sortable-group.item-group"), + items: el2.livewire_sortable.toArray().map((value, index3) => { + return { + order: index3 + 1, + value + }; + }) + }; + }); + masterEl.closest("[wire\\:id]").__livewire.$wire.call(masterEl.getAttribute("wire:sortable-group"), groups); + } + }); + }); + // resources/js/index.js window.SlideOverPanel = panel_default; document.addEventListener("alpine:init", () => { - const theme = localStorage.getItem("theme") ?? "light"; + const theme = localStorage.getItem("theme") ?? "system"; window.Alpine.store( "theme", theme === "dark" || theme === "system" && window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" @@ -171,4 +2512,14 @@ }); }); })(); -//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vcmVzb3VyY2VzL2pzL2NvbXBvbmVudHMvcGFuZWwuanMiLCAiLi4vcmVzb3VyY2VzL2pzL2luZGV4LmpzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBTbGlkZU92ZXJQYW5lbCA9ICgpID0+IHtcbiAgcmV0dXJuIHtcbiAgICBvcGVuOiBmYWxzZSxcbiAgICBzaG93QWN0aXZlQ29tcG9uZW50OiB0cnVlLFxuICAgIGFjdGl2ZUNvbXBvbmVudDogZmFsc2UsXG4gICAgY29tcG9uZW50SGlzdG9yeTogW10sXG4gICAgcGFuZWxXaWR0aDogbnVsbCxcbiAgICBsaXN0ZW5lcnM6IFtdLFxuICAgIGdldEFjdGl2ZUNvbXBvbmVudFBhbmVsQXR0cmlidXRlKGtleSkge1xuICAgICAgaWYgKHRoaXMuJHdpcmUuZ2V0KCdjb21wb25lbnRzJylbdGhpcy5hY3RpdmVDb21wb25lbnRdICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuJHdpcmUuZ2V0KCdjb21wb25lbnRzJylbdGhpcy5hY3RpdmVDb21wb25lbnRdWydwYW5lbEF0dHJpYnV0ZXMnXVtrZXldO1xuICAgICAgfVxuICAgIH0sXG4gICAgY2xvc2VQYW5lbE9uRXNjYXBlKHR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NILENBQUM7IiwKICAibmFtZXMiOiBbImlkIiwgInRoZW1lIl0KfQo= +/*! Bundled license information: + +sortablejs/modular/sortable.esm.js: + (**! + * Sortable 1.15.2 + * @author RubaXa + * @author owenm + * @license MIT + *) +*/ +//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiLi4vcmVzb3VyY2VzL2pzL2NvbXBvbmVudHMvcGFuZWwuanMiLCAiLi4vbm9kZV9tb2R1bGVzL3NvcnRhYmxlanMvbW9kdWxhci9zb3J0YWJsZS5lc20uanMiLCAiLi4vcmVzb3VyY2VzL2pzL2NvbXBvbmVudHMvc29ydGFibGUuanMiLCAiLi4vcmVzb3VyY2VzL2pzL2luZGV4LmpzIl0sCiAgInNvdXJjZXNDb250ZW50IjogWyJjb25zdCBTbGlkZU92ZXJQYW5lbCA9ICgpID0+IHtcbiAgcmV0dXJuIHtcbiAgICBvcGVuOiBmYWxzZSxcbiAgICBzaG93QWN0aXZlQ29tcG9uZW50OiB0cnVlLFxuICAgIGFjdGl2ZUNvbXBvbmVudDogZmFsc2UsXG4gICAgY29tcG9uZW50SGlzdG9yeTogW10sXG4gICAgcGFuZWxXaWR0aDogbnVsbCxcbiAgICBsaXN0ZW5lcnM6IFtdLFxuICAgIGdldEFjdGl2ZUNvbXBvbmVudFBhbmVsQXR0cmlidXRlKGtleSkge1xuICAgICAgaWYgKHRoaXMuJHdpcmUuZ2V0KCdjb21wb25lbnRzJylbdGhpcy5hY3RpdmVDb21wb25lbnRdICE9PSB1bmRlZmluZWQpIHtcbiAgICAgICAgcmV0dXJuIHRoaXMuJHdpcmUuZ2V0KCdjb21wb25lbnRzJylbdGhpcy5hY3RpdmVDb21wb25lbnRdWydwYW5lbEF0dHJpYnV0ZXMnXVtrZXldO1xuICAgICAgfVxuICAgIH0sXG4gICAgY2xvc2VQYW5lbE9uRXNjYXBlKHRyaWdnZXIpIHtcbiAgICAgIGlmICh0aGlzLmdldEFjdGl2ZUN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GlvbjtcbiAgICAgICAgICB9XG4gICAgICAgICAgX3RoaXMuYW5pbWF0ZSh0YXJnZXQsIGFuaW1hdGluZ1JlY3QsIHRvUmVjdCwgdGltZSk7XG4gICAgICAgIH1cbiAgICAgICAgaWYgKHRpbWUpIHtcbiAgICAgICAgICBhbmltYXRpbmcgPSB0cnVlO1xuICAgICAgICAgIGFuaW1hdGlvblRpbWUgPSBNYXRoLm1heChhbmltYXRpb25UaW1lLCB0aW1lKTtcbiAgICAgICAgICBjbGVhclRpbWVvdXQodGFyZ2V0LmFuaW1hdGlvblJlc2V0VGltZXIpO1xuICAgICAgICAgIHRhcmdldC5hbmltYXRpb25SZXNldFRpbWVyID0gc2V0VGltZW91dChmdW5jdGlvbiAoKSB7XG4gICAgICAgICAgICB0YXJnZXQuYW5pbWF0aW9uVGltZSA9IDA7XG4gICAgICAgICAgICB0YXJnZXQucHJldkZyb21SZWN0ID0gbnVsbDtcbiAgICAgICAgICAgIHRhcmdldC5mcm9tUmVjdCA9IG51bGw7XG4gICAgICAgICAgICB0YXJnZXQucHJldlRvUmVjdCA9IG51bGw7XG4gICAgICAgICAgICB0YXJnZXQudGhpc0FuaW1hdGlvbkR1cmF0aW9uID0gbnVsbDtcbiAgICAgICAgICB9LCB0aW1lKTtcbiAgICAgICAgICB0YXJnZXQudGhpc0FuaW1hdGlvbkR1cmF0aW9uID0gdGltZTtcbiAgICAgICAgfVxuICAgICAgfSk7XG4gICAgICBjbGVhclRpbWVvdXQoYW5pbWF0aW9uQ2FsbGJhY2tJZCk7XG4gICAgICBpZiAoIWFuaW1hdGluZykge1xuICAgICAgICBpZiAodHlwZW9mIGNhbGxiYWNrID09PSAnZnVuY3Rpb24nKSBjYWxsYmFjaygpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgYW5pbWF0aW9uQ2FsbGJhY2tJZCA9IHNldFRpbWVvdXQoZnVuY3Rpb24gKCkge1xuICAgICAgICAgIGlmICh0eXBlb2YgY2FsbGJhY2sgPT09ICd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RWwgIT09IHBhcmVudEVsKSB7XG4gICAgICAgICAgaWYgKG5ld0luZGV4ID49IDApIHtcbiAgICAgICAgICAgIC8vIEFkZCBldmVudFxuICAgICAgICAgICAgX2Rpc3BhdGNoRXZlbnQoe1xuICAgICAgICAgICAgICByb290RWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICBuYW1lOiAnYWRkJyxcbiAgICAgICAgICAgICAgdG9FbDogcGFyZW50RWwsXG4gICAgICAgICAgICAgIGZyb21FbDogcm9vdEVsLFxuICAgICAgICAgICAgICBvcmlnaW5hbEV2ZW50OiBldnRcbiAgICAgICAgICAgIH0pO1xuXG4gICAgICAgICAgICAvLyBSZW1vdmUgZXZlbnRcbiAgICAgICAgICAgIF9kaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgIG5hbWU6ICdyZW1vdmUnLFxuICAgICAgICAgICAgICB0b0VsOiBwYXJlbnRFbCxcbiAgICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgICB9KTtcblxuICAgICAgICAgICAgLy8gZHJhZyBmcm9tIG9uZSBsaXN0IGFuZCBkcm9wIGludG8gYW5vdGhlclxuICAgICAgICAgICAgX2Rpc3BhdGNoRXZlbnQoe1xuICAgICAgICAgICAgICByb290RWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICBuYW1lOiAnc29ydCcsXG4gICAgICAgICAgICAgIHRvRWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICBmcm9tRWw6IHJvb3RFbCxcbiAgICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIF9kaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgIG5hbWU6ICdzb3J0JyxcbiAgICAgICAgICAgICAgdG9FbDogcGFyZW50RWwsXG4gICAgICAgICAgICAgIG9yaWdpbmFsRXZlbnQ6IGV2dFxuICAgICAgICAgICAgfSk7XG4gICAgICAgICAgfVxuICAgICAgICAgIHB1dFNvcnRhYmxlICYmIHB1dFNvcnRhYmxlLnNhdmUoKTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBpZiAobmV3SW5kZXggIT09IG9sZEluZGV4KSB7XG4gICAgICAgICAgICBpZiAobmV3SW5kZXggPj0gMCkge1xuICAgICAgICAgICAgICAvLyBkcmFnICYgZHJvcCB3aXRoaW4gdGhlIHNhbWUgbGlzdFxuICAgICAgICAgICAgICBfZGlzcGF0Y2hFdmVudCh7XG4gICAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgICAgbmFtZTogJ3VwZGF0ZScsXG4gICAgICAgICAgICAgICAgdG9FbDogcGFyZW50RWwsXG4gICAgICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgICBfZGlzcGF0Y2hFdmVudCh7XG4gICAgICAgICAgICAgICAgc29ydGFibGU6IHRoaXMsXG4gICAgICAgICAgICAgICAgbmFtZTogJ3NvcnQnLFxuICAgICAgICAgICAgICAgIHRvRWw6IHBhcmVudEVsLFxuICAgICAgICAgICAgICAgIG9yaWdpbmFsRXZlbnQ6IGV2dFxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgICAgaWYgKFNvcnRhYmxlLmFjdGl2ZSkge1xuICAgICAgICAgIC8qIGpzaGludCBlcW51bGw6dHJ1ZSAqL1xuICAgICAgICAgIGlmIChuZXdJbmRleCA9PSBudWxsIHx8IG5ld0luZGV4ID09PSAtMSkge1xuICAgICAgICAgICAgbmV3SW5kZXggPSBvbGRJbmRleDtcbiAgICAgICAgICAgIG5ld0RyYWdnYWJsZUluZGV4ID0gb2xkRHJhZ2dhYmxlSW5kZXg7XG4gICAgIC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AmJiAhY2xvbmVzSGlkZGVuICYmIGNsb25lc0hpZGRlbkJlZm9yZSkge1xuICAgICAgICAgICAgICBtdWx0aURyYWdDbG9uZXMuZm9yRWFjaChmdW5jdGlvbiAoY2xvbmUpIHtcbiAgICAgICAgICAgICAgICBhY3RpdmVTb3J0YWJsZS5hZGRBbmltYXRpb25TdGF0ZSh7XG4gICAgICAgICAgICAgICAgICB0YXJnZXQ6IGNsb25lLFxuICAgICAgICAgICAgICAgICAgcmVjdDogY2xvbmVzRnJvbVJlY3RcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgICBjbG9uZS5mcm9tUmVjdCA9IGNsb25lc0Zyb21SZWN0O1xuICAgICAgICAgICAgICAgIGNsb25lLnRoaXNBbmltYXRpb25EdXJhdGlvbiA9IG51bGw7XG4gICAgICAgICAgICAgIH0pO1xuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBhY3RpdmVTb3J0YWJsZS5fc2hvd0Nsb25lKHNvcnRhYmxlKTtcbiAgICAgICAgICB9XG4gICAgICAgIH1cbiAgICAgIH1cbiAgICB9LFxuICAgIGRyYWdPdmVyQW5pbWF0aW9uQ2FwdHVyZTogZnVuY3Rpb24gZHJhZ092ZXJBbmltYXRpb25DYXB0dXJlKF9yZWYxMSkge1xuICAgICAgdmFyIGRyYWdSZWN0ID0gX3JlZjExLmRyYWdSZWN0LFxuICAgICAgICBpc093bmVyID0gX3JlZjExLmlzT3duZXIsXG4gICAgICAgIGFjdGl2ZVNvcnRhYmxlID0gX3JlZjExLmFjdGl2ZVNvcnRhYmxlO1xuICAgICAgbXVsdGlEcmFnRWxlbWVudHMuZm9yRWFjaChmdW5jdGlvbiAobXVsdGlEcmFnRWxlbWVudCkge1xuICAgICAgICBtdWx0aURyYWdFbGVtZW50LnRoaXNBbmltYXRpb25EdXJhdGlvbiA9IG51bGw7XG4gICAgICB9KTtcbiAgICAgIGlmIChhY3RpdmVTb3J0YWJsZ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YWdTZWxlY3QpKSB7XG4gICAgICAgICAgICB2YXIgbGFzdEluZGV4ID0gaW5kZXgobGFzdE11bHRpRHJhZ1NlbGVjdCksXG4gICAgICAgICAgICAgIGN1cnJlbnRJbmRleCA9IGluZGV4KGRyYWdFbCQxKTtcbiAgICAgICAgICAgIGlmICh+bGFzdEluZGV4ICYmIH5jdXJyZW50SW5kZXggJiYgbGFzdEluZGV4ICE9PSBjdXJyZW50SW5kZXgpIHtcbiAgICAgICAgICAgICAgLy8gTXVzdCBpbmNsdWRlIGxhc3RNdWx0aURyYWdTZWxlY3QgKHNlbGVjdCBpdCksIGluIGNhc2UgbW9kaWZpZWQgc2VsZWN0aW9uIGZyb20gbm8gc2VsZWN0aW9uXG4gICAgICAgICAgICAgIC8vIChidXQgcHJldmlvdXMgc2VsZWN0aW9uIGV4aXN0ZWQpXG4gICAgICAgICAgICAgIHZhciBuLCBpO1xuICAgICAgICAgICAgICBpZiAoY3VycmVudEluZGV4ID4gbGFzdEluZGV4KSB7XG4gICAgICAgICAgICAgICAgaSA9IGxhc3RJbmRleDtcbiAgICAgICAgICAgICAgICBuID0gY3VycmVudEluZGV4O1xuICAgICAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgICAgIGkgPSBjdXJyZW50SW5kZXg7XG4gICAgICAgICAgICAgICAgbiA9IGxhc3RJbmRleCArIDE7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgZm9yICg7IGkgPCBuOyBpKyspIHtcbiAgICAgICAgICAgICAgICBpZiAofm11bHRpRHJhZ0VsZW1lbnRzLmluZGV4T2YoY2hpbGRyZW5baV0pKSBjb250aW51ZTtcbiAgICAgICAgICAgICAgICB0b2dnbGVDbGFzcyhjaGlsZHJlbltpXSwgb3B0aW9ucy5zZWxlY3RlZENsYXNzLCB0cnVlKTtcbiAgICAgICAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5wdXNoKGNoaWxkcmVuW2ldKTtcbiAgICAgICAgICAgICAgICBkaXNwYXRjaEV2ZW50KHtcbiAgICAgICAgICAgICAgICAgIHNvcnRhYmxlOiBzb3J0YWJsZSxcbiAgICAgICAgICAgICAgICAgIHJvb3RFbDogcm9vdEVsLFxuICAgICAgICAgICAgICAgICAgbmFtZTogJ3NlbGVjdCcsXG4gICAgICAgICAgICAgICAgICB0YXJnZXRFbDogY2hpbGRyZW5baV0sXG4gICAgICAgICAgICAgICAgICBvcmlnaW5hbEV2ZW50OiBldnRcbiAgICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICBsYXN0TXVsdGlEcmFnU2VsZWN0ID0gZHJhZ0VsJDE7XG4gICAgICAgICAgfVxuICAgICAgICAgIG11bHRpRHJhZ1NvcnRhYmxlID0gdG9Tb3J0YWJsZTtcbiAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5zcGxpY2UobXVsdGlEcmFnRWxlbWVudHMuaW5kZXhPZihkcmFnRWwkMSksIDEpO1xuICAgICAgICAgIGxhc3RNdWx0aURyYWdTZWxlY3QgPSBudWxsO1xuICAgICAgICAgIGRpc3BhdGNoRXZlbnQoe1xuICAgICAgICAgICAgc29ydGFibGU6IHNvcnRhYmxlLFxuICAgICAgICAgICAgcm9vdEVsOiByb290RWwsXG4gICAgICAgICAgICBuYW1lOiAnZGVzZWxlY3QnLFxuICAgICAgICAgICAgdGFyZ2V0RWw6IGRyYWdFbCQxLFxuICAgICAgICAgICAgb3JpZ2luYWxFdmVudDogZXZ0XG4gICAgICAgICAgfSk7XG4gICAgICAgIH1cbiAgICAgIH1cblxuICAgICAgLy8gTXVsdGktZHJhZyBkcm9wXG4gICAgICBpZiAoZHJhZ1N0YXJ0ZWQgJiYgdGhpcy5pc011bHRpRHJhZykge1xuICAgICAgICBmb2xkaW5nID0gZmFsc2U7XG4gICAgICAgIC8vIERvIG5vdCBcInVuZm9sZFwi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mVjdCA9IHJlY3Q7XG5cbiAgICAgICAgICAgICAgICAgIC8vIFByZXBhcmUgdW5mb2xkIGFuaW1hdGlvblxuICAgICAgICAgICAgICAgICAgdG9Tb3J0YWJsZS5hZGRBbmltYXRpb25TdGF0ZSh7XG4gICAgICAgICAgICAgICAgICAgIHRhcmdldDogbXVsdGlEcmFnRWxlbWVudCxcbiAgICAgICAgICAgICAgICAgICAgcmVjdDogcmVjdFxuICAgICAgICAgICAgICAgICAgfSk7XG4gICAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICB9KTtcbiAgICAgICAgICAgIH1cblxuICAgICAgICAgICAgLy8gTXVsdGkgZHJhZyBlbGVtZW50cyBhcmUgbm90IG5lY2Vzc2FyaWx5IHJlbW92ZWQgZnJvbSB0aGUgRE9NIG9uIGRyb3AsIHNvIHRvIHJlaW5zZXJ0XG4gICAgICAgICAgICAvLyBwcm9wZXJseSB0aGV5IG11c3QgYWxsIGJlIHJlbW92ZWRcbiAgICAgICAgICAgIHJlbW92ZU11bHRpRHJhZ0VsZW1lbnRzKCk7XG4gICAgICAgICAgICBtdWx0aURyYWdFbGVtZW50cy5mb3JFYWNoKGZ1bmN0aW9uIChtdWx0aURyYWdFbGVtZW50KSB7XG4gICAgICAgICAgICAgIGlmIChjaGlsZHJlblttdWx0aURyYWdJbmRleF0pIHtcbiAgICAgICAgICAgICAgICBwYXJlbnRFbC5pbnNlcnRCZWZvcmUobXVsdGlEcmFnRWxlbWVudCwgY2hpbGRyZW5bbXVsdGlEcmFnSW5kZXhdKTtcbiAgICAgICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgICAgICBwYXJlbnRFbC5hcHBlbmRDaGlsZChtdWx0aURyYWdFbGVtZW50KTtcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgICBtdWx0aURyYWdJbmRleCsrO1xuICAgICAgICAgICAgfSk7XG5cbiAgICAgICAgICAgIC8vIElmIGluaXRpYWwgZm9sZGluZyBpcyBkb25lLCB0aGUg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E1BQU07QUFDekIsWUFBTUEsU0FBUSxPQUFPLE9BQU8sTUFBTSxPQUFPO0FBRXpDLE1BQUFBLFdBQVUsU0FDTixTQUFTLGdCQUFnQixVQUFVLElBQUksTUFBTSxJQUM3QyxTQUFTLGdCQUFnQixVQUFVLE9BQU8sTUFBTTtBQUFBLElBQ3RELENBQUM7QUFBQSxFQUNILENBQUM7IiwKICAibmFtZXMiOiBbImlkIiwgIm9iaiIsICJpbmRleCIsICJnaG9zdEVsIiwgIm9wdGlvbiIsICJkZWZhdWx0cyIsICJyb290RWwiLCAiY2xvbmVFbCIsICJvbGRJbmRleCIsICJuZXdJbmRleCIsICJvbGREcmFnZ2FibGVJbmRleCIsICJuZXdEcmFnZ2FibGVJbmRleCIsICJwdXRTb3J0YWJsZSIsICJwbHVnaW5FdmVudCIsICJfZGV0ZWN0RGlyZWN0aW9uIiwgIl9kcmFnRWxJblJvd0NvbHVtbiIsICJfZGV0ZWN0TmVhcmVzdEVtcHR5U29ydGFibGUiLCAiX3ByZXBhcmVHcm91cCIsICJkcmFnRWwiLCAiX2hpZGVHaG9zdEZvclRhcmdldCIsICJfdW5oaWRlR2hvc3RGb3JUYXJnZXQiLCAibmVhcmVzdEVtcHR5SW5zZXJ0RGV0ZWN0RXZlbnQiLCAiX2NoZWNrT3V0c2lkZVRhcmdldEVsIiwgImRyYWdTdGFydEZuIiwgInRhcmdldCIsICJhZnRlciIsICJlbCIsICJwbHVnaW5zIiwgImRyb3AiLCAiYXV0b1Njcm9sbCIsICJvblNwaWxsIiwgImluZGV4IiwgImNvbXBvbmVudCIsICJlbCIsICJ0aGVtZSJdCn0K diff --git a/packages/admin/resources/js/components/sortable.js b/packages/admin/resources/js/components/sortable.js new file mode 100644 index 000000000..c09214585 --- /dev/null +++ b/packages/admin/resources/js/components/sortable.js @@ -0,0 +1,137 @@ +import Sortable from 'sortablejs' + +window.Sortable = Sortable + +if (typeof window.Livewire === 'undefined') { + throw 'Livewire Sortable Plugin: window.Livewire is undefined. Make sure @livewireScripts is placed above this script include' +} + +const moveEndMorphMarker = (el) => { + const endMorphMarker = Array.from(el.childNodes).filter((childNode) => { + return childNode.nodeType === 8 && ['[if ENDBLOCK]> { + if (directive.modifiers.length > 0) { + return + } + + let options = {} + + if (el.hasAttribute('wire:sortable.options')) { + options = (new Function(`return ${el.getAttribute('wire:sortable.options')};`))() + } + + el.livewire_sortable = window.Sortable.create(el, { + sort: true, + ...options, + draggable: '[wire\\:sortable\\.item]', + handle: el.querySelector('[wire\\:sortable\\.handle]') ? '[wire\\:sortable\\.handle]' : null, + dataIdAttr: 'wire:sortable.item', + group: { + pull: false, + put: false, + ...options.group, + name: el.getAttribute('wire:sortable'), + }, + store: { + ...options.store, + set: function (sortable) { + let items = sortable.toArray().map((value, index) => { + return { + order: index + 1, + value: value, + } + }) + + moveEndMorphMarker(el) + + component.$wire.call(directive.method, items) + }, + }, + }) + + let hasSetHandleCorrectly = el.querySelector('[wire\\:sortable\\.item]') !== null + + // If there are already items, then the 'handle' option has already been correctly set. + // The option does not have to reevaluated after the next Livewire component update. + if (hasSetHandleCorrectly) { + return + } + + const currentComponent = component + + Livewire.hook('commit', ({ component, succeed }) => { + if (component.id !== currentComponent.id) { + return + } + + if (hasSetHandleCorrectly) { + return + } + + succeed(() => { + queueMicrotask(() => { + el.livewire_sortable.option('handle', el.querySelector('[wire\\:sortable\\.handle]') ? '[wire\\:sortable\\.handle]' : null) + + hasSetHandleCorrectly = el.querySelector('[wire\\:sortable\\.item]') !== null + }) + }) + }) +}) + +Livewire.directive('sortable-group', ({ el, directive, component }) => { + // Only fire this handler on the "root" group directive. + if (! directive.modifiers.includes('item-group')) { + return + } + + let options = {} + + if (el.hasAttribute('wire:sortable-group.options')) { + options = (new Function(`return ${el.getAttribute('wire:sortable-group.options')};`))(); + } + + el.livewire_sortable = window.Sortable.create(el, { + sort: true, + ...options, + draggable: '[wire\\:sortable-group\\.item]', + handle: '[wire\\:sortable-group\\.handle]', + dataIdAttr: 'wire:sortable-group.item', + group: { + pull: true, + put: true, + ...options.group, + name: el.closest('[wire\\:sortable-group]').getAttribute('wire:sortable-group'), + }, + onSort: (evt) => { + if (evt.to !== evt.from && el === evt.from) { + return + } + + let masterEl = el.closest('[wire\\:sortable-group]') + + let groups = Array.from(masterEl.querySelectorAll('[wire\\:sortable-group\\.item-group]')).map((el, index) => { + moveEndMorphMarker(el) + + return { + order: index + 1, + value: el.getAttribute('wire:sortable-group.item-group'), + items: el.livewire_sortable.toArray().map((value, index) => { + return { + order: index + 1, + value: value + } + }), + } + }) + + masterEl.closest('[wire\\:id]').__livewire.$wire.call(masterEl.getAttribute('wire:sortable-group'), groups) + }, + }) +}) diff --git a/packages/admin/resources/js/index.js b/packages/admin/resources/js/index.js index 66cde8f11..b4234e32e 100755 --- a/packages/admin/resources/js/index.js +++ b/packages/admin/resources/js/index.js @@ -1,65 +1,10 @@ -/* -import { Alpine, Livewire } from '../../vendor/livewire/livewire/dist/livewire.esm' - -import internationalNumber from './plugins/internationalNumber' -import KeyPress from './plugins/keyPress' -import './helpers/window' -import './helpers/trix' - -Alpine.plugin(KeyPress) -Alpine.data('internationalNumber', internationalNumber) - -window.internationalNumber = internationalNumber - -const theme = localStorage.getItem('theme') ?? 'system' - -window.Alpine.store( - 'theme', - theme === 'dark' || - (theme === 'system' && - window.matchMedia('(prefers-color-scheme: dark)').matches) - ? 'dark' - : 'light', -) - -window.addEventListener('theme-changed', (event) => { - let theme = event.detail - - localStorage.setItem('theme', theme) - - if (theme === 'system') { - theme = window.matchMedia('(prefers-color-scheme: dark)').matches - ? 'dark' - : 'light' - } - - window.Alpine.store('theme', theme) -}) - -window - .matchMedia('(prefers-color-scheme: dark)') - .addEventListener('change', (event) => { - if (localStorage.getItem('theme') === 'system') { - window.Alpine.store('theme', event.matches ? 'dark' : 'light') - } - }) - -window.Alpine.effect(() => { - const theme = window.Alpine.store('theme') - - theme === 'dark' - ? document.documentElement.classList.add('dark') - : document.documentElement.classList.remove('dark') -}) - -Livewire.start() -*/ import SlideOverPanel from './components/panel' +import './components/sortable' window.SlideOverPanel = SlideOverPanel document.addEventListener('alpine:init', () => { - const theme = localStorage.getItem('theme') ?? 'light' + const theme = localStorage.getItem('theme') ?? 'system' window.Alpine.store( 'theme', diff --git a/packages/admin/resources/lang/en/words.php b/packages/admin/resources/lang/en/words.php index df1e04bbe..1385b0ac8 100755 --- a/packages/admin/resources/lang/en/words.php +++ b/packages/admin/resources/lang/en/words.php @@ -164,5 +164,7 @@ 'icon_no_result' => 'No matching icons found', 'selection' => 'Selection', 'sign_in_as' => 'Signed in as', + 'general' => 'General', + 'slug_description' => 'Use to generate the right url format for your store', ]; diff --git a/packages/admin/resources/lang/fr/words.php b/packages/admin/resources/lang/fr/words.php index bbff97884..f9806cd1e 100755 --- a/packages/admin/resources/lang/fr/words.php +++ b/packages/admin/resources/lang/fr/words.php @@ -163,5 +163,7 @@ 'icon_no_result' => 'Aucun résultat pour cette recherche.', 'selection' => 'Séléction', 'sign_in_as' => 'Connecté avec', + 'general' => 'Général', + 'slug_description' => 'Utiliser pour la génération de bon format url sur votre boutique', ]; diff --git a/packages/admin/resources/views/components/breadcrumb/index.blade.php b/packages/admin/resources/views/components/breadcrumb/index.blade.php index 71d0fa05a..ae20c9cd6 100755 --- a/packages/admin/resources/views/components/breadcrumb/index.blade.php +++ b/packages/admin/resources/views/components/breadcrumb/index.blade.php @@ -2,15 +2,15 @@