From b290d38f95331a1b69c48aea3458d4f9097639ac Mon Sep 17 00:00:00 2001 From: Thivarella Date: Fri, 15 May 2020 02:19:02 -0300 Subject: [PATCH 1/7] Update index.d.ts --- index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/index.d.ts b/index.d.ts index 8c831e9a..78d46986 100644 --- a/index.d.ts +++ b/index.d.ts @@ -20,6 +20,7 @@ export type TextInputMaskTypeProp = | 'cel-phone' | 'datetime' | 'custom' + | 'only-letters' // Option prop of TextInputMask. export interface TextInputMaskOptionProp { From f4b2447157430684666dbbeeeb50ad46c07471c0 Mon Sep 17 00:00:00 2001 From: Thivarella Date: Fri, 15 May 2020 02:20:24 -0300 Subject: [PATCH 2/7] Create only-letters.mask.js --- lib/masks/only-letters.mask.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 lib/masks/only-letters.mask.js diff --git a/lib/masks/only-letters.mask.js b/lib/masks/only-letters.mask.js new file mode 100644 index 00000000..3667dc9b --- /dev/null +++ b/lib/masks/only-letters.mask.js @@ -0,0 +1,23 @@ +import BaseMask from './_base.mask' + +export default class OnlyLettersMask extends BaseMask { + static getType() { + return 'only-letters' + } + + getValue(value, settings) { + return this.removeNotLetters(String(value)) + } + + getRawValue(maskedValue, settings) { + return super.removeNotLetters(String(maskedValue)) + } + + validate(value, settings) { + return true + } + + getMask(value, settings) { + return '' + } +} From 19d9c3bf704a5609467f70ef69c7d70447afb76c Mon Sep 17 00:00:00 2001 From: Thivarella Date: Fri, 15 May 2020 02:21:05 -0300 Subject: [PATCH 3/7] Update index.js --- lib/masks/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/masks/index.js b/lib/masks/index.js index 3a436310..9db93b10 100644 --- a/lib/masks/index.js +++ b/lib/masks/index.js @@ -5,6 +5,7 @@ import CustomMask from './custom.mask' import DatetimeMask from './datetime.mask' import MoneyMask from './money.mask' import OnlyNumbersMask from './only-numbers.mask' +import OnlyLettersMask from './only-letters.mask' import ZipCodeMask from './zip-code.mask' import CreditCardMask from './credit-card.mask' @@ -15,5 +16,6 @@ module.exports.CustomMask = CustomMask module.exports.DatetimeMask = DatetimeMask module.exports.MoneyMask = MoneyMask module.exports.OnlyNumbersMask = OnlyNumbersMask +module.exports.OnlyLettersMask = OnlyLettersMask module.exports.ZipCodeMask = ZipCodeMask module.exports.CreditCardMask = CreditCardMask From fe0216708f5de024ec7e95d961b59faed6a2b386 Mon Sep 17 00:00:00 2001 From: Thivarella Date: Fri, 15 May 2020 02:21:51 -0300 Subject: [PATCH 4/7] Update _base.mask.js --- lib/masks/_base.mask.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/masks/_base.mask.js b/lib/masks/_base.mask.js index cd831ed6..90a4fbf9 100644 --- a/lib/masks/_base.mask.js +++ b/lib/masks/_base.mask.js @@ -33,6 +33,10 @@ export default class BaseMask { removeNotNumbers(text) { return text.replace(/[^0-9]+/g, '') } + + removeNotLeters(text) { + return text.replace(/\d/g, '') + } removeWhiteSpaces(text) { return (text || '').replace(/\s/g, '') From 01f1bee9aaf7c975a9ee43dc31919c01e53bb674 Mon Sep 17 00:00:00 2001 From: Thivarella Date: Fri, 15 May 2020 02:36:50 -0300 Subject: [PATCH 5/7] Update index.js --- dist/lib/masks/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/lib/masks/index.js b/dist/lib/masks/index.js index 84b569e3..6f26d5c0 100644 --- a/dist/lib/masks/index.js +++ b/dist/lib/masks/index.js @@ -1 +1 @@ -var _celPhone=require('./cel-phone.mask');var _celPhone2=_interopRequireDefault(_celPhone);var _cnpj=require('./cnpj.mask');var _cnpj2=_interopRequireDefault(_cnpj);var _cpf=require('./cpf.mask');var _cpf2=_interopRequireDefault(_cpf);var _custom=require('./custom.mask');var _custom2=_interopRequireDefault(_custom);var _datetime=require('./datetime.mask');var _datetime2=_interopRequireDefault(_datetime);var _money=require('./money.mask');var _money2=_interopRequireDefault(_money);var _onlyNumbers=require('./only-numbers.mask');var _onlyNumbers2=_interopRequireDefault(_onlyNumbers);var _zipCode=require('./zip-code.mask');var _zipCode2=_interopRequireDefault(_zipCode);var _creditCard=require('./credit-card.mask');var _creditCard2=_interopRequireDefault(_creditCard);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}module.exports.CelPhoneMask=_celPhone2.default;module.exports.CnpjMask=_cnpj2.default;module.exports.CpfMask=_cpf2.default;module.exports.CustomMask=_custom2.default;module.exports.DatetimeMask=_datetime2.default;module.exports.MoneyMask=_money2.default;module.exports.OnlyNumbersMask=_onlyNumbers2.default;module.exports.ZipCodeMask=_zipCode2.default;module.exports.CreditCardMask=_creditCard2.default; \ No newline at end of file +var _celPhone=require('./cel-phone.mask');var _celPhone2=_interopRequireDefault(_celPhone);var _cnpj=require('./cnpj.mask');var _cnpj2=_interopRequireDefault(_cnpj);var _cpf=require('./cpf.mask');var _cpf2=_interopRequireDefault(_cpf);var _custom=require('./custom.mask');var _custom2=_interopRequireDefault(_custom);var _datetime=require('./datetime.mask');var _datetime2=_interopRequireDefault(_datetime);var _money=require('./money.mask');var _money2=_interopRequireDefault(_money);var _onlyNumbers=require('./only-numbers.mask');var _onlyNumbers2=_interopRequireDefault(_onlyNumbers);var _onlyLetters=require('./only-letters.mask');var _onlyLetters2=_interopRequireDefault(_onlyLetters);var _zipCode=require('./zip-code.mask');var _zipCode2=_interopRequireDefault(_zipCode);var _creditCard=require('./credit-card.mask');var _creditCard2=_interopRequireDefault(_creditCard);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj};}module.exports.CelPhoneMask=_celPhone2.default;module.exports.CnpjMask=_cnpj2.default;module.exports.CpfMask=_cpf2.default;module.exports.CustomMask=_custom2.default;module.exports.DatetimeMask=_datetime2.default;module.exports.MoneyMask=_money2.default;module.exports.OnlyNumbersMask=_onlyNumbers2.default;module.exports.OnlyLettersMask=_onlyLetters2.default;module.exports.ZipCodeMask=_zipCode2.default;module.exports.CreditCardMask=_creditCard2.default; From 3e3fa1e528ba459f1de69edb1160f091a0b18913 Mon Sep 17 00:00:00 2001 From: Thivarella Date: Fri, 15 May 2020 02:39:24 -0300 Subject: [PATCH 6/7] Add files via upload --- dist/lib/masks/only-letters.mask.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 dist/lib/masks/only-letters.mask.js diff --git a/dist/lib/masks/only-letters.mask.js b/dist/lib/masks/only-letters.mask.js new file mode 100644 index 00000000..ec2c4e1d --- /dev/null +++ b/dist/lib/masks/only-letters.mask.js @@ -0,0 +1 @@ +Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i Date: Fri, 15 May 2020 02:40:39 -0300 Subject: [PATCH 7/7] Update _base.mask.js --- dist/lib/masks/_base.mask.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/lib/masks/_base.mask.js b/dist/lib/masks/_base.mask.js index 9ec35a7f..25a7207d 100644 --- a/dist/lib/masks/_base.mask.js +++ b/dist/lib/masks/_base.mask.js @@ -1 +1 @@ -Object.defineProperty(exports,"__esModule",{value:true});var _createClass=function(){function defineProperties(target,props){for(var i=0;i