UNPKG

react-form-create

Version:
1,332 lines 1.14 MB
var __defProp = Object.defineProperty; var __defProps = Object.defineProperties; var __getOwnPropDescs = Object.getOwnPropertyDescriptors; var __getOwnPropSymbols = Object.getOwnPropertySymbols; var __hasOwnProp = Object.prototype.hasOwnProperty; var __propIsEnum = Object.prototype.propertyIsEnumerable; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __spreadValues = (a, b) => { for (var prop in b || (b = {})) if (__hasOwnProp.call(b, prop)) __defNormalProp(a, prop, b[prop]); if (__getOwnPropSymbols) for (var prop of __getOwnPropSymbols(b)) { if (__propIsEnum.call(b, prop)) __defNormalProp(a, prop, b[prop]); } return a; }; var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); import * as React from "react"; import React__default, { memo, useRef, useEffect, createContext, useReducer, createElement, useContext, useCallback, useState, forwardRef, useImperativeHandle, useMemo, isValidElement, PureComponent, Component } from "react"; import * as _antd from "antd"; import { Modal, message, Button as Button$1, Typography as Typography$1, Divider as Divider$1, Row as Row$1, Col as Col$1, Layout, Space as Space$1, Form, AutoComplete as AutoComplete$1, Cascader as Cascader$1, Checkbox as Checkbox$1, DatePicker as DatePicker$1, Input as Input$1, InputNumber as InputNumber$1, Mentions as Mentions$1, Radio, Rate as Rate$1, Select as Select$1, Slider as Slider$2, Switch as Switch$1, TimePicker as TimePicker$1, TreeSelect as TreeSelect$1, Upload as Upload$1, Calendar as Calendar$1, Image as Image$1, Table as Table$1, Tree as Tree$1, Alert as Alert$1, ConfigProvider, Tabs } from "antd"; import moment$1 from "moment"; /**! * Sortable 1.14.0 * @author RubaXa <trash@rubaxa.org> * @author owenm <owen23355@gmail.com> * @license MIT */ function ownKeys$1(object, enumerableOnly) { var keys2 = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function(sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys2.push.apply(keys2, symbols); } return keys2; } function _objectSpread2$1(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys$1(Object(source), true).forEach(function(key) { _defineProperty$3(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys$1(Object(source)).forEach(function(key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _typeof$1(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof$1 = function(obj2) { return typeof obj2; }; } else { _typeof$1 = function(obj2) { return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }; } return _typeof$1(obj); } function _defineProperty$3(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$g() { _extends$g = 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$g.apply(this, arguments); } function _objectWithoutPropertiesLoose$1(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$3(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$1(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.14.0"; 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 transform2 = css(el, "transform"); if (transform2 && transform2 !== "none") { appliedTransforms = transform2 + " " + 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$1(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$1(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$1(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); } } var expando = "Sortable" + 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$1({}, 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) && (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$1({ sortable }, evt)); } if (sortable.options[plugin.pluginName] && sortable[plugin.pluginName][eventName]) { sortable[plugin.pluginName][eventName](_objectSpread2$1({ 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$g(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$g(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$1(_objectSpread2$1({}, 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$2 = ["evt"]; var pluginEvent2 = function pluginEvent3(eventName, sortable) { var _ref = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, originalEvent = _ref.evt, data = _objectWithoutProperties$3(_ref, _excluded$2); PluginManager.pluginEvent.bind(Sortable)(eventName, sortable, _objectSpread2$1({ 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$1({ putSortable, cloneEl, targetEl: dragEl, rootEl, oldIndex, oldDraggableIndex, newIndex, newDraggableIndex }, info)); } var dragEl, parentEl, ghostEl, rootEl, nextEl, lastDownEl, cloneEl, cloneHidden, oldIndex, newIndex, oldDraggableIndex, newDraggableIndex, activeGroup, putSortable, awaitingDragStarted = false, ignoreNextClick = false, sortables = [], tapEvt, touchEvt, lastDx, lastDy, tapDistanceLeft, tapDistanceTop, moved, lastTarget, lastDirection, pastFirstInvertThresh = false, isCircumstantialInvert = false, targetMoveDistance, ghostRelativeParent, ghostRelativeParentInitialScroll = [], _silent = false, savedInputChecked = []; var documentExists = typeof document !== "undefined", PositionGhostAbsolutely = IOS, CSSFloatProperty = Edge || IE11OrLess ? "cssFloat" : "float", supportDraggable = documentExists && !ChromeForAndroid && !IOS && "draggable" in document.createElement("div"), 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"; }(), _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"; }, _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; }, _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; }, _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$1(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; }, _hideGhostForTarget = function _hideGhostForTarget2() { if (!supportCssPointerEvents && ghostEl) { css(ghostEl, "display", "none"); } }, _unhideGhostForTarget = function _unhideGhostForTarget2() { if (!supportCssPointerEvents && ghostEl) { css(ghostEl, "display", ""); } }; if (documentExists) { 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$g({}, 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, invertSwap: false, invertedSwapThreshold: null, 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$g(this, AnimationStateManager()); } 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$1(target); oldDraggableIndex = index$1(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$1(dragEl); 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"); } }, _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$1({ 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.captureAni