Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.delimiter = this.options.thousandsSeparator || separators.delimiter;
}
else {
this.delimiter = '';
}
this.decimalLimit = getNumberDecimalLimit(this.component);
// Currencies to override BrowserLanguage Config. Object key {}
if (_.has(this.options, `languageOverride.${this.options.language}`)) {
const override = _.get(this.options, `languageOverride.${this.options.language}`);
this.decimalSeparator = override.decimalSeparator;
this.delimiter = override.delimiter;
}
this.numberMask = createNumberMask({
prefix: '',
suffix: '',
requireDecimal: this.component.requireDecimal ?? false,
thousandsSeparatorSymbol: this.component.thousandsSeparator ?? this.delimiter,
decimalSymbol: this.component.decimalSymbol ?? this.decimalSeparator,
decimalLimit: this.component.decimalLimit ?? this.decimalLimit,
allowNegative: this.component.allowNegative ?? true,
allowDecimal: this.component.allowDecimal ?? !this.component.validate?.integer,
fillGaps: this.component.decimalLimit && this.component.requireDecimal,
});
}
}
var mask;
if (scope.component.inputMask) {
// Text or other input mask, including number with inputMask.
mask = formioUtils.getInputMask(scope.component.inputMask);
}
else if (format === 'currency') {
maskOptions.prefix = scope.prefix;
maskOptions.suffix = scope.suffix;
// Currency mask.
mask = createNumberMask(maskOptions);
}
else if (format === 'number') {
// Numeric input mask.
mask = createNumberMask(maskOptions);
}
else if (format === 'datetime') {
mask = formioUtils.getInputMask((scope.component.format.replace(/[hHmMyYdD]/g, '9').replace(/[a]/g, 'P')));
mask.forEach(function(item, index) {
if (item === 'P') {
mask[index] = /[AP]/;
mask.splice(index + 1, 0, /[M]/);
}
});
}
// Set the mask on the input element.
if (mask) {
scope.inputMask = mask;
maskInput({
inputElement: input,
createNumberMask() {
const decimalLimit = _.get(this.component, 'decimalLimit', 2);
const affixes = getCurrencyAffixes({
currency: this.component.currency,
decimalLimit: decimalLimit,
decimalSeparator: this.decimalSeparator,
lang: this.options.language
});
this.prefix = this.options.prefix || affixes.prefix;
this.suffix = this.options.suffix || affixes.suffix;
return createNumberMask({
prefix: this.prefix,
suffix: this.suffix,
thousandsSeparatorSymbol: _.get(this.component, 'thousandsSeparator', this.delimiter),
decimalSymbol: _.get(this.component, 'decimalSymbol', this.decimalSeparator),
decimalLimit: decimalLimit,
allowNegative: _.get(this.component, 'allowNegative', true),
allowDecimal: _.get(this.component, 'allowDecimal', true)
});
}
Row,
Card,
CardBody,
Container,
Col,
FormGroup,
Label,
Input
} from './../../components';
import { HeaderMain } from "../../features/HeaderMain";
const autoCorrectedDatePipe = createAutoCorrectedDatePipe('mm/dd/yyyy');
const dolarsMask = createNumberMask({ prefix: '$' });
const dolarsMaskDecimal = createNumberMask({ prefix: '$', allowDecimal: true });
const percentageMask = createNumberMask({ prefix: '', suffix: '%', integerLimit: 3 });
const upperCasePipe = conformedValue => conformedValue.toUpperCase();
const TextMask = () => (
<p>
Text Mask is an input mask library.
It can create input masks for <code>phone</code>,
<code>date</code>, <code>currency</code>, <code>zip code</code>, <code>percentage</code>, <code>email</code>, and literally anything!
</p>
createNumberMask() {
return createNumberMask({
prefix: '',
suffix: '',
requireDecimal: _.get(this.component, 'requireDecimal', false),
thousandsSeparatorSymbol: _.get(this.component, 'thousandsSeparator', this.delimiter),
decimalSymbol: _.get(this.component, 'decimalSymbol', this.decimalSeparator),
decimalLimit: _.get(this.component, 'decimalLimit', this.decimalLimit),
allowNegative: _.get(this.component, 'allowNegative', true),
allowDecimal: _.get(this.component, 'allowDecimal',
!(this.component.validate && this.component.validate.integer))
});
}
import {
Row,
Card,
CardBody,
Container,
Col,
FormGroup,
Label,
Input
} from './../../components';
import { HeaderMain } from "../../features/HeaderMain";
const autoCorrectedDatePipe = createAutoCorrectedDatePipe('mm/dd/yyyy');
const dolarsMask = createNumberMask({ prefix: '$' });
const dolarsMaskDecimal = createNumberMask({ prefix: '$', allowDecimal: true });
const percentageMask = createNumberMask({ prefix: '', suffix: '%', integerLimit: 3 });
const upperCasePipe = conformedValue => conformedValue.toUpperCase();
const TextMask = () => (
<p>
Text Mask is an input mask library.
It can create input masks for <code>phone</code>,
<code>date</code>, <code>currency</code>, <code>zip code</code>, <code>percentage</code>, <code>email</code>, and literally anything!
</p>
import {
Row,
Card,
CardBody,
Container,
Col,
FormGroup,
Label,
Input
} from './../../components';
import { HeaderMain } from "../../features/HeaderMain";
const autoCorrectedDatePipe = createAutoCorrectedDatePipe('mm/dd/yyyy');
const dolarsMask = createNumberMask({ prefix: '$' });
const dolarsMaskDecimal = createNumberMask({ prefix: '$', allowDecimal: true });
const percentageMask = createNumberMask({ prefix: '', suffix: '%', integerLimit: 3 });
const upperCasePipe = conformedValue => conformedValue.toUpperCase();
const TextMask = () => (
<p>
Text Mask is an input mask library.
It can create input masks for <code>phone</code>,
<code>date</code>, <code>currency</code>, <code>zip code</code>, <code>percentage</code>, <code>email</code>, and literally anything!
</p>