zmdms-webui 2.5.1 → 2.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/es/_virtual/index2.js +2 -2
- package/dist/es/modal/useDraggable.js +1 -1
- package/dist/es/node_modules/immutability-helper/index.js +1 -1
- package/dist/es/node_modules/rc-util/es/Dom/findDOMNode.js +2 -2
- package/dist/es/node_modules/react-is/cjs/react-is.development.js +1 -1
- package/dist/es/node_modules/react-is/cjs/react-is.production.min.js +1 -1
- package/dist/es/node_modules/react-is/index.js +1 -1
- package/package.json +2 -2
- package/dist/es/_virtual/Draggable.js +0 -3
- package/dist/es/_virtual/DraggableCore.js +0 -3
- package/dist/es/_virtual/cjs.js +0 -3
- package/dist/es/_virtual/clsx.js +0 -3
- package/dist/es/_virtual/domFns.js +0 -3
- package/dist/es/_virtual/getPrefix.js +0 -3
- package/dist/es/_virtual/index4.js +0 -3
- package/dist/es/_virtual/index5.js +0 -3
- package/dist/es/_virtual/log.js +0 -3
- package/dist/es/_virtual/positionFns.js +0 -3
- package/dist/es/_virtual/react-is.development2.js +0 -3
- package/dist/es/_virtual/react-is.production.min2.js +0 -3
- package/dist/es/_virtual/shims.js +0 -3
- package/dist/es/node_modules/object-assign/index.js +0 -99
- package/dist/es/node_modules/prop-types/checkPropTypes.js +0 -115
- package/dist/es/node_modules/prop-types/factoryWithThrowingShims.js +0 -74
- package/dist/es/node_modules/prop-types/factoryWithTypeCheckers.js +0 -625
- package/dist/es/node_modules/prop-types/index.js +0 -28
- package/dist/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +0 -21
- package/dist/es/node_modules/prop-types/lib/has.js +0 -11
- package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +0 -190
- package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +0 -26
- package/dist/es/node_modules/prop-types/node_modules/react-is/index.js +0 -19
- package/dist/es/node_modules/react-draggable/build/cjs/Draggable.js +0 -412
- package/dist/es/node_modules/react-draggable/build/cjs/DraggableCore.js +0 -453
- package/dist/es/node_modules/react-draggable/build/cjs/cjs.js +0 -21
- package/dist/es/node_modules/react-draggable/build/cjs/utils/domFns.js +0 -237
- package/dist/es/node_modules/react-draggable/build/cjs/utils/getPrefix.js +0 -52
- package/dist/es/node_modules/react-draggable/build/cjs/utils/log.js +0 -9
- package/dist/es/node_modules/react-draggable/build/cjs/utils/positionFns.js +0 -155
- package/dist/es/node_modules/react-draggable/build/cjs/utils/shims.js +0 -33
- package/dist/es/node_modules/react-draggable/node_modules/clsx/dist/clsx.js +0 -7
|
@@ -1,237 +0,0 @@
|
|
|
1
|
-
import { __exports as domFns } from '../../../../../_virtual/domFns.js';
|
|
2
|
-
import './shims.js';
|
|
3
|
-
import './getPrefix.js';
|
|
4
|
-
import { __exports as getPrefix } from '../../../../../_virtual/getPrefix.js';
|
|
5
|
-
import { __exports as shims } from '../../../../../_virtual/shims.js';
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(domFns, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
domFns.addClassName = addClassName;
|
|
11
|
-
domFns.addEvent = addEvent;
|
|
12
|
-
domFns.addUserSelectStyles = addUserSelectStyles;
|
|
13
|
-
domFns.createCSSTransform = createCSSTransform;
|
|
14
|
-
domFns.createSVGTransform = createSVGTransform;
|
|
15
|
-
domFns.getTouch = getTouch;
|
|
16
|
-
domFns.getTouchIdentifier = getTouchIdentifier;
|
|
17
|
-
domFns.getTranslation = getTranslation;
|
|
18
|
-
domFns.innerHeight = innerHeight;
|
|
19
|
-
domFns.innerWidth = innerWidth;
|
|
20
|
-
domFns.matchesSelector = matchesSelector;
|
|
21
|
-
domFns.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
|
|
22
|
-
domFns.offsetXYFromParent = offsetXYFromParent;
|
|
23
|
-
domFns.outerHeight = outerHeight;
|
|
24
|
-
domFns.outerWidth = outerWidth;
|
|
25
|
-
domFns.removeClassName = removeClassName;
|
|
26
|
-
domFns.removeEvent = removeEvent;
|
|
27
|
-
domFns.scheduleRemoveUserSelectStyles = scheduleRemoveUserSelectStyles;
|
|
28
|
-
var _shims = shims;
|
|
29
|
-
var _getPrefix = _interopRequireWildcard(getPrefix);
|
|
30
|
-
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
31
|
-
/*:: import type {ControlPosition, PositionOffsetControlPosition, MouseTouchEvent} from './types';*/
|
|
32
|
-
let matchesSelectorFunc = '';
|
|
33
|
-
function matchesSelector(el /*: Node*/, selector /*: string*/) /*: boolean*/{
|
|
34
|
-
if (!matchesSelectorFunc) {
|
|
35
|
-
matchesSelectorFunc = (0, _shims.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
|
|
36
|
-
// $FlowIgnore: Doesn't think elements are indexable
|
|
37
|
-
return (0, _shims.isFunction)(el[method]);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
// Might not be found entirely (not an Element?) - in that case, bail
|
|
42
|
-
// $FlowIgnore: Doesn't think elements are indexable
|
|
43
|
-
if (!(0, _shims.isFunction)(el[matchesSelectorFunc])) return false;
|
|
44
|
-
|
|
45
|
-
// $FlowIgnore: Doesn't think elements are indexable
|
|
46
|
-
return el[matchesSelectorFunc](selector);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Works up the tree to the draggable itself attempting to match selector.
|
|
50
|
-
function matchesSelectorAndParentsTo(el /*: Node*/, selector /*: string*/, baseNode /*: Node*/) /*: boolean*/{
|
|
51
|
-
let node = el;
|
|
52
|
-
do {
|
|
53
|
-
if (matchesSelector(node, selector)) return true;
|
|
54
|
-
if (node === baseNode) return false;
|
|
55
|
-
// $FlowIgnore[incompatible-type]
|
|
56
|
-
node = node.parentNode;
|
|
57
|
-
} while (node);
|
|
58
|
-
return false;
|
|
59
|
-
}
|
|
60
|
-
function addEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/, inputOptions /*: Object*/) /*: void*/{
|
|
61
|
-
if (!el) return;
|
|
62
|
-
const options = {
|
|
63
|
-
capture: true,
|
|
64
|
-
...inputOptions
|
|
65
|
-
};
|
|
66
|
-
// $FlowIgnore[method-unbinding]
|
|
67
|
-
if (el.addEventListener) {
|
|
68
|
-
el.addEventListener(event, handler, options);
|
|
69
|
-
} else if (el.attachEvent) {
|
|
70
|
-
el.attachEvent('on' + event, handler);
|
|
71
|
-
} else {
|
|
72
|
-
// $FlowIgnore: Doesn't think elements are indexable
|
|
73
|
-
el['on' + event] = handler;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
function removeEvent(el /*: ?Node*/, event /*: string*/, handler /*: Function*/, inputOptions /*: Object*/) /*: void*/{
|
|
77
|
-
if (!el) return;
|
|
78
|
-
const options = {
|
|
79
|
-
capture: true,
|
|
80
|
-
...inputOptions
|
|
81
|
-
};
|
|
82
|
-
// $FlowIgnore[method-unbinding]
|
|
83
|
-
if (el.removeEventListener) {
|
|
84
|
-
el.removeEventListener(event, handler, options);
|
|
85
|
-
} else if (el.detachEvent) {
|
|
86
|
-
el.detachEvent('on' + event, handler);
|
|
87
|
-
} else {
|
|
88
|
-
// $FlowIgnore: Doesn't think elements are indexable
|
|
89
|
-
el['on' + event] = null;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
function outerHeight(node /*: HTMLElement*/) /*: number*/{
|
|
93
|
-
// This is deliberately excluding margin for our calculations, since we are using
|
|
94
|
-
// offsetTop which is including margin. See getBoundPosition
|
|
95
|
-
let height = node.clientHeight;
|
|
96
|
-
const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
|
97
|
-
height += (0, _shims.int)(computedStyle.borderTopWidth);
|
|
98
|
-
height += (0, _shims.int)(computedStyle.borderBottomWidth);
|
|
99
|
-
return height;
|
|
100
|
-
}
|
|
101
|
-
function outerWidth(node /*: HTMLElement*/) /*: number*/{
|
|
102
|
-
// This is deliberately excluding margin for our calculations, since we are using
|
|
103
|
-
// offsetLeft which is including margin. See getBoundPosition
|
|
104
|
-
let width = node.clientWidth;
|
|
105
|
-
const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
|
106
|
-
width += (0, _shims.int)(computedStyle.borderLeftWidth);
|
|
107
|
-
width += (0, _shims.int)(computedStyle.borderRightWidth);
|
|
108
|
-
return width;
|
|
109
|
-
}
|
|
110
|
-
function innerHeight(node /*: HTMLElement*/) /*: number*/{
|
|
111
|
-
let height = node.clientHeight;
|
|
112
|
-
const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
|
113
|
-
height -= (0, _shims.int)(computedStyle.paddingTop);
|
|
114
|
-
height -= (0, _shims.int)(computedStyle.paddingBottom);
|
|
115
|
-
return height;
|
|
116
|
-
}
|
|
117
|
-
function innerWidth(node /*: HTMLElement*/) /*: number*/{
|
|
118
|
-
let width = node.clientWidth;
|
|
119
|
-
const computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
|
120
|
-
width -= (0, _shims.int)(computedStyle.paddingLeft);
|
|
121
|
-
width -= (0, _shims.int)(computedStyle.paddingRight);
|
|
122
|
-
return width;
|
|
123
|
-
}
|
|
124
|
-
/*:: interface EventWithOffset {
|
|
125
|
-
clientX: number, clientY: number
|
|
126
|
-
}*/
|
|
127
|
-
// Get from offsetParent
|
|
128
|
-
function offsetXYFromParent(evt /*: EventWithOffset*/, offsetParent /*: HTMLElement*/, scale /*: number*/) /*: ControlPosition*/{
|
|
129
|
-
const isBody = offsetParent === offsetParent.ownerDocument.body;
|
|
130
|
-
const offsetParentRect = isBody ? {
|
|
131
|
-
left: 0,
|
|
132
|
-
top: 0
|
|
133
|
-
} : offsetParent.getBoundingClientRect();
|
|
134
|
-
const x = (evt.clientX + offsetParent.scrollLeft - offsetParentRect.left) / scale;
|
|
135
|
-
const y = (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale;
|
|
136
|
-
return {
|
|
137
|
-
x,
|
|
138
|
-
y
|
|
139
|
-
};
|
|
140
|
-
}
|
|
141
|
-
function createCSSTransform(controlPos /*: ControlPosition*/, positionOffset /*: PositionOffsetControlPosition*/) /*: Object*/{
|
|
142
|
-
const translation = getTranslation(controlPos, positionOffset, 'px');
|
|
143
|
-
return {
|
|
144
|
-
[(0, _getPrefix.browserPrefixToKey)('transform', _getPrefix.default)]: translation
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
function createSVGTransform(controlPos /*: ControlPosition*/, positionOffset /*: PositionOffsetControlPosition*/) /*: string*/{
|
|
148
|
-
const translation = getTranslation(controlPos, positionOffset, '');
|
|
149
|
-
return translation;
|
|
150
|
-
}
|
|
151
|
-
function getTranslation(_ref /*:: */, positionOffset /*: PositionOffsetControlPosition*/, unitSuffix /*: string*/) /*: string*/{
|
|
152
|
-
let {
|
|
153
|
-
x,
|
|
154
|
-
y
|
|
155
|
-
} /*: ControlPosition*/ = _ref /*: ControlPosition*/;
|
|
156
|
-
let translation = `translate(${x}${unitSuffix},${y}${unitSuffix})`;
|
|
157
|
-
if (positionOffset) {
|
|
158
|
-
const defaultX = `${typeof positionOffset.x === 'string' ? positionOffset.x : positionOffset.x + unitSuffix}`;
|
|
159
|
-
const defaultY = `${typeof positionOffset.y === 'string' ? positionOffset.y : positionOffset.y + unitSuffix}`;
|
|
160
|
-
translation = `translate(${defaultX}, ${defaultY})` + translation;
|
|
161
|
-
}
|
|
162
|
-
return translation;
|
|
163
|
-
}
|
|
164
|
-
function getTouch(e /*: MouseTouchEvent*/, identifier /*: number*/) /*: ?{clientX: number, clientY: number}*/{
|
|
165
|
-
return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, t => identifier === t.identifier) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, t => identifier === t.identifier);
|
|
166
|
-
}
|
|
167
|
-
function getTouchIdentifier(e /*: MouseTouchEvent*/) /*: ?number*/{
|
|
168
|
-
if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
|
|
169
|
-
if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// User-select Hacks:
|
|
173
|
-
//
|
|
174
|
-
// Useful for preventing blue highlights all over everything when dragging.
|
|
175
|
-
|
|
176
|
-
// Note we're passing `document` b/c we could be iframed
|
|
177
|
-
function addUserSelectStyles(doc /*: ?Document*/) {
|
|
178
|
-
if (!doc) return;
|
|
179
|
-
let styleEl = doc.getElementById('react-draggable-style-el');
|
|
180
|
-
if (!styleEl) {
|
|
181
|
-
styleEl = doc.createElement('style');
|
|
182
|
-
styleEl.type = 'text/css';
|
|
183
|
-
styleEl.id = 'react-draggable-style-el';
|
|
184
|
-
styleEl.innerHTML = '.react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n';
|
|
185
|
-
styleEl.innerHTML += '.react-draggable-transparent-selection *::selection {all: inherit;}\n';
|
|
186
|
-
doc.getElementsByTagName('head')[0].appendChild(styleEl);
|
|
187
|
-
}
|
|
188
|
-
if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');
|
|
189
|
-
}
|
|
190
|
-
function scheduleRemoveUserSelectStyles(doc /*: ?Document*/) {
|
|
191
|
-
// Prevent a possible "forced reflow"
|
|
192
|
-
if (window.requestAnimationFrame) {
|
|
193
|
-
window.requestAnimationFrame(() => {
|
|
194
|
-
removeUserSelectStyles(doc);
|
|
195
|
-
});
|
|
196
|
-
} else {
|
|
197
|
-
removeUserSelectStyles(doc);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
function removeUserSelectStyles(doc /*: ?Document*/) {
|
|
201
|
-
if (!doc) return;
|
|
202
|
-
try {
|
|
203
|
-
if (doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection');
|
|
204
|
-
// $FlowIgnore: IE
|
|
205
|
-
if (doc.selection) {
|
|
206
|
-
// $FlowIgnore: IE
|
|
207
|
-
doc.selection.empty();
|
|
208
|
-
} else {
|
|
209
|
-
// Remove selection caused by scroll, unless it's a focused input
|
|
210
|
-
// (we use doc.defaultView in case we're in an iframe)
|
|
211
|
-
const selection = (doc.defaultView || window).getSelection();
|
|
212
|
-
if (selection && selection.type !== 'Caret') {
|
|
213
|
-
selection.removeAllRanges();
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
} catch (e) {
|
|
217
|
-
// probably IE
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
function addClassName(el /*: HTMLElement*/, className /*: string*/) {
|
|
221
|
-
if (el.classList) {
|
|
222
|
-
el.classList.add(className);
|
|
223
|
-
} else {
|
|
224
|
-
if (!el.className.match(new RegExp(`(?:^|\\s)${className}(?!\\S)`))) {
|
|
225
|
-
el.className += ` ${className}`;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
function removeClassName(el /*: HTMLElement*/, className /*: string*/) {
|
|
230
|
-
if (el.classList) {
|
|
231
|
-
el.classList.remove(className);
|
|
232
|
-
} else {
|
|
233
|
-
el.className = el.className.replace(new RegExp(`(?:^|\\s)${className}(?!\\S)`, 'g'), '');
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export { domFns as default };
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { __exports as getPrefix$1 } from '../../../../../_virtual/getPrefix.js';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(getPrefix$1, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
getPrefix$1.browserPrefixToKey = browserPrefixToKey;
|
|
7
|
-
getPrefix$1.browserPrefixToStyle = browserPrefixToStyle;
|
|
8
|
-
getPrefix$1.default = void 0;
|
|
9
|
-
getPrefix$1.getPrefix = getPrefix;
|
|
10
|
-
const prefixes = ['Moz', 'Webkit', 'O', 'ms'];
|
|
11
|
-
function getPrefix() /*: string*/{
|
|
12
|
-
let prop /*: string*/ = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
|
|
13
|
-
// Ensure we're running in an environment where there is actually a global
|
|
14
|
-
// `window` obj
|
|
15
|
-
if (typeof window === 'undefined') return '';
|
|
16
|
-
|
|
17
|
-
// If we're in a pseudo-browser server-side environment, this access
|
|
18
|
-
// path may not exist, so bail out if it doesn't.
|
|
19
|
-
const style = window.document?.documentElement?.style;
|
|
20
|
-
if (!style) return '';
|
|
21
|
-
if (prop in style) return '';
|
|
22
|
-
for (let i = 0; i < prefixes.length; i++) {
|
|
23
|
-
if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
|
|
24
|
-
}
|
|
25
|
-
return '';
|
|
26
|
-
}
|
|
27
|
-
function browserPrefixToKey(prop /*: string*/, prefix /*: string*/) /*: string*/{
|
|
28
|
-
return prefix ? `${prefix}${kebabToTitleCase(prop)}` : prop;
|
|
29
|
-
}
|
|
30
|
-
function browserPrefixToStyle(prop /*: string*/, prefix /*: string*/) /*: string*/{
|
|
31
|
-
return prefix ? `-${prefix.toLowerCase()}-${prop}` : prop;
|
|
32
|
-
}
|
|
33
|
-
function kebabToTitleCase(str /*: string*/) /*: string*/{
|
|
34
|
-
let out = '';
|
|
35
|
-
let shouldCapitalize = true;
|
|
36
|
-
for (let i = 0; i < str.length; i++) {
|
|
37
|
-
if (shouldCapitalize) {
|
|
38
|
-
out += str[i].toUpperCase();
|
|
39
|
-
shouldCapitalize = false;
|
|
40
|
-
} else if (str[i] === '-') {
|
|
41
|
-
shouldCapitalize = true;
|
|
42
|
-
} else {
|
|
43
|
-
out += str[i];
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
return out;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Default export is the prefix itself, like 'Moz', 'Webkit', etc
|
|
50
|
-
// Note that you may have to re-test for certain things; for instance, Chrome 50
|
|
51
|
-
// can handle unprefixed `transform`, but not unprefixed `user-select`
|
|
52
|
-
getPrefix$1.default = (getPrefix() /*: string*/);
|
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
import { __exports as positionFns } from '../../../../../_virtual/positionFns.js';
|
|
2
|
-
import './shims.js';
|
|
3
|
-
import './domFns.js';
|
|
4
|
-
import { __exports as shims } from '../../../../../_virtual/shims.js';
|
|
5
|
-
import { __exports as domFns } from '../../../../../_virtual/domFns.js';
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(positionFns, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
positionFns.canDragX = canDragX;
|
|
11
|
-
positionFns.canDragY = canDragY;
|
|
12
|
-
positionFns.createCoreData = createCoreData;
|
|
13
|
-
positionFns.createDraggableData = createDraggableData;
|
|
14
|
-
positionFns.getBoundPosition = getBoundPosition;
|
|
15
|
-
positionFns.getControlPosition = getControlPosition;
|
|
16
|
-
positionFns.snapToGrid = snapToGrid;
|
|
17
|
-
var _shims = shims;
|
|
18
|
-
var _domFns = domFns;
|
|
19
|
-
/*:: import type Draggable from '../Draggable';*/
|
|
20
|
-
/*:: import type {Bounds, ControlPosition, DraggableData, MouseTouchEvent} from './types';*/
|
|
21
|
-
/*:: import type DraggableCore from '../DraggableCore';*/
|
|
22
|
-
function getBoundPosition(draggable /*: Draggable*/, x /*: number*/, y /*: number*/) /*: [number, number]*/{
|
|
23
|
-
// If no bounds, short-circuit and move on
|
|
24
|
-
if (!draggable.props.bounds) return [x, y];
|
|
25
|
-
|
|
26
|
-
// Clone new bounds
|
|
27
|
-
let {
|
|
28
|
-
bounds
|
|
29
|
-
} = draggable.props;
|
|
30
|
-
bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
|
|
31
|
-
const node = findDOMNode(draggable);
|
|
32
|
-
if (typeof bounds === 'string') {
|
|
33
|
-
const {
|
|
34
|
-
ownerDocument
|
|
35
|
-
} = node;
|
|
36
|
-
const ownerWindow = ownerDocument.defaultView;
|
|
37
|
-
let boundNode;
|
|
38
|
-
if (bounds === 'parent') {
|
|
39
|
-
boundNode = node.parentNode;
|
|
40
|
-
} else {
|
|
41
|
-
// Flow assigns the wrong return type (Node) for getRootNode(),
|
|
42
|
-
// so we cast it to one of the correct types (Element).
|
|
43
|
-
// The others are Document and ShadowRoot.
|
|
44
|
-
// All three implement querySelector() so it's safe to call.
|
|
45
|
-
const rootNode = ((node.getRootNode() /*: any*/) /*: Element*/);
|
|
46
|
-
boundNode = rootNode.querySelector(bounds);
|
|
47
|
-
}
|
|
48
|
-
if (!(boundNode instanceof ownerWindow.HTMLElement)) {
|
|
49
|
-
throw new Error('Bounds selector "' + bounds + '" could not find an element.');
|
|
50
|
-
}
|
|
51
|
-
const boundNodeEl /*: HTMLElement*/ = boundNode; // for Flow, can't seem to refine correctly
|
|
52
|
-
const nodeStyle = ownerWindow.getComputedStyle(node);
|
|
53
|
-
const boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl);
|
|
54
|
-
// Compute bounds. This is a pain with padding and offsets but this gets it exactly right.
|
|
55
|
-
bounds = {
|
|
56
|
-
left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft),
|
|
57
|
-
top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop),
|
|
58
|
-
right: (0, _domFns.innerWidth)(boundNodeEl) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight),
|
|
59
|
-
bottom: (0, _domFns.innerHeight)(boundNodeEl) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom)
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Keep x and y below right and bottom limits...
|
|
64
|
-
if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right);
|
|
65
|
-
if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom);
|
|
66
|
-
|
|
67
|
-
// But above left and top limits.
|
|
68
|
-
if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left);
|
|
69
|
-
if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top);
|
|
70
|
-
return [x, y];
|
|
71
|
-
}
|
|
72
|
-
function snapToGrid(grid /*: [number, number]*/, pendingX /*: number*/, pendingY /*: number*/) /*: [number, number]*/{
|
|
73
|
-
const x = Math.round(pendingX / grid[0]) * grid[0];
|
|
74
|
-
const y = Math.round(pendingY / grid[1]) * grid[1];
|
|
75
|
-
return [x, y];
|
|
76
|
-
}
|
|
77
|
-
function canDragX(draggable /*: Draggable*/) /*: boolean*/{
|
|
78
|
-
return draggable.props.axis === 'both' || draggable.props.axis === 'x';
|
|
79
|
-
}
|
|
80
|
-
function canDragY(draggable /*: Draggable*/) /*: boolean*/{
|
|
81
|
-
return draggable.props.axis === 'both' || draggable.props.axis === 'y';
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// Get {x, y} positions from event.
|
|
85
|
-
function getControlPosition(e /*: MouseTouchEvent*/, touchIdentifier /*: ?number*/, draggableCore /*: DraggableCore*/) /*: ?ControlPosition*/{
|
|
86
|
-
const touchObj = typeof touchIdentifier === 'number' ? (0, _domFns.getTouch)(e, touchIdentifier) : null;
|
|
87
|
-
if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch
|
|
88
|
-
const node = findDOMNode(draggableCore);
|
|
89
|
-
// User can provide an offsetParent if desired.
|
|
90
|
-
const offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
|
|
91
|
-
return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent, draggableCore.props.scale);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Create an data object exposed by <DraggableCore>'s events
|
|
95
|
-
function createCoreData(draggable /*: DraggableCore*/, x /*: number*/, y /*: number*/) /*: DraggableData*/{
|
|
96
|
-
const isStart = !(0, _shims.isNum)(draggable.lastX);
|
|
97
|
-
const node = findDOMNode(draggable);
|
|
98
|
-
if (isStart) {
|
|
99
|
-
// If this is our first move, use the x and y as last coords.
|
|
100
|
-
return {
|
|
101
|
-
node,
|
|
102
|
-
deltaX: 0,
|
|
103
|
-
deltaY: 0,
|
|
104
|
-
lastX: x,
|
|
105
|
-
lastY: y,
|
|
106
|
-
x,
|
|
107
|
-
y
|
|
108
|
-
};
|
|
109
|
-
} else {
|
|
110
|
-
// Otherwise calculate proper values.
|
|
111
|
-
return {
|
|
112
|
-
node,
|
|
113
|
-
deltaX: x - draggable.lastX,
|
|
114
|
-
deltaY: y - draggable.lastY,
|
|
115
|
-
lastX: draggable.lastX,
|
|
116
|
-
lastY: draggable.lastY,
|
|
117
|
-
x,
|
|
118
|
-
y
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Create an data exposed by <Draggable>'s events
|
|
124
|
-
function createDraggableData(draggable /*: Draggable*/, coreData /*: DraggableData*/) /*: DraggableData*/{
|
|
125
|
-
const scale = draggable.props.scale;
|
|
126
|
-
return {
|
|
127
|
-
node: coreData.node,
|
|
128
|
-
x: draggable.state.x + coreData.deltaX / scale,
|
|
129
|
-
y: draggable.state.y + coreData.deltaY / scale,
|
|
130
|
-
deltaX: coreData.deltaX / scale,
|
|
131
|
-
deltaY: coreData.deltaY / scale,
|
|
132
|
-
lastX: draggable.state.x,
|
|
133
|
-
lastY: draggable.state.y
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
// A lot faster than stringify/parse
|
|
138
|
-
function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/{
|
|
139
|
-
return {
|
|
140
|
-
left: bounds.left,
|
|
141
|
-
top: bounds.top,
|
|
142
|
-
right: bounds.right,
|
|
143
|
-
bottom: bounds.bottom
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
function findDOMNode(draggable /*: Draggable | DraggableCore*/) /*: HTMLElement*/{
|
|
147
|
-
const node = draggable.findDOMNode();
|
|
148
|
-
if (!node) {
|
|
149
|
-
throw new Error('<DraggableCore>: Unmounted during event!');
|
|
150
|
-
}
|
|
151
|
-
// $FlowIgnore we can't assert on HTMLElement due to tests... FIXME
|
|
152
|
-
return node;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
export { positionFns as default };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { __exports as shims } from '../../../../../_virtual/shims.js';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(shims, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
shims.dontSetMe = dontSetMe;
|
|
7
|
-
shims.findInArray = findInArray;
|
|
8
|
-
shims.int = int;
|
|
9
|
-
shims.isFunction = isFunction;
|
|
10
|
-
shims.isNum = isNum;
|
|
11
|
-
// @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
|
|
12
|
-
function findInArray(array /*: Array<any> | TouchList*/, callback /*: Function*/) /*: any*/{
|
|
13
|
-
for (let i = 0, length = array.length; i < length; i++) {
|
|
14
|
-
if (callback.apply(callback, [array[i], i, array])) return array[i];
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function isFunction(func /*: any*/) /*: boolean %checks*/{
|
|
18
|
-
// $FlowIgnore[method-unbinding]
|
|
19
|
-
return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
|
|
20
|
-
}
|
|
21
|
-
function isNum(num /*: any*/) /*: boolean %checks*/{
|
|
22
|
-
return typeof num === 'number' && !isNaN(num);
|
|
23
|
-
}
|
|
24
|
-
function int(a /*: string*/) /*: number*/{
|
|
25
|
-
return parseInt(a, 10);
|
|
26
|
-
}
|
|
27
|
-
function dontSetMe(props /*: Object*/, propName /*: string*/, componentName /*: string*/) /*: ?Error*/{
|
|
28
|
-
if (props[propName]) {
|
|
29
|
-
return new Error(`Invalid prop ${propName} passed to ${componentName} - do not set this, set it on the child.`);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export { shims as default };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { __module as clsx } from '../../../../../_virtual/clsx.js';
|
|
2
|
-
|
|
3
|
-
function r(e){var o,t,f="";if("string"==typeof e||"number"==typeof e)f+=e;else if("object"==typeof e)if(Array.isArray(e)){var n=e.length;for(o=0;o<n;o++)e[o]&&(t=r(e[o]))&&(f&&(f+=" "),f+=t);}else for(t in e)e[t]&&(f&&(f+=" "),f+=t);return f}function e(){for(var e,o,t=0,f="",n=arguments.length;t<n;t++)(e=arguments[t])&&(o=r(e))&&(f&&(f+=" "),f+=o);return f}clsx.exports=e,clsx.exports.clsx=e;
|
|
4
|
-
|
|
5
|
-
var clsxExports = clsx.exports;
|
|
6
|
-
|
|
7
|
-
export { clsxExports as c };
|