@cocreate/resize 1.2.17 → 1.2.19

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 CHANGED
@@ -1,3 +1,17 @@
1
+ ## [1.2.19](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.2.18...v1.2.19) (2022-11-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * bump depenedencies ([e46d8f4](https://github.com/CoCreate-app/CoCreate-resize/commit/e46d8f4d67ebef67cf5ef6fb7b3761824c23da42))
7
+
8
+ ## [1.2.18](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.2.17...v1.2.18) (2022-11-23)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * bumped [@cocreate](https://github.com/cocreate) dependencies ([7bfa206](https://github.com/CoCreate-app/CoCreate-resize/commit/7bfa2062018bee49e37ce7e371e50be5c8ef77cd))
14
+
1
15
  ## [1.2.17](https://github.com/CoCreate-app/CoCreate-resize/compare/v1.2.16...v1.2.17) (2022-11-22)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cocreate/resize",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
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.4.1",
64
- "@cocreate/observer": "^1.5.24"
63
+ "@cocreate/docs": "^1.4.3",
64
+ "@cocreate/observer": "^1.5.26"
65
65
  }
66
66
  }
package/src/index.js CHANGED
@@ -71,12 +71,12 @@ CoCreateResize.prototype = {
71
71
  },
72
72
 
73
73
  getGridProperty: function() {
74
- if(!this.resizeWidget.parentNode) return;
74
+ if (!this.resizeWidget.parentNode) return;
75
75
  let compStyles = window.getComputedStyle(this.resizeWidget.parentNode);
76
76
  let gridColumns = compStyles.gridTemplateColumns;
77
77
  let height = compStyles.gridAutoRows;
78
78
 
79
- if(gridColumns !== 'none') {
79
+ if (gridColumns !== 'none') {
80
80
  let width = gridColumns.split(' ');
81
81
  this.limitSpan = width.length;
82
82
  this.gridColumnGap = Number.parseInt(compStyles.gridColumnGap);
@@ -87,17 +87,17 @@ CoCreateResize.prototype = {
87
87
  },
88
88
 
89
89
  checkGridColumns: function() {
90
- if(typeof this.resizeWidget !== 'undefined' && this.resizeWidget.parentNode)
90
+ if (typeof this.resizeWidget !== 'undefined' && this.resizeWidget.parentNode)
91
91
  {
92
92
  let compStylesOfParent = window.getComputedStyle(this.resizeWidget.parentNode);
93
93
  let spans = 0;
94
94
  let gridColumns = compStylesOfParent.gridTemplateColumns.split(' ');
95
95
  let temp = gridColumns[0];
96
96
  gridColumns.map(v => {
97
- if(v == temp) spans ++;
97
+ if (v == temp) spans ++;
98
98
  });
99
99
  this.limitSpan = spans;
100
- if(this.resizeWidget.style['grid-column-end'])
100
+ if (this.resizeWidget.style['grid-column-end'])
101
101
  {
102
102
  let curClassAttributes = this.resizeWidget.getAttribute('class').split(' ');
103
103
  let prevColumnState = curClassAttributes[curClassAttributes.length - 1].split('_');
@@ -106,8 +106,8 @@ CoCreateResize.prototype = {
106
106
  let curSpan = Number.parseInt(curColumnState[1]);
107
107
 
108
108
  let span = 0;
109
- if(this.limitSpan >= prevSpan) span = prevSpan;
110
- else if(prevSpan > this.limitSpan) span = this.limitSpan;
109
+ if (this.limitSpan >= prevSpan) span = prevSpan;
110
+ else if (prevSpan > this.limitSpan) span = this.limitSpan;
111
111
  else span = Math.min(curSpan, this.limitSpan);
112
112
 
113
113
  this.resizeWidget.style['grid-column-end'] = 'span ' + span;
@@ -197,7 +197,7 @@ CoCreateResize.prototype = {
197
197
 
198
198
  //this is just for grid system
199
199
  setRowEnd: function(height) {
200
- if(this.gridHeight) {
200
+ if (this.gridHeight) {
201
201
  this.heightSpan = Math.ceil((height - (this.heightSpan - 1) * this.gridRowGap) / this.gridHeight );
202
202
  this.resizeWidget.style['grid-row-end'] = 'span ' + this.heightSpan;
203
203
  this.collaborate({rowEnd: this.heightSpan})
@@ -242,7 +242,7 @@ CoCreateResize.prototype = {
242
242
 
243
243
  //this is just for grid system
244
244
  setColumnEnd: function(width) {
245
- if(this.gridWidth) {
245
+ if (this.gridWidth) {
246
246
  let spans = Math.ceil((width - (this.widthSpan - 1) * this.gridColumnGap) / this.gridWidth);
247
247
  this.widthSpan = (spans > this.limitSpan) ? this.limitSpan : spans;
248
248
  this.resizeWidget.style['grid-column-end'] = 'span ' + this.widthSpan;
@@ -303,14 +303,14 @@ CoCreateResize.prototype = {
303
303
  }
304
304
 
305
305
  //this is just for grid system
306
- if(this.detectGrid()) {
306
+ if (this.detectGrid()) {
307
307
  this.resizeWidget.style.width = null;
308
308
  this.resizeWidget.style.height = null;
309
309
  this.resizeWidget.style.left = null;
310
310
  this.resizeWidget.style.top = null;
311
311
 
312
- if(this.widthSpan) this.resizeWidget.setAttribute('class', this.originClassAttribute + ' grid-column-end:span_' + this.widthSpan);
313
- if(this.heightSpan) this.resizeWidget.setAttribute('class', this.originClassAttribute + ' grid-row-end:span_' + this.heightSpan);
312
+ if (this.widthSpan) this.resizeWidget.setAttribute('class', this.originClassAttribute + ' grid-column-end:span_' + this.widthSpan);
313
+ if (this.heightSpan) this.resizeWidget.setAttribute('class', this.originClassAttribute + ' grid-row-end:span_' + this.heightSpan);
314
314
  }
315
315
 
316
316
  DIRECTIONS.map(d => { this.removeListenerMulti(document.documentElement, EVENTS[0], this.doDrags[d]) });