@taiga-ui/kit 4.52.0-canary.65c65f9 → 4.52.0-canary.669a014
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/components/avatar/avatar-outline.directive.d.ts +3 -3
- package/components/badge/badge.directive.d.ts +2 -2
- package/components/block/block.directive.d.ts +4 -4
- package/components/block/block.options.d.ts +1 -1
- package/components/checkbox/checkbox.component.d.ts +7 -18
- package/components/checkbox/checkbox.options.d.ts +5 -9
- package/components/chip/chip.directive.d.ts +2 -4
- package/components/comment/comment.directive.d.ts +2 -2
- package/components/confirm/confirm.component.d.ts +1 -0
- package/components/confirm/confirm.service.d.ts +2 -1
- package/components/floating-container/floating-container.directive.d.ts +2 -2
- package/components/input-color/input-color.component.d.ts +2 -2
- package/components/input-number/quantum.directive.d.ts +1 -1
- package/components/input-slider/input-slider.directive.d.ts +1 -1
- package/components/like/like.component.d.ts +4 -11
- package/components/like/like.options.d.ts +2 -3
- package/components/multi-select/multi-select-group/multi-select-group.component.d.ts +2 -2
- package/components/pager/pager.component.d.ts +1 -1
- package/components/pin/pin.directive.d.ts +2 -2
- package/components/progress/progress-bar/fixed-gradient/progress-fixed-gradient.directive.d.ts +1 -2
- package/components/progress/progress-segmented/progress-segmented.directive.d.ts +2 -2
- package/components/radio/radio.component.d.ts +7 -8
- package/components/radio/radio.directive.d.ts +2 -2
- package/components/radio/radio.options.d.ts +2 -5
- package/components/rating/rating.component.d.ts +5 -5
- package/components/rating/rating.options.d.ts +5 -3
- package/components/slides/slides.directive.d.ts +4 -4
- package/components/status/status.directive.d.ts +2 -2
- package/components/switch/switch.component.d.ts +7 -19
- package/components/switch/switch.options.d.ts +4 -8
- package/directives/chevron/chevron.directive.d.ts +2 -3
- package/directives/copy/copy.directive.d.ts +1 -2
- package/directives/copy/copy.options.d.ts +1 -1
- package/directives/fade/fade.directive.d.ts +1 -0
- package/directives/sensitive/sensitive.directive.d.ts +2 -2
- package/directives/shimmer/shimmer.directive.d.ts +3 -3
- package/directives/skeleton/skeleton.directive.d.ts +3 -3
- package/directives/tooltip/tooltip.directive.d.ts +2 -2
- package/fesm2022/taiga-ui-kit-components-avatar.mjs +20 -31
- package/fesm2022/taiga-ui-kit-components-avatar.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-badge.mjs +11 -18
- package/fesm2022/taiga-ui-kit-components-badge.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-block.mjs +15 -22
- package/fesm2022/taiga-ui-kit-components-block.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-checkbox.mjs +18 -75
- package/fesm2022/taiga-ui-kit-components-checkbox.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-chip.mjs +13 -25
- package/fesm2022/taiga-ui-kit-components-chip.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-comment.mjs +11 -18
- package/fesm2022/taiga-ui-kit-components-comment.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-confirm.mjs +7 -7
- package/fesm2022/taiga-ui-kit-components-confirm.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-data-list-wrapper.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-data-list-wrapper.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-filter.mjs +1 -1
- package/fesm2022/taiga-ui-kit-components-filter.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-floating-container.mjs +11 -17
- package/fesm2022/taiga-ui-kit-components-floating-container.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-chip.mjs +10 -5
- package/fesm2022/taiga-ui-kit-components-input-chip.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-color.mjs +4 -6
- package/fesm2022/taiga-ui-kit-components-input-color.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-date-multi.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-date-multi.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-date.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-date.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-month-range.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-month-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-month.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-month.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-number.mjs +7 -6
- package/fesm2022/taiga-ui-kit-components-input-number.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-pin.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-pin.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-range.mjs +6 -8
- package/fesm2022/taiga-ui-kit-components-input-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-slider.mjs +10 -13
- package/fesm2022/taiga-ui-kit-components-input-slider.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-time.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-time.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-input-year.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-input-year.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-like.mjs +38 -31
- package/fesm2022/taiga-ui-kit-components-like.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-message.mjs +6 -8
- package/fesm2022/taiga-ui-kit-components-message.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-multi-select.mjs +9 -8
- package/fesm2022/taiga-ui-kit-components-multi-select.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-pager.mjs +3 -3
- package/fesm2022/taiga-ui-kit-components-pager.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-pagination.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-pagination.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-pin.mjs +13 -17
- package/fesm2022/taiga-ui-kit-components-pin.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-progress.mjs +21 -34
- package/fesm2022/taiga-ui-kit-components-progress.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-radio.mjs +30 -35
- package/fesm2022/taiga-ui-kit-components-radio.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-rating.mjs +15 -19
- package/fesm2022/taiga-ui-kit-components-rating.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-select.mjs +1 -1
- package/fesm2022/taiga-ui-kit-components-select.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-slider.mjs +2 -2
- package/fesm2022/taiga-ui-kit-components-slider.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-slides.mjs +12 -20
- package/fesm2022/taiga-ui-kit-components-slides.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-status.mjs +10 -14
- package/fesm2022/taiga-ui-kit-components-status.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-switch.mjs +18 -64
- package/fesm2022/taiga-ui-kit-components-switch.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-components-tabs.mjs +11 -14
- package/fesm2022/taiga-ui-kit-components-tabs.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-button-group.mjs +6 -9
- package/fesm2022/taiga-ui-kit-directives-button-group.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-chevron.mjs +11 -18
- package/fesm2022/taiga-ui-kit-directives-chevron.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-connected.mjs +7 -12
- package/fesm2022/taiga-ui-kit-directives-connected.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-copy.mjs +4 -6
- package/fesm2022/taiga-ui-kit-directives-copy.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-fade.mjs +6 -9
- package/fesm2022/taiga-ui-kit-directives-fade.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-password.mjs +3 -3
- package/fesm2022/taiga-ui-kit-directives-password.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-sensitive.mjs +11 -16
- package/fesm2022/taiga-ui-kit-directives-sensitive.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-shimmer.mjs +22 -32
- package/fesm2022/taiga-ui-kit-directives-shimmer.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-skeleton.mjs +25 -36
- package/fesm2022/taiga-ui-kit-directives-skeleton.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-tooltip.mjs +11 -16
- package/fesm2022/taiga-ui-kit-directives-tooltip.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-directives-unfinished-validator.mjs +1 -2
- package/fesm2022/taiga-ui-kit-directives-unfinished-validator.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-pipes.mjs +0 -1
- package/fesm2022/taiga-ui-kit-pipes.mjs.map +1 -1
- package/fesm2022/taiga-ui-kit-tokens.mjs +1 -6
- package/fesm2022/taiga-ui-kit-tokens.mjs.map +1 -1
- package/package.json +35 -39
- package/pipes/index.d.ts +0 -1
- package/styles/components/checkbox.less +14 -12
- package/styles/components/like.less +4 -9
- package/styles/components/pin.less +0 -1
- package/styles/components/radio.less +1 -1
- package/styles/components/switch.less +9 -9
- package/tokens/index.d.ts +0 -1
- package/fesm2022/taiga-ui-kit-pipes-field-error.mjs +0 -147
- package/fesm2022/taiga-ui-kit-pipes-field-error.mjs.map +0 -1
- package/pipes/field-error/field-error-content-pipe.d.ts +0 -14
- package/pipes/field-error/field-error-pipe.d.ts +0 -29
- package/pipes/field-error/index.d.ts +0 -2
- package/tokens/validation-errors.d.ts +0 -5
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
* data-size — size (default: 'm') ('s' | 'm')
|
|
12
12
|
*
|
|
13
13
|
* @vars
|
|
14
|
-
* --t-
|
|
15
|
-
* --t-
|
|
14
|
+
* --t-icon-start — checkmark icon
|
|
15
|
+
* --t-icon-end — indeterminate state icon
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
|
-
* <input type="checkbox" tuiCheckbox />
|
|
18
|
+
* <input type="checkbox" tuiCheckbox tuiIcons tuiAppearance data-appearance='secondary' />
|
|
19
19
|
*
|
|
20
20
|
* @see-also
|
|
21
21
|
* Switch, Radio, Appearance
|
|
@@ -32,20 +32,22 @@
|
|
|
32
32
|
flex-shrink: 0;
|
|
33
33
|
|
|
34
34
|
&::before {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
position: absolute;
|
|
36
|
+
block-size: 100%;
|
|
37
|
+
inline-size: 100%;
|
|
38
38
|
font-size: 1rem;
|
|
39
|
-
|
|
40
|
-
mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"></svg>') no-repeat center /
|
|
41
|
-
calc(~'min(1em, 100%)' + 10 * var(--tui-stroke-width, 0.125rem)) ~'min(1em, 100%)' padding-box;
|
|
39
|
+
mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg"></svg>');
|
|
42
40
|
transform: scale(0);
|
|
43
41
|
transition:
|
|
44
42
|
transform var(--tui-duration) ease-in-out,
|
|
45
43
|
mask 0s var(--tui-duration) ease-in-out;
|
|
46
44
|
}
|
|
47
45
|
|
|
48
|
-
|
|
46
|
+
&::after {
|
|
47
|
+
display: none;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
&:disabled._readonly._readonly {
|
|
49
51
|
opacity: 1;
|
|
50
52
|
pointer-events: none;
|
|
51
53
|
}
|
|
@@ -53,7 +55,7 @@
|
|
|
53
55
|
&:checked,
|
|
54
56
|
&:indeterminate {
|
|
55
57
|
&::before {
|
|
56
|
-
mask-image: var(--t-
|
|
58
|
+
mask-image: var(--t-icon-start);
|
|
57
59
|
transform: scale(1);
|
|
58
60
|
transition:
|
|
59
61
|
transform var(--tui-duration) ease-in-out,
|
|
@@ -63,7 +65,7 @@
|
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
&:indeterminate::before {
|
|
66
|
-
mask-image: var(--t-
|
|
68
|
+
mask-image: var(--t-icon-end);
|
|
67
69
|
}
|
|
68
70
|
|
|
69
71
|
&[data-size='s'] {
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
* data-size — size (default: 'm') ('s' | 'm')
|
|
12
12
|
*
|
|
13
13
|
* @vars
|
|
14
|
-
* --t-icon-color
|
|
15
|
-
* --t-
|
|
16
|
-
* --t-
|
|
14
|
+
* --t-icon-color — custom color for `:checked` state
|
|
15
|
+
* --t-icon-start — default state icon
|
|
16
|
+
* --t-icon-end — checkmark icon
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
|
-
* <input tuiLike />
|
|
19
|
+
* <input tuiLike tuiIcons tuiAppearance data-appearance="secondary" />
|
|
20
20
|
*
|
|
21
21
|
* @see-also
|
|
22
22
|
* Checkbox, Switch, Radio, Appearance
|
|
@@ -34,16 +34,11 @@
|
|
|
34
34
|
&::after {
|
|
35
35
|
.fullsize();
|
|
36
36
|
|
|
37
|
-
content: '';
|
|
38
|
-
background: currentColor;
|
|
39
37
|
font-size: 1.25rem;
|
|
40
|
-
mask: var(--t-unchecked-icon) no-repeat center /
|
|
41
|
-
calc(~'min(1em, 100%)' + 10 * var(--tui-stroke-width, 0.125rem)) ~'min(1em, 100%)' padding-box;
|
|
42
38
|
transition-property: transform, opacity;
|
|
43
39
|
}
|
|
44
40
|
|
|
45
41
|
&::after {
|
|
46
|
-
mask-image: var(--t-checked-icon);
|
|
47
42
|
opacity: 0;
|
|
48
43
|
color: var(--t-icon-color, inherit);
|
|
49
44
|
transform: scale(0);
|
|
@@ -11,10 +11,10 @@
|
|
|
11
11
|
* data-size — size (default: 'm') ('s' | 'm')
|
|
12
12
|
*
|
|
13
13
|
* @vars
|
|
14
|
-
* --t-
|
|
14
|
+
* --t-icon-start — checkmark icon
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
|
-
* <input type="checkbox" tuiSwitch />
|
|
17
|
+
* <input type="checkbox" tuiSwitch tuiAppearance data-appearance="primary" />
|
|
18
18
|
*
|
|
19
19
|
* @see-also
|
|
20
20
|
* Checkbox, Radio
|
|
@@ -63,13 +63,12 @@
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
&:disabled._readonly {
|
|
66
|
+
&:disabled._readonly._readonly {
|
|
67
67
|
opacity: 1;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
&::before,
|
|
71
71
|
&::after {
|
|
72
|
-
content: '';
|
|
73
72
|
position: absolute;
|
|
74
73
|
block-size: 100%;
|
|
75
74
|
inline-size: 1.5rem;
|
|
@@ -77,10 +76,6 @@
|
|
|
77
76
|
}
|
|
78
77
|
|
|
79
78
|
&::before {
|
|
80
|
-
display: var(--t-checked-icon, none);
|
|
81
|
-
background: currentColor;
|
|
82
|
-
mask: var(--t-checked-icon) no-repeat center / calc(~'min(1em, 100%)' + 10 * var(--tui-stroke-width, 0.125rem))
|
|
83
|
-
~'min(1em, 100%)' padding-box;
|
|
84
79
|
font-size: 1rem;
|
|
85
80
|
inline-size: 1.375rem;
|
|
86
81
|
transform: translateX(-1.5rem);
|
|
@@ -88,11 +83,16 @@
|
|
|
88
83
|
|
|
89
84
|
&::after {
|
|
90
85
|
right: 0;
|
|
86
|
+
display: block;
|
|
91
87
|
border-radius: 100%;
|
|
88
|
+
background: none;
|
|
92
89
|
transform: scale(0.33333);
|
|
93
90
|
box-shadow: -4.5rem 0 0 0.75rem var(--tui-background-base);
|
|
94
91
|
outline: 0.375rem solid var(--tui-background-neutral-2-pressed);
|
|
95
|
-
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
&:not([data-icon-start])::after {
|
|
95
|
+
outline-offset: 20rem;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
&:invalid:not([data-mode]),
|
package/tokens/index.d.ts
CHANGED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { AsyncPipe } from '@angular/common';
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, Pipe, INJECTOR, Injector } from '@angular/core';
|
|
4
|
-
import { __decorate } from 'tslib';
|
|
5
|
-
import { NgControl, ControlContainer } from '@angular/forms';
|
|
6
|
-
import { TuiValidationError } from '@taiga-ui/cdk/classes';
|
|
7
|
-
import { tuiIsString, tuiPure } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
8
|
-
import { TUI_VALIDATION_ERRORS } from '@taiga-ui/kit/tokens';
|
|
9
|
-
import { map, of, Observable } from 'rxjs';
|
|
10
|
-
|
|
11
|
-
const EMPTY_RECORD = {};
|
|
12
|
-
function unwrapObservable(content, context) {
|
|
13
|
-
return content.pipe(map((error) => new TuiValidationError(error || '', context)));
|
|
14
|
-
}
|
|
15
|
-
function defaultError(content, context) {
|
|
16
|
-
return of(new TuiValidationError(content || '', context));
|
|
17
|
-
}
|
|
18
|
-
class TuiFieldErrorPipe {
|
|
19
|
-
constructor() {
|
|
20
|
-
this.order = [];
|
|
21
|
-
this.parent = inject(NgControl, { skipSelf: true, optional: true });
|
|
22
|
-
this.self = inject(NgControl, { self: true, optional: true });
|
|
23
|
-
this.container = inject(ControlContainer, { optional: true });
|
|
24
|
-
this.validationErrors = inject(TUI_VALIDATION_ERRORS);
|
|
25
|
-
if (this.self && !this.self.valueAccessor) {
|
|
26
|
-
this.self.valueAccessor = this;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
transform(order) {
|
|
30
|
-
this.order = order;
|
|
31
|
-
return this.computedError;
|
|
32
|
-
}
|
|
33
|
-
registerOnChange() { }
|
|
34
|
-
registerOnTouched() { }
|
|
35
|
-
setDisabledState() { }
|
|
36
|
-
writeValue() { }
|
|
37
|
-
get computedError() {
|
|
38
|
-
return (this.invalid && this.touched && this.error) || of(null);
|
|
39
|
-
}
|
|
40
|
-
get error() {
|
|
41
|
-
const { errorId } = this;
|
|
42
|
-
if (!errorId) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
const firstError = this.controlErrors[errorId];
|
|
46
|
-
const errorContent = this.validationErrors[errorId];
|
|
47
|
-
return this.getError(firstError, errorContent);
|
|
48
|
-
}
|
|
49
|
-
get invalid() {
|
|
50
|
-
return !!this.control?.invalid;
|
|
51
|
-
}
|
|
52
|
-
get touched() {
|
|
53
|
-
return !!this.control?.touched;
|
|
54
|
-
}
|
|
55
|
-
get control() {
|
|
56
|
-
return this.self?.control || this.parent?.control || this.container?.control;
|
|
57
|
-
}
|
|
58
|
-
get errorId() {
|
|
59
|
-
return this.getErrorId(this.order, this.controlErrors);
|
|
60
|
-
}
|
|
61
|
-
get controlErrors() {
|
|
62
|
-
return this.control?.errors || EMPTY_RECORD;
|
|
63
|
-
}
|
|
64
|
-
getError(context, content) {
|
|
65
|
-
if (context instanceof TuiValidationError) {
|
|
66
|
-
return of(context);
|
|
67
|
-
}
|
|
68
|
-
if (content === undefined && tuiIsString(context)) {
|
|
69
|
-
return of(new TuiValidationError(context));
|
|
70
|
-
}
|
|
71
|
-
if (content instanceof Observable) {
|
|
72
|
-
return unwrapObservable(content, context);
|
|
73
|
-
}
|
|
74
|
-
if (content instanceof Function) {
|
|
75
|
-
const message = content(context);
|
|
76
|
-
return message instanceof Observable
|
|
77
|
-
? unwrapObservable(message, context)
|
|
78
|
-
: defaultError(message, context);
|
|
79
|
-
}
|
|
80
|
-
return defaultError(content, context);
|
|
81
|
-
}
|
|
82
|
-
getErrorId(order, controlErrors) {
|
|
83
|
-
const id = order?.find((errorId) => controlErrors[errorId]);
|
|
84
|
-
const [fallback] = Object.keys(controlErrors);
|
|
85
|
-
return id || fallback || '';
|
|
86
|
-
}
|
|
87
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiFieldErrorPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
88
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: TuiFieldErrorPipe, isStandalone: true, name: "tuiFieldError", pure: false }); }
|
|
89
|
-
}
|
|
90
|
-
__decorate([
|
|
91
|
-
tuiPure
|
|
92
|
-
], TuiFieldErrorPipe.prototype, "getError", null);
|
|
93
|
-
__decorate([
|
|
94
|
-
tuiPure
|
|
95
|
-
], TuiFieldErrorPipe.prototype, "getErrorId", null);
|
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiFieldErrorPipe, decorators: [{
|
|
97
|
-
type: Pipe,
|
|
98
|
-
args: [{
|
|
99
|
-
standalone: true,
|
|
100
|
-
name: 'tuiFieldError',
|
|
101
|
-
pure: false,
|
|
102
|
-
}]
|
|
103
|
-
}], ctorParameters: () => [], propDecorators: { getError: [], getErrorId: [] } });
|
|
104
|
-
|
|
105
|
-
class TuiFieldErrorContentPipe {
|
|
106
|
-
constructor() {
|
|
107
|
-
this.injector = inject(INJECTOR);
|
|
108
|
-
this.localInjector = Injector.create({
|
|
109
|
-
providers: [{ provide: AsyncPipe }, { provide: TuiFieldErrorPipe }],
|
|
110
|
-
parent: this.injector,
|
|
111
|
-
});
|
|
112
|
-
this.asyncPipe = this.localInjector.get(AsyncPipe);
|
|
113
|
-
this.fieldErrorPipe = this.localInjector.get(TuiFieldErrorPipe);
|
|
114
|
-
}
|
|
115
|
-
transform(order) {
|
|
116
|
-
return this.getErrorContent(order);
|
|
117
|
-
}
|
|
118
|
-
ngOnDestroy() {
|
|
119
|
-
this.asyncPipe.ngOnDestroy();
|
|
120
|
-
}
|
|
121
|
-
getErrorContent(order) {
|
|
122
|
-
const error = this.asyncPipe.transform(this.fieldErrorPipe.transform(order));
|
|
123
|
-
if (!error) {
|
|
124
|
-
return '';
|
|
125
|
-
}
|
|
126
|
-
return typeof error.message === 'function'
|
|
127
|
-
? error.message(error.context)
|
|
128
|
-
: error.message;
|
|
129
|
-
}
|
|
130
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiFieldErrorContentPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
131
|
-
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: TuiFieldErrorContentPipe, isStandalone: true, name: "tuiFieldErrorContent", pure: false }); }
|
|
132
|
-
}
|
|
133
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiFieldErrorContentPipe, decorators: [{
|
|
134
|
-
type: Pipe,
|
|
135
|
-
args: [{
|
|
136
|
-
standalone: true,
|
|
137
|
-
name: 'tuiFieldErrorContent',
|
|
138
|
-
pure: false,
|
|
139
|
-
}]
|
|
140
|
-
}] });
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Generated bundle index. Do not edit.
|
|
144
|
-
*/
|
|
145
|
-
|
|
146
|
-
export { TuiFieldErrorContentPipe, TuiFieldErrorPipe };
|
|
147
|
-
//# sourceMappingURL=taiga-ui-kit-pipes-field-error.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-kit-pipes-field-error.mjs","sources":["../../../projects/kit/pipes/field-error/field-error-pipe.ts","../../../projects/kit/pipes/field-error/field-error-content-pipe.ts","../../../projects/kit/pipes/field-error/taiga-ui-kit-pipes-field-error.ts"],"sourcesContent":["import {inject, Pipe, type PipeTransform} from '@angular/core';\nimport {\n type AbstractControl,\n ControlContainer,\n type ControlValueAccessor,\n NgControl,\n} from '@angular/forms';\nimport {TuiValidationError} from '@taiga-ui/cdk/classes';\nimport {tuiIsString, tuiPure} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {TUI_VALIDATION_ERRORS} from '@taiga-ui/kit/tokens';\nimport {type PolymorpheusContent} from '@taiga-ui/polymorpheus';\nimport {map, Observable, of} from 'rxjs';\n\nconst EMPTY_RECORD = {};\n\nfunction unwrapObservable(\n content: Observable<PolymorpheusContent>,\n context: any,\n): Observable<TuiValidationError> {\n return content.pipe(map((error) => new TuiValidationError(error || '', context)));\n}\n\nfunction defaultError(\n content: PolymorpheusContent,\n context: any,\n): Observable<TuiValidationError> {\n return of(new TuiValidationError(content || '', context));\n}\n\n@Pipe({\n standalone: true,\n name: 'tuiFieldError',\n pure: false,\n})\nexport class TuiFieldErrorPipe implements PipeTransform, ControlValueAccessor {\n private order: readonly string[] = [];\n private readonly parent = inject(NgControl, {skipSelf: true, optional: true});\n private readonly self = inject(NgControl, {self: true, optional: true});\n private readonly container = inject(ControlContainer, {optional: true});\n private readonly validationErrors = inject(TUI_VALIDATION_ERRORS);\n\n constructor() {\n if (this.self && !this.self.valueAccessor) {\n this.self.valueAccessor = this;\n }\n }\n\n public transform(order: readonly string[]): Observable<TuiValidationError | null> {\n this.order = order;\n\n return this.computedError;\n }\n\n public registerOnChange(): void {}\n\n public registerOnTouched(): void {}\n\n public setDisabledState(): void {}\n\n public writeValue(): void {}\n\n protected get computedError(): Observable<TuiValidationError | null> {\n return (this.invalid && this.touched && this.error) || of(null);\n }\n\n private get error(): Observable<TuiValidationError> | null {\n const {errorId} = this;\n\n if (!errorId) {\n return null;\n }\n\n const firstError = this.controlErrors[errorId];\n const errorContent = this.validationErrors[errorId];\n\n return this.getError(firstError, errorContent);\n }\n\n private get invalid(): boolean {\n return !!this.control?.invalid;\n }\n\n private get touched(): boolean {\n return !!this.control?.touched;\n }\n\n private get control(): AbstractControl | null | undefined {\n return this.self?.control || this.parent?.control || this.container?.control;\n }\n\n private get errorId(): string {\n return this.getErrorId(this.order, this.controlErrors);\n }\n\n private get controlErrors(): Record<string, unknown> {\n return this.control?.errors || EMPTY_RECORD;\n }\n\n @tuiPure\n private getError(\n context: any,\n content?: Observable<PolymorpheusContent> | PolymorpheusContent,\n ): Observable<TuiValidationError> {\n if (context instanceof TuiValidationError) {\n return of(context);\n }\n\n if (content === undefined && tuiIsString(context)) {\n return of(new TuiValidationError(context));\n }\n\n if (content instanceof Observable) {\n return unwrapObservable(content, context);\n }\n\n if (content instanceof Function) {\n const message = content(context) as\n | Observable<PolymorpheusContent>\n | PolymorpheusContent;\n\n return message instanceof Observable\n ? unwrapObservable(message, context)\n : defaultError(message, context);\n }\n\n return defaultError(content, context);\n }\n\n @tuiPure\n private getErrorId(\n order: readonly string[],\n controlErrors: Record<string, unknown>,\n ): string {\n const id = order?.find((errorId) => controlErrors[errorId]);\n const [fallback] = Object.keys(controlErrors);\n\n return id || fallback || '';\n }\n}\n","import {AsyncPipe} from '@angular/common';\nimport {\n inject,\n INJECTOR,\n Injector,\n type OnDestroy,\n Pipe,\n type PipeTransform,\n} from '@angular/core';\nimport {type PolymorpheusContent} from '@taiga-ui/polymorpheus';\n\nimport {TuiFieldErrorPipe} from './field-error-pipe';\n\n@Pipe({\n standalone: true,\n name: 'tuiFieldErrorContent',\n pure: false,\n})\nexport class TuiFieldErrorContentPipe implements PipeTransform, OnDestroy {\n private readonly injector = inject(INJECTOR);\n private readonly localInjector = Injector.create({\n providers: [{provide: AsyncPipe}, {provide: TuiFieldErrorPipe}],\n parent: this.injector,\n });\n\n private readonly asyncPipe = this.localInjector.get(AsyncPipe);\n private readonly fieldErrorPipe = this.localInjector.get(TuiFieldErrorPipe);\n\n public transform(order: readonly string[]): PolymorpheusContent {\n return this.getErrorContent(order);\n }\n\n public ngOnDestroy(): void {\n this.asyncPipe.ngOnDestroy();\n }\n\n private getErrorContent(order: readonly string[]): PolymorpheusContent {\n const error = this.asyncPipe.transform(this.fieldErrorPipe.transform(order));\n\n if (!error) {\n return '';\n }\n\n return typeof error.message === 'function'\n ? error.message(error.context)\n : error.message;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;;;;;AAaA,MAAM,YAAY,GAAG,EAAE;AAEvB,SAAS,gBAAgB,CACrB,OAAwC,EACxC,OAAY,EAAA;IAEZ,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,KAAK,IAAI,kBAAkB,CAAC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,EAAA,UAAA,EAAA,CAAA;kBALpC,IAAI;AAAC,YAAA,IAAA,EAAA,CAAA;AACF,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE,sBAAsB;AAC5B,oBAAA,IAAI,EAAE,KAAK;AACd,iBAAA;;;ACjBD;;AAEG;;;;"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { type OnDestroy, type PipeTransform } from '@angular/core';
|
|
2
|
-
import { type PolymorpheusContent } from '@taiga-ui/polymorpheus';
|
|
3
|
-
import * as i0 from "@angular/core";
|
|
4
|
-
export declare class TuiFieldErrorContentPipe implements PipeTransform, OnDestroy {
|
|
5
|
-
private readonly injector;
|
|
6
|
-
private readonly localInjector;
|
|
7
|
-
private readonly asyncPipe;
|
|
8
|
-
private readonly fieldErrorPipe;
|
|
9
|
-
transform(order: readonly string[]): PolymorpheusContent;
|
|
10
|
-
ngOnDestroy(): void;
|
|
11
|
-
private getErrorContent;
|
|
12
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<TuiFieldErrorContentPipe, never>;
|
|
13
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<TuiFieldErrorContentPipe, "tuiFieldErrorContent", true>;
|
|
14
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { type PipeTransform } from '@angular/core';
|
|
2
|
-
import { type ControlValueAccessor } from '@angular/forms';
|
|
3
|
-
import { TuiValidationError } from '@taiga-ui/cdk/classes';
|
|
4
|
-
import { Observable } from 'rxjs';
|
|
5
|
-
import * as i0 from "@angular/core";
|
|
6
|
-
export declare class TuiFieldErrorPipe implements PipeTransform, ControlValueAccessor {
|
|
7
|
-
private order;
|
|
8
|
-
private readonly parent;
|
|
9
|
-
private readonly self;
|
|
10
|
-
private readonly container;
|
|
11
|
-
private readonly validationErrors;
|
|
12
|
-
constructor();
|
|
13
|
-
transform(order: readonly string[]): Observable<TuiValidationError | null>;
|
|
14
|
-
registerOnChange(): void;
|
|
15
|
-
registerOnTouched(): void;
|
|
16
|
-
setDisabledState(): void;
|
|
17
|
-
writeValue(): void;
|
|
18
|
-
protected get computedError(): Observable<TuiValidationError | null>;
|
|
19
|
-
private get error();
|
|
20
|
-
private get invalid();
|
|
21
|
-
private get touched();
|
|
22
|
-
private get control();
|
|
23
|
-
private get errorId();
|
|
24
|
-
private get controlErrors();
|
|
25
|
-
private getError;
|
|
26
|
-
private getErrorId;
|
|
27
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<TuiFieldErrorPipe, never>;
|
|
28
|
-
static ɵpipe: i0.ɵɵPipeDeclaration<TuiFieldErrorPipe, "tuiFieldError", true>;
|
|
29
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, type Provider } from '@angular/core';
|
|
2
|
-
import { type PolymorpheusContent } from '@taiga-ui/polymorpheus';
|
|
3
|
-
import { type Observable } from 'rxjs';
|
|
4
|
-
export declare const TUI_VALIDATION_ERRORS: InjectionToken<Record<string, PolymorpheusContent | Observable<PolymorpheusContent>>>;
|
|
5
|
-
export declare const tuiValidationErrorsProvider: (useValue: Record<string, Observable<PolymorpheusContent> | PolymorpheusContent>) => Provider;
|