zmdms-webui 2.5.1 → 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/_commonjsHelpers.js +29 -1
- package/dist/es/_virtual/clsx.m.js +6 -0
- package/dist/es/node_modules/react-draggable/build/cjs/Draggable.js +262 -200
- package/dist/es/node_modules/react-draggable/build/cjs/DraggableCore.js +311 -184
- package/dist/es/node_modules/react-draggable/build/cjs/cjs.js +5 -6
- package/dist/es/node_modules/react-draggable/build/cjs/utils/domFns.js +217 -93
- package/dist/es/node_modules/react-draggable/build/cjs/utils/getPrefix.js +53 -20
- package/dist/es/node_modules/react-draggable/build/cjs/utils/log.js +1 -0
- package/dist/es/node_modules/react-draggable/build/cjs/utils/positionFns.js +126 -67
- package/dist/es/node_modules/react-draggable/build/cjs/utils/shims.js +38 -7
- package/package.json +2 -2
- package/dist/es/_virtual/clsx.js +0 -3
- package/dist/es/node_modules/react-draggable/node_modules/clsx/dist/clsx.js +0 -7
|
@@ -14,115 +14,163 @@ positionFns.createDraggableData = createDraggableData;
|
|
|
14
14
|
positionFns.getBoundPosition = getBoundPosition;
|
|
15
15
|
positionFns.getControlPosition = getControlPosition;
|
|
16
16
|
positionFns.snapToGrid = snapToGrid;
|
|
17
|
+
|
|
17
18
|
var _shims = shims;
|
|
19
|
+
|
|
18
20
|
var _domFns = domFns;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
|
|
22
|
+
function getBoundPosition(draggable
|
|
23
|
+
/*: Draggable*/
|
|
24
|
+
, x
|
|
25
|
+
/*: number*/
|
|
26
|
+
, y
|
|
27
|
+
/*: number*/
|
|
28
|
+
)
|
|
29
|
+
/*: [number, number]*/
|
|
30
|
+
{
|
|
23
31
|
// If no bounds, short-circuit and move on
|
|
24
|
-
if (!draggable.props.bounds) return [x, y];
|
|
32
|
+
if (!draggable.props.bounds) return [x, y]; // Clone new bounds
|
|
25
33
|
|
|
26
|
-
|
|
27
|
-
let {
|
|
28
|
-
bounds
|
|
29
|
-
} = draggable.props;
|
|
34
|
+
var bounds = draggable.props.bounds;
|
|
30
35
|
bounds = typeof bounds === 'string' ? bounds : cloneBounds(bounds);
|
|
31
|
-
|
|
36
|
+
var node = findDOMNode(draggable);
|
|
37
|
+
|
|
32
38
|
if (typeof bounds === 'string') {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
let boundNode;
|
|
39
|
+
var ownerDocument = node.ownerDocument;
|
|
40
|
+
var ownerWindow = ownerDocument.defaultView;
|
|
41
|
+
var boundNode;
|
|
42
|
+
|
|
38
43
|
if (bounds === 'parent') {
|
|
39
44
|
boundNode = node.parentNode;
|
|
40
45
|
} else {
|
|
41
|
-
|
|
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);
|
|
46
|
+
boundNode = ownerDocument.querySelector(bounds);
|
|
47
47
|
}
|
|
48
|
+
|
|
48
49
|
if (!(boundNode instanceof ownerWindow.HTMLElement)) {
|
|
49
50
|
throw new Error('Bounds selector "' + bounds + '" could not find an element.');
|
|
50
51
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
+
|
|
55
60
|
bounds = {
|
|
56
61
|
left: -node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingLeft) + (0, _shims.int)(nodeStyle.marginLeft),
|
|
57
62
|
top: -node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingTop) + (0, _shims.int)(nodeStyle.marginTop),
|
|
58
63
|
right: (0, _domFns.innerWidth)(boundNodeEl) - (0, _domFns.outerWidth)(node) - node.offsetLeft + (0, _shims.int)(boundNodeStyle.paddingRight) - (0, _shims.int)(nodeStyle.marginRight),
|
|
59
64
|
bottom: (0, _domFns.innerHeight)(boundNodeEl) - (0, _domFns.outerHeight)(node) - node.offsetTop + (0, _shims.int)(boundNodeStyle.paddingBottom) - (0, _shims.int)(nodeStyle.marginBottom)
|
|
60
65
|
};
|
|
61
|
-
}
|
|
66
|
+
} // Keep x and y below right and bottom limits...
|
|
67
|
+
|
|
62
68
|
|
|
63
|
-
// Keep x and y below right and bottom limits...
|
|
64
69
|
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);
|
|
70
|
+
if ((0, _shims.isNum)(bounds.bottom)) y = Math.min(y, bounds.bottom); // But above left and top limits.
|
|
66
71
|
|
|
67
|
-
// But above left and top limits.
|
|
68
72
|
if ((0, _shims.isNum)(bounds.left)) x = Math.max(x, bounds.left);
|
|
69
73
|
if ((0, _shims.isNum)(bounds.top)) y = Math.max(y, bounds.top);
|
|
70
74
|
return [x, y];
|
|
71
75
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
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];
|
|
75
88
|
return [x, y];
|
|
76
89
|
}
|
|
77
|
-
|
|
90
|
+
|
|
91
|
+
function canDragX(draggable
|
|
92
|
+
/*: Draggable*/
|
|
93
|
+
)
|
|
94
|
+
/*: boolean*/
|
|
95
|
+
{
|
|
78
96
|
return draggable.props.axis === 'both' || draggable.props.axis === 'x';
|
|
79
97
|
}
|
|
80
|
-
|
|
98
|
+
|
|
99
|
+
function canDragY(draggable
|
|
100
|
+
/*: Draggable*/
|
|
101
|
+
)
|
|
102
|
+
/*: boolean*/
|
|
103
|
+
{
|
|
81
104
|
return draggable.props.axis === 'both' || draggable.props.axis === 'y';
|
|
82
|
-
}
|
|
105
|
+
} // Get {x, y} positions from event.
|
|
83
106
|
|
|
84
|
-
|
|
85
|
-
function getControlPosition(e
|
|
86
|
-
|
|
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;
|
|
87
118
|
if (typeof touchIdentifier === 'number' && !touchObj) return null; // not the right touch
|
|
88
|
-
|
|
89
|
-
// User can provide an offsetParent if desired.
|
|
90
|
-
|
|
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;
|
|
91
123
|
return (0, _domFns.offsetXYFromParent)(touchObj || e, offsetParent, draggableCore.props.scale);
|
|
92
|
-
}
|
|
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);
|
|
93
139
|
|
|
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
140
|
if (isStart) {
|
|
99
141
|
// If this is our first move, use the x and y as last coords.
|
|
100
142
|
return {
|
|
101
|
-
node,
|
|
143
|
+
node: node,
|
|
102
144
|
deltaX: 0,
|
|
103
145
|
deltaY: 0,
|
|
104
146
|
lastX: x,
|
|
105
147
|
lastY: y,
|
|
106
|
-
x,
|
|
107
|
-
y
|
|
148
|
+
x: x,
|
|
149
|
+
y: y
|
|
108
150
|
};
|
|
109
151
|
} else {
|
|
110
152
|
// Otherwise calculate proper values.
|
|
111
153
|
return {
|
|
112
|
-
node,
|
|
113
|
-
deltaX: x -
|
|
114
|
-
deltaY: y -
|
|
115
|
-
lastX:
|
|
116
|
-
lastY:
|
|
117
|
-
x,
|
|
118
|
-
y
|
|
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
|
|
119
161
|
};
|
|
120
162
|
}
|
|
121
|
-
}
|
|
163
|
+
} // Create an data exposed by <Draggable>'s events
|
|
164
|
+
|
|
122
165
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
166
|
+
function createDraggableData(draggable
|
|
167
|
+
/*: Draggable*/
|
|
168
|
+
, coreData
|
|
169
|
+
/*: DraggableData*/
|
|
170
|
+
)
|
|
171
|
+
/*: DraggableData*/
|
|
172
|
+
{
|
|
173
|
+
var scale = draggable.props.scale;
|
|
126
174
|
return {
|
|
127
175
|
node: coreData.node,
|
|
128
176
|
x: draggable.state.x + coreData.deltaX / scale,
|
|
@@ -132,10 +180,14 @@ function createDraggableData(draggable /*: Draggable*/, coreData /*: DraggableDa
|
|
|
132
180
|
lastX: draggable.state.x,
|
|
133
181
|
lastY: draggable.state.y
|
|
134
182
|
};
|
|
135
|
-
}
|
|
183
|
+
} // A lot faster than stringify/parse
|
|
184
|
+
|
|
136
185
|
|
|
137
|
-
|
|
138
|
-
|
|
186
|
+
function cloneBounds(bounds
|
|
187
|
+
/*: Bounds*/
|
|
188
|
+
)
|
|
189
|
+
/*: Bounds*/
|
|
190
|
+
{
|
|
139
191
|
return {
|
|
140
192
|
left: bounds.left,
|
|
141
193
|
top: bounds.top,
|
|
@@ -143,12 +195,19 @@ function cloneBounds(bounds /*: Bounds*/) /*: Bounds*/{
|
|
|
143
195
|
bottom: bounds.bottom
|
|
144
196
|
};
|
|
145
197
|
}
|
|
146
|
-
|
|
147
|
-
|
|
198
|
+
|
|
199
|
+
function findDOMNode(draggable
|
|
200
|
+
/*: Draggable | DraggableCore*/
|
|
201
|
+
)
|
|
202
|
+
/*: HTMLElement*/
|
|
203
|
+
{
|
|
204
|
+
var node = draggable.findDOMNode();
|
|
205
|
+
|
|
148
206
|
if (!node) {
|
|
149
207
|
throw new Error('<DraggableCore>: Unmounted during event!');
|
|
150
|
-
}
|
|
151
|
-
|
|
208
|
+
} // $FlowIgnore we can't assert on HTMLElement due to tests... FIXME
|
|
209
|
+
|
|
210
|
+
|
|
152
211
|
return node;
|
|
153
212
|
}
|
|
154
213
|
|
|
@@ -8,25 +8,56 @@ shims.findInArray = findInArray;
|
|
|
8
8
|
shims.int = int;
|
|
9
9
|
shims.isFunction = isFunction;
|
|
10
10
|
shims.isNum = isNum;
|
|
11
|
+
|
|
11
12
|
// @credits https://gist.github.com/rogozhnikoff/a43cfed27c41e4e68cdc
|
|
12
|
-
function findInArray(array
|
|
13
|
-
|
|
13
|
+
function findInArray(array
|
|
14
|
+
/*: Array<any> | TouchList*/
|
|
15
|
+
, callback
|
|
16
|
+
/*: Function*/
|
|
17
|
+
)
|
|
18
|
+
/*: any*/
|
|
19
|
+
{
|
|
20
|
+
for (var i = 0, length = array.length; i < length; i++) {
|
|
14
21
|
if (callback.apply(callback, [array[i], i, array])) return array[i];
|
|
15
22
|
}
|
|
16
23
|
}
|
|
17
|
-
|
|
24
|
+
|
|
25
|
+
function isFunction(func
|
|
26
|
+
/*: any*/
|
|
27
|
+
)
|
|
28
|
+
/*: boolean %checks*/
|
|
29
|
+
{
|
|
18
30
|
// $FlowIgnore[method-unbinding]
|
|
19
31
|
return typeof func === 'function' || Object.prototype.toString.call(func) === '[object Function]';
|
|
20
32
|
}
|
|
21
|
-
|
|
33
|
+
|
|
34
|
+
function isNum(num
|
|
35
|
+
/*: any*/
|
|
36
|
+
)
|
|
37
|
+
/*: boolean %checks*/
|
|
38
|
+
{
|
|
22
39
|
return typeof num === 'number' && !isNaN(num);
|
|
23
40
|
}
|
|
24
|
-
|
|
41
|
+
|
|
42
|
+
function int(a
|
|
43
|
+
/*: string*/
|
|
44
|
+
)
|
|
45
|
+
/*: number*/
|
|
46
|
+
{
|
|
25
47
|
return parseInt(a, 10);
|
|
26
48
|
}
|
|
27
|
-
|
|
49
|
+
|
|
50
|
+
function dontSetMe(props
|
|
51
|
+
/*: Object*/
|
|
52
|
+
, propName
|
|
53
|
+
/*: string*/
|
|
54
|
+
, componentName
|
|
55
|
+
/*: string*/
|
|
56
|
+
)
|
|
57
|
+
/*: ?Error*/
|
|
58
|
+
{
|
|
28
59
|
if (props[propName]) {
|
|
29
|
-
return new Error(
|
|
60
|
+
return new Error("Invalid prop ".concat(propName, " passed to ").concat(componentName, " - do not set this, set it on the child."));
|
|
30
61
|
}
|
|
31
62
|
}
|
|
32
63
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zmdms-webui",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"module": "dist/index.es.js",
|
|
@@ -148,7 +148,7 @@
|
|
|
148
148
|
"react-contexify": "^6.0.0",
|
|
149
149
|
"react-dnd": "^16.0.1",
|
|
150
150
|
"react-dnd-html5-backend": "^16.0.1",
|
|
151
|
-
"react-draggable": "
|
|
151
|
+
"react-draggable": "4.4.5",
|
|
152
152
|
"screenfull": "^6.0.2",
|
|
153
153
|
"virtuallist-antd": "^0.8.0-beta.1",
|
|
154
154
|
"xlsx": "^0.18.5",
|
package/dist/es/_virtual/clsx.js
DELETED
|
@@ -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 };
|