Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-input-mask

Package Overview
Dependencies
Maintainers
1
Versions
90
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-input-mask - npm Package Compare versions

Comparing version 0.7.3 to 0.7.4

48

build/InputElement.js

@@ -63,4 +63,3 @@ // https://github.com/sanniassin/react-input-mask

var canUseAccessors = !!(Object.getOwnPropertyDescriptor && Object.getPrototypeOf && Object.defineProperty);
if (canUseAccessors) {
if (this.canUseAccessors) {
var input = this.getInputDOMNode();

@@ -104,2 +103,7 @@ this.valueDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), 'value');

},
setInputValue: function (val) {
var input = this.getInputDOMNode();
this.value = val;
input.value = val;
},
getPrefix: function () {

@@ -485,8 +489,8 @@ var prefix = "";

if (this.valueDescriptor && this.getInputValue() !== this.state.value) {
this.getInputDOMNode().value = this.state.value;
this.setInputValue(this.state.value);
}
},
updateUncontrolledInput: function () {
if (this.getInputDOMNode().value !== this.state.value) {
this.getInputDOMNode().value = this.state.value;
if (this.getInputValue() !== this.state.value) {
this.setInputValue(this.state.value);
}

@@ -535,3 +539,3 @@ },

if (value !== this.state.value) {
event.target.value = value;
this.setInputValue(value);
this.setState({

@@ -587,3 +591,3 @@ value: this.hasValue ? this.state.value : value

if (value !== this.state.value) {
event.target.value = value;
this.setInputValue(value);
this.setState({

@@ -609,2 +613,3 @@ value: this.hasValue ? this.state.value : value

var lastEditablePos = this.lastEditablePos;
var preventEmptyChange = this.preventEmptyChange;

@@ -616,3 +621,3 @@ var target = event.target;

this.preventEmptyChange = false;
target.value = this.state.value;
this.setInputValue(this.state.value);
return;

@@ -680,7 +685,7 @@ }

// prevent hanging after first entered character on Windows 10 Mobile
if (!this.isAndroidBrowser && !this.isWindowsPhoneBrowser) {
target.value = value;
if (!this.canUseAccessors || !this.isAndroidBrowser && !this.isWindowsPhoneBrowser) {
this.setInputValue(value);
}
if (this.isAndroidFirefox && value && !this.getInputValue() || this.isAndroidBrowser || this.isWindowsPhoneBrowser) {
if (this.canUseAccessors && (this.isAndroidFirefox && value && !this.getInputValue() || this.isAndroidBrowser || this.isWindowsPhoneBrowser)) {
this.value = value;

@@ -704,2 +709,3 @@ this.enableValueAccessors();

}
this.setCaretPos(caretPos);

@@ -712,6 +718,6 @@ },

var inputValue = this.formatValue(value);
var isInputValueChanged = inputValue !== event.target.value;
var isInputValueChanged = inputValue !== this.getInputValue();
if (isInputValueChanged) {
event.target.value = inputValue;
this.setInputValue(inputValue);
}

@@ -737,5 +743,5 @@

var inputValue = "";
var isInputValueChanged = inputValue !== event.target.value;
var isInputValueChanged = inputValue !== this.getInputValue();
if (isInputValueChanged) {
event.target.value = inputValue;
this.setInputValue(inputValue);
}

@@ -757,3 +763,3 @@ this.setState({

this.pasteSelection = this.getSelection();
event.target.value = "";
this.setInputValue("");
return;

@@ -784,5 +790,5 @@ }

caretPos = this.getRightEditablePos(caretPos) || caretPos;
if (value !== this.getInputDOMNode().value) {
if (value !== this.getInputValue()) {
if (event) {
event.target.value = value;
this.setInputValue(value);
}

@@ -803,2 +809,8 @@ this.setState({

if (Object.getOwnPropertyDescriptor && Object.getPrototypeOf && Object.defineProperty) {
var input = this.getInputDOMNode();
var valueDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), 'value');
this.canUseAccessors = !!(valueDescriptor && valueDescriptor.get && valueDescriptor.set);
}
if (this.mask && this.props.value == null) {

@@ -805,0 +817,0 @@ this.updateUncontrolledInput();

@@ -62,4 +62,3 @@ // https://github.com/sanniassin/react-input-mask

enableValueAccessors: function() {
var canUseAccessors = !!(Object.getOwnPropertyDescriptor && Object.getPrototypeOf && Object.defineProperty);
if (canUseAccessors) {
if (this.canUseAccessors) {
var input = this.getInputDOMNode();

@@ -101,2 +100,7 @@ this.valueDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), 'value');

},
setInputValue: function(val) {
var input = this.getInputDOMNode();
this.value = val;
input.value = val;
},
getPrefix: function() {

@@ -477,8 +481,8 @@ var prefix = "";

if (this.valueDescriptor && this.getInputValue() !== this.state.value) {
this.getInputDOMNode().value = this.state.value;
this.setInputValue(this.state.value);
}
},
updateUncontrolledInput: function() {
if (this.getInputDOMNode().value !== this.state.value) {
this.getInputDOMNode().value = this.state.value;
if (this.getInputValue() !== this.state.value) {
this.setInputValue(this.state.value);
}

@@ -529,3 +533,3 @@ },

if (value !== this.state.value) {
event.target.value = value;
this.setInputValue(value);
this.setState({

@@ -579,3 +583,3 @@ value: this.hasValue ? this.state.value : value

if (value !== this.state.value) {
event.target.value = value;
this.setInputValue(value);
this.setState({

@@ -595,3 +599,3 @@ value: this.hasValue ? this.state.value : value

onChange: function(event) {
var { pasteSelection, mask, maskChar, lastEditablePos } = this;
var { pasteSelection, mask, maskChar, lastEditablePos, preventEmptyChange } = this;
var target = event.target;

@@ -602,3 +606,3 @@ var value = this.getInputValue();

this.preventEmptyChange = false;
target.value = this.state.value;
this.setInputValue(this.state.value);
return;

@@ -670,7 +674,7 @@ }

// prevent hanging after first entered character on Windows 10 Mobile
if (!this.isAndroidBrowser && !this.isWindowsPhoneBrowser) {
target.value = value;
if (!this.canUseAccessors || (!this.isAndroidBrowser && !this.isWindowsPhoneBrowser)) {
this.setInputValue(value);
}
if ((this.isAndroidFirefox && value && !this.getInputValue()) || this.isAndroidBrowser || this.isWindowsPhoneBrowser) {
if (this.canUseAccessors && ((this.isAndroidFirefox && value && !this.getInputValue()) || this.isAndroidBrowser || this.isWindowsPhoneBrowser)) {
this.value = value;

@@ -694,2 +698,3 @@ this.enableValueAccessors();

}
this.setCaretPos(caretPos);

@@ -702,6 +707,6 @@ },

var inputValue = this.formatValue(value);
var isInputValueChanged = inputValue !== event.target.value;
var isInputValueChanged = inputValue !== this.getInputValue();
if (isInputValueChanged) {
event.target.value = inputValue;
this.setInputValue(inputValue);
}

@@ -728,5 +733,5 @@

var inputValue = "";
var isInputValueChanged = inputValue !== event.target.value;
var isInputValueChanged = inputValue !== this.getInputValue();
if (isInputValueChanged) {
event.target.value = inputValue;
this.setInputValue(inputValue);
}

@@ -748,3 +753,3 @@ this.setState({

this.pasteSelection = this.getSelection();
event.target.value = "";
this.setInputValue("");
return;

@@ -775,5 +780,5 @@ }

caretPos = this.getRightEditablePos(caretPos) || caretPos;
if (value !== this.getInputDOMNode().value) {
if (value !== this.getInputValue()) {
if (event) {
event.target.value = value;
this.setInputValue(value);
}

@@ -794,2 +799,8 @@ this.setState({

if (Object.getOwnPropertyDescriptor && Object.getPrototypeOf && Object.defineProperty) {
var input = this.getInputDOMNode();
var valueDescriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(input), 'value');
this.canUseAccessors = !!(valueDescriptor && valueDescriptor.get && valueDescriptor.set);
}
if (this.mask && this.props.value == null) {

@@ -796,0 +807,0 @@ this.updateUncontrolledInput();

{
"name": "react-input-mask",
"description": "Masked input component for React",
"version": "0.7.3",
"version": "0.7.4",
"homepage": "https://github.com/sanniassin/react-input-mask",

@@ -6,0 +6,0 @@ "license": "MIT",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc