@taiga-ui/core 3.59.0 → 3.60.0-canary.799e7d6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/taiga-ui-core-abstract.umd.js +2 -2
- package/bundles/taiga-ui-core-abstract.umd.js.map +1 -1
- package/bundles/taiga-ui-core-animations.umd.js +146 -146
- package/bundles/taiga-ui-core-animations.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-alert.umd.js +3 -3
- package/bundles/taiga-ui-core-components-alert.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-button.umd.js +1 -1
- package/bundles/taiga-ui-core-components-button.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-dialog.umd.js +9 -9
- package/bundles/taiga-ui-core-components-dialog.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-hosted-dropdown.umd.js +1 -1
- package/bundles/taiga-ui-core-components-hosted-dropdown.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-loader.umd.js +1 -1
- package/bundles/taiga-ui-core-components-loader.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-primitive-calendar.umd.js +3 -4
- package/bundles/taiga-ui-core-components-primitive-calendar.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-primitive-checkbox.umd.js +3 -3
- package/bundles/taiga-ui-core-components-primitive-checkbox.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-root.umd.js +1 -1
- package/bundles/taiga-ui-core-components-root.umd.js.map +1 -1
- package/bundles/taiga-ui-core-components-svg.umd.js +59 -59
- package/bundles/taiga-ui-core-components-svg.umd.js.map +1 -1
- package/bundles/taiga-ui-core-constants.umd.js +31 -31
- package/bundles/taiga-ui-core-constants.umd.js.map +1 -1
- package/bundles/taiga-ui-core-directives-textfield-controller.umd.js +3 -3
- package/bundles/taiga-ui-core-directives-textfield-controller.umd.js.map +1 -1
- package/bundles/taiga-ui-core-enums.umd.js.map +1 -1
- package/bundles/taiga-ui-core-observables.umd.js +2 -2
- package/bundles/taiga-ui-core-observables.umd.js.map +1 -1
- package/bundles/taiga-ui-core-pipes-calendar-sheet.umd.js +1 -1
- package/bundles/taiga-ui-core-pipes-calendar-sheet.umd.js.map +1 -1
- package/bundles/taiga-ui-core-pipes-flag.umd.js +4 -4
- package/bundles/taiga-ui-core-pipes-flag.umd.js.map +1 -1
- package/bundles/taiga-ui-core-pipes-format-date.umd.js +1 -1
- package/bundles/taiga-ui-core-pipes-format-date.umd.js.map +1 -1
- package/bundles/taiga-ui-core-pipes-format-number.umd.js +1 -1
- package/bundles/taiga-ui-core-pipes-format-number.umd.js.map +1 -1
- package/bundles/taiga-ui-core-pipes-format-phone.umd.js +3 -3
- package/bundles/taiga-ui-core-pipes-format-phone.umd.js.map +1 -1
- package/bundles/taiga-ui-core-pipes-month.umd.js +1 -1
- package/bundles/taiga-ui-core-pipes-month.umd.js.map +1 -1
- package/bundles/taiga-ui-core-pipes-order-week-days.umd.js +1 -1
- package/bundles/taiga-ui-core-pipes-order-week-days.umd.js.map +1 -1
- package/bundles/taiga-ui-core-providers.umd.js +2 -2
- package/bundles/taiga-ui-core-providers.umd.js.map +1 -1
- package/bundles/taiga-ui-core-services.umd.js +18 -18
- package/bundles/taiga-ui-core-services.umd.js.map +1 -1
- package/bundles/taiga-ui-core-tokens.umd.js +38 -38
- package/bundles/taiga-ui-core-tokens.umd.js.map +1 -1
- package/bundles/taiga-ui-core-utils-dom.umd.js +19 -19
- package/bundles/taiga-ui-core-utils-dom.umd.js.map +1 -1
- package/bundles/taiga-ui-core-utils-format.umd.js +15 -15
- package/bundles/taiga-ui-core-utils-format.umd.js.map +1 -1
- package/bundles/taiga-ui-core-utils-mask.umd.js +28 -28
- package/bundles/taiga-ui-core-utils-mask.umd.js.map +1 -1
- package/bundles/taiga-ui-core-utils-miscellaneous.umd.js +7 -7
- package/bundles/taiga-ui-core-utils-miscellaneous.umd.js.map +1 -1
- package/components/primitive-calendar/primitive-calendar.component.d.ts +1 -1
- package/constants/cache-basting-payload.d.ts +1 -1
- package/esm2015/abstract/abstract-textfield-host.js +3 -3
- package/esm2015/animations/animations.js +148 -148
- package/esm2015/components/alert/alert.providers.js +2 -2
- package/esm2015/components/alert/alert.service.js +3 -3
- package/esm2015/components/button/button.options.js +2 -2
- package/esm2015/components/dialog/dialog-close.service.js +5 -5
- package/esm2015/components/dialog/dialog.service.js +3 -3
- package/esm2015/components/dialog/dialog.tokens.js +4 -4
- package/esm2015/components/hosted-dropdown/hosted-dropdown.token.js +2 -2
- package/esm2015/components/loader/loader.options.js +2 -2
- package/esm2015/components/primitive-calendar/primitive-calendar.component.js +4 -4
- package/esm2015/components/primitive-checkbox/checkbox.options.js +4 -4
- package/esm2015/components/root/root.component.js +1 -1
- package/esm2015/components/svg/deprecated-icons.js +57 -57
- package/esm2015/components/svg/svg-options.js +4 -4
- package/esm2015/constants/decimal-symbols.js +2 -2
- package/esm2015/constants/default-icons-path.js +2 -2
- package/esm2015/constants/default-number-format.js +4 -4
- package/esm2015/constants/editing-keys.js +10 -10
- package/esm2015/constants/events.js +5 -5
- package/esm2015/constants/hint-directions.js +13 -13
- package/esm2015/constants/mask-caret-trap.js +2 -2
- package/esm2015/directives/textfield-controller/textfield-controller.provider.js +2 -2
- package/esm2015/directives/textfield-controller/textfield.controller.js +2 -2
- package/esm2015/directives/textfield-controller/textfield.options.js +2 -2
- package/esm2015/enums/appearance.js +1 -1
- package/esm2015/enums/dropdown-animation.js +1 -1
- package/esm2015/enums/interactive-state.js +1 -1
- package/esm2015/enums/notification.js +1 -1
- package/esm2015/enums/range-state.js +1 -1
- package/esm2015/observables/smart-search.js +3 -3
- package/esm2015/pipes/calendar-sheet/calendar-sheet.pipe.js +2 -2
- package/esm2015/pipes/flag/flag.pipe.js +5 -5
- package/esm2015/pipes/format-date/format-date.pipe.js +2 -2
- package/esm2015/pipes/format-number/format-number.pipe.js +2 -2
- package/esm2015/pipes/format-phone/format-phone.pipe.js +4 -4
- package/esm2015/pipes/month/month.pipe.js +2 -2
- package/esm2015/pipes/order-week-days/order-week-days.pipe.js +2 -2
- package/esm2015/providers/is-mobile-resolution.provider.js +2 -2
- package/esm2015/providers/mode.provider.js +2 -2
- package/esm2015/services/breakpoint.service.js +3 -3
- package/esm2015/services/format-date.service.js +5 -5
- package/esm2015/services/hint.service.js +3 -3
- package/esm2015/services/night-theme.service.js +5 -5
- package/esm2015/services/svg.service.js +5 -5
- package/esm2015/services/visual-viewport.service.js +3 -3
- package/esm2015/tokens/animation-options.js +2 -2
- package/esm2015/tokens/common-icon.js +5 -5
- package/esm2015/tokens/data-list-accessor.js +2 -2
- package/esm2015/tokens/data-list-host.js +2 -2
- package/esm2015/tokens/day-type-handler.js +2 -2
- package/esm2015/tokens/document-or-shadow-root.js +2 -2
- package/esm2015/tokens/element-ref.js +2 -2
- package/esm2015/tokens/i18n.js +7 -7
- package/esm2015/tokens/icon-place.js +2 -2
- package/esm2015/tokens/is-mobile-resolution.js +2 -2
- package/esm2015/tokens/legacy-mask.js +2 -2
- package/esm2015/tokens/mode.js +2 -2
- package/esm2015/tokens/notification-options.js +9 -9
- package/esm2015/tokens/option-content.js +2 -2
- package/esm2015/tokens/reduced-motion.js +2 -2
- package/esm2015/tokens/sanitizer.js +2 -2
- package/esm2015/tokens/selection-stream.js +2 -2
- package/esm2015/tokens/spin-icons.js +3 -3
- package/esm2015/tokens/textfield-host.js +2 -2
- package/esm2015/tokens/theme.js +2 -2
- package/esm2015/tokens/value-accessor.js +2 -2
- package/esm2015/tokens/viewport.js +2 -2
- package/esm2015/utils/dom/check-fixed-position.js +3 -3
- package/esm2015/utils/dom/get-safe-area-size.js +4 -4
- package/esm2015/utils/dom/get-word-range.js +5 -5
- package/esm2015/utils/dom/process-icon.js +11 -11
- package/esm2015/utils/format/format-number.js +4 -4
- package/esm2015/utils/format/format-phone.js +9 -9
- package/esm2015/utils/format/get-fractional-part-padded.js +2 -2
- package/esm2015/utils/format/number-to-string-without-exp.js +3 -3
- package/esm2015/utils/format/other-decimal-symbol.js +2 -2
- package/esm2015/utils/mask/create-auto-corrected-money-pipe.js +11 -11
- package/esm2015/utils/mask/create-correction-mask.js +3 -3
- package/esm2015/utils/mask/create-number-mask.js +13 -13
- package/esm2015/utils/mask/masked-money-value-is-empty.js +3 -3
- package/esm2015/utils/mask/masked-number-string-to-number.js +2 -2
- package/esm2015/utils/miscellaneous/get-border.js +3 -3
- package/esm2015/utils/miscellaneous/icons-path-factory.js +3 -3
- package/esm2015/utils/miscellaneous/is-obscured.js +2 -2
- package/esm2015/utils/miscellaneous/is-presumed-html-string.js +2 -2
- package/esm2015/utils/miscellaneous/size-bigger.js +2 -2
- package/fesm2015/taiga-ui-core-abstract.js +2 -2
- package/fesm2015/taiga-ui-core-abstract.js.map +1 -1
- package/fesm2015/taiga-ui-core-animations.js +146 -146
- package/fesm2015/taiga-ui-core-animations.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-alert.js +3 -3
- package/fesm2015/taiga-ui-core-components-alert.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-button.js +1 -1
- package/fesm2015/taiga-ui-core-components-button.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-dialog.js +9 -9
- package/fesm2015/taiga-ui-core-components-dialog.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-hosted-dropdown.js +1 -1
- package/fesm2015/taiga-ui-core-components-hosted-dropdown.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-loader.js +1 -1
- package/fesm2015/taiga-ui-core-components-loader.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-primitive-calendar.js +3 -3
- package/fesm2015/taiga-ui-core-components-primitive-calendar.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-primitive-checkbox.js +3 -3
- package/fesm2015/taiga-ui-core-components-primitive-checkbox.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-root.js +1 -1
- package/fesm2015/taiga-ui-core-components-root.js.map +1 -1
- package/fesm2015/taiga-ui-core-components-svg.js +59 -59
- package/fesm2015/taiga-ui-core-components-svg.js.map +1 -1
- package/fesm2015/taiga-ui-core-constants.js +31 -31
- package/fesm2015/taiga-ui-core-constants.js.map +1 -1
- package/fesm2015/taiga-ui-core-directives-textfield-controller.js +3 -3
- package/fesm2015/taiga-ui-core-directives-textfield-controller.js.map +1 -1
- package/fesm2015/taiga-ui-core-enums.js.map +1 -1
- package/fesm2015/taiga-ui-core-observables.js +2 -2
- package/fesm2015/taiga-ui-core-observables.js.map +1 -1
- package/fesm2015/taiga-ui-core-pipes-calendar-sheet.js +1 -1
- package/fesm2015/taiga-ui-core-pipes-calendar-sheet.js.map +1 -1
- package/fesm2015/taiga-ui-core-pipes-flag.js +4 -4
- package/fesm2015/taiga-ui-core-pipes-flag.js.map +1 -1
- package/fesm2015/taiga-ui-core-pipes-format-date.js +1 -1
- package/fesm2015/taiga-ui-core-pipes-format-date.js.map +1 -1
- package/fesm2015/taiga-ui-core-pipes-format-number.js +1 -1
- package/fesm2015/taiga-ui-core-pipes-format-number.js.map +1 -1
- package/fesm2015/taiga-ui-core-pipes-format-phone.js +3 -3
- package/fesm2015/taiga-ui-core-pipes-format-phone.js.map +1 -1
- package/fesm2015/taiga-ui-core-pipes-month.js +1 -1
- package/fesm2015/taiga-ui-core-pipes-month.js.map +1 -1
- package/fesm2015/taiga-ui-core-pipes-order-week-days.js +1 -1
- package/fesm2015/taiga-ui-core-pipes-order-week-days.js.map +1 -1
- package/fesm2015/taiga-ui-core-providers.js +2 -2
- package/fesm2015/taiga-ui-core-providers.js.map +1 -1
- package/fesm2015/taiga-ui-core-services.js +18 -18
- package/fesm2015/taiga-ui-core-services.js.map +1 -1
- package/fesm2015/taiga-ui-core-tokens.js +38 -38
- package/fesm2015/taiga-ui-core-tokens.js.map +1 -1
- package/fesm2015/taiga-ui-core-utils-dom.js +19 -19
- package/fesm2015/taiga-ui-core-utils-dom.js.map +1 -1
- package/fesm2015/taiga-ui-core-utils-format.js +15 -15
- package/fesm2015/taiga-ui-core-utils-format.js.map +1 -1
- package/fesm2015/taiga-ui-core-utils-mask.js +27 -27
- package/fesm2015/taiga-ui-core-utils-mask.js.map +1 -1
- package/fesm2015/taiga-ui-core-utils-miscellaneous.js +7 -7
- package/fesm2015/taiga-ui-core-utils-miscellaneous.js.map +1 -1
- package/package.json +42 -42
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { svgNodeFilter, CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_SPACE } from '@taiga-ui/cdk';
|
|
2
2
|
|
|
3
3
|
function tuiCheckFixedPosition(element) {
|
|
4
|
-
if (!element || typeof getComputedStyle ===
|
|
4
|
+
if (!element || typeof getComputedStyle === 'undefined') {
|
|
5
5
|
return false;
|
|
6
6
|
}
|
|
7
7
|
const style = getComputedStyle(element);
|
|
8
|
-
return (style.getPropertyValue(
|
|
8
|
+
return (style.getPropertyValue('position') === 'fixed' ||
|
|
9
9
|
tuiCheckFixedPosition(element.parentElement));
|
|
10
10
|
}
|
|
11
11
|
|
|
@@ -15,11 +15,11 @@ function tuiCheckFixedPosition(element) {
|
|
|
15
15
|
* ATTENTION: Only use in browser environment
|
|
16
16
|
*/
|
|
17
17
|
function tuiGetSafeAreaSize() {
|
|
18
|
-
if (!CSS.supports(
|
|
18
|
+
if (!CSS.supports('padding-top: env(safe-area-inset-top)')) {
|
|
19
19
|
return 0;
|
|
20
20
|
}
|
|
21
|
-
const div = document.createElement(
|
|
22
|
-
div.style.paddingTop =
|
|
21
|
+
const div = document.createElement('div');
|
|
22
|
+
div.style.paddingTop = 'env(safe-area-inset-top)';
|
|
23
23
|
document.body.appendChild(div);
|
|
24
24
|
const safeAreaSize = parseInt(window.getComputedStyle(div).paddingTop, 10) || 0;
|
|
25
25
|
document.body.removeChild(div);
|
|
@@ -89,11 +89,11 @@ function tuiGetWordRange(currentRange) {
|
|
|
89
89
|
treeWalker.currentNode = startContainer;
|
|
90
90
|
do {
|
|
91
91
|
const container = treeWalker.currentNode;
|
|
92
|
-
const textContent = container.textContent ||
|
|
92
|
+
const textContent = container.textContent || '';
|
|
93
93
|
const content = container === startContainer
|
|
94
94
|
? textContent.slice(0, Math.max(0, startOffset + 1))
|
|
95
95
|
: textContent;
|
|
96
|
-
const offset = Math.max(content.lastIndexOf(
|
|
96
|
+
const offset = Math.max(content.lastIndexOf(' '), content.lastIndexOf(CHAR_NO_BREAK_SPACE), content.lastIndexOf(CHAR_ZERO_WIDTH_SPACE)) + 1;
|
|
97
97
|
range.setStart(container, 0);
|
|
98
98
|
if (offset) {
|
|
99
99
|
range.setStart(container, offset);
|
|
@@ -103,10 +103,10 @@ function tuiGetWordRange(currentRange) {
|
|
|
103
103
|
treeWalker.currentNode = endContainer;
|
|
104
104
|
do {
|
|
105
105
|
const container = treeWalker.currentNode;
|
|
106
|
-
const textContent = container.textContent ||
|
|
106
|
+
const textContent = container.textContent || '';
|
|
107
107
|
const content = container === endContainer ? textContent.slice(endOffset + 1) : textContent;
|
|
108
108
|
const offset = [
|
|
109
|
-
content.indexOf(
|
|
109
|
+
content.indexOf(' '),
|
|
110
110
|
content.indexOf(CHAR_NO_BREAK_SPACE),
|
|
111
111
|
content.indexOf(CHAR_ZERO_WIDTH_SPACE),
|
|
112
112
|
].reduce((result, item) => result === -1 || item === -1
|
|
@@ -121,15 +121,15 @@ function tuiGetWordRange(currentRange) {
|
|
|
121
121
|
return range;
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
const WIDTH_SEARCH =
|
|
125
|
-
const HEIGHT_SEARCH =
|
|
126
|
-
const START =
|
|
124
|
+
const WIDTH_SEARCH = 'width="';
|
|
125
|
+
const HEIGHT_SEARCH = 'height="';
|
|
126
|
+
const START = '<svg';
|
|
127
127
|
function tuiProcessIcon(source, name) {
|
|
128
128
|
if (source.includes(`id="${name}"`)) {
|
|
129
129
|
return source;
|
|
130
130
|
}
|
|
131
131
|
const src = source.slice(Math.max(0, source.indexOf(START)));
|
|
132
|
-
const attributes = src.slice(0, Math.max(0, src.indexOf(
|
|
132
|
+
const attributes = src.slice(0, Math.max(0, src.indexOf('>')));
|
|
133
133
|
if (!(attributes === null || attributes === void 0 ? void 0 : attributes.includes(WIDTH_SEARCH)) || !attributes.includes(HEIGHT_SEARCH)) {
|
|
134
134
|
return `${src.replace(START, `<svg xmlns="http://www.w3.org/2000/svg"><g id="${name}" xmlns="http://www.w3.org/2000/svg"><svg`)}</g></svg>`;
|
|
135
135
|
}
|
|
@@ -137,14 +137,14 @@ function tuiProcessIcon(source, name) {
|
|
|
137
137
|
const indexOfHeight = attributes.indexOf(HEIGHT_SEARCH);
|
|
138
138
|
const widthOffset = indexOfWidth + WIDTH_SEARCH.length;
|
|
139
139
|
const heightOffset = indexOfHeight + HEIGHT_SEARCH.length;
|
|
140
|
-
const widthString = attributes.slice(widthOffset, attributes.indexOf(
|
|
141
|
-
const heightString = attributes.slice(heightOffset, attributes.indexOf(
|
|
140
|
+
const widthString = attributes.slice(widthOffset, attributes.indexOf('"', widthOffset));
|
|
141
|
+
const heightString = attributes.slice(heightOffset, attributes.indexOf('"', heightOffset));
|
|
142
142
|
if (!heightString ||
|
|
143
143
|
!widthString ||
|
|
144
|
-
widthString.includes(
|
|
145
|
-
heightString.includes(
|
|
146
|
-
widthString.includes(
|
|
147
|
-
heightString.includes(
|
|
144
|
+
widthString.includes('%') ||
|
|
145
|
+
heightString.includes('%') ||
|
|
146
|
+
widthString.includes('em') ||
|
|
147
|
+
heightString.includes('em')) {
|
|
148
148
|
return src.replace(START, `<svg id="${name}"`);
|
|
149
149
|
}
|
|
150
150
|
const width = parseInt(widthString, 10);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-core-utils-dom.js","sources":["../../../projects/core/utils/dom/check-fixed-position.ts","../../../projects/core/utils/dom/get-safe-area-size.ts","../../../projects/core/utils/dom/get-screen-width.ts","../../../projects/core/utils/dom/get-viewport-height.ts","../../../projects/core/utils/dom/get-viewport-width.ts","../../../projects/core/utils/dom/get-word-range.ts","../../../projects/core/utils/dom/process-icon.ts","../../../projects/core/utils/dom/taiga-ui-core-utils-dom.ts"],"sourcesContent":["export function tuiCheckFixedPosition(element: HTMLElement | null): boolean {\n if (!element || typeof getComputedStyle === `undefined`) {\n return false;\n }\n\n const style = getComputedStyle(element);\n\n return (\n style.getPropertyValue(`position`) === `fixed` ||\n tuiCheckFixedPosition(element.parentElement)\n );\n}\n","/**\n * Calculates size of safe area on mobile devices (status bars)\n *\n * ATTENTION: Only use in browser environment\n */\nexport function tuiGetSafeAreaSize(): number {\n if (!CSS.supports(`padding-top: env(safe-area-inset-top)`)) {\n return 0;\n }\n\n const div = document.createElement(`div`);\n\n div.style.paddingTop = `env(safe-area-inset-top)`;\n document.body.appendChild(div);\n\n const safeAreaSize = parseInt(window.getComputedStyle(div).paddingTop, 10) || 0;\n\n document.body.removeChild(div);\n\n return safeAreaSize;\n}\n","export function tuiGetScreenWidth(doc: Document): number {\n return Math.max(\n doc.documentElement.clientWidth,\n doc.defaultView ? doc.defaultView.innerWidth : 0,\n );\n}\n","/**\n * @description:\n * Cross-browser @media (height)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (height) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientHeight\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (height) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportHeight({document, innerHeight}: Window): number {\n return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);\n}\n","/**\n * @description:\n * Cross-browser @media (width)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (width) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientWidth\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (width) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportWidth({document, innerWidth}: Window): number {\n return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);\n}\n","import {CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_SPACE, svgNodeFilter} from '@taiga-ui/cdk';\n\n/**\n * Creates a cloned range with its boundaries set at word boundaries\n *\n * @param currentRange a range to clone\n * @return modified range\n */\nexport function tuiGetWordRange(currentRange: Range): Range {\n const range = currentRange.cloneRange();\n const {startContainer, startOffset, endContainer, endOffset} = range;\n const {ownerDocument} = startContainer;\n\n if (!ownerDocument) {\n return range;\n }\n\n const treeWalker = ownerDocument.createTreeWalker(\n ownerDocument.body,\n NodeFilter.SHOW_TEXT,\n svgNodeFilter,\n );\n\n treeWalker.currentNode = startContainer;\n\n do {\n const container = treeWalker.currentNode;\n const textContent = container.textContent || ``;\n const content =\n container === startContainer\n ? textContent.slice(0, Math.max(0, startOffset + 1))\n : textContent;\n const offset =\n Math.max(\n content.lastIndexOf(` `),\n content.lastIndexOf(CHAR_NO_BREAK_SPACE),\n content.lastIndexOf(CHAR_ZERO_WIDTH_SPACE),\n ) + 1;\n\n range.setStart(container, 0);\n\n if (offset) {\n range.setStart(container, offset);\n break;\n }\n } while (treeWalker.previousNode());\n\n treeWalker.currentNode = endContainer;\n\n do {\n const container = treeWalker.currentNode;\n const textContent = container.textContent || ``;\n const content =\n container === endContainer ? textContent.slice(endOffset + 1) : textContent;\n const offset = [\n content.indexOf(` `),\n content.indexOf(CHAR_NO_BREAK_SPACE),\n content.indexOf(CHAR_ZERO_WIDTH_SPACE),\n ].reduce(\n (result, item) =>\n result === -1 || item === -1\n ? Math.max(result, item)\n : Math.min(result, item),\n -1,\n );\n\n range.setEnd(container, textContent.length);\n\n if (offset !== -1) {\n range.setEnd(container, offset + textContent.length - content.length);\n break;\n }\n } while (treeWalker.nextNode());\n\n return range;\n}\n","const WIDTH_SEARCH = `width=\"`;\nconst HEIGHT_SEARCH = `height=\"`;\nconst START = `<svg`;\n\nexport function tuiProcessIcon(source: string, name: string): string {\n if (source.includes(`id=\"${name}\"`)) {\n return source;\n }\n\n const src = source.slice(Math.max(0, source.indexOf(START)));\n const attributes = src.slice(0, Math.max(0, src.indexOf(`>`)));\n\n if (!attributes?.includes(WIDTH_SEARCH) || !attributes.includes(HEIGHT_SEARCH)) {\n return `${src.replace(\n START,\n `<svg xmlns=\"http://www.w3.org/2000/svg\"><g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg`,\n )}</g></svg>`;\n }\n\n const indexOfWidth = attributes.indexOf(WIDTH_SEARCH);\n const indexOfHeight = attributes.indexOf(HEIGHT_SEARCH);\n const widthOffset = indexOfWidth + WIDTH_SEARCH.length;\n const heightOffset = indexOfHeight + HEIGHT_SEARCH.length;\n const widthString = attributes.slice(\n widthOffset,\n attributes.indexOf(`\"`, widthOffset),\n );\n const heightString = attributes.slice(\n heightOffset,\n attributes.indexOf(`\"`, heightOffset),\n );\n\n if (\n !heightString ||\n !widthString ||\n widthString.includes(`%`) ||\n heightString.includes(`%`) ||\n widthString.includes(`em`) ||\n heightString.includes(`em`)\n ) {\n return src.replace(START, `<svg id=\"${name}\"`);\n }\n\n const width = parseInt(widthString, 10);\n const height = parseInt(heightString, 10);\n\n return `<g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg x=\"50%\" y=\"50%\" width=\"${\n width / 16\n }em\" height=\"${\n height / 16\n }em\" overflow=\"visible\" viewBox=\"0 0 ${width} ${height}\"><svg x=\"${-width / 2}\" y=\"${\n -height / 2\n }\">${src}</svg></svg></g>`;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAM,SAAU,qBAAqB,CAAC,OAA2B,EAAA;AAC7D,IAAA,IAAI,CAAC,OAAO,IAAI,OAAO,gBAAgB,KAAK,WAAW,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AK,GAAG,CAAA,gBAAA,CAAkB,CAAC;AAC/B;;ACrDA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-core-utils-dom.js","sources":["../../../projects/core/utils/dom/check-fixed-position.ts","../../../projects/core/utils/dom/get-safe-area-size.ts","../../../projects/core/utils/dom/get-screen-width.ts","../../../projects/core/utils/dom/get-viewport-height.ts","../../../projects/core/utils/dom/get-viewport-width.ts","../../../projects/core/utils/dom/get-word-range.ts","../../../projects/core/utils/dom/process-icon.ts","../../../projects/core/utils/dom/taiga-ui-core-utils-dom.ts"],"sourcesContent":["export function tuiCheckFixedPosition(element: HTMLElement | null): boolean {\n if (!element || typeof getComputedStyle === 'undefined') {\n return false;\n }\n\n const style = getComputedStyle(element);\n\n return (\n style.getPropertyValue('position') === 'fixed' ||\n tuiCheckFixedPosition(element.parentElement)\n );\n}\n","/**\n * Calculates size of safe area on mobile devices (status bars)\n *\n * ATTENTION: Only use in browser environment\n */\nexport function tuiGetSafeAreaSize(): number {\n if (!CSS.supports('padding-top: env(safe-area-inset-top)')) {\n return 0;\n }\n\n const div = document.createElement('div');\n\n div.style.paddingTop = 'env(safe-area-inset-top)';\n document.body.appendChild(div);\n\n const safeAreaSize = parseInt(window.getComputedStyle(div).paddingTop, 10) || 0;\n\n document.body.removeChild(div);\n\n return safeAreaSize;\n}\n","export function tuiGetScreenWidth(doc: Document): number {\n return Math.max(\n doc.documentElement.clientWidth,\n doc.defaultView ? doc.defaultView.innerWidth : 0,\n );\n}\n","/**\n * @description:\n * Cross-browser @media (height)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (height) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientHeight\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (height) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportHeight({document, innerHeight}: Window): number {\n return Math.max(document.documentElement.clientHeight || 0, innerHeight || 0);\n}\n","/**\n * @description:\n * Cross-browser @media (width)\n *\n * 1. window.innerWidth\n * 1.1. gets CSS viewport @media (width) which include scrollbars\n * 1.2. initial-scale and zoom variations may cause mobile values to\n * wrongly scale down to what PPK calls the visual\n * viewport and be smaller than the @media values\n * 1.3. zoom may cause values to be 1px off due to native rounding\n *\n * 2. document.documentElement.clientWidth\n * 2.1. equals CSS viewport width minus scrollbar width\n * 2.2. matches @media (width) when there is no scrollbar\n * 2.3. available cross-browser\n * 2.4. inaccurate if doctype is missing\n */\nexport function tuiGetViewportWidth({document, innerWidth}: Window): number {\n return Math.max(document.documentElement.clientWidth || 0, innerWidth || 0);\n}\n","import {CHAR_NO_BREAK_SPACE, CHAR_ZERO_WIDTH_SPACE, svgNodeFilter} from '@taiga-ui/cdk';\n\n/**\n * Creates a cloned range with its boundaries set at word boundaries\n *\n * @param currentRange a range to clone\n * @return modified range\n */\nexport function tuiGetWordRange(currentRange: Range): Range {\n const range = currentRange.cloneRange();\n const {startContainer, startOffset, endContainer, endOffset} = range;\n const {ownerDocument} = startContainer;\n\n if (!ownerDocument) {\n return range;\n }\n\n const treeWalker = ownerDocument.createTreeWalker(\n ownerDocument.body,\n NodeFilter.SHOW_TEXT,\n svgNodeFilter,\n );\n\n treeWalker.currentNode = startContainer;\n\n do {\n const container = treeWalker.currentNode;\n const textContent = container.textContent || '';\n const content =\n container === startContainer\n ? textContent.slice(0, Math.max(0, startOffset + 1))\n : textContent;\n const offset =\n Math.max(\n content.lastIndexOf(' '),\n content.lastIndexOf(CHAR_NO_BREAK_SPACE),\n content.lastIndexOf(CHAR_ZERO_WIDTH_SPACE),\n ) + 1;\n\n range.setStart(container, 0);\n\n if (offset) {\n range.setStart(container, offset);\n break;\n }\n } while (treeWalker.previousNode());\n\n treeWalker.currentNode = endContainer;\n\n do {\n const container = treeWalker.currentNode;\n const textContent = container.textContent || '';\n const content =\n container === endContainer ? textContent.slice(endOffset + 1) : textContent;\n const offset = [\n content.indexOf(' '),\n content.indexOf(CHAR_NO_BREAK_SPACE),\n content.indexOf(CHAR_ZERO_WIDTH_SPACE),\n ].reduce(\n (result, item) =>\n result === -1 || item === -1\n ? Math.max(result, item)\n : Math.min(result, item),\n -1,\n );\n\n range.setEnd(container, textContent.length);\n\n if (offset !== -1) {\n range.setEnd(container, offset + textContent.length - content.length);\n break;\n }\n } while (treeWalker.nextNode());\n\n return range;\n}\n","const WIDTH_SEARCH = 'width=\"';\nconst HEIGHT_SEARCH = 'height=\"';\nconst START = '<svg';\n\nexport function tuiProcessIcon(source: string, name: string): string {\n if (source.includes(`id=\"${name}\"`)) {\n return source;\n }\n\n const src = source.slice(Math.max(0, source.indexOf(START)));\n const attributes = src.slice(0, Math.max(0, src.indexOf('>')));\n\n if (!attributes?.includes(WIDTH_SEARCH) || !attributes.includes(HEIGHT_SEARCH)) {\n return `${src.replace(\n START,\n `<svg xmlns=\"http://www.w3.org/2000/svg\"><g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg`,\n )}</g></svg>`;\n }\n\n const indexOfWidth = attributes.indexOf(WIDTH_SEARCH);\n const indexOfHeight = attributes.indexOf(HEIGHT_SEARCH);\n const widthOffset = indexOfWidth + WIDTH_SEARCH.length;\n const heightOffset = indexOfHeight + HEIGHT_SEARCH.length;\n const widthString = attributes.slice(\n widthOffset,\n attributes.indexOf('\"', widthOffset),\n );\n const heightString = attributes.slice(\n heightOffset,\n attributes.indexOf('\"', heightOffset),\n );\n\n if (\n !heightString ||\n !widthString ||\n widthString.includes('%') ||\n heightString.includes('%') ||\n widthString.includes('em') ||\n heightString.includes('em')\n ) {\n return src.replace(START, `<svg id=\"${name}\"`);\n }\n\n const width = parseInt(widthString, 10);\n const height = parseInt(heightString, 10);\n\n return `<g id=\"${name}\" xmlns=\"http://www.w3.org/2000/svg\"><svg x=\"50%\" y=\"50%\" width=\"${\n width / 16\n }em\" height=\"${\n height / 16\n }em\" overflow=\"visible\" viewBox=\"0 0 ${width} ${height}\"><svg x=\"${-width / 2}\" y=\"${\n -height / 2\n }\">${src}</svg></svg></g>`;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAAM,SAAU,qBAAqB,CAAC,OAA2B,EAAA;AAC7D,IAAA,IAAI,CAAC,OAAO,IAAI,OAAO,gBAAgB,KAAK,WAAW,EAAE;AACrD,QAAA,OAAO,KAAK,CAAC;AAChB,KAAA;AAED,IAAA,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;IAExC,QACI,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,KAAK,OAAO;AAC9C,QAAA,qBAAqB,CAAC,OAAO,CAAC,aAAa,CAAC,EAC9C;AACN;;ACXA;;;;AAIG;SACa,kBAAkB,GAAA;AAC9B,IAAA,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,uCAAuC,CAAC,EAAE;AACxD,QAAA,OAAO,CAAC,CAAC;AACZ,KAAA;IAED,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;AAE1C,IAAA,GAAG,CAAC,KAAK,CAAC,UAAU,GAAG,0BAA0B,CAAC;AAClD,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAE/B,IAAA,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;AAEhF,IAAA,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAE/B,IAAA,OAAO,YAAY,CAAC;AACxB;;ACpBM,SAAU,iBAAiB,CAAC,GAAa,EAAA;IAC3C,OAAO,IAAI,CAAC,GAAG,CACX,GAAG,CAAC,eAAe,CAAC,WAAW,E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AA,EAAI,MAAM,CAAA,UAAA,EAAa,CAAC,KAAK,GAAG,CAAC,CACzE,KAAA,EAAA,CAAC,MAAM,GAAG,CACd,CAAA,EAAA,EAAK,GAAG,CAAA,gBAAA,CAAkB,CAAC;AAC/B;;ACrDA;;AAEG;;;;"}
|
|
@@ -24,10 +24,10 @@ function tuiCapitalizeFirstLetter(value) {
|
|
|
24
24
|
*/
|
|
25
25
|
function tuiNumberToStringWithoutExp(value) {
|
|
26
26
|
const valueAsString = String(value);
|
|
27
|
-
const [numberPart, expPart] = valueAsString.split(
|
|
27
|
+
const [numberPart, expPart] = valueAsString.split('e-');
|
|
28
28
|
let valueWithoutExp = valueAsString;
|
|
29
29
|
if (expPart) {
|
|
30
|
-
const [, fractionalPart] = numberPart.split(
|
|
30
|
+
const [, fractionalPart] = numberPart.split('.');
|
|
31
31
|
const decimalDigits = Number(expPart) + ((fractionalPart === null || fractionalPart === void 0 ? void 0 : fractionalPart.length) || 0);
|
|
32
32
|
valueWithoutExp = value.toFixed(decimalDigits);
|
|
33
33
|
}
|
|
@@ -42,7 +42,7 @@ function tuiNumberToStringWithoutExp(value) {
|
|
|
42
42
|
* @return the fractional part of number
|
|
43
43
|
*/
|
|
44
44
|
function tuiGetFractionPartPadded(value, precision) {
|
|
45
|
-
const [, fractionPartPadded =
|
|
45
|
+
const [, fractionPartPadded = ''] = tuiNumberToStringWithoutExp(value).split('.');
|
|
46
46
|
return tuiIsNumber(precision)
|
|
47
47
|
? fractionPartPadded.slice(0, Math.max(0, precision))
|
|
48
48
|
: fractionPartPadded;
|
|
@@ -66,15 +66,15 @@ function tuiFormatNumber(value, settings = {}) {
|
|
|
66
66
|
if (Number.isFinite(decimalLimit)) {
|
|
67
67
|
if (zeroPadding) {
|
|
68
68
|
const zeroPaddingSize = Math.max(decimalLimit - fractionPartPadded.length, 0);
|
|
69
|
-
const zeroPartString =
|
|
69
|
+
const zeroPartString = '0'.repeat(zeroPaddingSize);
|
|
70
70
|
fractionPartPadded = `${fractionPartPadded}${zeroPartString}`;
|
|
71
71
|
}
|
|
72
72
|
else {
|
|
73
|
-
fractionPartPadded = fractionPartPadded.replace(/0*$/,
|
|
73
|
+
fractionPartPadded = fractionPartPadded.replace(/0*$/, '');
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
const remainder = integerPartString.length % 3;
|
|
77
|
-
const sign = value < 0 ? CHAR_HYPHEN :
|
|
77
|
+
const sign = value < 0 ? CHAR_HYPHEN : '';
|
|
78
78
|
let result = sign + integerPartString.charAt(0);
|
|
79
79
|
for (let i = 1; i < integerPartString.length; i++) {
|
|
80
80
|
if (i % 3 === remainder && integerPartString.length > 3) {
|
|
@@ -106,16 +106,16 @@ function tuiFormatNumber(value, settings = {}) {
|
|
|
106
106
|
*/
|
|
107
107
|
function tuiFormatPhone(value, countryCode, phoneMask) {
|
|
108
108
|
if (!value) {
|
|
109
|
-
return
|
|
109
|
+
return '';
|
|
110
110
|
}
|
|
111
111
|
let result = countryCode;
|
|
112
|
-
countryCode = countryCode.replace(/[()]/g,
|
|
112
|
+
countryCode = countryCode.replace(/[()]/g, '');
|
|
113
113
|
if (!value.startsWith(countryCode)) {
|
|
114
|
-
value = countryCode + value.replace(CHAR_PLUS,
|
|
114
|
+
value = countryCode + value.replace(CHAR_PLUS, '');
|
|
115
115
|
}
|
|
116
|
-
const splitPhoneMask = phoneMask.split(
|
|
117
|
-
const splitValue = value.slice(countryCode.length).split(
|
|
118
|
-
result +=
|
|
116
|
+
const splitPhoneMask = phoneMask.split('');
|
|
117
|
+
const splitValue = value.slice(countryCode.length).split('');
|
|
118
|
+
result += ' ';
|
|
119
119
|
if (splitValue.length === 0) {
|
|
120
120
|
return result;
|
|
121
121
|
}
|
|
@@ -123,8 +123,8 @@ function tuiFormatPhone(value, countryCode, phoneMask) {
|
|
|
123
123
|
if (splitValue.length === 0) {
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
|
-
if (mask ===
|
|
127
|
-
result += splitValue[0] ||
|
|
126
|
+
if (mask === '#') {
|
|
127
|
+
result += splitValue[0] || '';
|
|
128
128
|
splitValue.splice(0, 1);
|
|
129
129
|
}
|
|
130
130
|
else {
|
|
@@ -135,7 +135,7 @@ function tuiFormatPhone(value, countryCode, phoneMask) {
|
|
|
135
135
|
}
|
|
136
136
|
|
|
137
137
|
function tuiOtherDecimalSymbol(symbol) {
|
|
138
|
-
return symbol ===
|
|
138
|
+
return symbol === '.' ? ',' : '.';
|
|
139
139
|
}
|
|
140
140
|
|
|
141
141
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-core-utils-format.js","sources":["../../../projects/core/utils/format/capitalize.ts","../../../projects/core/utils/format/capitalize-first-letter.ts","../../../projects/core/utils/format/number-to-string-without-exp.ts","../../../projects/core/utils/format/get-fractional-part-padded.ts","../../../projects/core/utils/format/format-number.ts","../../../projects/core/utils/format/format-phone.ts","../../../projects/core/utils/format/other-decimal-symbol.ts","../../../projects/core/utils/format/taiga-ui-core-utils-format.ts"],"sourcesContent":["/**\n * Capitalizes a given string, replacing it with a lowercase string and making\n * the first letter of each word uppercase.\n *\n * @param value the input string\n * @return the capitalized string\n */\nexport function tuiCapitalize(value: string): string {\n return value.toLowerCase().replace(/(?:^|\\s)\\S/g, char => char.toUpperCase());\n}\n","export function tuiCapitalizeFirstLetter(value: string): string {\n return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;\n}\n","/**\n * Convert number to string with replacing exponent part on decimals\n *\n * @param value the number\n * @return string representation of a number\n */\nexport function tuiNumberToStringWithoutExp(value: number): string {\n const valueAsString = String(value);\n const [numberPart, expPart] = valueAsString.split(`e-`);\n\n let valueWithoutExp = valueAsString;\n\n if (expPart) {\n const [, fractionalPart] = numberPart.split(`.`);\n const decimalDigits = Number(expPart) + (fractionalPart?.length || 0);\n\n valueWithoutExp = value.toFixed(decimalDigits);\n }\n\n return valueWithoutExp;\n}\n","import {tuiIsNumber} from '@taiga-ui/cdk';\n\nimport {tuiNumberToStringWithoutExp} from './number-to-string-without-exp';\n\n/**\n * Return fractional part of number\n *\n * @param value the number\n * @param precision number of digits of decimal part, null to keep untouched\n * @return the fractional part of number\n */\nexport function tuiGetFractionPartPadded(\n value: number,\n precision?: number | null,\n): string {\n const [, fractionPartPadded = ``] = tuiNumberToStringWithoutExp(value).split(`.`);\n\n return tuiIsNumber(precision)\n ? fractionPartPadded.slice(0, Math.max(0, precision))\n : fractionPartPadded;\n}\n","import {CHAR_HYPHEN, tuiRoundWith} from '@taiga-ui/cdk';\nimport {TUI_DEFAULT_NUMBER_FORMAT} from '@taiga-ui/core/constants';\nimport {TuiNumberFormatSettings} from '@taiga-ui/core/interfaces';\n\nimport {tuiGetFractionPartPadded} from './get-fractional-part-padded';\n\n/**\n * Formats number adding a thousand separators and correct decimal separator\n * padding decimal part with zeroes to given length\n *\n * @param value the input number\n * @param settings See {@link TuiNumberFormatSettings}\n * @return the formatted string\n */\nexport function tuiFormatNumber(\n value: number,\n settings: Partial<TuiNumberFormatSettings> = {},\n): string {\n const {decimalLimit, decimalSeparator, thousandSeparator, zeroPadding, rounding} = {\n ...TUI_DEFAULT_NUMBER_FORMAT,\n ...settings,\n };\n\n const rounded = Number.isFinite(decimalLimit)\n ? tuiRoundWith({value, precision: decimalLimit, method: rounding})\n : value;\n const integerPartString = String(Math.floor(Math.abs(rounded)));\n\n let fractionPartPadded = tuiGetFractionPartPadded(rounded, decimalLimit);\n\n if (Number.isFinite(decimalLimit)) {\n if (zeroPadding) {\n const zeroPaddingSize: number = Math.max(\n decimalLimit - fractionPartPadded.length,\n 0,\n );\n const zeroPartString = `0`.repeat(zeroPaddingSize);\n\n fractionPartPadded = `${fractionPartPadded}${zeroPartString}`;\n } else {\n fractionPartPadded = fractionPartPadded.replace(/0*$/, ``);\n }\n }\n\n const remainder = integerPartString.length % 3;\n const sign = value < 0 ? CHAR_HYPHEN : ``;\n let result = sign + integerPartString.charAt(0);\n\n for (let i = 1; i < integerPartString.length; i++) {\n if (i % 3 === remainder && integerPartString.length > 3) {\n result += thousandSeparator;\n }\n\n result += integerPartString.charAt(i);\n }\n\n return fractionPartPadded ? result + decimalSeparator + fractionPartPadded : result;\n}\n","import {CHAR_PLUS} from '@taiga-ui/cdk';\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/core-concepts/transformer maskitoTransform} instead<br/>\n * @example\n * import {maskitoTransform} from '@maskito/core';\n *\n * const mask = {\n * mask: ['+', '1', ' ', /\\d/, /\\d/, /\\d/, ')', ' ', /\\d/, /\\d/, /\\d/, '-', /\\d/, /\\d/, /\\d/, /\\d/],\n * };\n * maskitoTransform('12125552368', mask); // +1 (212) 555-2368\n * ___\n * Formats a string with the phone format +7XXXXXXXXXXXX or XXXXXXXXXXXX,\n * adding parentheses and hyphens.\n *\n * @param value the input string\n * @param countryCode a country code\n * @param phoneMask a phone number mask\n * @return the formatted phone string of the form +7 XXX XXX-XX-XX\n */\nexport function tuiFormatPhone(\n value: string,\n countryCode: string,\n phoneMask: string,\n): string {\n if (!value) {\n return ``;\n }\n\n let result = countryCode;\n\n countryCode = countryCode.replace(/[()]/g, ``);\n\n if (!value.startsWith(countryCode)) {\n value = countryCode + value.replace(CHAR_PLUS, ``);\n }\n\n const splitPhoneMask = phoneMask.split(``);\n const splitValue = value.slice(countryCode.length).split(``);\n\n result += ` `;\n\n if (splitValue.length === 0) {\n return result;\n }\n\n for (const mask of splitPhoneMask) {\n if (splitValue.length === 0) {\n break;\n }\n\n if (mask === `#`) {\n result += splitValue[0] || ``;\n splitValue.splice(0, 1);\n } else {\n result += mask;\n }\n }\n\n return result;\n}\n","import {TuiDecimalSymbol} from '@taiga-ui/core/types';\n\nexport function tuiOtherDecimalSymbol(symbol: TuiDecimalSymbol): TuiDecimalSymbol {\n return symbol === `.` ? `,` : `.`;\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;;;;;;AAMG;AACG,SAAU,aAAa,CAAC,KAAa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CAAC,CAAC,KAAK,CAAC,CAAA,CAAE,CAAC,CAAC;IAE7D,MAAM,IAAI,GAAG,CAAC;AAEd,IAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;AACzB,QAAA,OAAO,MAAM,CAAC;AACjB,KAAA;AAED,IAAA,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE;AAC/B,QAAA,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE;YACzB,MAAM;AACT,SAAA;QAED,IAAI,IAAI,KAAK,CAAA,CAAA,CAAG,EAAE;AACd,YAAA,MAAM,IAAI,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9B,YAAA,UAAU,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3B,SAAA;AAAM,aAAA;YACH,MAAM,IAAI,IAAI,CAAC;AAClB,SAAA;AACJ,KAAA;AAED,IAAA,OAAO,MAAM,CAAC;AAClB;;AC3DM,SAAU,qBAAqB,CAAC,MAAwB,EAAA;IAC1D,OAAO,MAAM,KAAK,CAAA,CAAA,CAAG,GAAG,CAAA,CAAA,CAAG,GAAG,CAAA,CAAA,CAAG,CAAC;AACtC;;ACJA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-core-utils-format.js","sources":["../../../projects/core/utils/format/capitalize.ts","../../../projects/core/utils/format/capitalize-first-letter.ts","../../../projects/core/utils/format/number-to-string-without-exp.ts","../../../projects/core/utils/format/get-fractional-part-padded.ts","../../../projects/core/utils/format/format-number.ts","../../../projects/core/utils/format/format-phone.ts","../../../projects/core/utils/format/other-decimal-symbol.ts","../../../projects/core/utils/format/taiga-ui-core-utils-format.ts"],"sourcesContent":["/**\n * Capitalizes a given string, replacing it with a lowercase string and making\n * the first letter of each word uppercase.\n *\n * @param value the input string\n * @return the capitalized string\n */\nexport function tuiCapitalize(value: string): string {\n return value.toLowerCase().replace(/(?:^|\\s)\\S/g, char => char.toUpperCase());\n}\n","export function tuiCapitalizeFirstLetter(value: string): string {\n return `${value.charAt(0).toUpperCase()}${value.slice(1)}`;\n}\n","/**\n * Convert number to string with replacing exponent part on decimals\n *\n * @param value the number\n * @return string representation of a number\n */\nexport function tuiNumberToStringWithoutExp(value: number): string {\n const valueAsString = String(value);\n const [numberPart, expPart] = valueAsString.split('e-');\n\n let valueWithoutExp = valueAsString;\n\n if (expPart) {\n const [, fractionalPart] = numberPart.split('.');\n const decimalDigits = Number(expPart) + (fractionalPart?.length || 0);\n\n valueWithoutExp = value.toFixed(decimalDigits);\n }\n\n return valueWithoutExp;\n}\n","import {tuiIsNumber} from '@taiga-ui/cdk';\n\nimport {tuiNumberToStringWithoutExp} from './number-to-string-without-exp';\n\n/**\n * Return fractional part of number\n *\n * @param value the number\n * @param precision number of digits of decimal part, null to keep untouched\n * @return the fractional part of number\n */\nexport function tuiGetFractionPartPadded(\n value: number,\n precision?: number | null,\n): string {\n const [, fractionPartPadded = ''] = tuiNumberToStringWithoutExp(value).split('.');\n\n return tuiIsNumber(precision)\n ? fractionPartPadded.slice(0, Math.max(0, precision))\n : fractionPartPadded;\n}\n","import {CHAR_HYPHEN, tuiRoundWith} from '@taiga-ui/cdk';\nimport {TUI_DEFAULT_NUMBER_FORMAT} from '@taiga-ui/core/constants';\nimport {TuiNumberFormatSettings} from '@taiga-ui/core/interfaces';\n\nimport {tuiGetFractionPartPadded} from './get-fractional-part-padded';\n\n/**\n * Formats number adding a thousand separators and correct decimal separator\n * padding decimal part with zeroes to given length\n *\n * @param value the input number\n * @param settings See {@link TuiNumberFormatSettings}\n * @return the formatted string\n */\nexport function tuiFormatNumber(\n value: number,\n settings: Partial<TuiNumberFormatSettings> = {},\n): string {\n const {decimalLimit, decimalSeparator, thousandSeparator, zeroPadding, rounding} = {\n ...TUI_DEFAULT_NUMBER_FORMAT,\n ...settings,\n };\n\n const rounded = Number.isFinite(decimalLimit)\n ? tuiRoundWith({value, precision: decimalLimit, method: rounding})\n : value;\n const integerPartString = String(Math.floor(Math.abs(rounded)));\n\n let fractionPartPadded = tuiGetFractionPartPadded(rounded, decimalLimit);\n\n if (Number.isFinite(decimalLimit)) {\n if (zeroPadding) {\n const zeroPaddingSize: number = Math.max(\n decimalLimit - fractionPartPadded.length,\n 0,\n );\n const zeroPartString = '0'.repeat(zeroPaddingSize);\n\n fractionPartPadded = `${fractionPartPadded}${zeroPartString}`;\n } else {\n fractionPartPadded = fractionPartPadded.replace(/0*$/, '');\n }\n }\n\n const remainder = integerPartString.length % 3;\n const sign = value < 0 ? CHAR_HYPHEN : '';\n let result = sign + integerPartString.charAt(0);\n\n for (let i = 1; i < integerPartString.length; i++) {\n if (i % 3 === remainder && integerPartString.length > 3) {\n result += thousandSeparator;\n }\n\n result += integerPartString.charAt(i);\n }\n\n return fractionPartPadded ? result + decimalSeparator + fractionPartPadded : result;\n}\n","import {CHAR_PLUS} from '@taiga-ui/cdk';\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/core-concepts/transformer maskitoTransform} instead<br/>\n * @example\n * import {maskitoTransform} from '@maskito/core';\n *\n * const mask = {\n * mask: ['+', '1', ' ', /\\d/, /\\d/, /\\d/, ')', ' ', /\\d/, /\\d/, /\\d/, '-', /\\d/, /\\d/, /\\d/, /\\d/],\n * };\n * maskitoTransform('12125552368', mask); // +1 (212) 555-2368\n * ___\n * Formats a string with the phone format +7XXXXXXXXXXXX or XXXXXXXXXXXX,\n * adding parentheses and hyphens.\n *\n * @param value the input string\n * @param countryCode a country code\n * @param phoneMask a phone number mask\n * @return the formatted phone string of the form +7 XXX XXX-XX-XX\n */\nexport function tuiFormatPhone(\n value: string,\n countryCode: string,\n phoneMask: string,\n): string {\n if (!value) {\n return '';\n }\n\n let result = countryCode;\n\n countryCode = countryCode.replace(/[()]/g, '');\n\n if (!value.startsWith(countryCode)) {\n value = countryCode + value.replace(CHAR_PLUS, '');\n }\n\n const splitPhoneMask = phoneMask.split('');\n const splitValue = value.slice(countryCode.length).split('');\n\n result += ' ';\n\n if (splitValue.length === 0) {\n return result;\n }\n\n for (const mask of splitPhoneMask) {\n if (splitValue.length === 0) {\n break;\n }\n\n if (mask === '#') {\n result += splitValue[0] || '';\n splitValue.splice(0, 1);\n } else {\n result += mask;\n }\n }\n\n return result;\n}\n","import {TuiDecimalSymbol} from '@taiga-ui/core/types';\n\nexport function tuiOtherDecimalSymbol(symbol: TuiDecimalSymbol): TuiDecimalSymbol {\n return symbol === '.' ? ',' : '.';\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;AAAA;;;;;;AAMG;AACG,SAAU,aAAa,CAAC,KAAa,EAAA;AACvC,IAAA,OAAO,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,IAAI,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;AAClF;;ACTM,SAAU,wBAAwB,CAAC,KAAa,EAAA;AAClD,IAAA,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA,EAAG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;AAC/D;;ACFA;;;;;AAKG;AACG,SAAU,2BAA2B,CAAC,KAAa,EAAA;AACrD,IAAA,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;AACpC,IAAA,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAExD,IAAI,eAAe,GAAG,aAAa,CAAC;AAEpC,IAAA,IAAI,OAAO,EAAE;QACT,MAAM,GAAG,cAAc,CAAC,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AACjD,QAAA,MAAM,aAAa,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAA,cAAc,KAAd,IAAA,IAAA,cAAc,uBAAd,cAAc,CAAE,MAAM,KAAI,CAAC,CAAC,CAAC;AAEtE,QAAA,e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} from '@taiga-ui/core/constants';
|
|
3
3
|
import { tuiOtherDecimalSymbol } from '@taiga-ui/core/utils/format';
|
|
4
4
|
|
|
5
|
-
function addDecimalSymbolIfNeeded(value, decimalSymbol =
|
|
5
|
+
function addDecimalSymbolIfNeeded(value, decimalSymbol = ',') {
|
|
6
6
|
return !value.includes(decimalSymbol) ? value + decimalSymbol : value;
|
|
7
7
|
}
|
|
8
|
-
function calculateSafariCaret(previousValue =
|
|
8
|
+
function calculateSafariCaret(previousValue = '', current, previousCaret, decimalSymbol = ',') {
|
|
9
9
|
const tailRegex = new RegExp(`${decimalSymbol}.+`);
|
|
10
|
-
const previousWithoutTail = previousValue.replace(tailRegex,
|
|
11
|
-
const currentWithoutTail = current.replace(tailRegex,
|
|
10
|
+
const previousWithoutTail = previousValue.replace(tailRegex, '');
|
|
11
|
+
const currentWithoutTail = current.replace(tailRegex, '');
|
|
12
12
|
const pasteOrCutOperation = Math.abs(previousWithoutTail.length - currentWithoutTail.length) > 2;
|
|
13
13
|
if (pasteOrCutOperation) {
|
|
14
14
|
return current.length;
|
|
@@ -30,12 +30,12 @@ function calculateSafariCaret(previousValue = ``, current, previousCaret, decima
|
|
|
30
30
|
function calculateChangedTailIndex(previous, current) {
|
|
31
31
|
for (let i = 0; i < current.length; i++) {
|
|
32
32
|
if (previous[i] !== current[i]) {
|
|
33
|
-
return current[i] ===
|
|
33
|
+
return current[i] === '0' ? i : i + 1;
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
return current.length;
|
|
37
37
|
}
|
|
38
|
-
function calculateCaretGap(previousValue =
|
|
38
|
+
function calculateCaretGap(previousValue = '', current, thousandSymbol) {
|
|
39
39
|
const pasteOrCutOperation = Math.abs(previousValue.length - current.length) > 2;
|
|
40
40
|
if (pasteOrCutOperation) {
|
|
41
41
|
return 0;
|
|
@@ -49,13 +49,13 @@ function calculateCaretGap(previousValue = ``, current, thousandSymbol) {
|
|
|
49
49
|
* @deprecated Use {@link https://maskito.dev/kit/number Number} from {@link https://github.com/taiga-family/maskito Maskito} instead <br/>
|
|
50
50
|
* Used to finish a number with zeros to a given precision
|
|
51
51
|
*/
|
|
52
|
-
function tuiCreateAutoCorrectedNumberPipe(decimalLimit = 0, decimalSymbol =
|
|
52
|
+
function tuiCreateAutoCorrectedNumberPipe(decimalLimit = 0, decimalSymbol = ',', thousandSymbol = CHAR_NO_BREAK_SPACE, nativeInput, allowNegative, isIOS = false) {
|
|
53
53
|
ngDevMode && tuiAssert.assert(decimalLimit >= 0);
|
|
54
54
|
// Guess for which browser I need this :)
|
|
55
55
|
let previousCaret = -1;
|
|
56
56
|
const unlucky = (!!nativeInput && tuiIsSafari(nativeInput)) || isIOS;
|
|
57
57
|
if (nativeInput && unlucky) {
|
|
58
|
-
nativeInput.addEventListener(
|
|
58
|
+
nativeInput.addEventListener('beforeinput', () => {
|
|
59
59
|
previousCaret = nativeInput.selectionStart || 0;
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -81,26 +81,26 @@ function tuiCreateAutoCorrectedNumberPipe(decimalLimit = 0, decimalSymbol = `,`,
|
|
|
81
81
|
nativeInput.setSelectionRange(realCaretPosition, realCaretPosition);
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
|
-
if (conformedValue ===
|
|
84
|
+
if (conformedValue === '' || !decimalLimit || !Number.isInteger(decimalLimit)) {
|
|
85
85
|
return { value: conformedValue };
|
|
86
86
|
}
|
|
87
87
|
const withDecimalSymbol = addDecimalSymbolIfNeeded(conformedValue, decimalSymbol);
|
|
88
88
|
const decimalPart = withDecimalSymbol.split(decimalSymbol)[1];
|
|
89
89
|
const zeroPaddingSize = decimalLimit - decimalPart.length;
|
|
90
90
|
return {
|
|
91
|
-
value: withDecimalSymbol +
|
|
91
|
+
value: withDecimalSymbol + '0'.repeat(zeroPaddingSize),
|
|
92
92
|
};
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
const ASSERTION =
|
|
96
|
+
const ASSERTION = 'Correction function must return single char or null';
|
|
97
97
|
/**
|
|
98
98
|
* TODO: delete in v4.0
|
|
99
99
|
* @deprecated Use {@link https://maskito.dev/core-concepts/processors processors} from {@link https://github.com/taiga-family/maskito Maskito}
|
|
100
100
|
*/
|
|
101
101
|
function tuiCreateCorrectionMask(allowed, correctionHandler) {
|
|
102
102
|
return rawValue => {
|
|
103
|
-
const mask = rawValue.split(
|
|
103
|
+
const mask = rawValue.split('').reduce((result, char, index) => {
|
|
104
104
|
const corrected = correctionHandler(char, index);
|
|
105
105
|
ngDevMode &&
|
|
106
106
|
tuiAssert.assert(corrected === null || corrected.length === 1, ASSERTION);
|
|
@@ -158,7 +158,7 @@ function isDecimalSymbol(str, decimalSymbol, autoCorrectDecimalSymbol) {
|
|
|
158
158
|
}
|
|
159
159
|
function convertToMask(strNumber) {
|
|
160
160
|
return strNumber
|
|
161
|
-
.split(
|
|
161
|
+
.split('')
|
|
162
162
|
.map(char => (TUI_DIGIT_REGEXP.test(char) ? TUI_DIGIT_REGEXP : char));
|
|
163
163
|
}
|
|
164
164
|
function addThousandsSeparator(strNumber, thousandSymbol) {
|
|
@@ -173,18 +173,18 @@ function addThousandsSeparator(strNumber, thousandSymbol) {
|
|
|
173
173
|
* @deprecated Use {@link https://maskito.dev/kit/number Number} from {@link https://github.com/taiga-family/maskito Maskito} instead <br/>
|
|
174
174
|
* Adaptation for {@link https://github.com/text-mask/text-mask/tree/master/addons#createnumbermask `createNumberMask`}
|
|
175
175
|
*/
|
|
176
|
-
function tuiCreateNumberMask({ allowDecimal = false, decimalSymbol =
|
|
176
|
+
function tuiCreateNumberMask({ allowDecimal = false, decimalSymbol = ',', thousandSymbol = CHAR_NO_BREAK_SPACE, autoCorrectDecimalSymbol = true, decimalLimit = 2, requireDecimal = false, allowNegative = false, integerLimit = 0, } = {}) {
|
|
177
177
|
ngDevMode && tuiAssert.assert(decimalLimit >= 0);
|
|
178
178
|
ngDevMode && tuiAssert.assert(Number.isInteger(integerLimit));
|
|
179
179
|
ngDevMode && tuiAssert.assert(integerLimit >= 0);
|
|
180
180
|
return (rawValue, { previousConformedValue }) => {
|
|
181
181
|
if (previousConformedValue && requireDecimal) {
|
|
182
|
-
const conformedWithoutSeparator = rawValue.split(thousandSymbol).join(
|
|
182
|
+
const conformedWithoutSeparator = rawValue.split(thousandSymbol).join('');
|
|
183
183
|
const previousConformedValueWithoutDecimalSymbolAndSeparator = previousConformedValue
|
|
184
184
|
.split(thousandSymbol)
|
|
185
|
-
.join(
|
|
185
|
+
.join('')
|
|
186
186
|
.split(decimalSymbol)
|
|
187
|
-
.join(
|
|
187
|
+
.join('');
|
|
188
188
|
// Forbid removal of decimal separator if decimal part is required
|
|
189
189
|
if (conformedWithoutSeparator ===
|
|
190
190
|
previousConformedValueWithoutDecimalSymbolAndSeparator) {
|
|
@@ -195,7 +195,7 @@ function tuiCreateNumberMask({ allowDecimal = false, decimalSymbol = `,`, thousa
|
|
|
195
195
|
allowNegative;
|
|
196
196
|
if (isDecimalSymbol(rawValue, decimalSymbol, autoCorrectDecimalSymbol) &&
|
|
197
197
|
allowDecimal) {
|
|
198
|
-
return [
|
|
198
|
+
return ['0', decimalSymbol, TUI_DIGIT_REGEXP];
|
|
199
199
|
}
|
|
200
200
|
if (isNegative) {
|
|
201
201
|
rawValue = rawValue.slice(1);
|
|
@@ -203,21 +203,21 @@ function tuiCreateNumberMask({ allowDecimal = false, decimalSymbol = `,`, thousa
|
|
|
203
203
|
const decimalIndex = getDecimalSymbolIndex(rawValue, decimalSymbol, autoCorrectDecimalSymbol);
|
|
204
204
|
const hasDecimal = decimalIndex !== -1;
|
|
205
205
|
const integer = hasDecimal ? rawValue.slice(0, decimalIndex) : rawValue;
|
|
206
|
-
const thousandSeparators = integer.match(new RegExp(thousandSymbol,
|
|
206
|
+
const thousandSeparators = integer.match(new RegExp(thousandSymbol, 'g')) || [];
|
|
207
207
|
const integerCapped = integerLimit
|
|
208
208
|
? integer.slice(0, integerLimit + thousandSeparators.length)
|
|
209
209
|
: integer;
|
|
210
|
-
const integerCappedClean = integerCapped.replace(TUI_NON_DIGITS_REGEXP,
|
|
211
|
-
const [leadingZerosMatch] = integerCappedClean.match(TUI_LEADING_ZEROES_REGEXP) || [
|
|
210
|
+
const integerCappedClean = integerCapped.replace(TUI_NON_DIGITS_REGEXP, '');
|
|
211
|
+
const [leadingZerosMatch] = integerCappedClean.match(TUI_LEADING_ZEROES_REGEXP) || [''];
|
|
212
212
|
const leadingZerosAmount = leadingZerosMatch.length;
|
|
213
213
|
const integerCappedZerosClean = integerCappedClean
|
|
214
|
-
.replace(/^0+(?!\.|$)/,
|
|
214
|
+
.replace(/^0+(?!\.|$)/, '')
|
|
215
215
|
.trim();
|
|
216
216
|
const withSeparator = addThousandsSeparator(integerCappedZerosClean, thousandSymbol);
|
|
217
217
|
const mask = convertToMask(withSeparator);
|
|
218
218
|
if ((hasDecimal && allowDecimal) || requireDecimal) {
|
|
219
219
|
const fraction = hasDecimal
|
|
220
|
-
? convertToMask(rawValue.slice(decimalIndex + 1).replace(TUI_NON_DIGITS_REGEXP,
|
|
220
|
+
? convertToMask(rawValue.slice(decimalIndex + 1).replace(TUI_NON_DIGITS_REGEXP, ''))
|
|
221
221
|
: [];
|
|
222
222
|
const fractionCapped = decimalLimit
|
|
223
223
|
? fraction.slice(0, decimalLimit)
|
|
@@ -230,7 +230,7 @@ function tuiCreateNumberMask({ allowDecimal = false, decimalSymbol = `,`, thousa
|
|
|
230
230
|
mask.push(TUI_DIGIT_REGEXP);
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
const isOnlyZeroDigit = mask.length === 1 && integerCappedZerosClean ===
|
|
233
|
+
const isOnlyZeroDigit = mask.length === 1 && integerCappedZerosClean === '0';
|
|
234
234
|
if (isNegative) {
|
|
235
235
|
if (mask.length === 0) {
|
|
236
236
|
mask.push(TUI_DIGIT_REGEXP);
|
|
@@ -258,9 +258,9 @@ function tuiEnableAutoCorrectDecimalSymbol({ thousandSeparator, }) {
|
|
|
258
258
|
*/
|
|
259
259
|
function tuiMaskedMoneyValueIsEmpty(value) {
|
|
260
260
|
switch (value) {
|
|
261
|
-
case
|
|
261
|
+
case '':
|
|
262
262
|
case CHAR_HYPHEN:
|
|
263
|
-
case
|
|
263
|
+
case ',':
|
|
264
264
|
case `${CHAR_HYPHEN},`:
|
|
265
265
|
return true;
|
|
266
266
|
default:
|
|
@@ -273,7 +273,7 @@ function tuiMaskedMoneyValueIsEmpty(value) {
|
|
|
273
273
|
* @deprecated use {@link https://maskito.dev/kit/number maskitoParseNumber} instead
|
|
274
274
|
*/
|
|
275
275
|
function tuiMaskedNumberStringToNumber(value, decimalsSymbol, thousandSymbol) {
|
|
276
|
-
return parseFloat(value.split(thousandSymbol).join(
|
|
276
|
+
return parseFloat(value.split(thousandSymbol).join('').split(decimalsSymbol).join('.'));
|
|
277
277
|
}
|
|
278
278
|
|
|
279
279
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-core-utils-mask.js","sources":["../../../projects/core/utils/mask/create-auto-corrected-money-pipe.ts","../../../projects/core/utils/mask/create-correction-mask.ts","../../../projects/core/utils/mask/create-number-mask.ts","../../../projects/core/utils/mask/enable-auto-correct-decimal-symbol.ts","../../../projects/core/utils/mask/masked-money-value-is-empty.ts","../../../projects/core/utils/mask/masked-number-string-to-number.ts","../../../projects/core/utils/mask/taiga-ui-core-utils-mask.ts"],"sourcesContent":["import {\n CHAR_HYPHEN,\n CHAR_NO_BREAK_SPACE,\n tuiAssert,\n tuiGetDocumentOrShadowRoot,\n tuiIsNativeFocused,\n tuiIsSafari,\n} from '@taiga-ui/cdk';\nimport {TuiTextMaskPipeHandler} from '@taiga-ui/core/mask';\nimport {TuiDecimalSymbol} from '@taiga-ui/core/types';\n\nfunction addDecimalSymbolIfNeeded(\n value: string,\n decimalSymbol: TuiDecimalSymbol = `,`,\n): string {\n return !value.includes(decimalSymbol) ? value + decimalSymbol : value;\n}\n\nfunction calculateSafariCaret(\n previousValue: string = ``,\n current: string,\n previousCaret: number,\n decimalSymbol: string = `,`,\n): number {\n const tailRegex = new RegExp(`${decimalSymbol}.+`);\n const previousWithoutTail = previousValue.replace(tailRegex, ``);\n const currentWithoutTail = current.replace(tailRegex, ``);\n\n const pasteOrCutOperation =\n Math.abs(previousWithoutTail.length - currentWithoutTail.length) > 2;\n\n if (pasteOrCutOperation) {\n return current.length;\n }\n\n if (previousValue.length === current.length) {\n if (previousValue.indexOf(decimalSymbol) <= previousCaret) {\n return calculateChangedTailIndex(previousValue, current);\n }\n\n return previousWithoutTail === currentWithoutTail\n ? previousCaret - 1\n : previousCaret + 1;\n }\n\n if (previousValue.length === 0) {\n return 1;\n }\n\n const changeLength = current.length - previousValue.length;\n\n return previousCaret + changeLength;\n}\n\nfunction calculateChangedTailIndex(previous: string, current: string): number {\n for (let i = 0; i < current.length; i++) {\n if (previous[i] !== current[i]) {\n return current[i] === `0` ? i : i + 1;\n }\n }\n\n return current.length;\n}\n\nfunction calculateCaretGap(\n previousValue: string = ``,\n current: string,\n thousandSymbol: string,\n): number {\n const pasteOrCutOperation = Math.abs(previousValue.length - current.length) > 2;\n\n if (pasteOrCutOperation) {\n return 0;\n }\n\n const wereSpaces = previousValue.split(thousandSymbol).length;\n const nowSpaces = current.split(thousandSymbol).length;\n\n return nowSpaces - wereSpaces;\n}\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/kit/number Number} from {@link https://github.com/taiga-family/maskito Maskito} instead <br/>\n * Used to finish a number with zeros to a given precision\n */\nexport function tuiCreateAutoCorrectedNumberPipe(\n decimalLimit: number = 0,\n decimalSymbol: TuiDecimalSymbol = `,`,\n thousandSymbol: string = CHAR_NO_BREAK_SPACE,\n nativeInput?: HTMLInputElement | null,\n allowNegative?: boolean,\n isIOS = false,\n): TuiTextMaskPipeHandler {\n ngDevMode && tuiAssert.assert(decimalLimit >= 0);\n\n // Guess for which browser I need this :)\n let previousCaret = -1;\n const unlucky = (!!nativeInput && tuiIsSafari(nativeInput)) || isIOS;\n\n if (nativeInput && unlucky) {\n nativeInput.addEventListener(`beforeinput`, () => {\n previousCaret = nativeInput.selectionStart || 0;\n });\n }\n\n return (conformedValue, config) => {\n // Removing everything by selecting and pressing '-'\n if (!conformedValue && config.rawValue === CHAR_HYPHEN && allowNegative) {\n return CHAR_HYPHEN;\n }\n\n // remove these hacks after text mask library has changed\n if (nativeInput && unlucky && tuiIsNativeFocused(nativeInput)) {\n const caret = calculateSafariCaret(\n config.previousConformedValue,\n conformedValue,\n previousCaret,\n );\n\n setTimeout(() => {\n nativeInput.setSelectionRange(caret, caret);\n });\n }\n\n if (\n nativeInput &&\n nativeInput.ownerDocument !== tuiGetDocumentOrShadowRoot(nativeInput) &&\n tuiIsNativeFocused(nativeInput) &&\n config.currentCaretPosition\n ) {\n const realCaretPosition =\n config.currentCaretPosition +\n calculateCaretGap(\n config.previousConformedValue,\n conformedValue,\n thousandSymbol,\n );\n\n setTimeout(() => {\n nativeInput.setSelectionRange(realCaretPosition, realCaretPosition);\n });\n }\n\n if (conformedValue === `` || !decimalLimit || !Number.isInteger(decimalLimit)) {\n return {value: conformedValue};\n }\n\n const withDecimalSymbol = addDecimalSymbolIfNeeded(conformedValue, decimalSymbol);\n const decimalPart = withDecimalSymbol.split(decimalSymbol)[1];\n const zeroPaddingSize = decimalLimit - decimalPart.length;\n\n return {\n value: withDecimalSymbol + `0`.repeat(zeroPaddingSize),\n };\n };\n}\n","import {tuiAssert} from '@taiga-ui/cdk';\nimport {MASK_CARET_TRAP} from '@taiga-ui/core/constants';\nimport {\n TuiTextMaskCorrectionHandler,\n TuiTextMaskList,\n TuiTextMaskListHandler,\n} from '@taiga-ui/core/mask';\n\nconst ASSERTION = `Correction function must return single char or null`;\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/core-concepts/processors processors} from {@link https://github.com/taiga-family/maskito Maskito}\n */\nexport function tuiCreateCorrectionMask(\n allowed: RegExp,\n correctionHandler: TuiTextMaskCorrectionHandler,\n): TuiTextMaskListHandler {\n return rawValue => {\n const mask = rawValue.split(``).reduce<TuiTextMaskList>((result, char, index) => {\n const corrected = correctionHandler(char, index);\n\n ngDevMode &&\n tuiAssert.assert(corrected === null || corrected.length === 1, ASSERTION);\n\n if (!allowed.test(char) && !corrected) {\n return result;\n }\n\n if (allowed.test(char)) {\n return [...result, allowed];\n }\n\n if (corrected) {\n return [...result, corrected, MASK_CARET_TRAP];\n }\n\n return result;\n }, []);\n const lastIndex = mask.lastIndexOf(MASK_CARET_TRAP);\n const filtered = mask.filter(\n (item, index) => item !== MASK_CARET_TRAP || index === lastIndex,\n );\n\n return filtered.some(item => item !== allowed)\n ? [...filtered, allowed]\n : filtered;\n };\n}\n","import {CHAR_EN_DASH, CHAR_HYPHEN, CHAR_NO_BREAK_SPACE, tuiAssert} from '@taiga-ui/cdk';\nimport {\n MASK_CARET_TRAP,\n TUI_DIGIT_REGEXP,\n TUI_LEADING_ZEROES_REGEXP,\n TUI_NON_DIGITS_REGEXP,\n} from '@taiga-ui/core/constants';\nimport {TuiNumberMaskOptions, TuiTextMaskListHandler} from '@taiga-ui/core/mask';\nimport {TuiDecimalSymbol} from '@taiga-ui/core/types';\nimport {tuiOtherDecimalSymbol} from '@taiga-ui/core/utils/format';\n\nconst NON_ZERO_DIGIT = /[1-9]/;\n\nfunction preventLeadingZeroes(\n mask: Array<RegExp | string>,\n isOnlyZeroDigit: boolean = false,\n leadingZerosAmount: number = 0,\n): Array<RegExp | string> {\n if (isOnlyZeroDigit || leadingZerosAmount === 0) {\n return mask;\n }\n\n const firstDigitIndex = mask.indexOf(TUI_DIGIT_REGEXP);\n\n if (firstDigitIndex === -1) {\n return mask;\n }\n\n const secondMaskDigit = mask[firstDigitIndex + 1];\n const isCaretTrap = secondMaskDigit === MASK_CARET_TRAP;\n\n if (isCaretTrap && leadingZerosAmount === 1) {\n return mask;\n }\n\n if (isCaretTrap) {\n mask.unshift(NON_ZERO_DIGIT);\n\n return mask;\n }\n\n mask[firstDigitIndex] = NON_ZERO_DIGIT;\n\n return mask;\n}\n\nfunction getDecimalSymbolIndex(\n str: string,\n decimalSymbol: TuiDecimalSymbol,\n autoCorrectDecimalSymbol: boolean,\n): number {\n if (!autoCorrectDecimalSymbol) {\n return str.lastIndexOf(decimalSymbol);\n }\n\n return Math.max(\n str.lastIndexOf(decimalSymbol),\n str.lastIndexOf(tuiOtherDecimalSymbol(decimalSymbol)),\n );\n}\n\nfunction isDecimalSymbol(\n str: string,\n decimalSymbol: TuiDecimalSymbol,\n autoCorrectDecimalSymbol: boolean,\n): boolean {\n if (autoCorrectDecimalSymbol) {\n return /^[,.]$/.test(str);\n }\n\n return str === decimalSymbol;\n}\n\nfunction convertToMask(strNumber: string): Array<RegExp | string> {\n return strNumber\n .split(``)\n .map(char => (TUI_DIGIT_REGEXP.test(char) ? TUI_DIGIT_REGEXP : char));\n}\n\nfunction addThousandsSeparator(strNumber: string, thousandSymbol: string): string {\n return strNumber.length > 3\n ? // TODO: investigate to disallow potentially catastrophic exponential-time regular expressions.\n // eslint-disable-next-line unicorn/no-unsafe-regex\n strNumber.replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandSymbol)\n : strNumber;\n}\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/kit/number Number} from {@link https://github.com/taiga-family/maskito Maskito} instead <br/>\n * Adaptation for {@link https://github.com/text-mask/text-mask/tree/master/addons#createnumbermask `createNumberMask`}\n */\nexport function tuiCreateNumberMask({\n allowDecimal = false,\n decimalSymbol = `,`,\n thousandSymbol = CHAR_NO_BREAK_SPACE,\n autoCorrectDecimalSymbol = true,\n decimalLimit = 2,\n requireDecimal = false,\n allowNegative = false,\n integerLimit = 0,\n}: TuiNumberMaskOptions = {}): TuiTextMaskListHandler {\n ngDevMode && tuiAssert.assert(decimalLimit >= 0);\n ngDevMode && tuiAssert.assert(Number.isInteger(integerLimit));\n ngDevMode && tuiAssert.assert(integerLimit >= 0);\n\n return (rawValue, {previousConformedValue}) => {\n if (previousConformedValue && requireDecimal) {\n const conformedWithoutSeparator = rawValue.split(thousandSymbol).join(``);\n const previousConformedValueWithoutDecimalSymbolAndSeparator =\n previousConformedValue\n .split(thousandSymbol)\n .join(``)\n .split(decimalSymbol)\n .join(``);\n\n // Forbid removal of decimal separator if decimal part is required\n if (\n conformedWithoutSeparator ===\n previousConformedValueWithoutDecimalSymbolAndSeparator\n ) {\n rawValue = previousConformedValue;\n }\n }\n\n const isNegative =\n (rawValue?.startsWith(CHAR_HYPHEN) || rawValue?.startsWith(CHAR_EN_DASH)) &&\n allowNegative;\n\n if (\n isDecimalSymbol(rawValue, decimalSymbol, autoCorrectDecimalSymbol) &&\n allowDecimal\n ) {\n return [`0`, decimalSymbol, TUI_DIGIT_REGEXP];\n }\n\n if (isNegative) {\n rawValue = rawValue.slice(1);\n }\n\n const decimalIndex = getDecimalSymbolIndex(\n rawValue,\n decimalSymbol,\n autoCorrectDecimalSymbol,\n );\n const hasDecimal = decimalIndex !== -1;\n const integer = hasDecimal ? rawValue.slice(0, decimalIndex) : rawValue;\n const thousandSeparators = integer.match(new RegExp(thousandSymbol, `g`)) || [];\n const integerCapped = integerLimit\n ? integer.slice(0, integerLimit + thousandSeparators.length)\n : integer;\n const integerCappedClean = integerCapped.replace(TUI_NON_DIGITS_REGEXP, ``);\n const [leadingZerosMatch] = integerCappedClean.match(\n TUI_LEADING_ZEROES_REGEXP,\n ) || [``];\n const leadingZerosAmount = leadingZerosMatch.length;\n const integerCappedZerosClean = integerCappedClean\n .replace(/^0+(?!\\.|$)/, ``)\n .trim();\n const withSeparator = addThousandsSeparator(\n integerCappedZerosClean,\n thousandSymbol,\n );\n const mask = convertToMask(withSeparator);\n\n if ((hasDecimal && allowDecimal) || requireDecimal) {\n const fraction = hasDecimal\n ? convertToMask(\n rawValue.slice(decimalIndex + 1).replace(TUI_NON_DIGITS_REGEXP, ``),\n )\n : [];\n const fractionCapped = decimalLimit\n ? fraction.slice(0, decimalLimit)\n : fraction;\n\n if (rawValue[decimalIndex] !== tuiOtherDecimalSymbol(decimalSymbol)) {\n mask.push(MASK_CARET_TRAP);\n }\n\n mask.push(decimalSymbol, MASK_CARET_TRAP, ...fractionCapped);\n\n for (let i = 0; i < Math.min(decimalLimit - fractionCapped.length, 20); i++) {\n mask.push(TUI_DIGIT_REGEXP);\n }\n }\n\n const isOnlyZeroDigit = mask.length === 1 && integerCappedZerosClean === `0`;\n\n if (isNegative) {\n if (mask.length === 0) {\n mask.push(TUI_DIGIT_REGEXP);\n }\n\n mask.unshift(CHAR_HYPHEN);\n }\n\n return preventLeadingZeroes(mask, isOnlyZeroDigit, leadingZerosAmount);\n };\n}\n","import {TUI_DECIMAL_SYMBOLS} from '@taiga-ui/core/constants';\nimport {TuiNumberFormatSettings} from '@taiga-ui/core/interfaces';\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/kit/number Number} from {@link https://github.com/taiga-family/maskito Maskito} instead\n */\nexport function tuiEnableAutoCorrectDecimalSymbol({\n thousandSeparator,\n}: TuiNumberFormatSettings): boolean {\n return !TUI_DECIMAL_SYMBOLS.includes(thousandSeparator);\n}\n","import {CHAR_HYPHEN} from '@taiga-ui/cdk';\n\n/**\n * TODO: delete in v4.0\n * @deprecated use {@link https://maskito.dev/kit/number maskitoParseNumber} instead\n * ```ts\n * Number.isNaN(maskitoParseNumber(value, decimalSeparator))\n * ```\n */\nexport function tuiMaskedMoneyValueIsEmpty(value: string): boolean {\n switch (value) {\n case ``:\n case CHAR_HYPHEN:\n case `,`:\n case `${CHAR_HYPHEN},`:\n return true;\n default:\n return false;\n }\n}\n","import {TuiDecimalSymbol} from '@taiga-ui/core/types';\n\n/**\n * TODO: delete in v4.0\n * @deprecated use {@link https://maskito.dev/kit/number maskitoParseNumber} instead\n */\nexport function tuiMaskedNumberStringToNumber(\n value: string,\n decimalsSymbol: TuiDecimalSymbol,\n thousandSymbol: string,\n): number {\n return parseFloat(\n value.split(thousandSymbol).join(``).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,oBAAoB,CAAC,IAAI,EAAE,eAAe,EAAE,kBAAkB,CAAC,CAAC;AAC3E,KAAC,CAAC;AACN;;ACnMA;;;AAGG;AACa,SAAA,iCAAiC,CAAC,EAC9C,iBAAiB,GACK,EAAA;AACtB,IAAA,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAC5D;;ACTA;;;;;;AAMG;AACG,SAAU,0BAA0B,CAAC,KAAa,EAAA;AACpD,IAAA,QAAQ,KAAK;AACT,QAAA,KAAK,EAAE,CAAC;AACR,QAAA,KAAK,WAAW,CAAC;AACjB,QAAA,KAAK,GAAG,CAAC;QACT,KAAK,CAAA,EAAG,WAAW,CAAG,CAAA,CAAA;AAClB,YAAA,OAAO,IAAI,CAAC;AAChB,QAAA;AACI,YAAA,OAAO,KAAK,CAAC;AACpB,KAAA;AACL;;ACjBA;;;AAGG;SACa,6BAA6B,CACzC,KAAa,EACb,cAAgC,EAChC,cAAsB,EAAA;IAEtB,OAAO,UAAU,CACb,KAAK,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAA,CAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG,CAAC,CACvE,CAAC;AACN;;ACdA;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"taiga-ui-core-utils-mask.js","sources":["../../../projects/core/utils/mask/create-auto-corrected-money-pipe.ts","../../../projects/core/utils/mask/create-correction-mask.ts","../../../projects/core/utils/mask/create-number-mask.ts","../../../projects/core/utils/mask/enable-auto-correct-decimal-symbol.ts","../../../projects/core/utils/mask/masked-money-value-is-empty.ts","../../../projects/core/utils/mask/masked-number-string-to-number.ts","../../../projects/core/utils/mask/taiga-ui-core-utils-mask.ts"],"sourcesContent":["import {\n CHAR_HYPHEN,\n CHAR_NO_BREAK_SPACE,\n tuiAssert,\n tuiGetDocumentOrShadowRoot,\n tuiIsNativeFocused,\n tuiIsSafari,\n} from '@taiga-ui/cdk';\nimport {TuiTextMaskPipeHandler} from '@taiga-ui/core/mask';\nimport {TuiDecimalSymbol} from '@taiga-ui/core/types';\n\nfunction addDecimalSymbolIfNeeded(\n value: string,\n decimalSymbol: TuiDecimalSymbol = ',',\n): string {\n return !value.includes(decimalSymbol) ? value + decimalSymbol : value;\n}\n\nfunction calculateSafariCaret(\n previousValue: string = '',\n current: string,\n previousCaret: number,\n decimalSymbol: string = ',',\n): number {\n const tailRegex = new RegExp(`${decimalSymbol}.+`);\n const previousWithoutTail = previousValue.replace(tailRegex, '');\n const currentWithoutTail = current.replace(tailRegex, '');\n\n const pasteOrCutOperation =\n Math.abs(previousWithoutTail.length - currentWithoutTail.length) > 2;\n\n if (pasteOrCutOperation) {\n return current.length;\n }\n\n if (previousValue.length === current.length) {\n if (previousValue.indexOf(decimalSymbol) <= previousCaret) {\n return calculateChangedTailIndex(previousValue, current);\n }\n\n return previousWithoutTail === currentWithoutTail\n ? previousCaret - 1\n : previousCaret + 1;\n }\n\n if (previousValue.length === 0) {\n return 1;\n }\n\n const changeLength = current.length - previousValue.length;\n\n return previousCaret + changeLength;\n}\n\nfunction calculateChangedTailIndex(previous: string, current: string): number {\n for (let i = 0; i < current.length; i++) {\n if (previous[i] !== current[i]) {\n return current[i] === '0' ? i : i + 1;\n }\n }\n\n return current.length;\n}\n\nfunction calculateCaretGap(\n previousValue: string = '',\n current: string,\n thousandSymbol: string,\n): number {\n const pasteOrCutOperation = Math.abs(previousValue.length - current.length) > 2;\n\n if (pasteOrCutOperation) {\n return 0;\n }\n\n const wereSpaces = previousValue.split(thousandSymbol).length;\n const nowSpaces = current.split(thousandSymbol).length;\n\n return nowSpaces - wereSpaces;\n}\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/kit/number Number} from {@link https://github.com/taiga-family/maskito Maskito} instead <br/>\n * Used to finish a number with zeros to a given precision\n */\nexport function tuiCreateAutoCorrectedNumberPipe(\n decimalLimit: number = 0,\n decimalSymbol: TuiDecimalSymbol = ',',\n thousandSymbol: string = CHAR_NO_BREAK_SPACE,\n nativeInput?: HTMLInputElement | null,\n allowNegative?: boolean,\n isIOS = false,\n): TuiTextMaskPipeHandler {\n ngDevMode && tuiAssert.assert(decimalLimit >= 0);\n\n // Guess for which browser I need this :)\n let previousCaret = -1;\n const unlucky = (!!nativeInput && tuiIsSafari(nativeInput)) || isIOS;\n\n if (nativeInput && unlucky) {\n nativeInput.addEventListener('beforeinput', () => {\n previousCaret = nativeInput.selectionStart || 0;\n });\n }\n\n return (conformedValue, config) => {\n // Removing everything by selecting and pressing '-'\n if (!conformedValue && config.rawValue === CHAR_HYPHEN && allowNegative) {\n return CHAR_HYPHEN;\n }\n\n // remove these hacks after text mask library has changed\n if (nativeInput && unlucky && tuiIsNativeFocused(nativeInput)) {\n const caret = calculateSafariCaret(\n config.previousConformedValue,\n conformedValue,\n previousCaret,\n );\n\n setTimeout(() => {\n nativeInput.setSelectionRange(caret, caret);\n });\n }\n\n if (\n nativeInput &&\n nativeInput.ownerDocument !== tuiGetDocumentOrShadowRoot(nativeInput) &&\n tuiIsNativeFocused(nativeInput) &&\n config.currentCaretPosition\n ) {\n const realCaretPosition =\n config.currentCaretPosition +\n calculateCaretGap(\n config.previousConformedValue,\n conformedValue,\n thousandSymbol,\n );\n\n setTimeout(() => {\n nativeInput.setSelectionRange(realCaretPosition, realCaretPosition);\n });\n }\n\n if (conformedValue === '' || !decimalLimit || !Number.isInteger(decimalLimit)) {\n return {value: conformedValue};\n }\n\n const withDecimalSymbol = addDecimalSymbolIfNeeded(conformedValue, decimalSymbol);\n const decimalPart = withDecimalSymbol.split(decimalSymbol)[1];\n const zeroPaddingSize = decimalLimit - decimalPart.length;\n\n return {\n value: withDecimalSymbol + '0'.repeat(zeroPaddingSize),\n };\n };\n}\n","import {tuiAssert} from '@taiga-ui/cdk';\nimport {MASK_CARET_TRAP} from '@taiga-ui/core/constants';\nimport {\n TuiTextMaskCorrectionHandler,\n TuiTextMaskList,\n TuiTextMaskListHandler,\n} from '@taiga-ui/core/mask';\n\nconst ASSERTION = 'Correction function must return single char or null';\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/core-concepts/processors processors} from {@link https://github.com/taiga-family/maskito Maskito}\n */\nexport function tuiCreateCorrectionMask(\n allowed: RegExp,\n correctionHandler: TuiTextMaskCorrectionHandler,\n): TuiTextMaskListHandler {\n return rawValue => {\n const mask = rawValue.split('').reduce<TuiTextMaskList>((result, char, index) => {\n const corrected = correctionHandler(char, index);\n\n ngDevMode &&\n tuiAssert.assert(corrected === null || corrected.length === 1, ASSERTION);\n\n if (!allowed.test(char) && !corrected) {\n return result;\n }\n\n if (allowed.test(char)) {\n return [...result, allowed];\n }\n\n if (corrected) {\n return [...result, corrected, MASK_CARET_TRAP];\n }\n\n return result;\n }, []);\n const lastIndex = mask.lastIndexOf(MASK_CARET_TRAP);\n const filtered = mask.filter(\n (item, index) => item !== MASK_CARET_TRAP || index === lastIndex,\n );\n\n return filtered.some(item => item !== allowed)\n ? [...filtered, allowed]\n : filtered;\n };\n}\n","import {CHAR_EN_DASH, CHAR_HYPHEN, CHAR_NO_BREAK_SPACE, tuiAssert} from '@taiga-ui/cdk';\nimport {\n MASK_CARET_TRAP,\n TUI_DIGIT_REGEXP,\n TUI_LEADING_ZEROES_REGEXP,\n TUI_NON_DIGITS_REGEXP,\n} from '@taiga-ui/core/constants';\nimport {TuiNumberMaskOptions, TuiTextMaskListHandler} from '@taiga-ui/core/mask';\nimport {TuiDecimalSymbol} from '@taiga-ui/core/types';\nimport {tuiOtherDecimalSymbol} from '@taiga-ui/core/utils/format';\n\nconst NON_ZERO_DIGIT = /[1-9]/;\n\nfunction preventLeadingZeroes(\n mask: Array<RegExp | string>,\n isOnlyZeroDigit: boolean = false,\n leadingZerosAmount: number = 0,\n): Array<RegExp | string> {\n if (isOnlyZeroDigit || leadingZerosAmount === 0) {\n return mask;\n }\n\n const firstDigitIndex = mask.indexOf(TUI_DIGIT_REGEXP);\n\n if (firstDigitIndex === -1) {\n return mask;\n }\n\n const secondMaskDigit = mask[firstDigitIndex + 1];\n const isCaretTrap = secondMaskDigit === MASK_CARET_TRAP;\n\n if (isCaretTrap && leadingZerosAmount === 1) {\n return mask;\n }\n\n if (isCaretTrap) {\n mask.unshift(NON_ZERO_DIGIT);\n\n return mask;\n }\n\n mask[firstDigitIndex] = NON_ZERO_DIGIT;\n\n return mask;\n}\n\nfunction getDecimalSymbolIndex(\n str: string,\n decimalSymbol: TuiDecimalSymbol,\n autoCorrectDecimalSymbol: boolean,\n): number {\n if (!autoCorrectDecimalSymbol) {\n return str.lastIndexOf(decimalSymbol);\n }\n\n return Math.max(\n str.lastIndexOf(decimalSymbol),\n str.lastIndexOf(tuiOtherDecimalSymbol(decimalSymbol)),\n );\n}\n\nfunction isDecimalSymbol(\n str: string,\n decimalSymbol: TuiDecimalSymbol,\n autoCorrectDecimalSymbol: boolean,\n): boolean {\n if (autoCorrectDecimalSymbol) {\n return /^[,.]$/.test(str);\n }\n\n return str === decimalSymbol;\n}\n\nfunction convertToMask(strNumber: string): Array<RegExp | string> {\n return strNumber\n .split('')\n .map(char => (TUI_DIGIT_REGEXP.test(char) ? TUI_DIGIT_REGEXP : char));\n}\n\nfunction addThousandsSeparator(strNumber: string, thousandSymbol: string): string {\n return strNumber.length > 3\n ? // TODO: investigate to disallow potentially catastrophic exponential-time regular expressions.\n // eslint-disable-next-line unicorn/no-unsafe-regex\n strNumber.replace(/\\B(?=(\\d{3})+(?!\\d))/g, thousandSymbol)\n : strNumber;\n}\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/kit/number Number} from {@link https://github.com/taiga-family/maskito Maskito} instead <br/>\n * Adaptation for {@link https://github.com/text-mask/text-mask/tree/master/addons#createnumbermask `createNumberMask`}\n */\nexport function tuiCreateNumberMask({\n allowDecimal = false,\n decimalSymbol = ',',\n thousandSymbol = CHAR_NO_BREAK_SPACE,\n autoCorrectDecimalSymbol = true,\n decimalLimit = 2,\n requireDecimal = false,\n allowNegative = false,\n integerLimit = 0,\n}: TuiNumberMaskOptions = {}): TuiTextMaskListHandler {\n ngDevMode && tuiAssert.assert(decimalLimit >= 0);\n ngDevMode && tuiAssert.assert(Number.isInteger(integerLimit));\n ngDevMode && tuiAssert.assert(integerLimit >= 0);\n\n return (rawValue, {previousConformedValue}) => {\n if (previousConformedValue && requireDecimal) {\n const conformedWithoutSeparator = rawValue.split(thousandSymbol).join('');\n const previousConformedValueWithoutDecimalSymbolAndSeparator =\n previousConformedValue\n .split(thousandSymbol)\n .join('')\n .split(decimalSymbol)\n .join('');\n\n // Forbid removal of decimal separator if decimal part is required\n if (\n conformedWithoutSeparator ===\n previousConformedValueWithoutDecimalSymbolAndSeparator\n ) {\n rawValue = previousConformedValue;\n }\n }\n\n const isNegative =\n (rawValue?.startsWith(CHAR_HYPHEN) || rawValue?.startsWith(CHAR_EN_DASH)) &&\n allowNegative;\n\n if (\n isDecimalSymbol(rawValue, decimalSymbol, autoCorrectDecimalSymbol) &&\n allowDecimal\n ) {\n return ['0', decimalSymbol, TUI_DIGIT_REGEXP];\n }\n\n if (isNegative) {\n rawValue = rawValue.slice(1);\n }\n\n const decimalIndex = getDecimalSymbolIndex(\n rawValue,\n decimalSymbol,\n autoCorrectDecimalSymbol,\n );\n const hasDecimal = decimalIndex !== -1;\n const integer = hasDecimal ? rawValue.slice(0, decimalIndex) : rawValue;\n const thousandSeparators = integer.match(new RegExp(thousandSymbol, 'g')) || [];\n const integerCapped = integerLimit\n ? integer.slice(0, integerLimit + thousandSeparators.length)\n : integer;\n const integerCappedClean = integerCapped.replace(TUI_NON_DIGITS_REGEXP, '');\n const [leadingZerosMatch] = integerCappedClean.match(\n TUI_LEADING_ZEROES_REGEXP,\n ) || [''];\n const leadingZerosAmount = leadingZerosMatch.length;\n const integerCappedZerosClean = integerCappedClean\n .replace(/^0+(?!\\.|$)/, '')\n .trim();\n const withSeparator = addThousandsSeparator(\n integerCappedZerosClean,\n thousandSymbol,\n );\n const mask = convertToMask(withSeparator);\n\n if ((hasDecimal && allowDecimal) || requireDecimal) {\n const fraction = hasDecimal\n ? convertToMask(\n rawValue.slice(decimalIndex + 1).replace(TUI_NON_DIGITS_REGEXP, ''),\n )\n : [];\n const fractionCapped = decimalLimit\n ? fraction.slice(0, decimalLimit)\n : fraction;\n\n if (rawValue[decimalIndex] !== tuiOtherDecimalSymbol(decimalSymbol)) {\n mask.push(MASK_CARET_TRAP);\n }\n\n mask.push(decimalSymbol, MASK_CARET_TRAP, ...fractionCapped);\n\n for (let i = 0; i < Math.min(decimalLimit - fractionCapped.length, 20); i++) {\n mask.push(TUI_DIGIT_REGEXP);\n }\n }\n\n const isOnlyZeroDigit = mask.length === 1 && integerCappedZerosClean === '0';\n\n if (isNegative) {\n if (mask.length === 0) {\n mask.push(TUI_DIGIT_REGEXP);\n }\n\n mask.unshift(CHAR_HYPHEN);\n }\n\n return preventLeadingZeroes(mask, isOnlyZeroDigit, leadingZerosAmount);\n };\n}\n","import {TUI_DECIMAL_SYMBOLS} from '@taiga-ui/core/constants';\nimport {TuiNumberFormatSettings} from '@taiga-ui/core/interfaces';\n\n/**\n * TODO: delete in v4.0\n * @deprecated Use {@link https://maskito.dev/kit/number Number} from {@link https://github.com/taiga-family/maskito Maskito} instead\n */\nexport function tuiEnableAutoCorrectDecimalSymbol({\n thousandSeparator,\n}: TuiNumberFormatSettings): boolean {\n return !TUI_DECIMAL_SYMBOLS.includes(thousandSeparator);\n}\n","import {CHAR_HYPHEN} from '@taiga-ui/cdk';\n\n/**\n * TODO: delete in v4.0\n * @deprecated use {@link https://maskito.dev/kit/number maskitoParseNumber} instead\n * ```ts\n * Number.isNaN(maskitoParseNumber(value, decimalSeparator))\n * ```\n */\nexport function tuiMaskedMoneyValueIsEmpty(value: string): boolean {\n switch (value) {\n case '':\n case CHAR_HYPHEN:\n case ',':\n case `${CHAR_HYPHEN},`:\n return true;\n default:\n return false;\n }\n}\n","import {TuiDecimalSymbol} from '@taiga-ui/core/types';\n\n/**\n * TODO: delete in v4.0\n * @deprecated use {@link https://maskito.dev/kit/number maskitoParseNumber} instead\n */\nexport function tuiMaskedNumberStringToNumber(\n value: string,\n decimalsSymbol: TuiDecimalSymbol,\n thousandSymbol: string,\n): number {\n return parseFloat(\n value.split(thousandSymbol).join('').split(decimalsSymbol).join('.'),\n );\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAWA,SAAS,wBAAwB,CAC7B,KAAa,EACb,gBAAkC,GAAG,EAAA;AAErC,IAAA,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,KAAK,GAAG,aAAa,GAAG,KAAK,CAAC;AAC1E,CAAC;AAED,SAAS,oBAAoB,CACzB,aAAA,GAAwB,EAAE,EAC1B,OAAe,EACf,aAAqB,EACrB,aAAA,GAAwB,GAAG,EAAA;IAE3B,MAAM,SAAS,GAAG,IAAI,MAAM,CAAC,CAAG,EAAA,aAAa,CAAI,EAAA,CAAA,CAAC,CAAC;IACnD,MAAM,mBAAmB,GAAG,aAAa,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;IACjE,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;AAE1D,IAAA,MAAM,mBAAmB,GACrB,IAAI,CAAC,GAAG,CAAC,mBAAmB,CAAC,MAAM,GAAG,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAEzE,IAAA,IAAI,mBAAmB,EAAE;QACrB,OAAO,OAAO,CAAC,MAAM,CAAC;AACzB,KAAA;AAED,IAAA,IAAI,aAAa,CAAC,MAAM,KAAK,OAAO,CAAC,MAAM,EAAE;QACzC,IAAI,aAAa,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,aAAa,EAAE;AACvD,YAAA,OAAO,yBAAyB,CAAC,aAAa,EAAE,OAAO,C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