zmdms-webui 2.5.0 → 2.5.2
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/Draggable.js +3 -0
- package/dist/es/_virtual/DraggableCore.js +3 -0
- package/dist/es/_virtual/_commonjsHelpers.js +29 -1
- package/dist/es/_virtual/cjs.js +3 -0
- package/dist/es/_virtual/clsx.m.js +6 -0
- package/dist/es/_virtual/domFns.js +3 -0
- package/dist/es/_virtual/getPrefix.js +3 -0
- package/dist/es/_virtual/index2.js +2 -2
- package/dist/es/_virtual/index4.js +3 -0
- package/dist/es/_virtual/index5.js +3 -0
- package/dist/es/_virtual/log.js +3 -0
- package/dist/es/_virtual/positionFns.js +3 -0
- package/dist/es/_virtual/react-is.development2.js +3 -0
- package/dist/es/_virtual/react-is.production.min2.js +3 -0
- package/dist/es/_virtual/shims.js +3 -0
- package/dist/es/applayoutsider/appLayoutSider.d.ts +4 -0
- package/dist/es/applayoutsider/appLayoutSider.js +2 -2
- package/dist/es/applayoutsider/menu/index.js +2 -2
- package/dist/es/canvastable/canvasTable.js +1 -4
- package/dist/es/chatroom/chat-room.js +19 -0
- package/dist/es/chatroom/index.css +1 -0
- package/dist/es/chatroom/index.js +5 -0
- package/dist/es/modal/interface.d.ts +4 -0
- package/dist/es/modal/modal.js +15 -9
- package/dist/es/modal/useDraggable.js +51 -0
- package/dist/es/node_modules/immutability-helper/index.js +1 -1
- package/dist/es/node_modules/object-assign/index.js +99 -0
- package/dist/es/node_modules/prop-types/checkPropTypes.js +115 -0
- package/dist/es/node_modules/prop-types/factoryWithThrowingShims.js +74 -0
- package/dist/es/node_modules/prop-types/factoryWithTypeCheckers.js +625 -0
- package/dist/es/node_modules/prop-types/index.js +28 -0
- package/dist/es/node_modules/prop-types/lib/ReactPropTypesSecret.js +21 -0
- package/dist/es/node_modules/prop-types/lib/has.js +11 -0
- package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.development.js +190 -0
- package/dist/es/node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js +26 -0
- package/dist/es/node_modules/prop-types/node_modules/react-is/index.js +19 -0
- package/dist/es/node_modules/rc-util/es/Dom/findDOMNode.js +2 -2
- package/dist/es/node_modules/react-draggable/build/cjs/Draggable.js +474 -0
- package/dist/es/node_modules/react-draggable/build/cjs/DraggableCore.js +580 -0
- package/dist/es/node_modules/react-draggable/build/cjs/cjs.js +20 -0
- package/dist/es/node_modules/react-draggable/build/cjs/utils/domFns.js +361 -0
- package/dist/es/node_modules/react-draggable/build/cjs/utils/getPrefix.js +85 -0
- package/dist/es/node_modules/react-draggable/build/cjs/utils/log.js +10 -0
- package/dist/es/node_modules/react-draggable/build/cjs/utils/positionFns.js +214 -0
- package/dist/es/node_modules/react-draggable/build/cjs/utils/shims.js +64 -0
- 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/dist/index.dark.css +1 -1
- package/dist/index.default.css +1 -1
- package/dist/less/components/ChatRoom/style/index.less +147 -0
- package/dist/less/components/ChatRoom/style/style.less +2 -0
- package/dist/less/styles/index.less +2 -0
- package/package.json +2 -1
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
import { __exports as domFns } from '../../../../../_virtual/domFns.js';
|
|
2
|
+
import './shims.js';
|
|
3
|
+
import './getPrefix.js';
|
|
4
|
+
import { __exports as shims } from '../../../../../_virtual/shims.js';
|
|
5
|
+
import { __exports as getPrefix } from '../../../../../_virtual/getPrefix.js';
|
|
6
|
+
|
|
7
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
8
|
+
|
|
9
|
+
Object.defineProperty(domFns, "__esModule", {
|
|
10
|
+
value: true
|
|
11
|
+
});
|
|
12
|
+
domFns.addClassName = addClassName;
|
|
13
|
+
domFns.addEvent = addEvent;
|
|
14
|
+
domFns.addUserSelectStyles = addUserSelectStyles;
|
|
15
|
+
domFns.createCSSTransform = createCSSTransform;
|
|
16
|
+
domFns.createSVGTransform = createSVGTransform;
|
|
17
|
+
domFns.getTouch = getTouch;
|
|
18
|
+
domFns.getTouchIdentifier = getTouchIdentifier;
|
|
19
|
+
domFns.getTranslation = getTranslation;
|
|
20
|
+
domFns.innerHeight = innerHeight;
|
|
21
|
+
domFns.innerWidth = innerWidth;
|
|
22
|
+
domFns.matchesSelector = matchesSelector;
|
|
23
|
+
domFns.matchesSelectorAndParentsTo = matchesSelectorAndParentsTo;
|
|
24
|
+
domFns.offsetXYFromParent = offsetXYFromParent;
|
|
25
|
+
domFns.outerHeight = outerHeight;
|
|
26
|
+
domFns.outerWidth = outerWidth;
|
|
27
|
+
domFns.removeClassName = removeClassName;
|
|
28
|
+
domFns.removeEvent = removeEvent;
|
|
29
|
+
domFns.removeUserSelectStyles = removeUserSelectStyles;
|
|
30
|
+
|
|
31
|
+
var _shims = shims;
|
|
32
|
+
|
|
33
|
+
var _getPrefix = _interopRequireWildcard(getPrefix);
|
|
34
|
+
|
|
35
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
36
|
+
|
|
37
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
38
|
+
|
|
39
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
40
|
+
|
|
41
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
42
|
+
|
|
43
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
44
|
+
|
|
45
|
+
var matchesSelectorFunc = '';
|
|
46
|
+
|
|
47
|
+
function matchesSelector(el
|
|
48
|
+
/*: Node*/
|
|
49
|
+
, selector
|
|
50
|
+
/*: string*/
|
|
51
|
+
)
|
|
52
|
+
/*: boolean*/
|
|
53
|
+
{
|
|
54
|
+
if (!matchesSelectorFunc) {
|
|
55
|
+
matchesSelectorFunc = (0, _shims.findInArray)(['matches', 'webkitMatchesSelector', 'mozMatchesSelector', 'msMatchesSelector', 'oMatchesSelector'], function (method) {
|
|
56
|
+
// $FlowIgnore: Doesn't think elements are indexable
|
|
57
|
+
return (0, _shims.isFunction)(el[method]);
|
|
58
|
+
});
|
|
59
|
+
} // Might not be found entirely (not an Element?) - in that case, bail
|
|
60
|
+
// $FlowIgnore: Doesn't think elements are indexable
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
if (!(0, _shims.isFunction)(el[matchesSelectorFunc])) return false; // $FlowIgnore: Doesn't think elements are indexable
|
|
64
|
+
|
|
65
|
+
return el[matchesSelectorFunc](selector);
|
|
66
|
+
} // Works up the tree to the draggable itself attempting to match selector.
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
function matchesSelectorAndParentsTo(el
|
|
70
|
+
/*: Node*/
|
|
71
|
+
, selector
|
|
72
|
+
/*: string*/
|
|
73
|
+
, baseNode
|
|
74
|
+
/*: Node*/
|
|
75
|
+
)
|
|
76
|
+
/*: boolean*/
|
|
77
|
+
{
|
|
78
|
+
var node = el;
|
|
79
|
+
|
|
80
|
+
do {
|
|
81
|
+
if (matchesSelector(node, selector)) return true;
|
|
82
|
+
if (node === baseNode) return false;
|
|
83
|
+
node = node.parentNode;
|
|
84
|
+
} while (node);
|
|
85
|
+
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function addEvent(el
|
|
90
|
+
/*: ?Node*/
|
|
91
|
+
, event
|
|
92
|
+
/*: string*/
|
|
93
|
+
, handler
|
|
94
|
+
/*: Function*/
|
|
95
|
+
, inputOptions
|
|
96
|
+
/*: Object*/
|
|
97
|
+
)
|
|
98
|
+
/*: void*/
|
|
99
|
+
{
|
|
100
|
+
if (!el) return;
|
|
101
|
+
|
|
102
|
+
var options = _objectSpread({
|
|
103
|
+
capture: true
|
|
104
|
+
}, inputOptions); // $FlowIgnore[method-unbinding]
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
if (el.addEventListener) {
|
|
108
|
+
el.addEventListener(event, handler, options);
|
|
109
|
+
} else if (el.attachEvent) {
|
|
110
|
+
el.attachEvent('on' + event, handler);
|
|
111
|
+
} else {
|
|
112
|
+
// $FlowIgnore: Doesn't think elements are indexable
|
|
113
|
+
el['on' + event] = handler;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
function removeEvent(el
|
|
118
|
+
/*: ?Node*/
|
|
119
|
+
, event
|
|
120
|
+
/*: string*/
|
|
121
|
+
, handler
|
|
122
|
+
/*: Function*/
|
|
123
|
+
, inputOptions
|
|
124
|
+
/*: Object*/
|
|
125
|
+
)
|
|
126
|
+
/*: void*/
|
|
127
|
+
{
|
|
128
|
+
if (!el) return;
|
|
129
|
+
|
|
130
|
+
var options = _objectSpread({
|
|
131
|
+
capture: true
|
|
132
|
+
}, inputOptions); // $FlowIgnore[method-unbinding]
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
if (el.removeEventListener) {
|
|
136
|
+
el.removeEventListener(event, handler, options);
|
|
137
|
+
} else if (el.detachEvent) {
|
|
138
|
+
el.detachEvent('on' + event, handler);
|
|
139
|
+
} else {
|
|
140
|
+
// $FlowIgnore: Doesn't think elements are indexable
|
|
141
|
+
el['on' + event] = null;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
function outerHeight(node
|
|
146
|
+
/*: HTMLElement*/
|
|
147
|
+
)
|
|
148
|
+
/*: number*/
|
|
149
|
+
{
|
|
150
|
+
// This is deliberately excluding margin for our calculations, since we are using
|
|
151
|
+
// offsetTop which is including margin. See getBoundPosition
|
|
152
|
+
var height = node.clientHeight;
|
|
153
|
+
var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
|
154
|
+
height += (0, _shims.int)(computedStyle.borderTopWidth);
|
|
155
|
+
height += (0, _shims.int)(computedStyle.borderBottomWidth);
|
|
156
|
+
return height;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function outerWidth(node
|
|
160
|
+
/*: HTMLElement*/
|
|
161
|
+
)
|
|
162
|
+
/*: number*/
|
|
163
|
+
{
|
|
164
|
+
// This is deliberately excluding margin for our calculations, since we are using
|
|
165
|
+
// offsetLeft which is including margin. See getBoundPosition
|
|
166
|
+
var width = node.clientWidth;
|
|
167
|
+
var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
|
168
|
+
width += (0, _shims.int)(computedStyle.borderLeftWidth);
|
|
169
|
+
width += (0, _shims.int)(computedStyle.borderRightWidth);
|
|
170
|
+
return width;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function innerHeight(node
|
|
174
|
+
/*: HTMLElement*/
|
|
175
|
+
)
|
|
176
|
+
/*: number*/
|
|
177
|
+
{
|
|
178
|
+
var height = node.clientHeight;
|
|
179
|
+
var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
|
180
|
+
height -= (0, _shims.int)(computedStyle.paddingTop);
|
|
181
|
+
height -= (0, _shims.int)(computedStyle.paddingBottom);
|
|
182
|
+
return height;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function innerWidth(node
|
|
186
|
+
/*: HTMLElement*/
|
|
187
|
+
)
|
|
188
|
+
/*: number*/
|
|
189
|
+
{
|
|
190
|
+
var width = node.clientWidth;
|
|
191
|
+
var computedStyle = node.ownerDocument.defaultView.getComputedStyle(node);
|
|
192
|
+
width -= (0, _shims.int)(computedStyle.paddingLeft);
|
|
193
|
+
width -= (0, _shims.int)(computedStyle.paddingRight);
|
|
194
|
+
return width;
|
|
195
|
+
}
|
|
196
|
+
/*:: interface EventWithOffset {
|
|
197
|
+
clientX: number, clientY: number
|
|
198
|
+
}*/
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
// Get from offsetParent
|
|
202
|
+
function offsetXYFromParent(evt
|
|
203
|
+
/*: EventWithOffset*/
|
|
204
|
+
, offsetParent
|
|
205
|
+
/*: HTMLElement*/
|
|
206
|
+
, scale
|
|
207
|
+
/*: number*/
|
|
208
|
+
)
|
|
209
|
+
/*: ControlPosition*/
|
|
210
|
+
{
|
|
211
|
+
var isBody = offsetParent === offsetParent.ownerDocument.body;
|
|
212
|
+
var offsetParentRect = isBody ? {
|
|
213
|
+
left: 0,
|
|
214
|
+
top: 0
|
|
215
|
+
} : offsetParent.getBoundingClientRect();
|
|
216
|
+
var x = (evt.clientX + offsetParent.scrollLeft - offsetParentRect.left) / scale;
|
|
217
|
+
var y = (evt.clientY + offsetParent.scrollTop - offsetParentRect.top) / scale;
|
|
218
|
+
return {
|
|
219
|
+
x: x,
|
|
220
|
+
y: y
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function createCSSTransform(controlPos
|
|
225
|
+
/*: ControlPosition*/
|
|
226
|
+
, positionOffset
|
|
227
|
+
/*: PositionOffsetControlPosition*/
|
|
228
|
+
)
|
|
229
|
+
/*: Object*/
|
|
230
|
+
{
|
|
231
|
+
var translation = getTranslation(controlPos, positionOffset, 'px');
|
|
232
|
+
return _defineProperty({}, (0, _getPrefix.browserPrefixToKey)('transform', _getPrefix.default), translation);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function createSVGTransform(controlPos
|
|
236
|
+
/*: ControlPosition*/
|
|
237
|
+
, positionOffset
|
|
238
|
+
/*: PositionOffsetControlPosition*/
|
|
239
|
+
)
|
|
240
|
+
/*: string*/
|
|
241
|
+
{
|
|
242
|
+
var translation = getTranslation(controlPos, positionOffset, '');
|
|
243
|
+
return translation;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
function getTranslation(_ref2, positionOffset
|
|
247
|
+
/*: PositionOffsetControlPosition*/
|
|
248
|
+
, unitSuffix
|
|
249
|
+
/*: string*/
|
|
250
|
+
)
|
|
251
|
+
/*: string*/
|
|
252
|
+
{
|
|
253
|
+
var x = _ref2.x,
|
|
254
|
+
y = _ref2.y;
|
|
255
|
+
var translation = "translate(".concat(x).concat(unitSuffix, ",").concat(y).concat(unitSuffix, ")");
|
|
256
|
+
|
|
257
|
+
if (positionOffset) {
|
|
258
|
+
var defaultX = "".concat(typeof positionOffset.x === 'string' ? positionOffset.x : positionOffset.x + unitSuffix);
|
|
259
|
+
var defaultY = "".concat(typeof positionOffset.y === 'string' ? positionOffset.y : positionOffset.y + unitSuffix);
|
|
260
|
+
translation = "translate(".concat(defaultX, ", ").concat(defaultY, ")") + translation;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
return translation;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function getTouch(e
|
|
267
|
+
/*: MouseTouchEvent*/
|
|
268
|
+
, identifier
|
|
269
|
+
/*: number*/
|
|
270
|
+
)
|
|
271
|
+
/*: ?{clientX: number, clientY: number}*/
|
|
272
|
+
{
|
|
273
|
+
return e.targetTouches && (0, _shims.findInArray)(e.targetTouches, function (t) {
|
|
274
|
+
return identifier === t.identifier;
|
|
275
|
+
}) || e.changedTouches && (0, _shims.findInArray)(e.changedTouches, function (t) {
|
|
276
|
+
return identifier === t.identifier;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
function getTouchIdentifier(e
|
|
281
|
+
/*: MouseTouchEvent*/
|
|
282
|
+
)
|
|
283
|
+
/*: ?number*/
|
|
284
|
+
{
|
|
285
|
+
if (e.targetTouches && e.targetTouches[0]) return e.targetTouches[0].identifier;
|
|
286
|
+
if (e.changedTouches && e.changedTouches[0]) return e.changedTouches[0].identifier;
|
|
287
|
+
} // User-select Hacks:
|
|
288
|
+
//
|
|
289
|
+
// Useful for preventing blue highlights all over everything when dragging.
|
|
290
|
+
// Note we're passing `document` b/c we could be iframed
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
function addUserSelectStyles(doc
|
|
294
|
+
/*: ?Document*/
|
|
295
|
+
) {
|
|
296
|
+
if (!doc) return;
|
|
297
|
+
var styleEl = doc.getElementById('react-draggable-style-el');
|
|
298
|
+
|
|
299
|
+
if (!styleEl) {
|
|
300
|
+
styleEl = doc.createElement('style');
|
|
301
|
+
styleEl.type = 'text/css';
|
|
302
|
+
styleEl.id = 'react-draggable-style-el';
|
|
303
|
+
styleEl.innerHTML = '.react-draggable-transparent-selection *::-moz-selection {all: inherit;}\n';
|
|
304
|
+
styleEl.innerHTML += '.react-draggable-transparent-selection *::selection {all: inherit;}\n';
|
|
305
|
+
doc.getElementsByTagName('head')[0].appendChild(styleEl);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (doc.body) addClassName(doc.body, 'react-draggable-transparent-selection');
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function removeUserSelectStyles(doc
|
|
312
|
+
/*: ?Document*/
|
|
313
|
+
) {
|
|
314
|
+
if (!doc) return;
|
|
315
|
+
|
|
316
|
+
try {
|
|
317
|
+
if (doc.body) removeClassName(doc.body, 'react-draggable-transparent-selection'); // $FlowIgnore: IE
|
|
318
|
+
|
|
319
|
+
if (doc.selection) {
|
|
320
|
+
// $FlowIgnore: IE
|
|
321
|
+
doc.selection.empty();
|
|
322
|
+
} else {
|
|
323
|
+
// Remove selection caused by scroll, unless it's a focused input
|
|
324
|
+
// (we use doc.defaultView in case we're in an iframe)
|
|
325
|
+
var selection = (doc.defaultView || window).getSelection();
|
|
326
|
+
|
|
327
|
+
if (selection && selection.type !== 'Caret') {
|
|
328
|
+
selection.removeAllRanges();
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
} catch (e) {// probably IE
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function addClassName(el
|
|
336
|
+
/*: HTMLElement*/
|
|
337
|
+
, className
|
|
338
|
+
/*: string*/
|
|
339
|
+
) {
|
|
340
|
+
if (el.classList) {
|
|
341
|
+
el.classList.add(className);
|
|
342
|
+
} else {
|
|
343
|
+
if (!el.className.match(new RegExp("(?:^|\\s)".concat(className, "(?!\\S)")))) {
|
|
344
|
+
el.className += " ".concat(className);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
function removeClassName(el
|
|
350
|
+
/*: HTMLElement*/
|
|
351
|
+
, className
|
|
352
|
+
/*: string*/
|
|
353
|
+
) {
|
|
354
|
+
if (el.classList) {
|
|
355
|
+
el.classList.remove(className);
|
|
356
|
+
} else {
|
|
357
|
+
el.className = el.className.replace(new RegExp("(?:^|\\s)".concat(className, "(?!\\S)"), 'g'), '');
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export { domFns as default };
|
|
@@ -0,0 +1,85 @@
|
|
|
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
|
+
var prefixes = ['Moz', 'Webkit', 'O', 'ms'];
|
|
11
|
+
|
|
12
|
+
function getPrefix()
|
|
13
|
+
/*: string*/
|
|
14
|
+
{
|
|
15
|
+
var _window$document, _window$document$docu;
|
|
16
|
+
|
|
17
|
+
var prop
|
|
18
|
+
/*: string*/
|
|
19
|
+
= arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'transform';
|
|
20
|
+
// Ensure we're running in an environment where there is actually a global
|
|
21
|
+
// `window` obj
|
|
22
|
+
if (typeof window === 'undefined') return ''; // If we're in a pseudo-browser server-side environment, this access
|
|
23
|
+
// path may not exist, so bail out if it doesn't.
|
|
24
|
+
|
|
25
|
+
var style = (_window$document = window.document) === null || _window$document === void 0 ? void 0 : (_window$document$docu = _window$document.documentElement) === null || _window$document$docu === void 0 ? void 0 : _window$document$docu.style;
|
|
26
|
+
if (!style) return '';
|
|
27
|
+
if (prop in style) return '';
|
|
28
|
+
|
|
29
|
+
for (var i = 0; i < prefixes.length; i++) {
|
|
30
|
+
if (browserPrefixToKey(prop, prefixes[i]) in style) return prefixes[i];
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return '';
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function browserPrefixToKey(prop
|
|
37
|
+
/*: string*/
|
|
38
|
+
, prefix
|
|
39
|
+
/*: string*/
|
|
40
|
+
)
|
|
41
|
+
/*: string*/
|
|
42
|
+
{
|
|
43
|
+
return prefix ? "".concat(prefix).concat(kebabToTitleCase(prop)) : prop;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function browserPrefixToStyle(prop
|
|
47
|
+
/*: string*/
|
|
48
|
+
, prefix
|
|
49
|
+
/*: string*/
|
|
50
|
+
)
|
|
51
|
+
/*: string*/
|
|
52
|
+
{
|
|
53
|
+
return prefix ? "-".concat(prefix.toLowerCase(), "-").concat(prop) : prop;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function kebabToTitleCase(str
|
|
57
|
+
/*: string*/
|
|
58
|
+
)
|
|
59
|
+
/*: string*/
|
|
60
|
+
{
|
|
61
|
+
var out = '';
|
|
62
|
+
var shouldCapitalize = true;
|
|
63
|
+
|
|
64
|
+
for (var i = 0; i < str.length; i++) {
|
|
65
|
+
if (shouldCapitalize) {
|
|
66
|
+
out += str[i].toUpperCase();
|
|
67
|
+
shouldCapitalize = false;
|
|
68
|
+
} else if (str[i] === '-') {
|
|
69
|
+
shouldCapitalize = true;
|
|
70
|
+
} else {
|
|
71
|
+
out += str[i];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return out;
|
|
76
|
+
} // Default export is the prefix itself, like 'Moz', 'Webkit', etc
|
|
77
|
+
// Note that you may have to re-test for certain things; for instance, Chrome 50
|
|
78
|
+
// can handle unprefixed `transform`, but not unprefixed `user-select`
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
var _default = (getPrefix()
|
|
82
|
+
/*: string*/
|
|
83
|
+
);
|
|
84
|
+
|
|
85
|
+
getPrefix$1.default = _default;
|
|
@@ -0,0 +1,214 @@
|
|
|
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
|
+
|
|
18
|
+
var _shims = shims;
|
|
19
|
+
|
|
20
|
+
var _domFns = domFns;
|
|
21
|
+
|
|
22
|
+
function getBoundPosition(draggable
|
|
23
|
+
/*: Draggable*/
|
|
24
|
+
, x
|
|
25
|
+
/*: number*/
|
|
26
|
+
, y
|
|
27
|
+
/*: number*/
|
|
28
|
+
)
|
|
29
|
+
/*: [number, number]*/
|
|
30
|
+
{
|
|
31
|
+
// If no bounds, short-circuit and move on
|
|
32
|
+
if (!draggable.props.bounds) return [x, y]; // Clone new bounds
|
|
33
|
+
|
|
34
|
+
var bounds = draggable.props.bounds;
|
|
35
|
+
bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
|
|
36
|
+
var node = findDOMNode(draggable);
|
|
37
|
+
|
|
38
|
+
if (typeof bounds === 'string') {
|
|
39
|
+
var ownerDocument = node.ownerDocument;
|
|
40
|
+
var ownerWindow = ownerDocument.defaultView;
|
|
41
|
+
var boundNode;
|
|
42
|
+
|
|
43
|
+
if (bounds === 'parent') {
|
|
44
|
+
boundNode = node.parentNode;
|
|
45
|
+
} else {
|
|
46
|
+
boundNode = ownerDocument.querySelector(bounds);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (!(boundNode instanceof ownerWindow.HTMLElement)) {
|
|
50
|
+
throw new Error('Bounds selector "' + bounds + '" could not find an element.');
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var boundNodeEl
|
|
54
|
+
/*: HTMLElement*/
|
|
55
|
+
= boundNode; // for Flow, can't seem to refine correctly
|
|
56
|
+
|
|
57
|
+
var nodeStyle = ownerWindow.getComputedStyle(node);
|
|
58
|
+
var boundNodeStyle = ownerWindow.getComputedStyle(boundNodeEl); // Compute bounds. This is a pain with padding and offsets but this gets it exactly right.
|
|
59
|
+
|
|
60
|
+
bounds = {
|
|
61
|
+
left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft),
|
|
62
|
+
top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop),
|
|
63
|
+
right: (0, _domFns.innerWidth)(boundNodeEl) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight),
|
|
64
|
+
bottom: (0, _domFns.innerHeight)(boundNodeEl) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom)
|
|
65
|
+
};
|
|
66
|
+
} // Keep x and y below right and bottom limits...
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
if ((0, _shims.isNum)(bounds.right)) x = Math.min(x, bounds.right);
|
|
70
|
+
if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom); // But above left and top limits.
|
|
71
|
+
|
|
72
|
+
if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left);
|
|
73
|
+
if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top);
|
|
74
|
+
return [x, y];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function snapToGrid(grid
|
|
78
|
+
/*: [number, number]*/
|
|
79
|
+
, pendingX
|
|
80
|
+
/*: number*/
|
|
81
|
+
, pendingY
|
|
82
|
+
/*: number*/
|
|
83
|
+
)
|
|
84
|
+
/*: [number, number]*/
|
|
85
|
+
{
|
|
86
|
+
var x = Math.round(pendingX / grid[0]) * grid[0];
|
|
87
|
+
var y = Math.round(pendingY / grid[1]) * grid[1];
|
|
88
|
+
return [x, y];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function canDragX(draggable
|
|
92
|
+
/*: Draggable*/
|
|
93
|
+
)
|
|
94
|
+
/*: boolean*/
|
|
95
|
+
{
|
|
96
|
+
return draggable.props.axis === 'both' || draggable.props.axis === 'x';
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function canDragY(draggable
|
|
100
|
+
/*: Draggable*/
|
|
101
|
+
)
|
|
102
|
+
/*: boolean*/
|
|
103
|
+
{
|
|
104
|
+
return draggable.props.axis === 'both' || draggable.props.axis === 'y';
|
|
105
|
+
} // Get {x, y} positions from event.
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
function getControlPosition(e
|
|
109
|
+
/*: MouseTouchEvent*/
|
|
110
|
+
, touchIdentifier
|
|
111
|
+
/*: ?number*/
|
|
112
|
+
, draggableCore
|
|
113
|
+
/*: DraggableCore*/
|
|
114
|
+
)
|
|
115
|
+
/*: ?ControlPosition*/
|
|
116
|
+
{
|
|
117
|
+
var touchObj = typeof touchIdentifier === 'number' ? (0, _domFns.getTouch)(e, touchIdentifier) : null;
|
|
118
|
+
if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch
|
|
119
|
+
|
|
120
|
+
var node = findDOMNode(draggableCore); // User can provide an offsetParent if desired.
|
|
121
|
+
|
|
122
|
+
var offsetParent = draggableCore.props.offsetParent || node.offsetParent || node.ownerDocument.body;
|
|
123
|
+
return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent, draggableCore.props.scale);
|
|
124
|
+
} // Create an data object exposed by <DraggableCore>'s events
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
function createCoreData(draggable
|
|
128
|
+
/*: DraggableCore*/
|
|
129
|
+
, x
|
|
130
|
+
/*: number*/
|
|
131
|
+
, y
|
|
132
|
+
/*: number*/
|
|
133
|
+
)
|
|
134
|
+
/*: DraggableData*/
|
|
135
|
+
{
|
|
136
|
+
var state = draggable.state;
|
|
137
|
+
var isStart = !(0, _shims.isNum)(state.lastX);
|
|
138
|
+
var node = findDOMNode(draggable);
|
|
139
|
+
|
|
140
|
+
if (isStart) {
|
|
141
|
+
// If this is our first move, use the x and y as last coords.
|
|
142
|
+
return {
|
|
143
|
+
node: node,
|
|
144
|
+
deltaX: 0,
|
|
145
|
+
deltaY: 0,
|
|
146
|
+
lastX: x,
|
|
147
|
+
lastY: y,
|
|
148
|
+
x: x,
|
|
149
|
+
y: y
|
|
150
|
+
};
|
|
151
|
+
} else {
|
|
152
|
+
// Otherwise calculate proper values.
|
|
153
|
+
return {
|
|
154
|
+
node: node,
|
|
155
|
+
deltaX: x - state.lastX,
|
|
156
|
+
deltaY: y - state.lastY,
|
|
157
|
+
lastX: state.lastX,
|
|
158
|
+
lastY: state.lastY,
|
|
159
|
+
x: x,
|
|
160
|
+
y: y
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
} // Create an data exposed by <Draggable>'s events
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
function createDraggableData(draggable
|
|
167
|
+
/*: Draggable*/
|
|
168
|
+
, coreData
|
|
169
|
+
/*: DraggableData*/
|
|
170
|
+
)
|
|
171
|
+
/*: DraggableData*/
|
|
172
|
+
{
|
|
173
|
+
var scale = draggable.props.scale;
|
|
174
|
+
return {
|
|
175
|
+
node: coreData.node,
|
|
176
|
+
x: draggable.state.x + coreData.deltaX / scale,
|
|
177
|
+
y: draggable.state.y + coreData.deltaY / scale,
|
|
178
|
+
deltaX: coreData.deltaX / scale,
|
|
179
|
+
deltaY: coreData.deltaY / scale,
|
|
180
|
+
lastX: draggable.state.x,
|
|
181
|
+
lastY: draggable.state.y
|
|
182
|
+
};
|
|
183
|
+
} // A lot faster than stringify/parse
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
function cloneBounds(bounds
|
|
187
|
+
/*: Bounds*/
|
|
188
|
+
)
|
|
189
|
+
/*: Bounds*/
|
|
190
|
+
{
|
|
191
|
+
return {
|
|
192
|
+
left: bounds.left,
|
|
193
|
+
top: bounds.top,
|
|
194
|
+
right: bounds.right,
|
|
195
|
+
bottom: bounds.bottom
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
function findDOMNode(draggable
|
|
200
|
+
/*: Draggable | DraggableCore*/
|
|
201
|
+
)
|
|
202
|
+
/*: HTMLElement*/
|
|
203
|
+
{
|
|
204
|
+
var node = draggable.findDOMNode();
|
|
205
|
+
|
|
206
|
+
if (!node) {
|
|
207
|
+
throw new Error('<DraggableCore>: Unmounted during event!');
|
|
208
|
+
} // $FlowIgnore we can't assert on HTMLElement due to tests... FIXME
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
return node;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export { positionFns as default };
|