Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency ngx-mask to v17 #1466

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions web/autosubliminal/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion web/autosubliminal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"natural-compare": "1.4.0",
"ng-lazyload-image": "9.1.3",
"ngx-countdown": "16.0.0",
"ngx-mask": "16.4.1",
"ngx-mask": "17.0.2",
"ngx-webstorage": "12.0.0",
"ngx-window-token": "7.0.0",
"primeicons": "6.0.1",
Expand Down
2 changes: 1 addition & 1 deletion web/autosubliminal/static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@

<body>
<app-root></app-root>
<script src="runtime.71d8a67be0ad9892.js" type="module"></script><script src="polyfills.eedc44092fabcb8f.js" type="module"></script><script src="scripts.4cc9680d69b62987.js" defer></script><script src="main.cb1a94c9f0403422.js" type="module"></script></body>
<script src="runtime.71d8a67be0ad9892.js" type="module"></script><script src="polyfills.eedc44092fabcb8f.js" type="module"></script><script src="scripts.4cc9680d69b62987.js" defer></script><script src="main.66b5784d1e8c6556.js" type="module"></script></body>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -91112,6 +91112,7 @@ let NgxMaskApplierService = /*#__PURE__*/(() => {
this.outputTransformFn = this._config.outputTransformFn;
this.keepCharacterPositions = this._config.keepCharacterPositions;
this._shift = new Set();
this.plusOnePosition = false;
this.maskExpression = '';
this.actualValue = '';
this.showKeepCharacterExp = '';
Expand Down Expand Up @@ -91213,7 +91214,7 @@ let NgxMaskApplierService = /*#__PURE__*/(() => {
let backspaceShift = false;
let shift = 1;
let stepBack = false;
if (inputValue.slice(0, this.prefix.length) === this.prefix && !this.showMaskTyped) {
if (inputValue.slice(0, this.prefix.length) === this.prefix) {
// eslint-disable-next-line no-param-reassign
inputValue = inputValue.slice(this.prefix.length, inputValue.length);
}
Expand Down Expand Up @@ -91284,9 +91285,38 @@ let NgxMaskApplierService = /*#__PURE__*/(() => {
// eslint-disable-next-line no-param-reassign
inputValue = this._stripToDecimal(inputValue);
}
// eslint-disable-next-line no-param-reassign
inputValue = inputValue[0] === '-' && this.allowNegativeNumbers ? inputValue.length > 2 && inputValue[1] === '0' && inputValue[2] !== this.thousandSeparator && !this._compareOrIncludes(inputValue[2], this.decimalMarker, this.thousandSeparator) && !backspaced ? inputValue.slice(0, inputValue.length - 1) : inputValue : inputValue.length > 1 && inputValue[0] === '0' && inputValue[1] !== this.thousandSeparator && !this._compareOrIncludes(inputValue[1], this.decimalMarker, this.thousandSeparator) && !backspaced ? inputValue.slice(0, inputValue.length - 1) : inputValue;
const precision = this.getPrecision(maskExpression);
const decimalMarker = Array.isArray(this.decimalMarker) ? "." /* MaskExpression.DOT */ : this.decimalMarker;
if (precision === 0) {
// eslint-disable-next-line no-param-reassign
inputValue = this.allowNegativeNumbers ? inputValue.length > 2 && inputValue[0] === "-" /* MaskExpression.MINUS */ && inputValue[1] === "0" /* MaskExpression.NUMBER_ZERO */ && inputValue[2] !== this.thousandSeparator && inputValue[2] !== "," /* MaskExpression.COMMA */ && inputValue[2] !== "." /* MaskExpression.DOT */ ? '-' + inputValue.slice(2, inputValue.length) : inputValue[0] === "0" /* MaskExpression.NUMBER_ZERO */ && inputValue.length > 1 && inputValue[1] !== this.thousandSeparator && inputValue[1] !== "," /* MaskExpression.COMMA */ && inputValue[1] !== "." /* MaskExpression.DOT */ ? inputValue.slice(1, inputValue.length) : inputValue : inputValue.length > 1 && inputValue[0] === "0" /* MaskExpression.NUMBER_ZERO */ && inputValue[1] !== this.thousandSeparator && inputValue[1] !== "," /* MaskExpression.COMMA */ && inputValue[1] !== "." /* MaskExpression.DOT */ ? inputValue.slice(1, inputValue.length) : inputValue;
} else {
// eslint-disable-next-line no-param-reassign
if (inputValue[0] === decimalMarker && inputValue.length > 1) {
// eslint-disable-next-line no-param-reassign
inputValue = "0" /* MaskExpression.NUMBER_ZERO */ + inputValue.slice(0, inputValue.length + 1);
this.plusOnePosition = true;
}
if (inputValue[0] === "0" /* MaskExpression.NUMBER_ZERO */ && inputValue[1] !== decimalMarker && inputValue[1] !== this.thousandSeparator) {
// eslint-disable-next-line no-param-reassign
inputValue = inputValue.length > 1 ? inputValue.slice(0, 1) + decimalMarker + inputValue.slice(1, inputValue.length + 1) : inputValue;
this.plusOnePosition = true;
}
if (this.allowNegativeNumbers && inputValue[0] === "-" /* MaskExpression.MINUS */ && (inputValue[1] === decimalMarker || inputValue[1] === "0" /* MaskExpression.NUMBER_ZERO */)) {
// eslint-disable-next-line no-param-reassign
inputValue = inputValue[1] === decimalMarker && inputValue.length > 2 ? inputValue.slice(0, 1) + "0" /* MaskExpression.NUMBER_ZERO */ + inputValue.slice(1, inputValue.length) : inputValue[1] === "0" /* MaskExpression.NUMBER_ZERO */ && inputValue.length > 2 && inputValue[2] !== decimalMarker ? inputValue.slice(0, 2) + decimalMarker + inputValue.slice(2, inputValue.length) : inputValue;
this.plusOnePosition = true;
}
}
if (backspaced) {
if (inputValue[0] === "0" /* MaskExpression.NUMBER_ZERO */ && inputValue[1] === this.decimalMarker && (inputValue[position] === "0" /* MaskExpression.NUMBER_ZERO */ || inputValue[position] === this.decimalMarker)) {
// eslint-disable-next-line no-param-reassign
inputValue = inputValue.slice(2, inputValue.length);
}
if (inputValue[0] === "-" /* MaskExpression.MINUS */ && inputValue[1] === "0" /* MaskExpression.NUMBER_ZERO */ && inputValue[2] === this.decimalMarker && (inputValue[position] === "0" /* MaskExpression.NUMBER_ZERO */ || inputValue[position] === this.decimalMarker)) {
// eslint-disable-next-line no-param-reassign
inputValue = "-" /* MaskExpression.MINUS */ + inputValue.slice(3, inputValue.length);
}
// eslint-disable-next-line no-param-reassign
inputValue = this._compareOrIncludes(inputValue[inputValue.length - 1], this.decimalMarker, this.thousandSeparator) ? inputValue.slice(0, inputValue.length - 1) : inputValue;
}
Expand All @@ -91303,11 +91333,10 @@ let NgxMaskApplierService = /*#__PURE__*/(() => {
invalidChars = invalidChars.replace(this._charToRegExpExpression(this.decimalMarker), '');
}
const invalidCharRegexp = new RegExp('[' + invalidChars + ']');
if (inputValue.match(invalidCharRegexp) || inputValue.length === 1 && this._compareOrIncludes(inputValue, this.decimalMarker, this.thousandSeparator)) {
if (inputValue.match(invalidCharRegexp)) {
// eslint-disable-next-line no-param-reassign
inputValue = inputValue.substring(0, inputValue.length - 1);
}
const precision = this.getPrecision(maskExpression);
// eslint-disable-next-line no-param-reassign
inputValue = this.checkInputPrecision(inputValue, precision, this.decimalMarker);
const strForSep = inputValue.replace(new RegExp(thousandSeparatorCharEscaped, 'g'), '');
Expand Down Expand Up @@ -91496,7 +91525,7 @@ let NgxMaskApplierService = /*#__PURE__*/(() => {
if (backspaced) {
onlySpecial = inputArray.every(char => this.specialCharacters.includes(char));
}
let res = `${this.prefix}${onlySpecial ? "" /* MaskExpression.EMPTY_STRING */ : result}${this.suffix}`;
let res = `${this.prefix}${onlySpecial ? "" /* MaskExpression.EMPTY_STRING */ : result}${this.showMaskTyped ? '' : this.suffix}`;
if (result.length === 0) {
res = !this.dropSpecialCharacters ? `${this.prefix}${result}` : `${result}`;
}
Expand Down Expand Up @@ -91629,7 +91658,7 @@ let NgxMaskService = /*#__PURE__*/(() => {

if (!inputValue && this.showMaskTyped) {
this.formControlResult(this.prefix);
return this.prefix + this.maskIsShown;
return this.prefix + this.maskIsShown + this.suffix;
}
const getSymbol = !!inputValue && typeof this.selStart === 'number' ? inputValue[this.selStart] ?? "" /* MaskExpression.EMPTY_STRING */ : "" /* MaskExpression.EMPTY_STRING */;
let newInputValue = '';
Expand Down Expand Up @@ -91712,7 +91741,7 @@ let NgxMaskService = /*#__PURE__*/(() => {
return result;
}
const resLen = result.length;
const prefNmask = this.prefix + this.maskIsShown;
const prefNmask = this.prefix + this.maskIsShown + this.suffix;
if (this.maskExpression.includes("H" /* MaskExpression.HOURS */)) {
const countSkipedSymbol = this._numberSkipedSymbols(result);
return result + prefNmask.slice(resLen + countSkipedSymbol);
Expand Down Expand Up @@ -91983,7 +92012,7 @@ let NgxMaskService = /*#__PURE__*/(() => {
let specialCharacters = Array.isArray(this.dropSpecialCharacters) ? this.specialCharacters.filter(v => {
return this.dropSpecialCharacters.includes(v);
}) : this.specialCharacters;
if (!this.deletedSpecialCharacter && this._checkPatternForSpace() && result.includes(" " /* MaskExpression.WHITE_SPACE */)) {
if (!this.deletedSpecialCharacter && this._checkPatternForSpace() && result.includes(" " /* MaskExpression.WHITE_SPACE */) && this.maskExpression.includes("*" /* MaskExpression.SYMBOL_STAR */)) {
specialCharacters = specialCharacters.filter(char => char !== " " /* MaskExpression.WHITE_SPACE */);
}

Expand Down Expand Up @@ -92206,20 +92235,19 @@ let NgxMaskDirective = /*#__PURE__*/(() => {
this._maskService.maskExpression = this._maskValue;
}
}
if (allowNegativeNumbers) {
this._maskService.allowNegativeNumbers = allowNegativeNumbers.currentValue;
if (this._maskService.allowNegativeNumbers) {
this._maskService.specialCharacters = this._maskService.specialCharacters.filter(c => c !== "-" /* MaskExpression.MINUS */);
}
}

if (specialCharacters) {
if (!specialCharacters.currentValue || !Array.isArray(specialCharacters.currentValue)) {
return;
} else {
this._maskService.specialCharacters = specialCharacters.currentValue || [];
}
}
if (allowNegativeNumbers) {
this._maskService.allowNegativeNumbers = allowNegativeNumbers.currentValue;
if (this._maskService.allowNegativeNumbers) {
this._maskService.specialCharacters = this._maskService.specialCharacters.filter(c => c !== "-" /* MaskExpression.MINUS */);
}
}
// Only overwrite the mask available patterns if a pattern has actually been passed in
if (patterns && patterns.currentValue) {
this._maskService.patterns = patterns.currentValue;
Expand Down Expand Up @@ -92437,7 +92465,13 @@ let NgxMaskDirective = /*#__PURE__*/(() => {
this._maskService.actualValue = el.value.slice(0, position - 1) + el.value.slice(position, position + 1) + inputSymbol + el.value.slice(position + 2);
position = position + 1;
} else if (checkSymbols) {
this._maskService.actualValue = el.value.slice(0, position - 1) + inputSymbol + el.value.slice(position + 1).split(this.suffix).join('') + this.suffix;
if (el.value.length === 1 && position === 1) {
this._maskService.actualValue = this.prefix + inputSymbol + this._maskService.maskIsShown.slice(1, this._maskService.maskIsShown.length) + this.suffix;
} else {
this._maskService.actualValue = el.value.slice(0, position - 1) + inputSymbol + el.value.slice(position + 1).split(this.suffix).join('') + this.suffix;
}
} else if (this.prefix && el.value.length === 1 && position - prefixLength === 1 && this._maskService._checkSymbolMask(el.value, this._maskService.maskExpression[position - 1 - prefixLength] ?? "" /* MaskExpression.EMPTY_STRING */)) {
this._maskService.actualValue = this.prefix + el.value + this._maskService.maskIsShown.slice(1, this._maskService.maskIsShown.length) + this.suffix;
}
}
}
Expand Down Expand Up @@ -92470,6 +92504,10 @@ let NgxMaskDirective = /*#__PURE__*/(() => {
if (this._getActiveElement() !== el) {
return;
}
if (this._maskService.plusOnePosition) {
position = position + 1;
this._maskService.plusOnePosition = false;
}
// update position after applyValueChanges to prevent cursor on wrong position when it has an array of maskExpression
if (this._maskExpressionArray.length) {
if (this._code === "Backspace" /* MaskExpression.BACKSPACE */) {
Expand All @@ -92481,7 +92519,7 @@ let NgxMaskDirective = /*#__PURE__*/(() => {
this._position = this._position === 1 && this._inputValue.length === 1 ? null : this._position;
let positionToApply = this._position ? this._inputValue.length + position + caretShift : position + (this._code === "Backspace" /* MaskExpression.BACKSPACE */ && !backspaceShift ? 0 : caretShift);
if (positionToApply > this._getActualInputLength()) {
positionToApply = this._getActualInputLength();
positionToApply = el.value === this._maskService.decimalMarker && el.value.length === 1 ? this._getActualInputLength() + 1 : this._getActualInputLength();
}
if (positionToApply < 0) {
positionToApply = 0;
Expand All @@ -92492,6 +92530,10 @@ let NgxMaskDirective = /*#__PURE__*/(() => {
console.warn('Ngx-mask writeValue work with string | number, your current value:', typeof transformedValue);
}
} else {
if (!this._maskValue) {
this.onChange(el.value);
return;
}
this._maskService.applyValueChanges(el.value.length, this._justPasted, this._code === "Backspace" /* MaskExpression.BACKSPACE */ || this._code === "Delete" /* MaskExpression.DELETE */);
}
}
Expand Down Expand Up @@ -92636,7 +92678,7 @@ let NgxMaskDirective = /*#__PURE__*/(() => {
controlValue = _this.inputTransformFn ? _this.inputTransformFn(controlValue) : controlValue;
}
if (typeof controlValue === 'string' || typeof controlValue === 'number' || controlValue === null || controlValue === undefined) {
if (controlValue === null || controlValue === undefined) {
if (controlValue === null || controlValue === undefined || controlValue === '') {
_this._maskService._currentValue = '';
_this._maskService._previousValue = '';
}
Expand Down Expand Up @@ -92749,7 +92791,7 @@ let NgxMaskDirective = /*#__PURE__*/(() => {
this._maskValue = this.maskExpression = this._maskService.maskExpression = expression.includes("{" /* MaskExpression.CURLY_BRACKETS_LEFT */) ? this._maskService._repeatPatternSymbols(expression) : expression;
}
} else {
const check = this._inputValue?.split("" /* MaskExpression.EMPTY_STRING */).every((character, index) => {
const check = this._maskService.removeMask(this._inputValue)?.split("" /* MaskExpression.EMPTY_STRING */).every((character, index) => {
const indexMask = mask.charAt(index);
return this._maskService._checkSymbolMask(character, indexMask);
});
Expand Down Expand Up @@ -101437,4 +101479,4 @@ function __disposeResources(env) {
/******/ var __webpack_exports__ = (__webpack_exec__(4913));
/******/ }
]);
//# sourceMappingURL=main.cb1a94c9f0403422.js.map
//# sourceMappingURL=main.66b5784d1e8c6556.js.map

Large diffs are not rendered by default.