@cocreate/resize 1.1.71 → 1.1.74
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/CHANGELOG.md +21 -0
- package/package.json +3 -3
- package/src/index.js +14 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [1.1.74](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.1.73...v1.1.74) (2022-06-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* if detectGrid has no parent element return ([cb0a6fd](https://github.com/CoCreate-app/CoCreate-resize/commit/cb0a6fd7f9b45fdc66879ff6e2737d5363321eb3))
|
|
7
|
+
|
|
8
|
+
## [1.1.73](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.1.72...v1.1.73) (2022-06-07)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* left postion missing px when adding style ([b1019b7](https://github.com/CoCreate-app/CoCreate-resize/commit/b1019b7bd32c47c2537031ea284f69cb73442ea9))
|
|
14
|
+
|
|
15
|
+
## [1.1.72](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.1.71...v1.1.72) (2022-05-23)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* bump all dependencies ([c99fb25](https://github.com/CoCreate-app/CoCreate-resize/commit/c99fb2506f276e79b2c3c126b8616838965671cd))
|
|
21
|
+
|
|
1
22
|
## [1.1.71](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.1.70...v1.1.71) (2022-05-19)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cocreate/resize",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.74",
|
|
4
4
|
"description": "A light weight resize handler make any element resizable by adding data attributes or usinng init object. Great for Customized text box or text area.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"resize",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"webpack-log": "^3.0.1"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@cocreate/docs": "^1.
|
|
64
|
-
"@cocreate/observer": "^1.
|
|
63
|
+
"@cocreate/docs": "^1.3.1",
|
|
64
|
+
"@cocreate/observer": "^1.5.1"
|
|
65
65
|
}
|
|
66
66
|
}
|
package/src/index.js
CHANGED
|
@@ -49,6 +49,7 @@ CoCreateResize.prototype = {
|
|
|
49
49
|
this.Drags = [];
|
|
50
50
|
|
|
51
51
|
//this is for grid
|
|
52
|
+
this.isGrid = this.detectGrid();
|
|
52
53
|
this.gridWidth = 0;
|
|
53
54
|
this.gridHeight = 0;
|
|
54
55
|
// this.missingWidth = 0;
|
|
@@ -246,14 +247,16 @@ CoCreateResize.prototype = {
|
|
|
246
247
|
if (e.touches)
|
|
247
248
|
e = e.touches[0];
|
|
248
249
|
left = this.startLeft + e.clientX - this.startX;
|
|
250
|
+
console.log('left', left)
|
|
249
251
|
width = this.startWidth - e.clientX + this.startX;
|
|
250
252
|
|
|
251
253
|
if (width < 10)
|
|
252
254
|
return;
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
this.resizeWidget.style.
|
|
255
|
+
if (!this.isGrid)
|
|
256
|
+
this.resizeWidget.style.left = left + 'px';
|
|
257
|
+
// let compStyles = window.getComputedStyle(this.resizeWidget);
|
|
258
|
+
// this.resizeWidget.style.right = compStyles.right;
|
|
259
|
+
// this.resizeWidget.style.left = null;
|
|
257
260
|
this.resizeWidget.style.width = width + 'px';
|
|
258
261
|
|
|
259
262
|
this.setColumnEnd(width);
|
|
@@ -277,8 +280,13 @@ CoCreateResize.prototype = {
|
|
|
277
280
|
},
|
|
278
281
|
|
|
279
282
|
detectGrid: function() {
|
|
280
|
-
let
|
|
281
|
-
|
|
283
|
+
let isGrid = false;
|
|
284
|
+
if (this.resizeWidget.parentNode) {
|
|
285
|
+
let compStyles = window.getComputedStyle(this.resizeWidget.parentNode);
|
|
286
|
+
isGrid = (compStyles.display === 'grid');
|
|
287
|
+
}
|
|
288
|
+
this.isGrid = isGrid;
|
|
289
|
+
return isGrid;
|
|
282
290
|
},
|
|
283
291
|
|
|
284
292
|
stopDrag: function(e) {
|
|
@@ -334,7 +342,6 @@ CoCreateResize.prototype = {
|
|
|
334
342
|
this.initDrags['left'] = this.initLeftDrag.bind(this);
|
|
335
343
|
this.initDrags['bottom'] = this.initBottomDrag.bind(this);
|
|
336
344
|
this.initDrags['right'] = this.initRightDrag.bind(this);
|
|
337
|
-
|
|
338
345
|
},
|
|
339
346
|
|
|
340
347
|
getDistance: function(elem, flag) {
|