react-imask
Advanced tools
Comparing version 6.0.5 to 6.0.6
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('imask/esm'), require('react'), require('prop-types'), require('imask/esm/imask')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'imask/esm', 'react', 'prop-types', 'imask/esm/imask'], factory) : | ||
(global = global || self, factory(global.ReactIMask = {}, null, global.React, global.PropTypes, global.IMask)); | ||
}(this, (function (exports, esm, React, PropTypes, IMask) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('imask'), require('react'), require('prop-types')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'imask', 'react', 'prop-types'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.ReactIMask = {}, global.IMask, global.React, global.PropTypes)); | ||
}(this, (function (exports, IMask, React, PropTypes) { 'use strict'; | ||
React = React && React.hasOwnProperty('default') ? React['default'] : React; | ||
PropTypes = PropTypes && PropTypes.hasOwnProperty('default') ? PropTypes['default'] : PropTypes; | ||
IMask = IMask && IMask.hasOwnProperty('default') ? IMask['default'] : IMask; | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var IMask__default = /*#__PURE__*/_interopDefaultLegacy(IMask); | ||
var React__default = /*#__PURE__*/_interopDefaultLegacy(React); | ||
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes); | ||
function _classCallCheck(instance, Constructor) { | ||
@@ -64,2 +66,15 @@ if (!(instance instanceof Constructor)) { | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
if (Reflect.construct.sham) return false; | ||
if (typeof Proxy === "function") return true; | ||
try { | ||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
function _objectWithoutPropertiesLoose(source, excluded) { | ||
@@ -117,38 +132,57 @@ if (source == null) return {}; | ||
function _createSuper(Derived) { | ||
var hasNativeReflectConstruct = _isNativeReflectConstruct(); | ||
return function _createSuperInternal() { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (hasNativeReflectConstruct) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
result = Reflect.construct(Super, arguments, NewTarget); | ||
} else { | ||
result = Super.apply(this, arguments); | ||
} | ||
return _possibleConstructorReturn(this, result); | ||
}; | ||
} | ||
var MASK_PROPS = { | ||
// common | ||
mask: PropTypes.oneOfType([PropTypes.array, PropTypes.func, PropTypes.string, PropTypes.instanceOf(RegExp), PropTypes.oneOf([Date, Number, IMask.Masked]), PropTypes.instanceOf(IMask.Masked)]), | ||
value: PropTypes.any, | ||
unmask: PropTypes.oneOfType([PropTypes.bool, PropTypes.oneOf(['typed'])]), | ||
prepare: PropTypes.func, | ||
validate: PropTypes.func, | ||
commit: PropTypes.func, | ||
overwrite: PropTypes.bool, | ||
mask: PropTypes__default['default'].oneOfType([PropTypes__default['default'].array, PropTypes__default['default'].func, PropTypes__default['default'].string, PropTypes__default['default'].instanceOf(RegExp), PropTypes__default['default'].oneOf([Date, Number, IMask__default['default'].Masked]), PropTypes__default['default'].instanceOf(IMask__default['default'].Masked)]), | ||
value: PropTypes__default['default'].any, | ||
unmask: PropTypes__default['default'].oneOfType([PropTypes__default['default'].bool, PropTypes__default['default'].oneOf(['typed'])]), | ||
prepare: PropTypes__default['default'].func, | ||
validate: PropTypes__default['default'].func, | ||
commit: PropTypes__default['default'].func, | ||
overwrite: PropTypes__default['default'].bool, | ||
// events | ||
onAccept: PropTypes.func, | ||
onComplete: PropTypes.func, | ||
onAccept: PropTypes__default['default'].func, | ||
onComplete: PropTypes__default['default'].func, | ||
// pattern | ||
placeholderChar: PropTypes.string, | ||
lazy: PropTypes.bool, | ||
definitions: PropTypes.object, | ||
blocks: PropTypes.object, | ||
placeholderChar: PropTypes__default['default'].string, | ||
lazy: PropTypes__default['default'].bool, | ||
definitions: PropTypes__default['default'].object, | ||
blocks: PropTypes__default['default'].object, | ||
// date | ||
pattern: PropTypes.string, | ||
format: PropTypes.func, | ||
parse: PropTypes.func, | ||
autofix: PropTypes.bool, | ||
pattern: PropTypes__default['default'].string, | ||
format: PropTypes__default['default'].func, | ||
parse: PropTypes__default['default'].func, | ||
autofix: PropTypes__default['default'].bool, | ||
// number | ||
radix: PropTypes.string, | ||
thousandsSeparator: PropTypes.string, | ||
mapToRadix: PropTypes.arrayOf(PropTypes.string), | ||
scale: PropTypes.number, | ||
signed: PropTypes.bool, | ||
normalizeZeros: PropTypes.bool, | ||
padFractionalZeros: PropTypes.bool, | ||
min: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]), | ||
max: PropTypes.oneOfType([PropTypes.number, PropTypes.instanceOf(Date)]), | ||
radix: PropTypes__default['default'].string, | ||
thousandsSeparator: PropTypes__default['default'].string, | ||
mapToRadix: PropTypes__default['default'].arrayOf(PropTypes__default['default'].string), | ||
scale: PropTypes__default['default'].number, | ||
signed: PropTypes__default['default'].bool, | ||
normalizeZeros: PropTypes__default['default'].bool, | ||
padFractionalZeros: PropTypes__default['default'].bool, | ||
min: PropTypes__default['default'].oneOfType([PropTypes__default['default'].number, PropTypes__default['default'].instanceOf(Date)]), | ||
max: PropTypes__default['default'].oneOfType([PropTypes__default['default'].number, PropTypes__default['default'].instanceOf(Date)]), | ||
// dynamic | ||
dispatch: PropTypes.func, | ||
dispatch: PropTypes__default['default'].func, | ||
// ref | ||
inputRef: PropTypes.func | ||
inputRef: PropTypes__default['default'].func | ||
}; | ||
@@ -161,10 +195,8 @@ var MASK_PROPS_NAMES = Object.keys(MASK_PROPS); | ||
function IMaskMixin(ComposedComponent) { | ||
var MaskedComponent = | ||
/*#__PURE__*/ | ||
function (_React$Component) { | ||
var MaskedComponent = /*#__PURE__*/function (_React$Component) { | ||
_inherits(MaskedComponent, _React$Component); | ||
var _super = _createSuper(MaskedComponent); | ||
function MaskedComponent() { | ||
var _getPrototypeOf2; | ||
var _this; | ||
@@ -178,3 +210,3 @@ | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(MaskedComponent)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this._inputRef = _this._inputRef.bind(_assertThisInitialized(_this)); | ||
@@ -229,3 +261,3 @@ return _this; | ||
value: function render() { | ||
return React.createElement(ComposedComponent, Object.assign({}, this._extractNonMaskProps(this.props), { | ||
return React__default['default'].createElement(ComposedComponent, Object.assign({}, this._extractNonMaskProps(this.props), { | ||
defaultValue: this.props.value, | ||
@@ -239,3 +271,3 @@ inputRef: this._inputRef | ||
var maskOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this._extractMaskOptionsFromProps(Object.assign({}, this.props)); | ||
this.maskRef = IMask(this.element, maskOptions).on('accept', this._onAccept.bind(this)).on('complete', this._onComplete.bind(this)); | ||
this.maskRef = IMask__default['default'](this.element, maskOptions).on('accept', this._onAccept.bind(this)).on('complete', this._onComplete.bind(this)); | ||
this.maskValue = this.props.value; | ||
@@ -273,2 +305,13 @@ } | ||
}, { | ||
key: "maskValue", | ||
get: function get() { | ||
if (this.props.unmask === 'typed') return this.maskRef.typedValue; | ||
if (this.props.unmask) return this.maskRef.unmaskedValue; | ||
return this.maskRef.value; | ||
}, | ||
set: function set(value) { | ||
value = value == null ? '' : value; | ||
if (this.props.unmask === 'typed') this.maskRef.typedValue = value;else if (this.props.unmask) this.maskRef.unmaskedValue = value;else this.maskRef.value = value; | ||
} | ||
}, { | ||
key: "_onAccept", | ||
@@ -295,17 +338,6 @@ value: function _onAccept() { | ||
} | ||
}, { | ||
key: "maskValue", | ||
get: function get() { | ||
if (this.props.unmask === 'typed') return this.maskRef.typedValue; | ||
if (this.props.unmask) return this.maskRef.unmaskedValue; | ||
return this.maskRef.value; | ||
}, | ||
set: function set(value) { | ||
value = value == null ? '' : value; | ||
if (this.props.unmask === 'typed') this.maskRef.typedValue = value;else if (this.props.unmask) this.maskRef.unmaskedValue = value;else this.maskRef.value = value; | ||
} | ||
}]); | ||
return MaskedComponent; | ||
}(React.Component); | ||
}(React__default['default'].Component); | ||
@@ -322,3 +354,3 @@ MaskedComponent.propTypes = MASK_PROPS; | ||
return React.createElement('input', Object.assign({}, props, { | ||
return React__default['default'].createElement('input', Object.assign({}, props, { | ||
ref: inputRef | ||
@@ -325,0 +357,0 @@ })); |
@@ -5,3 +5,3 @@ { | ||
"license": "MIT", | ||
"version": "6.0.5", | ||
"version": "6.0.6", | ||
"homepage": "https://imask.js.org/", | ||
@@ -22,3 +22,3 @@ "description": "React input mask", | ||
"dependencies": { | ||
"imask": "^6.0.5", | ||
"imask": "^6.0.6", | ||
"prop-types": "^15.7.2" | ||
@@ -32,3 +32,3 @@ }, | ||
}, | ||
"gitHead": "5af8593f94a26c3cb73033b4b7bc77c679c52567" | ||
"gitHead": "57687259268b61e3df3ec6ee7fca0591845a8748" | ||
} |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
41091
6
604
1
Updatedimask@^6.0.6