From 261779ead327397a61b27e634bc827ee70b718f4 Mon Sep 17 00:00:00 2001 From: Nikita Barsukov Date: Tue, 18 Apr 2023 15:25:14 +0300 Subject: [PATCH] feat(kit): `Number` keeps untouched decimal part if `precision: Infinity` (#253) --- package-lock.json | 171 +++++++++--------- package.json | 16 +- .../tests/kit/number/number-precision.cy.ts | 10 + .../kit/number/number-mask-doc.component.ts | 1 + .../kit/number/number-mask-doc.template.html | 7 + .../number/utils/generate-mask-expression.ts | 4 +- 6 files changed, 115 insertions(+), 94 deletions(-) diff --git a/package-lock.json b/package-lock.json index c96da3d6f..bd320237c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,14 +24,14 @@ "@ng-web-apis/universal": "^2.1.0", "@nguniversal/express-engine": "^12.1.3", "@stackblitz/sdk": "^1.8.2", - "@taiga-ui/addon-doc": "3.22.0", - "@taiga-ui/addon-mobile": "3.22.0", - "@taiga-ui/cdk": "3.22.0", - "@taiga-ui/core": "3.22.0", - "@taiga-ui/icons": "3.22.0", - "@taiga-ui/kit": "3.22.0", - "@taiga-ui/styles": "3.22.0", - "@taiga-ui/testing": "3.22.0", + "@taiga-ui/addon-doc": "3.24.0", + "@taiga-ui/addon-mobile": "3.24.0", + "@taiga-ui/cdk": "3.24.0", + "@taiga-ui/core": "3.24.0", + "@taiga-ui/icons": "3.24.0", + "@taiga-ui/kit": "3.24.0", + "@taiga-ui/styles": "3.24.0", + "@taiga-ui/testing": "3.24.0", "@tinkoff/ng-dompurify": "^3.0.0", "core-js": "^2.6.12", "dompurify": "^2.4.4", @@ -10756,9 +10756,9 @@ "integrity": "sha512-3aTg0Tb9dNs1huPkpdYxPEX/yc8A28eZneUMOEJzOLi7EJwl5onr9gCAVjIOkN4WLYu1iBSiJiGBYT629bZIJQ==" }, "node_modules/@taiga-ui/addon-doc": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/addon-doc/-/addon-doc-3.22.0.tgz", - "integrity": "sha512-vjhLyZO7EAdg1Q8trf/w5EC2++isKC67h5sTcPnIG7ggJTD0Hie7DqyFNEXT8pbmDOe1nPk58xezsdeifqu6ng==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/addon-doc/-/addon-doc-3.24.0.tgz", + "integrity": "sha512-/xu40cFpx3E3WXnmzgkX1yiJeEy9oLIQ2T4he2WpqU5E8I8vxxMzFvG/3y1OYDFOaGLXskueSGF+pptJ9I5AlA==", "dependencies": { "@angular-devkit/schematics": "12.2.18", "highlight.js": "11.7.0", @@ -10773,10 +10773,10 @@ "@angular/forms": ">=12.0.0", "@angular/router": ">=12.0.0", "@ng-web-apis/common": ">=2.0.0", - "@taiga-ui/addon-mobile": ">=3.22.0", - "@taiga-ui/cdk": ">=3.22.0", - "@taiga-ui/core": ">=3.22.0", - "@taiga-ui/kit": ">=3.22.0", + "@taiga-ui/addon-mobile": ">=3.24.0", + "@taiga-ui/cdk": ">=3.24.0", + "@taiga-ui/core": ">=3.24.0", + "@taiga-ui/kit": ">=3.24.0", "@tinkoff/ng-polymorpheus": ">=4.0.0" } }, @@ -10834,9 +10834,9 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==" }, "node_modules/@taiga-ui/addon-mobile": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/addon-mobile/-/addon-mobile-3.22.0.tgz", - "integrity": "sha512-x3/Og78HHXbztSF1sJhj6G/Rtd9IofC69UTBMapdw1ylOLD7ZAo3gyC+f38pfWxhw3U7Eeyy5ZPrI6X8iV34BQ==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/addon-mobile/-/addon-mobile-3.24.0.tgz", + "integrity": "sha512-Ce8FZJhWBrE0mlKhT61BMNQGrtXTnE+dED9bKYYRUTaFkLqflOjy3XuPEtuSIHJz2Dl3ofbPw2agsrclukMTFQ==", "dependencies": { "tslib": ">=2.0.0" }, @@ -10845,23 +10845,23 @@ "@angular/common": ">=12.0.0", "@angular/core": ">=12.0.0", "@ng-web-apis/common": ">=2.0.0", - "@taiga-ui/cdk": ">=3.22.0", - "@taiga-ui/core": ">=3.22.0", - "@taiga-ui/kit": ">=3.22.0", + "@taiga-ui/cdk": ">=3.24.0", + "@taiga-ui/core": ">=3.24.0", + "@taiga-ui/kit": ">=3.24.0", "@tinkoff/ng-polymorpheus": ">=4.0.0", "rxjs": ">=6.0.0" } }, "node_modules/@taiga-ui/cdk": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/cdk/-/cdk-3.22.0.tgz", - "integrity": "sha512-pDh9Bp6k3lAKF1szAdn6QCg5gc9ydNp5sSQH6cxJPltmAXhkycwG3wUJ3JdQmVKPTvCLOwZY8UsG0NjcEuUCxA==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/cdk/-/cdk-3.24.0.tgz", + "integrity": "sha512-FsTWG6KchhqenGT5YOGfDO5Wy6DNfhcqZzif40cxv0kgZO7d97EdE0F5J0Tda/wJwu5cdlM4u2avUcaHGaKsHA==", "dependencies": { "@ng-web-apis/common": "2.1.0", "@ng-web-apis/mutation-observer": "2.0.0", "@ng-web-apis/resize-observer": "2.0.0", "@tinkoff/ng-event-plugins": "3.1.0", - "@tinkoff/ng-polymorpheus": "4.0.10", + "@tinkoff/ng-polymorpheus": "4.0.11", "tslib": "2.5.0" }, "optionalDependencies": { @@ -10877,11 +10877,11 @@ } }, "node_modules/@taiga-ui/core": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/core/-/core-3.22.0.tgz", - "integrity": "sha512-myS0OY8lmHxq+a1tnwWXpSkBCp+v9NZ6tY2WSzMrYKQgwITmTXKNziZrYBMnPg2hUHGFNOoI1PVEoNLYgYTohw==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/core/-/core-3.24.0.tgz", + "integrity": "sha512-PPNE2I7yTZlVdis+Zd09dV21OspOPhe/VXPrWNM+J2A3vmxMAMwAR5i8qAoS6rBfUWpI/5vXImQSmvztXQQJeg==", "dependencies": { - "@taiga-ui/i18n": "^3.22.0", + "@taiga-ui/i18n": "^3.24.0", "tslib": ">=2.0.0" }, "peerDependencies": { @@ -10893,17 +10893,17 @@ "@angular/router": ">=12.0.0", "@ng-web-apis/common": ">=2.0.0", "@ng-web-apis/mutation-observer": ">=2.0.0", - "@taiga-ui/cdk": ">=3.22.0", - "@taiga-ui/i18n": ">=3.22.0", + "@taiga-ui/cdk": ">=3.24.0", + "@taiga-ui/i18n": ">=3.24.0", "@tinkoff/ng-event-plugins": ">=3.1.0", "@tinkoff/ng-polymorpheus": ">=4.0.0", "rxjs": ">=6.0.0" } }, "node_modules/@taiga-ui/i18n": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/i18n/-/i18n-3.22.0.tgz", - "integrity": "sha512-vHc4TsbZaUDtgmkktxjz5ppAotEilPnzvH8yNCz9xUc1FVYTUxAQh4GivIkqZPoPQ/gPARDQbeI71qvCc+EVWg==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/i18n/-/i18n-3.24.0.tgz", + "integrity": "sha512-fPzY18AWoQXdvt0+5E59dTFGV853A+g9j81QrzxF+YH+ToroxnkZHcL6bXj0RUi4r40j69cvs0H3FlfyvC3PNA==", "dependencies": { "tslib": ">=2.0.0" }, @@ -10913,17 +10913,17 @@ } }, "node_modules/@taiga-ui/icons": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/icons/-/icons-3.22.0.tgz", - "integrity": "sha512-jt+5tmDAn6Cha+3Tqktjwn7EAqXb5GoaaBzvJsLrCWVUqUaOrZdyJT/seZIS6DRYIWfcxGmYXC8QUSx7qSHMiA==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/icons/-/icons-3.24.0.tgz", + "integrity": "sha512-3cwKEraJs0JmMrn266NYjHBGqMo1PXMHMU0U2mz9SVmenStAMn2FdXRlRB5TZWd6JksIKu2e+JPqCDW6Ge2K6w==", "dependencies": { "tslib": "^2.2.0" } }, "node_modules/@taiga-ui/kit": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/kit/-/kit-3.22.0.tgz", - "integrity": "sha512-NfKY7Kco42aIimuThuzFpMWsul8za+sDmZhVkMw/5PFqLIzXPdcKp/2RBwNGHjMGNY4MfJ5UG70sJ9GRS9xK7g==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/kit/-/kit-3.24.0.tgz", + "integrity": "sha512-8p1ithoSOhKJqJQ+dJpUiGTNz85UfukeG39lqmJjUZlnW37seiGTYQsYKxg6LD8HoVXNptUQWwAx/X1k0i6Q2g==", "dependencies": { "@ng-web-apis/intersection-observer": "3.0.0", "text-mask-core": "5.1.2", @@ -10936,28 +10936,29 @@ "@angular/router": ">=12.0.0", "@ng-web-apis/common": ">=2.0.0", "@ng-web-apis/mutation-observer": ">=2.0.0", - "@taiga-ui/cdk": ">=3.22.0", - "@taiga-ui/core": ">=3.22.0", - "@taiga-ui/i18n": ">=3.22.0", + "@ng-web-apis/resize-observer": ">=2.0.0", + "@taiga-ui/cdk": ">=3.24.0", + "@taiga-ui/core": ">=3.24.0", + "@taiga-ui/i18n": ">=3.24.0", "@tinkoff/ng-polymorpheus": ">=4.0.0", "rxjs": ">=6.0.0" } }, "node_modules/@taiga-ui/styles": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/styles/-/styles-3.22.0.tgz", - "integrity": "sha512-vOC5PIgbdtWCyJfM7SAZ6CRxfyUWr1I9E7Ltqi1Nr5bSeH1jktWm2fu48X1idYdp+Zzhe4IcMDO7q1m7Uwksqw==" + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/styles/-/styles-3.24.0.tgz", + "integrity": "sha512-l7IfyrtSW5Z+Fgf8J2cydm9fF+xvTS0yKI4WKqqYyGnMVKRH/WzCqVc0zdqoDdNR7Z7FHfbMhN+jZwBmq2xa+w==" }, "node_modules/@taiga-ui/testing": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/testing/-/testing-3.22.0.tgz", - "integrity": "sha512-mkXoU3yhpGRJh3WhK1f2on7AsrDU4zbU3z9sXX49bgXKMy/WGJ4vvQQfz0EV8n5pTlaIwtwmsxDe7Ito5tKPZA==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/testing/-/testing-3.24.0.tgz", + "integrity": "sha512-JdMkkJpXPima3OeQRZ+EzZLa2W9pxhYhw+kjhM6CPiXGHXqnEDn/CAHoLZd+h6NnNk/wisW98S0ooyVwfrEX8w==", "dependencies": { "cypress-image-snapshot": "4.0.1", "tslib": ">=2.0.0" }, "peerDependencies": { - "@taiga-ui/cdk": ">=3.22.0" + "@taiga-ui/cdk": ">=3.24.0" } }, "node_modules/@tinkoff/eslint-config": { @@ -11040,9 +11041,9 @@ } }, "node_modules/@tinkoff/ng-polymorpheus": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/@tinkoff/ng-polymorpheus/-/ng-polymorpheus-4.0.10.tgz", - "integrity": "sha512-BxHSwj9CertJ3qiamZ52NTpsKn81EZHjDwiph8mXiEeKXpuPaDn6e5wmTWdW8mYexLPtBsxmCRvZ9vapw4F1kA==", + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/@tinkoff/ng-polymorpheus/-/ng-polymorpheus-4.0.11.tgz", + "integrity": "sha512-pRU4crK5pW4RPnEuvPq+sE3fgy5xqcdMfmfqQzd+OBRNGNJx8pFrzY1yXFEkC00pNl7/fZEVelXqe8v5MltAdw==", "dependencies": { "tslib": "^2.0.0" }, @@ -46676,9 +46677,9 @@ "integrity": "sha512-3aTg0Tb9dNs1huPkpdYxPEX/yc8A28eZneUMOEJzOLi7EJwl5onr9gCAVjIOkN4WLYu1iBSiJiGBYT629bZIJQ==" }, "@taiga-ui/addon-doc": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/addon-doc/-/addon-doc-3.22.0.tgz", - "integrity": "sha512-vjhLyZO7EAdg1Q8trf/w5EC2++isKC67h5sTcPnIG7ggJTD0Hie7DqyFNEXT8pbmDOe1nPk58xezsdeifqu6ng==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/addon-doc/-/addon-doc-3.24.0.tgz", + "integrity": "sha512-/xu40cFpx3E3WXnmzgkX1yiJeEy9oLIQ2T4he2WpqU5E8I8vxxMzFvG/3y1OYDFOaGLXskueSGF+pptJ9I5AlA==", "requires": { "@angular-devkit/schematics": "12.2.18", "highlight.js": "11.7.0", @@ -46730,57 +46731,57 @@ } }, "@taiga-ui/addon-mobile": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/addon-mobile/-/addon-mobile-3.22.0.tgz", - "integrity": "sha512-x3/Og78HHXbztSF1sJhj6G/Rtd9IofC69UTBMapdw1ylOLD7ZAo3gyC+f38pfWxhw3U7Eeyy5ZPrI6X8iV34BQ==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/addon-mobile/-/addon-mobile-3.24.0.tgz", + "integrity": "sha512-Ce8FZJhWBrE0mlKhT61BMNQGrtXTnE+dED9bKYYRUTaFkLqflOjy3XuPEtuSIHJz2Dl3ofbPw2agsrclukMTFQ==", "requires": { "tslib": ">=2.0.0" } }, "@taiga-ui/cdk": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/cdk/-/cdk-3.22.0.tgz", - "integrity": "sha512-pDh9Bp6k3lAKF1szAdn6QCg5gc9ydNp5sSQH6cxJPltmAXhkycwG3wUJ3JdQmVKPTvCLOwZY8UsG0NjcEuUCxA==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/cdk/-/cdk-3.24.0.tgz", + "integrity": "sha512-FsTWG6KchhqenGT5YOGfDO5Wy6DNfhcqZzif40cxv0kgZO7d97EdE0F5J0Tda/wJwu5cdlM4u2avUcaHGaKsHA==", "requires": { "@ng-web-apis/common": "2.1.0", "@ng-web-apis/mutation-observer": "2.0.0", "@ng-web-apis/resize-observer": "2.0.0", "@tinkoff/ng-event-plugins": "3.1.0", - "@tinkoff/ng-polymorpheus": "4.0.10", + "@tinkoff/ng-polymorpheus": "4.0.11", "ng-morph": "2.1.3", "parse5": "6.0.1", "tslib": "2.5.0" } }, "@taiga-ui/core": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/core/-/core-3.22.0.tgz", - "integrity": "sha512-myS0OY8lmHxq+a1tnwWXpSkBCp+v9NZ6tY2WSzMrYKQgwITmTXKNziZrYBMnPg2hUHGFNOoI1PVEoNLYgYTohw==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/core/-/core-3.24.0.tgz", + "integrity": "sha512-PPNE2I7yTZlVdis+Zd09dV21OspOPhe/VXPrWNM+J2A3vmxMAMwAR5i8qAoS6rBfUWpI/5vXImQSmvztXQQJeg==", "requires": { - "@taiga-ui/i18n": "^3.22.0", + "@taiga-ui/i18n": "^3.24.0", "tslib": ">=2.0.0" } }, "@taiga-ui/i18n": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/i18n/-/i18n-3.22.0.tgz", - "integrity": "sha512-vHc4TsbZaUDtgmkktxjz5ppAotEilPnzvH8yNCz9xUc1FVYTUxAQh4GivIkqZPoPQ/gPARDQbeI71qvCc+EVWg==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/i18n/-/i18n-3.24.0.tgz", + "integrity": "sha512-fPzY18AWoQXdvt0+5E59dTFGV853A+g9j81QrzxF+YH+ToroxnkZHcL6bXj0RUi4r40j69cvs0H3FlfyvC3PNA==", "requires": { "tslib": ">=2.0.0" } }, "@taiga-ui/icons": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/icons/-/icons-3.22.0.tgz", - "integrity": "sha512-jt+5tmDAn6Cha+3Tqktjwn7EAqXb5GoaaBzvJsLrCWVUqUaOrZdyJT/seZIS6DRYIWfcxGmYXC8QUSx7qSHMiA==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/icons/-/icons-3.24.0.tgz", + "integrity": "sha512-3cwKEraJs0JmMrn266NYjHBGqMo1PXMHMU0U2mz9SVmenStAMn2FdXRlRB5TZWd6JksIKu2e+JPqCDW6Ge2K6w==", "requires": { "tslib": "^2.2.0" } }, "@taiga-ui/kit": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/kit/-/kit-3.22.0.tgz", - "integrity": "sha512-NfKY7Kco42aIimuThuzFpMWsul8za+sDmZhVkMw/5PFqLIzXPdcKp/2RBwNGHjMGNY4MfJ5UG70sJ9GRS9xK7g==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/kit/-/kit-3.24.0.tgz", + "integrity": "sha512-8p1ithoSOhKJqJQ+dJpUiGTNz85UfukeG39lqmJjUZlnW37seiGTYQsYKxg6LD8HoVXNptUQWwAx/X1k0i6Q2g==", "requires": { "@ng-web-apis/intersection-observer": "3.0.0", "text-mask-core": "5.1.2", @@ -46788,14 +46789,14 @@ } }, "@taiga-ui/styles": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/styles/-/styles-3.22.0.tgz", - "integrity": "sha512-vOC5PIgbdtWCyJfM7SAZ6CRxfyUWr1I9E7Ltqi1Nr5bSeH1jktWm2fu48X1idYdp+Zzhe4IcMDO7q1m7Uwksqw==" + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/styles/-/styles-3.24.0.tgz", + "integrity": "sha512-l7IfyrtSW5Z+Fgf8J2cydm9fF+xvTS0yKI4WKqqYyGnMVKRH/WzCqVc0zdqoDdNR7Z7FHfbMhN+jZwBmq2xa+w==" }, "@taiga-ui/testing": { - "version": "3.22.0", - "resolved": "https://registry.npmjs.org/@taiga-ui/testing/-/testing-3.22.0.tgz", - "integrity": "sha512-mkXoU3yhpGRJh3WhK1f2on7AsrDU4zbU3z9sXX49bgXKMy/WGJ4vvQQfz0EV8n5pTlaIwtwmsxDe7Ito5tKPZA==", + "version": "3.24.0", + "resolved": "https://registry.npmjs.org/@taiga-ui/testing/-/testing-3.24.0.tgz", + "integrity": "sha512-JdMkkJpXPima3OeQRZ+EzZLa2W9pxhYhw+kjhM6CPiXGHXqnEDn/CAHoLZd+h6NnNk/wisW98S0ooyVwfrEX8w==", "requires": { "cypress-image-snapshot": "4.0.1", "tslib": ">=2.0.0" @@ -46864,9 +46865,9 @@ } }, "@tinkoff/ng-polymorpheus": { - "version": "4.0.10", - "resolved": "https://registry.npmjs.org/@tinkoff/ng-polymorpheus/-/ng-polymorpheus-4.0.10.tgz", - "integrity": "sha512-BxHSwj9CertJ3qiamZ52NTpsKn81EZHjDwiph8mXiEeKXpuPaDn6e5wmTWdW8mYexLPtBsxmCRvZ9vapw4F1kA==", + "version": "4.0.11", + "resolved": "https://registry.npmjs.org/@tinkoff/ng-polymorpheus/-/ng-polymorpheus-4.0.11.tgz", + "integrity": "sha512-pRU4crK5pW4RPnEuvPq+sE3fgy5xqcdMfmfqQzd+OBRNGNJx8pFrzY1yXFEkC00pNl7/fZEVelXqe8v5MltAdw==", "requires": { "tslib": "^2.0.0" } diff --git a/package.json b/package.json index 59ab617aa..b96971899 100644 --- a/package.json +++ b/package.json @@ -83,14 +83,14 @@ "@ng-web-apis/universal": "^2.1.0", "@nguniversal/express-engine": "^12.1.3", "@stackblitz/sdk": "^1.8.2", - "@taiga-ui/addon-doc": "3.22.0", - "@taiga-ui/addon-mobile": "3.22.0", - "@taiga-ui/cdk": "3.22.0", - "@taiga-ui/core": "3.22.0", - "@taiga-ui/icons": "3.22.0", - "@taiga-ui/kit": "3.22.0", - "@taiga-ui/styles": "3.22.0", - "@taiga-ui/testing": "3.22.0", + "@taiga-ui/addon-doc": "3.24.0", + "@taiga-ui/addon-mobile": "3.24.0", + "@taiga-ui/cdk": "3.24.0", + "@taiga-ui/core": "3.24.0", + "@taiga-ui/icons": "3.24.0", + "@taiga-ui/kit": "3.24.0", + "@taiga-ui/styles": "3.24.0", + "@taiga-ui/testing": "3.24.0", "@tinkoff/ng-dompurify": "^3.0.0", "core-js": "^2.6.12", "dompurify": "^2.4.4", diff --git a/projects/demo-integrations/cypress/tests/kit/number/number-precision.cy.ts b/projects/demo-integrations/cypress/tests/kit/number/number-precision.cy.ts index 5bc50e20e..db6818160 100644 --- a/projects/demo-integrations/cypress/tests/kit/number/number-precision.cy.ts +++ b/projects/demo-integrations/cypress/tests/kit/number/number-precision.cy.ts @@ -64,4 +64,14 @@ describe('Number | precision', () => { .should('have.prop', 'selectionEnd', 1); }); }); + + it('keeps untouched decimal part if `precision: Infinity`', () => { + openNumberPage('decimalSeparator=,&precision=Infinity'); + + cy.get('@input') + .type('0,123456789') + .should('have.value', '0,123456789') + .should('have.prop', 'selectionStart', '0,123456789'.length) + .should('have.prop', 'selectionEnd', '0,123456789'.length); + }); }); diff --git a/projects/demo/src/pages/kit/number/number-mask-doc.component.ts b/projects/demo/src/pages/kit/number/number-mask-doc.component.ts index 0a388a1bf..652d46ee2 100644 --- a/projects/demo/src/pages/kit/number/number-mask-doc.component.ts +++ b/projects/demo/src/pages/kit/number/number-mask-doc.component.ts @@ -42,6 +42,7 @@ export class NumberMaskDocComponent implements GeneratorOptions { maskitoOptions: MaskitoOptions = maskitoNumberOptionsGenerator(this); readonly decimalPseudoSeparatorsOptions = [['.', ',', 'б', 'ю'], ['.'], [',']]; + readonly precisionOptions: number[] = [0, 1, 2, 5, 10, Infinity]; precision = 0; isNegativeAllowed = true; diff --git a/projects/demo/src/pages/kit/number/number-mask-doc.template.html b/projects/demo/src/pages/kit/number/number-mask-doc.template.html index 0a7650185..64513ec40 100644 --- a/projects/demo/src/pages/kit/number/number-mask-doc.template.html +++ b/projects/demo/src/pages/kit/number/number-mask-doc.template.html @@ -142,6 +142,7 @@ documentationPropertyName="precision" documentationPropertyMode="input" documentationPropertyType="number" + [documentationPropertyValues]="precisionOptions" [(documentationPropertyValue)]="precision" (documentationPropertyValueChange)="updateOptions()" > @@ -149,6 +150,12 @@ decimalSeparator . +

+ Use + Infinity + for an untouched decimal part. +

+

Default: 0 diff --git a/projects/kit/src/lib/masks/number/utils/generate-mask-expression.ts b/projects/kit/src/lib/masks/number/utils/generate-mask-expression.ts index ad9ca9539..ec32f6cb3 100644 --- a/projects/kit/src/lib/masks/number/utils/generate-mask-expression.ts +++ b/projects/kit/src/lib/masks/number/utils/generate-mask-expression.ts @@ -18,7 +18,9 @@ export function generateMaskExpression({ const integerPart = thousandSeparator ? `[${digit}\\${thousandSeparator}]*` : `[${digit}]*`; - const decimalPart = `(\\${decimalSeparator}${digit}{0,${precision}})?`; + const decimalPart = `(\\${decimalSeparator}${digit}{0,${ + Number.isFinite(precision) ? precision : '' + }})?`; return precision > 0 ? new RegExp(`^${optionalMinus}${integerPart}${decimalPart}$`)