re-resizable
Advanced tools
Comparing version 4.0.2 to 4.0.3
@@ -329,5 +329,9 @@ 'use strict'; | ||
var endsWith = function endsWith(str, searchStr) { | ||
return str.substr(str.length - searchStr.length, searchStr.length) === searchStr; | ||
}; | ||
var getStringSize = function getStringSize(n) { | ||
if (n.toString().endsWith('px')) return n.toString(); | ||
if (n.toString().endsWith('%')) return n.toString(); | ||
if (endsWith(n.toString(), 'px')) return n.toString(); | ||
if (endsWith(n.toString(), '%')) return n.toString(); | ||
return n + 'px'; | ||
@@ -381,3 +385,3 @@ }; | ||
this.extendsProps = Object.keys(props).reduce(function (acc, key) { | ||
if (definedProps.includes(key)) return acc; | ||
if (definedProps.indexOf(key) !== -1) return acc; | ||
acc[key] = props[key]; | ||
@@ -490,15 +494,15 @@ return acc; | ||
var parentSize = this.getParentSize(); | ||
if (maxWidth && typeof maxWidth === 'string' && maxWidth.endsWith('%')) { | ||
if (maxWidth && typeof maxWidth === 'string' && endsWith(maxWidth, '%')) { | ||
var _ratio = Number(maxWidth.replace('%', '')) / 100; | ||
maxWidth = parentSize.width * _ratio; | ||
} | ||
if (maxHeight && typeof maxHeight === 'string' && maxHeight.endsWith('%')) { | ||
if (maxHeight && typeof maxHeight === 'string' && endsWith(maxHeight, '%')) { | ||
var _ratio2 = Number(maxHeight.replace('%', '')) / 100; | ||
maxHeight = parentSize.height * _ratio2; | ||
} | ||
if (minWidth && typeof minWidth === 'string' && minWidth.endsWith('%')) { | ||
if (minWidth && typeof minWidth === 'string' && endsWith(minWidth, '%')) { | ||
var _ratio3 = Number(minWidth.replace('%', '')) / 100; | ||
minWidth = parentSize.width * _ratio3; | ||
} | ||
if (minHeight && typeof minHeight === 'string' && minHeight.endsWith('%')) { | ||
if (minHeight && typeof minHeight === 'string' && endsWith(minHeight, '%')) { | ||
var _ratio4 = Number(minHeight.replace('%', '')) / 100; | ||
@@ -603,3 +607,3 @@ minHeight = parentSize.height * _ratio4; | ||
if (width && typeof width === 'string' && width.endsWith('%')) { | ||
if (width && typeof width === 'string' && endsWith(width, '%')) { | ||
var percent = newWidth / parentSize.width * 100; | ||
@@ -609,3 +613,3 @@ newWidth = percent + '%'; | ||
if (height && typeof height === 'string' && height.endsWith('%')) { | ||
if (height && typeof height === 'string' && endsWith(height, '%')) { | ||
var _percent = newHeight / parentSize.height * 100; | ||
@@ -743,4 +747,4 @@ newHeight = _percent + '%'; | ||
if (typeof _this4.state[key] === 'undefined' || _this4.state[key] === 'auto') return 'auto'; | ||
if (_this4.propsSize && _this4.propsSize[key] && _this4.propsSize[key].toString().endsWith('%')) { | ||
if (_this4.state[key].toString().endsWith('%')) return _this4.state[key].toString(); | ||
if (_this4.propsSize && _this4.propsSize[key] && endsWith(_this4.propsSize[key].toString(), '%')) { | ||
if (endsWith(_this4.state[key].toString(), '%')) return _this4.state[key].toString(); | ||
var parentSize = _this4.getParentSize(); | ||
@@ -747,0 +751,0 @@ var value = Number(_this4.state[key].toString().replace('px', '')); |
@@ -327,5 +327,9 @@ import { Component, createElement } from 'react'; | ||
var endsWith = function endsWith(str, searchStr) { | ||
return str.substr(str.length - searchStr.length, searchStr.length) === searchStr; | ||
}; | ||
var getStringSize = function getStringSize(n) { | ||
if (n.toString().endsWith('px')) return n.toString(); | ||
if (n.toString().endsWith('%')) return n.toString(); | ||
if (endsWith(n.toString(), 'px')) return n.toString(); | ||
if (endsWith(n.toString(), '%')) return n.toString(); | ||
return n + 'px'; | ||
@@ -379,3 +383,3 @@ }; | ||
this.extendsProps = Object.keys(props).reduce(function (acc, key) { | ||
if (definedProps.includes(key)) return acc; | ||
if (definedProps.indexOf(key) !== -1) return acc; | ||
acc[key] = props[key]; | ||
@@ -488,15 +492,15 @@ return acc; | ||
var parentSize = this.getParentSize(); | ||
if (maxWidth && typeof maxWidth === 'string' && maxWidth.endsWith('%')) { | ||
if (maxWidth && typeof maxWidth === 'string' && endsWith(maxWidth, '%')) { | ||
var _ratio = Number(maxWidth.replace('%', '')) / 100; | ||
maxWidth = parentSize.width * _ratio; | ||
} | ||
if (maxHeight && typeof maxHeight === 'string' && maxHeight.endsWith('%')) { | ||
if (maxHeight && typeof maxHeight === 'string' && endsWith(maxHeight, '%')) { | ||
var _ratio2 = Number(maxHeight.replace('%', '')) / 100; | ||
maxHeight = parentSize.height * _ratio2; | ||
} | ||
if (minWidth && typeof minWidth === 'string' && minWidth.endsWith('%')) { | ||
if (minWidth && typeof minWidth === 'string' && endsWith(minWidth, '%')) { | ||
var _ratio3 = Number(minWidth.replace('%', '')) / 100; | ||
minWidth = parentSize.width * _ratio3; | ||
} | ||
if (minHeight && typeof minHeight === 'string' && minHeight.endsWith('%')) { | ||
if (minHeight && typeof minHeight === 'string' && endsWith(minHeight, '%')) { | ||
var _ratio4 = Number(minHeight.replace('%', '')) / 100; | ||
@@ -601,3 +605,3 @@ minHeight = parentSize.height * _ratio4; | ||
if (width && typeof width === 'string' && width.endsWith('%')) { | ||
if (width && typeof width === 'string' && endsWith(width, '%')) { | ||
var percent = newWidth / parentSize.width * 100; | ||
@@ -607,3 +611,3 @@ newWidth = percent + '%'; | ||
if (height && typeof height === 'string' && height.endsWith('%')) { | ||
if (height && typeof height === 'string' && endsWith(height, '%')) { | ||
var _percent = newHeight / parentSize.height * 100; | ||
@@ -741,4 +745,4 @@ newHeight = _percent + '%'; | ||
if (typeof _this4.state[key] === 'undefined' || _this4.state[key] === 'auto') return 'auto'; | ||
if (_this4.propsSize && _this4.propsSize[key] && _this4.propsSize[key].toString().endsWith('%')) { | ||
if (_this4.state[key].toString().endsWith('%')) return _this4.state[key].toString(); | ||
if (_this4.propsSize && _this4.propsSize[key] && endsWith(_this4.propsSize[key].toString(), '%')) { | ||
if (endsWith(_this4.state[key].toString(), '%')) return _this4.state[key].toString(); | ||
var parentSize = _this4.getParentSize(); | ||
@@ -745,0 +749,0 @@ var value = Number(_this4.state[key].toString().replace('px', '')); |
@@ -331,5 +331,9 @@ (function (global, factory) { | ||
var endsWith = function endsWith(str, searchStr) { | ||
return str.substr(str.length - searchStr.length, searchStr.length) === searchStr; | ||
}; | ||
var getStringSize = function getStringSize(n) { | ||
if (n.toString().endsWith('px')) return n.toString(); | ||
if (n.toString().endsWith('%')) return n.toString(); | ||
if (endsWith(n.toString(), 'px')) return n.toString(); | ||
if (endsWith(n.toString(), '%')) return n.toString(); | ||
return n + 'px'; | ||
@@ -383,3 +387,3 @@ }; | ||
this.extendsProps = Object.keys(props).reduce(function (acc, key) { | ||
if (definedProps.includes(key)) return acc; | ||
if (definedProps.indexOf(key) !== -1) return acc; | ||
acc[key] = props[key]; | ||
@@ -492,15 +496,15 @@ return acc; | ||
var parentSize = this.getParentSize(); | ||
if (maxWidth && typeof maxWidth === 'string' && maxWidth.endsWith('%')) { | ||
if (maxWidth && typeof maxWidth === 'string' && endsWith(maxWidth, '%')) { | ||
var _ratio = Number(maxWidth.replace('%', '')) / 100; | ||
maxWidth = parentSize.width * _ratio; | ||
} | ||
if (maxHeight && typeof maxHeight === 'string' && maxHeight.endsWith('%')) { | ||
if (maxHeight && typeof maxHeight === 'string' && endsWith(maxHeight, '%')) { | ||
var _ratio2 = Number(maxHeight.replace('%', '')) / 100; | ||
maxHeight = parentSize.height * _ratio2; | ||
} | ||
if (minWidth && typeof minWidth === 'string' && minWidth.endsWith('%')) { | ||
if (minWidth && typeof minWidth === 'string' && endsWith(minWidth, '%')) { | ||
var _ratio3 = Number(minWidth.replace('%', '')) / 100; | ||
minWidth = parentSize.width * _ratio3; | ||
} | ||
if (minHeight && typeof minHeight === 'string' && minHeight.endsWith('%')) { | ||
if (minHeight && typeof minHeight === 'string' && endsWith(minHeight, '%')) { | ||
var _ratio4 = Number(minHeight.replace('%', '')) / 100; | ||
@@ -605,3 +609,3 @@ minHeight = parentSize.height * _ratio4; | ||
if (width && typeof width === 'string' && width.endsWith('%')) { | ||
if (width && typeof width === 'string' && endsWith(width, '%')) { | ||
var percent = newWidth / parentSize.width * 100; | ||
@@ -611,3 +615,3 @@ newWidth = percent + '%'; | ||
if (height && typeof height === 'string' && height.endsWith('%')) { | ||
if (height && typeof height === 'string' && endsWith(height, '%')) { | ||
var _percent = newHeight / parentSize.height * 100; | ||
@@ -745,4 +749,4 @@ newHeight = _percent + '%'; | ||
if (typeof _this4.state[key] === 'undefined' || _this4.state[key] === 'auto') return 'auto'; | ||
if (_this4.propsSize && _this4.propsSize[key] && _this4.propsSize[key].toString().endsWith('%')) { | ||
if (_this4.state[key].toString().endsWith('%')) return _this4.state[key].toString(); | ||
if (_this4.propsSize && _this4.propsSize[key] && endsWith(_this4.propsSize[key].toString(), '%')) { | ||
if (endsWith(_this4.state[key].toString(), '%')) return _this4.state[key].toString(); | ||
var parentSize = _this4.getParentSize(); | ||
@@ -749,0 +753,0 @@ var value = Number(_this4.state[key].toString().replace('px', '')); |
{ | ||
"name": "re-resizable", | ||
"version": "4.0.2", | ||
"version": "4.0.3", | ||
"description": "Resizable component for React.", | ||
@@ -5,0 +5,0 @@ "title": "re-resizable", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
229748
2087