@taiga-ui/legacy 4.52.0-canary.e10b718 → 4.52.0-canary.eb5ffe3
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/dialog/dialog.component.d.ts +20 -0
- package/components/dialog/dialog.directive.d.ts +7 -0
- package/components/dialog/dialog.factory.d.ts +16 -0
- package/components/dialog/dialog.interfaces.d.ts +31 -0
- package/components/dialog/dialog.service.d.ts +7 -0
- package/components/dialog/dialog.tokens.d.ts +8 -0
- package/components/dialog/index.d.ts +6 -0
- package/components/index.d.ts +2 -9
- package/components/input/input.module.d.ts +1 -1
- package/components/input-date-range/input-date-range.module.d.ts +1 -1
- package/components/input-date-time/input-date-time.component.d.ts +4 -3
- package/components/input-date-time/input-date-time.module.d.ts +1 -1
- package/components/input-month-range/input-month-range.module.d.ts +1 -1
- package/components/input-range/input-range.component.d.ts +1 -1
- package/components/input-tag/input-tag.module.d.ts +1 -1
- package/components/multi-select/multi-select-group/multi-select-group.component.d.ts +1 -1
- package/components/multi-select/multi-select.module.d.ts +1 -1
- package/components/pdf-viewer/index.d.ts +4 -0
- package/components/pdf-viewer/pdf-viewer.component.d.ts +12 -0
- package/components/pdf-viewer/pdf-viewer.directive.d.ts +7 -0
- package/components/pdf-viewer/pdf-viewer.options.d.ts +13 -0
- package/components/pdf-viewer/pdf-viewer.service.d.ts +13 -0
- package/components/select/select.module.d.ts +1 -1
- package/fesm2022/taiga-ui-legacy-components-arrow.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-dialog.mjs +129 -0
- package/fesm2022/taiga-ui-legacy-components-dialog.mjs.map +1 -0
- package/fesm2022/taiga-ui-legacy-components-input-date-range.mjs +5 -5
- package/fesm2022/taiga-ui-legacy-components-input-date-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-input-date-time.mjs +6 -6
- package/fesm2022/taiga-ui-legacy-components-input-date-time.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-input-month-range.mjs +2 -2
- package/fesm2022/taiga-ui-legacy-components-input-month-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-input-number.mjs +3 -3
- package/fesm2022/taiga-ui-legacy-components-input-number.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-input-range.mjs +7 -7
- package/fesm2022/taiga-ui-legacy-components-input-range.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-input-slider.mjs +3 -3
- package/fesm2022/taiga-ui-legacy-components-input-slider.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-input-tag.mjs +5 -5
- package/fesm2022/taiga-ui-legacy-components-input-tag.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-input.mjs +4 -5
- package/fesm2022/taiga-ui-legacy-components-input.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-multi-select-option.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-multi-select.mjs +9 -9
- package/fesm2022/taiga-ui-legacy-components-multi-select.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-pdf-viewer.mjs +82 -0
- package/fesm2022/taiga-ui-legacy-components-pdf-viewer.mjs.map +1 -0
- package/fesm2022/taiga-ui-legacy-components-primitive-textfield.mjs +2 -2
- package/fesm2022/taiga-ui-legacy-components-primitive-textfield.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-select-option.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-select.mjs +8 -9
- package/fesm2022/taiga-ui-legacy-components-select.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-tag.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components-textarea.mjs +2 -2
- package/fesm2022/taiga-ui-legacy-components-textarea.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-components.mjs +2 -9
- package/fesm2022/taiga-ui-legacy-components.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy-directives-unfinished-validator.mjs +1 -2
- package/fesm2022/taiga-ui-legacy-directives-unfinished-validator.mjs.map +1 -1
- package/fesm2022/taiga-ui-legacy.mjs +0 -2
- package/fesm2022/taiga-ui-legacy.mjs.map +1 -1
- package/index.d.ts +0 -2
- package/package.json +8 -56
- package/utils/icons-path-factory.d.ts +1 -1
- package/components/color-selector/color-edit/color-edit.component.d.ts +0 -18
- package/components/color-selector/color-edit/color-edit.module.d.ts +0 -21
- package/components/color-selector/color-picker/color-picker.component.d.ts +0 -22
- package/components/color-selector/color-picker/color-picker.module.d.ts +0 -14
- package/components/color-selector/color-selector.component.d.ts +0 -47
- package/components/color-selector/color-selector.module.d.ts +0 -23
- package/components/color-selector/color-selector.options.d.ts +0 -25
- package/components/color-selector/flat-picker/flat-picker.component.d.ts +0 -12
- package/components/color-selector/flat-picker/flat-picker.module.d.ts +0 -12
- package/components/color-selector/index.d.ts +0 -16
- package/components/color-selector/linear-multi-picker/linear-multi-picker.component.d.ts +0 -17
- package/components/color-selector/linear-multi-picker/linear-multi-picker.module.d.ts +0 -12
- package/components/color-selector/linear-picker/linear-picker.component.d.ts +0 -10
- package/components/color-selector/linear-picker/linear-picker.module.d.ts +0 -12
- package/components/color-selector/palette/palette.component.d.ts +0 -10
- package/components/color-selector/palette/palette.module.d.ts +0 -13
- package/components/color-selector/services/picker.service.d.ts +0 -15
- package/components/combo-box/combo-box-strict.directive.d.ts +0 -12
- package/components/combo-box/combo-box.component.d.ts +0 -52
- package/components/combo-box/combo-box.directive.d.ts +0 -13
- package/components/combo-box/combo-box.module.d.ts +0 -20
- package/components/combo-box/index.d.ts +0 -4
- package/components/input-color/index.d.ts +0 -2
- package/components/input-color/input-color.component.d.ts +0 -30
- package/components/input-color/input-color.module.d.ts +0 -17
- package/components/input-date/index.d.ts +0 -3
- package/components/input-date/input-date.component.d.ts +0 -62
- package/components/input-date/input-date.directive.d.ts +0 -19
- package/components/input-date/input-date.module.d.ts +0 -24
- package/components/input-date/native-date/native-date.component.d.ts +0 -15
- package/components/input-phone/index.d.ts +0 -4
- package/components/input-phone/input-phone.component.d.ts +0 -52
- package/components/input-phone/input-phone.directive.d.ts +0 -16
- package/components/input-phone/input-phone.module.d.ts +0 -15
- package/components/input-phone/input-phone.options.d.ts +0 -22
- package/components/input-phone/utils/complete-phone-insertion-preprocessor.d.ts +0 -9
- package/components/input-phone/utils/create-phone-mask-expression.d.ts +0 -7
- package/components/input-phone/utils/index.d.ts +0 -2
- package/components/input-phone-international/index.d.ts +0 -3
- package/components/input-phone-international/input-phone-international.component.d.ts +0 -43
- package/components/input-phone-international/input-phone-international.options.d.ts +0 -25
- package/components/input-phone-international/utils/extract-value-from-event.d.ts +0 -4
- package/components/input-time/index.d.ts +0 -4
- package/components/input-time/input-time.component.d.ts +0 -62
- package/components/input-time/input-time.directive.d.ts +0 -17
- package/components/input-time/input-time.module.d.ts +0 -23
- package/components/input-time/input-time.options.d.ts +0 -42
- package/components/input-time/native-time/native-time.component.d.ts +0 -12
- package/components/input-year/index.d.ts +0 -3
- package/components/input-year/input-year.component.d.ts +0 -36
- package/components/input-year/input-year.directive.d.ts +0 -14
- package/components/input-year/input-year.module.d.ts +0 -18
- package/components/svg/content-processor.d.ts +0 -19
- package/components/svg/deprecated-icons.d.ts +0 -5
- package/components/svg/index.d.ts +0 -5
- package/components/svg/svg-options.d.ts +0 -50
- package/components/svg/svg.component.d.ts +0 -50
- package/components/svg/svg.service.d.ts +0 -21
- package/fesm2022/taiga-ui-legacy-components-color-selector.mjs +0 -726
- package/fesm2022/taiga-ui-legacy-components-color-selector.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-components-combo-box.mjs +0 -300
- package/fesm2022/taiga-ui-legacy-components-combo-box.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-components-input-color.mjs +0 -127
- package/fesm2022/taiga-ui-legacy-components-input-color.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-components-input-date.mjs +0 -372
- package/fesm2022/taiga-ui-legacy-components-input-date.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-components-input-phone-international.mjs +0 -215
- package/fesm2022/taiga-ui-legacy-components-input-phone-international.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-components-input-phone.mjs +0 -373
- package/fesm2022/taiga-ui-legacy-components-input-phone.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-components-input-time.mjs +0 -430
- package/fesm2022/taiga-ui-legacy-components-input-time.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-components-input-year.mjs +0 -188
- package/fesm2022/taiga-ui-legacy-components-input-year.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-components-svg.mjs +0 -387
- package/fesm2022/taiga-ui-legacy-components-svg.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-pipes-format-phone.mjs +0 -59
- package/fesm2022/taiga-ui-legacy-pipes-format-phone.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-pipes-iso-to-country-code.mjs +0 -50
- package/fesm2022/taiga-ui-legacy-pipes-iso-to-country-code.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-pipes-to-country-code.mjs +0 -80
- package/fesm2022/taiga-ui-legacy-pipes-to-country-code.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-pipes.mjs +0 -8
- package/fesm2022/taiga-ui-legacy-pipes.mjs.map +0 -1
- package/fesm2022/taiga-ui-legacy-services.mjs +0 -42
- package/fesm2022/taiga-ui-legacy-services.mjs.map +0 -1
- package/pipes/format-phone/format-phone.pipe.d.ts +0 -37
- package/pipes/format-phone/index.d.ts +0 -1
- package/pipes/index.d.ts +0 -3
- package/pipes/iso-to-country-code/index.d.ts +0 -1
- package/pipes/iso-to-country-code/iso-to-country-code.pipe.d.ts +0 -30
- package/pipes/to-country-code/index.d.ts +0 -1
- package/pipes/to-country-code/to-country-code.pipe.d.ts +0 -38
- package/services/index.d.ts +0 -1
- package/services/static-request.service.d.ts +0 -11
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
import { __decorate } from 'tslib';
|
|
2
|
-
import * as i0 from '@angular/core';
|
|
3
|
-
import { inject, Input, ViewChild, ChangeDetectionStrategy, Component, Directive, NgModule } from '@angular/core';
|
|
4
|
-
import { maskitoNumberOptionsGenerator } from '@maskito/kit';
|
|
5
|
-
import { TUI_FALSE_HANDLER } from '@taiga-ui/cdk/constants';
|
|
6
|
-
import { MAX_YEAR, MIN_YEAR } from '@taiga-ui/cdk/date-time';
|
|
7
|
-
import { tuiPure } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
8
|
-
import { TUI_INPUT_DATE_OPTIONS } from '@taiga-ui/kit/tokens';
|
|
9
|
-
import { AbstractTuiNullableControl, tuiAsControl, AbstractTuiTextfieldHost } from '@taiga-ui/legacy/classes';
|
|
10
|
-
import * as i3 from '@taiga-ui/legacy/components/primitive-textfield';
|
|
11
|
-
import { TuiPrimitiveTextfieldComponent, TuiTextfieldComponent, TuiPrimitiveTextfieldModule } from '@taiga-ui/legacy/components/primitive-textfield';
|
|
12
|
-
import * as i6 from '@taiga-ui/legacy/directives';
|
|
13
|
-
import { TUI_TEXTFIELD_SIZE, TuiTextfieldControllerModule } from '@taiga-ui/legacy/directives';
|
|
14
|
-
import { tuiAsFocusableItemAccessor, tuiAsTextfieldHost } from '@taiga-ui/legacy/tokens';
|
|
15
|
-
import * as i1 from '@maskito/angular';
|
|
16
|
-
import { MaskitoDirective } from '@maskito/angular';
|
|
17
|
-
import * as i1$1 from '@taiga-ui/core/directives/dropdown';
|
|
18
|
-
import { TuiDropdownOpen, TuiDropdown } from '@taiga-ui/core/directives/dropdown';
|
|
19
|
-
import * as i4 from '@taiga-ui/core/components/scrollbar';
|
|
20
|
-
import { TuiScrollbar } from '@taiga-ui/core/components/scrollbar';
|
|
21
|
-
import * as i5 from '@taiga-ui/core/components/calendar';
|
|
22
|
-
import { TuiCalendarYear } from '@taiga-ui/core/components/calendar';
|
|
23
|
-
|
|
24
|
-
const UP_TO_4_DIGITS_REG = /^\d{0,4}$/;
|
|
25
|
-
/**
|
|
26
|
-
* TODO(v5): delete it
|
|
27
|
-
* @deprecated use new version of {@link https://taiga-ui.dev/components/input-year TuiInputYear} (from @taiga-ui/kit) instead
|
|
28
|
-
*/
|
|
29
|
-
class TuiInputYearComponent extends AbstractTuiNullableControl {
|
|
30
|
-
constructor() {
|
|
31
|
-
super(...arguments);
|
|
32
|
-
this.options = inject(TUI_INPUT_DATE_OPTIONS);
|
|
33
|
-
this.textfieldSize = inject(TUI_TEXTFIELD_SIZE);
|
|
34
|
-
this.open = false;
|
|
35
|
-
this.initialItem = new Date().getFullYear();
|
|
36
|
-
this.min = this.options.min.year;
|
|
37
|
-
this.max = this.options.max.year;
|
|
38
|
-
this.disabledItemHandler = TUI_FALSE_HANDLER;
|
|
39
|
-
this.nativeValue = '';
|
|
40
|
-
}
|
|
41
|
-
get nativeFocusableElement() {
|
|
42
|
-
return this.textfield?.nativeFocusableElement || null;
|
|
43
|
-
}
|
|
44
|
-
get focused() {
|
|
45
|
-
return !!this.textfield?.focused;
|
|
46
|
-
}
|
|
47
|
-
onValueChange(value) {
|
|
48
|
-
this.value = value ? Number(value) : null;
|
|
49
|
-
}
|
|
50
|
-
writeValue(value) {
|
|
51
|
-
super.writeValue(value);
|
|
52
|
-
this.updateNativeValue(this.value);
|
|
53
|
-
}
|
|
54
|
-
get size() {
|
|
55
|
-
return this.textfieldSize.size;
|
|
56
|
-
}
|
|
57
|
-
get calendarIcon() {
|
|
58
|
-
return this.options.icon;
|
|
59
|
-
}
|
|
60
|
-
getMaskOptions(min, max) {
|
|
61
|
-
return {
|
|
62
|
-
...maskitoNumberOptionsGenerator({
|
|
63
|
-
min: min ?? MIN_YEAR,
|
|
64
|
-
max: max ?? MAX_YEAR,
|
|
65
|
-
thousandSeparator: '',
|
|
66
|
-
}),
|
|
67
|
-
mask: UP_TO_4_DIGITS_REG,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
onYearClick(year) {
|
|
71
|
-
this.value = year;
|
|
72
|
-
this.updateNativeValue(year);
|
|
73
|
-
this.onOpenChange(false);
|
|
74
|
-
}
|
|
75
|
-
onFocused(focused) {
|
|
76
|
-
this.updateFocused(focused);
|
|
77
|
-
}
|
|
78
|
-
onOpenChange(open) {
|
|
79
|
-
this.open = open;
|
|
80
|
-
}
|
|
81
|
-
toggle() {
|
|
82
|
-
this.open = !this.open;
|
|
83
|
-
}
|
|
84
|
-
updateNativeValue(value) {
|
|
85
|
-
this.nativeValue = value?.toString() || '';
|
|
86
|
-
}
|
|
87
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiInputYearComponent, deps: null, target: i0.ɵɵFactoryTarget.Component }); }
|
|
88
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TuiInputYearComponent, isStandalone: false, selector: "tui-input-year", inputs: { min: "min", max: "max", disabledItemHandler: "disabledItemHandler" }, host: { properties: { "attr.data-size": "size" } }, providers: [
|
|
89
|
-
tuiAsFocusableItemAccessor(TuiInputYearComponent),
|
|
90
|
-
tuiAsControl(TuiInputYearComponent),
|
|
91
|
-
], viewQueries: [{ propertyName: "textfield", first: true, predicate: TuiPrimitiveTextfieldComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<tui-primitive-textfield\n class=\"t-textfield\"\n [disabled]=\"computedDisabled\"\n [invalid]=\"computedInvalid\"\n [maskito]=\"getMaskOptions(min, max)\"\n [nativeId]=\"nativeId\"\n [pseudoFocus]=\"pseudoFocus\"\n [pseudoHover]=\"pseudoHover\"\n [readOnly]=\"readOnly\"\n [tuiDropdown]=\"dropdown\"\n [tuiDropdownEnabled]=\"interactive\"\n [tuiDropdownOpen]=\"open && interactive\"\n [tuiTextfieldIcon]=\"calendarIcon\"\n [(value)]=\"nativeValue\"\n (click)=\"toggle()\"\n (focusedChange)=\"onFocused($event)\"\n (tuiDropdownOpenChange)=\"onOpenChange($event)\"\n (valueChange)=\"onValueChange($event)\"\n>\n <ng-content />\n <ng-content\n ngProjectAs=\"input\"\n select=\"input\"\n />\n</tui-primitive-textfield>\n\n<ng-template #dropdown>\n <tui-scrollbar>\n <tui-calendar-year\n [disabledItemHandler]=\"disabledItemHandler\"\n [initialItem]=\"value || initialItem\"\n [max]=\"max\"\n [min]=\"min\"\n [value]=\"value === null ? null : value\"\n (mousedown.prevent.zoneless)=\"(0)\"\n (yearClick)=\"onYearClick($event)\"\n />\n </tui-scrollbar>\n</ng-template>\n", styles: [":host{display:block;border-radius:var(--tui-radius-m);text-align:start}:host :host-context(*:disabled){pointer-events:none}.t-textfield{border-radius:inherit;text-align:inherit}\n"], dependencies: [{ kind: "directive", type: i1.MaskitoDirective, selector: "[maskito]", inputs: ["maskito", "maskitoElement"] }, { kind: "directive", type: i1$1.TuiDropdownOpen, selector: "[tuiDropdown][tuiDropdownOpen],[tuiDropdown][tuiDropdownOpenChange]", inputs: ["tuiDropdownEnabled", "tuiDropdownOpen"], outputs: ["tuiDropdownOpenChange"] }, { kind: "component", type: i3.TuiPrimitiveTextfieldComponent, selector: "tui-primitive-textfield", inputs: ["editable", "iconCleaner", "readOnly", "invalid", "disabled", "value"], outputs: ["valueChange"] }, { kind: "directive", type: i3.TuiPrimitiveTextfieldDirective, selector: "tui-primitive-textfield" }, { kind: "component", type: i4.TuiScrollbar, selector: "tui-scrollbar", inputs: ["hidden"] }, { kind: "component", type: i5.TuiCalendarYear, selector: "tui-calendar-year", inputs: ["rangeMode", "disabledItemHandler", "initialItem", "min", "max", "value"], outputs: ["yearClick"] }, { kind: "directive", type: i6.TuiTextfieldIconDirective, selector: "[tuiTextfieldIcon]", inputs: ["tuiTextfieldIcon"] }, { kind: "directive", type: i1$1.TuiDropdownDirective, selector: "[tuiDropdown]:not(ng-container):not(ng-template)", inputs: ["tuiDropdown"], exportAs: ["tuiDropdown"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
92
|
-
}
|
|
93
|
-
__decorate([
|
|
94
|
-
tuiPure
|
|
95
|
-
], TuiInputYearComponent.prototype, "getMaskOptions", null);
|
|
96
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiInputYearComponent, decorators: [{
|
|
97
|
-
type: Component,
|
|
98
|
-
args: [{ standalone: false, selector: 'tui-input-year', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
99
|
-
tuiAsFocusableItemAccessor(TuiInputYearComponent),
|
|
100
|
-
tuiAsControl(TuiInputYearComponent),
|
|
101
|
-
], host: {
|
|
102
|
-
'[attr.data-size]': 'size',
|
|
103
|
-
}, template: "<tui-primitive-textfield\n class=\"t-textfield\"\n [disabled]=\"computedDisabled\"\n [invalid]=\"computedInvalid\"\n [maskito]=\"getMaskOptions(min, max)\"\n [nativeId]=\"nativeId\"\n [pseudoFocus]=\"pseudoFocus\"\n [pseudoHover]=\"pseudoHover\"\n [readOnly]=\"readOnly\"\n [tuiDropdown]=\"dropdown\"\n [tuiDropdownEnabled]=\"interactive\"\n [tuiDropdownOpen]=\"open && interactive\"\n [tuiTextfieldIcon]=\"calendarIcon\"\n [(value)]=\"nativeValue\"\n (click)=\"toggle()\"\n (focusedChange)=\"onFocused($event)\"\n (tuiDropdownOpenChange)=\"onOpenChange($event)\"\n (valueChange)=\"onValueChange($event)\"\n>\n <ng-content />\n <ng-content\n ngProjectAs=\"input\"\n select=\"input\"\n />\n</tui-primitive-textfield>\n\n<ng-template #dropdown>\n <tui-scrollbar>\n <tui-calendar-year\n [disabledItemHandler]=\"disabledItemHandler\"\n [initialItem]=\"value || initialItem\"\n [max]=\"max\"\n [min]=\"min\"\n [value]=\"value === null ? null : value\"\n (mousedown.prevent.zoneless)=\"(0)\"\n (yearClick)=\"onYearClick($event)\"\n />\n </tui-scrollbar>\n</ng-template>\n", styles: [":host{display:block;border-radius:var(--tui-radius-m);text-align:start}:host :host-context(*:disabled){pointer-events:none}.t-textfield{border-radius:inherit;text-align:inherit}\n"] }]
|
|
104
|
-
}], propDecorators: { textfield: [{
|
|
105
|
-
type: ViewChild,
|
|
106
|
-
args: [TuiPrimitiveTextfieldComponent]
|
|
107
|
-
}], min: [{
|
|
108
|
-
type: Input
|
|
109
|
-
}], max: [{
|
|
110
|
-
type: Input
|
|
111
|
-
}], disabledItemHandler: [{
|
|
112
|
-
type: Input
|
|
113
|
-
}], getMaskOptions: [] } });
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* TODO(v5): delete it
|
|
117
|
-
* @deprecated use new version of {@link https://taiga-ui.dev/components/input-year TuiInputYear} (from @taiga-ui/kit) instead
|
|
118
|
-
*/
|
|
119
|
-
class TuiInputYearDirective extends AbstractTuiTextfieldHost {
|
|
120
|
-
get value() {
|
|
121
|
-
return this.host.nativeValue;
|
|
122
|
-
}
|
|
123
|
-
onValueChange(value) {
|
|
124
|
-
this.host.onValueChange(value);
|
|
125
|
-
this.host.nativeValue = value;
|
|
126
|
-
}
|
|
127
|
-
process(input) {
|
|
128
|
-
input.inputMode = 'numeric';
|
|
129
|
-
}
|
|
130
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiInputYearDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive }); }
|
|
131
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: TuiInputYearDirective, isStandalone: false, selector: "tui-input-year", providers: [tuiAsTextfieldHost(TuiInputYearDirective)], usesInheritance: true, ngImport: i0 }); }
|
|
132
|
-
}
|
|
133
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiInputYearDirective, decorators: [{
|
|
134
|
-
type: Directive,
|
|
135
|
-
args: [{
|
|
136
|
-
standalone: false,
|
|
137
|
-
selector: 'tui-input-year',
|
|
138
|
-
providers: [tuiAsTextfieldHost(TuiInputYearDirective)],
|
|
139
|
-
}]
|
|
140
|
-
}] });
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* TODO(v5): delete it
|
|
144
|
-
* @deprecated use new version of {@link https://taiga-ui.dev/components/input-year TuiInputYear} (from @taiga-ui/kit) instead
|
|
145
|
-
*/
|
|
146
|
-
class TuiInputYearModule {
|
|
147
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiInputYearModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
|
148
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: TuiInputYearModule, declarations: [TuiInputYearComponent, TuiInputYearDirective], imports: [MaskitoDirective,
|
|
149
|
-
TuiDropdownOpen,
|
|
150
|
-
TuiPrimitiveTextfieldModule,
|
|
151
|
-
TuiScrollbar,
|
|
152
|
-
TuiCalendarYear,
|
|
153
|
-
TuiTextfieldControllerModule, i1$1.TuiDropdownOptionsDirective, i1$1.TuiDropdownDriverDirective, i1$1.TuiDropdownDirective, i1$1.TuiDropdownComponent, i1$1.TuiDropdownOpen, i1$1.TuiDropdownOpenLegacy, i1$1.TuiDropdownPortal, i1$1.TuiDropdownManual, i1$1.TuiDropdownHover, i1$1.TuiDropdownContext, i1$1.TuiDropdownPosition, i1$1.TuiDropdownPositionSided, i1$1.TuiDropdownSelection], exports: [TuiInputYearComponent,
|
|
154
|
-
TuiInputYearDirective,
|
|
155
|
-
TuiTextfieldComponent, i1$1.TuiDropdownOptionsDirective, i1$1.TuiDropdownDriverDirective, i1$1.TuiDropdownDirective, i1$1.TuiDropdownComponent, i1$1.TuiDropdownOpen, i1$1.TuiDropdownOpenLegacy, i1$1.TuiDropdownPortal, i1$1.TuiDropdownManual, i1$1.TuiDropdownHover, i1$1.TuiDropdownContext, i1$1.TuiDropdownPosition, i1$1.TuiDropdownPositionSided, i1$1.TuiDropdownSelection] }); }
|
|
156
|
-
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiInputYearModule, imports: [TuiPrimitiveTextfieldModule,
|
|
157
|
-
TuiScrollbar,
|
|
158
|
-
TuiCalendarYear,
|
|
159
|
-
TuiTextfieldControllerModule, i1$1.TuiDropdownComponent] }); }
|
|
160
|
-
}
|
|
161
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiInputYearModule, decorators: [{
|
|
162
|
-
type: NgModule,
|
|
163
|
-
args: [{
|
|
164
|
-
imports: [
|
|
165
|
-
MaskitoDirective,
|
|
166
|
-
TuiDropdownOpen,
|
|
167
|
-
TuiPrimitiveTextfieldModule,
|
|
168
|
-
TuiScrollbar,
|
|
169
|
-
TuiCalendarYear,
|
|
170
|
-
TuiTextfieldControllerModule,
|
|
171
|
-
...TuiDropdown,
|
|
172
|
-
],
|
|
173
|
-
declarations: [TuiInputYearComponent, TuiInputYearDirective],
|
|
174
|
-
exports: [
|
|
175
|
-
TuiInputYearComponent,
|
|
176
|
-
TuiInputYearDirective,
|
|
177
|
-
TuiTextfieldComponent,
|
|
178
|
-
...TuiDropdown,
|
|
179
|
-
],
|
|
180
|
-
}]
|
|
181
|
-
}] });
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Generated bundle index. Do not edit.
|
|
185
|
-
*/
|
|
186
|
-
|
|
187
|
-
export { TuiInputYearComponent, TuiInputYearDirective, TuiInputYearModule };
|
|
188
|
-
//# sourceMappingURL=taiga-ui-legacy-components-input-year.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"taiga-ui-legacy-components-input-year.mjs","sources":["../../../projects/legacy/components/input-year/input-year.component.ts","../../../projects/legacy/components/input-year/input-year.template.html","../../../projects/legacy/components/input-year/input-year.directive.ts","../../../projects/legacy/components/input-year/input-year.module.ts","../../../projects/legacy/components/input-year/taiga-ui-legacy-components-input-year.ts"],"sourcesContent":["import {\n ChangeDetectionStrategy,\n Component,\n inject,\n Input,\n ViewChild,\n} from '@angular/core';\nimport {type MaskitoOptions} from '@maskito/core';\nimport {maskitoNumberOptionsGenerator} from '@maskito/kit';\nimport {TUI_FALSE_HANDLER} from '@taiga-ui/cdk/constants';\nimport {MAX_YEAR, MIN_YEAR} from '@taiga-ui/cdk/date-time';\nimport {type TuiBooleanHandler} from '@taiga-ui/cdk/types';\nimport {tuiPure} from '@taiga-ui/cdk/utils/miscellaneous';\nimport {type TuiSizeL, type TuiSizeS} from '@taiga-ui/core/types';\nimport {TUI_INPUT_DATE_OPTIONS, type TuiInputDateOptions} from '@taiga-ui/kit/tokens';\nimport {AbstractTuiNullableControl, tuiAsControl} from '@taiga-ui/legacy/classes';\nimport {TuiPrimitiveTextfieldComponent} from '@taiga-ui/legacy/components/primitive-textfield';\nimport {TUI_TEXTFIELD_SIZE} from '@taiga-ui/legacy/directives';\nimport {\n tuiAsFocusableItemAccessor,\n type TuiFocusableElementAccessor,\n} from '@taiga-ui/legacy/tokens';\n\nconst UP_TO_4_DIGITS_REG = /^\\d{0,4}$/;\n\n/**\n * TODO(v5): delete it\n * @deprecated use new version of {@link https://taiga-ui.dev/components/input-year TuiInputYear} (from @taiga-ui/kit) instead\n */\n@Component({\n standalone: false,\n selector: 'tui-input-year',\n templateUrl: './input-year.template.html',\n styleUrls: ['./input-year.style.less'],\n changeDetection: ChangeDetectionStrategy.OnPush,\n providers: [\n tuiAsFocusableItemAccessor(TuiInputYearComponent),\n tuiAsControl(TuiInputYearComponent),\n ],\n host: {\n '[attr.data-size]': 'size',\n },\n})\nexport class TuiInputYearComponent\n extends AbstractTuiNullableControl<number>\n implements TuiFocusableElementAccessor\n{\n @ViewChild(TuiPrimitiveTextfieldComponent)\n private readonly textfield?: TuiPrimitiveTextfieldComponent;\n\n private readonly options = inject(TUI_INPUT_DATE_OPTIONS);\n private readonly textfieldSize = inject(TUI_TEXTFIELD_SIZE);\n\n protected open = false;\n protected readonly initialItem = new Date().getFullYear();\n\n @Input()\n public min: number | null = this.options.min.year;\n\n @Input()\n public max: number | null = this.options.max.year;\n\n @Input()\n public disabledItemHandler: TuiBooleanHandler<number> = TUI_FALSE_HANDLER;\n\n public nativeValue = '';\n\n public get nativeFocusableElement(): HTMLInputElement | null {\n return this.textfield?.nativeFocusableElement || null;\n }\n\n public get focused(): boolean {\n return !!this.textfield?.focused;\n }\n\n public onValueChange(value: string): void {\n this.value = value ? Number(value) : null;\n }\n\n public override writeValue(value: number | null): void {\n super.writeValue(value);\n this.updateNativeValue(this.value);\n }\n\n protected get size(): TuiSizeL | TuiSizeS {\n return this.textfieldSize.size;\n }\n\n protected get calendarIcon(): TuiInputDateOptions['icon'] {\n return this.options.icon;\n }\n\n @tuiPure\n protected getMaskOptions(min: number | null, max: number | null): MaskitoOptions {\n return {\n ...maskitoNumberOptionsGenerator({\n min: min ?? MIN_YEAR,\n max: max ?? MAX_YEAR,\n thousandSeparator: '',\n }),\n mask: UP_TO_4_DIGITS_REG,\n };\n }\n\n protected onYearClick(year: number): void {\n this.value = year;\n this.updateNativeValue(year);\n this.onOpenChange(false);\n }\n\n protected onFocused(focused: boolean): void {\n this.updateFocused(focused);\n }\n\n protected onOpenChange(open: boolean): void {\n this.open = open;\n }\n\n protected toggle(): void {\n this.open = !this.open;\n }\n\n private updateNativeValue(value: number | null): void {\n this.nativeValue = value?.toString() || '';\n }\n}\n","<tui-primitive-textfield\n class=\"t-textfield\"\n [disabled]=\"computedDisabled\"\n [invalid]=\"computedInvalid\"\n [maskito]=\"getMaskOptions(min, max)\"\n [nativeId]=\"nativeId\"\n [pseudoFocus]=\"pseudoFocus\"\n [pseudoHover]=\"pseudoHover\"\n [readOnly]=\"readOnly\"\n [tuiDropdown]=\"dropdown\"\n [tuiDropdownEnabled]=\"interactive\"\n [tuiDropdownOpen]=\"open && interactive\"\n [tuiTextfieldIcon]=\"calendarIcon\"\n [(value)]=\"nativeValue\"\n (click)=\"toggle()\"\n (focusedChange)=\"onFocused($event)\"\n (tuiDropdownOpenChange)=\"onOpenChange($event)\"\n (valueChange)=\"onValueChange($event)\"\n>\n <ng-content />\n <ng-content\n ngProjectAs=\"input\"\n select=\"input\"\n />\n</tui-primitive-textfield>\n\n<ng-template #dropdown>\n <tui-scrollbar>\n <tui-calendar-year\n [disabledItemHandler]=\"disabledItemHandler\"\n [initialItem]=\"value || initialItem\"\n [max]=\"max\"\n [min]=\"min\"\n [value]=\"value === null ? null : value\"\n (mousedown.prevent.zoneless)=\"(0)\"\n (yearClick)=\"onYearClick($event)\"\n />\n </tui-scrollbar>\n</ng-template>\n","import {Directive} from '@angular/core';\nimport {AbstractTuiTextfieldHost} from '@taiga-ui/legacy/classes';\nimport {tuiAsTextfieldHost} from '@taiga-ui/legacy/tokens';\n\nimport {type TuiInputYearComponent} from './input-year.component';\n\n/**\n * TODO(v5): delete it\n * @deprecated use new version of {@link https://taiga-ui.dev/components/input-year TuiInputYear} (from @taiga-ui/kit) instead\n */\n@Directive({\n standalone: false,\n selector: 'tui-input-year',\n providers: [tuiAsTextfieldHost(TuiInputYearDirective)],\n})\nexport class TuiInputYearDirective extends AbstractTuiTextfieldHost<TuiInputYearComponent> {\n public override get value(): string {\n return this.host.nativeValue;\n }\n\n public onValueChange(value: string): void {\n this.host.onValueChange(value);\n this.host.nativeValue = value;\n }\n\n public override process(input: HTMLInputElement): void {\n input.inputMode = 'numeric';\n }\n}\n","import {NgModule} from '@angular/core';\nimport {MaskitoDirective} from '@maskito/angular';\nimport {TuiCalendarYear} from '@taiga-ui/core/components/calendar';\nimport {TuiScrollbar} from '@taiga-ui/core/components/scrollbar';\nimport {TuiDropdown, TuiDropdownOpen} from '@taiga-ui/core/directives/dropdown';\nimport {\n TuiPrimitiveTextfieldModule,\n TuiTextfieldComponent,\n} from '@taiga-ui/legacy/components/primitive-textfield';\nimport {TuiTextfieldControllerModule} from '@taiga-ui/legacy/directives';\n\nimport {TuiInputYearComponent} from './input-year.component';\nimport {TuiInputYearDirective} from './input-year.directive';\n\n/**\n * TODO(v5): delete it\n * @deprecated use new version of {@link https://taiga-ui.dev/components/input-year TuiInputYear} (from @taiga-ui/kit) instead\n */\n@NgModule({\n imports: [\n MaskitoDirective,\n TuiDropdownOpen,\n TuiPrimitiveTextfieldModule,\n TuiScrollbar,\n TuiCalendarYear,\n TuiTextfieldControllerModule,\n ...TuiDropdown,\n ],\n declarations: [TuiInputYearComponent, TuiInputYearDirective],\n exports: [\n TuiInputYearComponent,\n TuiInputYearDirective,\n TuiTextfieldComponent,\n ...TuiDropdown,\n ],\n})\nexport class TuiInputYearModule {}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i2","i1"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAM,kBAAkB,GAAG,WAAW;AAEtC;;;AAGG;AAeG,MAAO,qBACT,SAAQ,0BAAkC,CAAA;AAf9C,IAAA,WAAA,GAAA;;AAqBqB,QAAA,IAAA,CAAA,OAAO,GAAG,MAAM,CAAC,sBAAsB,CAAC;AACxC,QAAA,IAAA,CAAA,aAAa,GAAG,MAAM,CAAC,kBAAkB,CAAC;QAEjD,IAAI,CAAA,IAAA,GAAG,KAAK;AACH,QAAA,IAAA,CAAA,WAAW,GAAG,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAGlD,IAAG,CAAA,GAAA,GAAkB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI;QAG1C,IAAG,CAAA,GAAA,GAAkB,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI;QAG1C,IAAmB,CAAA,mBAAA,GAA8B,iBAAiB;QAElE,IAAW,CAAA,WAAA,GAAG,EAAE;AA4D1B;AA1DG,IAAA,IAAW,sBAAsB,GAAA;AAC7B,QAAA,OAAO,IAAI,CAAC,SAAS,EAAE,sBAAsB,IAAI,IAAI;;AAGzD,IAAA,IAAW,OAAO,GAAA;AACd,QAAA,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO;;AAG7B,IAAA,aAAa,CAAC,KAAa,EAAA;AA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CAAA;kBAlB9B,QAAQ;AAAC,YAAA,IAAA,EAAA,CAAA;AACN,oBAAA,OAAO,EAAE;wBACL,gBAAgB;wBAChB,eAAe;wBACf,2BAA2B;wBAC3B,YAAY;wBACZ,eAAe;wBACf,4BAA4B;AAC5B,wBAAA,GAAG,WAAW;AACjB,qBAAA;AACD,oBAAA,YAAY,EAAE,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;AAC5D,oBAAA,OAAO,EAAE;wBACL,qBAAqB;wBACrB,qBAAqB;wBACrB,qBAAqB;AACrB,wBAAA,GAAG,WAAW;AACjB,qBAAA;AACJ,iBAAA;;;ACnCD;;AAEG;;;;"}
|
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
import { tuiIsString, tuiPure } from '@taiga-ui/cdk/utils/miscellaneous';
|
|
2
|
-
import { __decorate } from 'tslib';
|
|
3
|
-
import { DOCUMENT, AsyncPipe } from '@angular/common';
|
|
4
|
-
import * as i0 from '@angular/core';
|
|
5
|
-
import { inject, SecurityContext, Injectable, InjectionToken, SkipSelf, Optional, Input, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
6
|
-
import { DomSanitizer } from '@angular/platform-browser';
|
|
7
|
-
import { WA_WINDOW } from '@ng-web-apis/common';
|
|
8
|
-
import { TUI_BASE_HREF } from '@taiga-ui/cdk/tokens';
|
|
9
|
-
import { tuiInjectElement, tuiGetDocumentOrShadowRoot } from '@taiga-ui/cdk/utils/dom';
|
|
10
|
-
import { TuiStaticRequestService } from '@taiga-ui/legacy/services';
|
|
11
|
-
import { TUI_SANITIZER, TUI_ICON_STARTS } from '@taiga-ui/legacy/tokens';
|
|
12
|
-
import { tuiProcessIcon, tuiIconsPathFactory, TUI_CACHE_BUSTING_PAYLOAD, tuiIsPresumedHTMLString } from '@taiga-ui/legacy/utils';
|
|
13
|
-
import { BehaviorSubject, identity, ReplaySubject, switchMap, of, startWith, catchError, map } from 'rxjs';
|
|
14
|
-
|
|
15
|
-
function makeRandomSalt() {
|
|
16
|
-
return Math.floor(Math.random() * Date.now());
|
|
17
|
-
}
|
|
18
|
-
function extractLinearGradientIdsFromSvg(svg) {
|
|
19
|
-
const ids = (svg.match(/url\(("?)('*)#(.*?)('*)\)/g) ?? []).map((url) => url.slice(4, url.length - 1).replaceAll(/['"#]+/g, ''));
|
|
20
|
-
return Array.from(new Set(ids));
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
24
|
-
* https://taiga-ui.dev/components/icon
|
|
25
|
-
*
|
|
26
|
-
* @description:
|
|
27
|
-
* Any ‘linearGradient’ attributes which are defined on the referenced
|
|
28
|
-
* element which are not defined on this element are inherited by this element.
|
|
29
|
-
* If this element has no defined gradient stops, and the referenced element does
|
|
30
|
-
* (possibly due to its own ‘xlink:href’ attribute), then this element inherits
|
|
31
|
-
* the gradient stop from the referenced element. Inheritance can be indirect
|
|
32
|
-
* to an arbitrary level; thus, if the referenced element inherits attribute
|
|
33
|
-
* or gradient stops due to its own ‘xlink:href’ attribute, then the current
|
|
34
|
-
* element can inherit those attributes or gradient stops.
|
|
35
|
-
*
|
|
36
|
-
* Documentation: https://www.w3.org/TR/SVG11/pservers.html
|
|
37
|
-
*
|
|
38
|
-
*/
|
|
39
|
-
function tuiSvgLinearGradientProcessor(svg, salt = makeRandomSalt()) {
|
|
40
|
-
if (tuiIsString(svg)) {
|
|
41
|
-
const uniqueIds = extractLinearGradientIdsFromSvg(svg);
|
|
42
|
-
return uniqueIds.reduce((newSvg, previousId) => {
|
|
43
|
-
const newId = `id_${salt}_${previousId}`;
|
|
44
|
-
return newSvg
|
|
45
|
-
.replaceAll(`"${previousId}"`, `"${newId}"`)
|
|
46
|
-
.replaceAll(`'${previousId}'`, `'${newId}'`)
|
|
47
|
-
.replaceAll(`url('#${previousId}')`, `url('#${newId}')`)
|
|
48
|
-
.replaceAll(`url("#${previousId}")`, `url("#${newId}")`)
|
|
49
|
-
.replaceAll(`url(#${previousId})`, `url(#${newId})`);
|
|
50
|
-
}, svg);
|
|
51
|
-
}
|
|
52
|
-
return svg;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/**
|
|
56
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
57
|
-
* https://taiga-ui.dev/components/icon
|
|
58
|
-
*/
|
|
59
|
-
const TUI_DEPRECATED_ICONS = {
|
|
60
|
-
tuiIconAttach: 'tuiIconPaperclip',
|
|
61
|
-
tuiIconAttention: 'tuiIconAlertCircle',
|
|
62
|
-
tuiIconBackCircle: 'tuiIconArrowLeftCircle',
|
|
63
|
-
tuiIconCall: 'tuiIconPhone',
|
|
64
|
-
tuiIconCallIn: 'tuiIconPhoneIncoming',
|
|
65
|
-
tuiIconCallOut: 'tuiIconPhoneOutgoing',
|
|
66
|
-
tuiIconCallTransfer: 'tuiIconPhoneForwarded',
|
|
67
|
-
tuiIconCancel: 'tuiIconXCircle',
|
|
68
|
-
tuiIconCancelCircle: 'tuiIconSlash',
|
|
69
|
-
tuiIconCard: 'tuiIconCreditCard',
|
|
70
|
-
tuiIconCards: 'tuiIconCreditCard',
|
|
71
|
-
tuiIconChartBar: 'tuiIconBarChart',
|
|
72
|
-
tuiIconChart: 'tuiIconBarChart',
|
|
73
|
-
tuiIconCheckList: 'tuiIconClipboard',
|
|
74
|
-
tuiIconCloseCircle: 'tuiIconXCircle',
|
|
75
|
-
tuiIconCollapse: 'tuiIconMinimize',
|
|
76
|
-
tuiIconComment: 'tuiIconMessageSquare',
|
|
77
|
-
tuiIconCommentFw: 'tuiIconMessageForward',
|
|
78
|
-
tuiIconCompany: 'tuiIconBriefcase',
|
|
79
|
-
tuiIconDefaultDoc: 'tuiIconFile',
|
|
80
|
-
tuiIconDesktop: 'tuiIconMonitor',
|
|
81
|
-
tuiIconDesktopOff: 'tuiIconMonitorOff',
|
|
82
|
-
tuiIconDislike: 'tuiIconThumbsDown',
|
|
83
|
-
tuiIconDone: 'tuiIconCheckCircle',
|
|
84
|
-
tuiIconDraft: 'tuiIconEdit2',
|
|
85
|
-
tuiIconEyeOpen: 'tuiIconEye',
|
|
86
|
-
tuiIconEyeClosed: 'tuiIconEyeOff',
|
|
87
|
-
tuiIconExpand: 'tuiIconMaximize',
|
|
88
|
-
tuiIconExternal: 'tuiIconExternalLink',
|
|
89
|
-
tuiIconFrame: 'tuiIconLayout',
|
|
90
|
-
tuiIconGeo: 'tuiIconMapPin',
|
|
91
|
-
tuiIconHeartFilled: 'tuiIconHeart',
|
|
92
|
-
tuiIconHide: 'tuiIconEyeOff',
|
|
93
|
-
tuiIconImg: 'tuiIconImage',
|
|
94
|
-
tuiIconInfoCircle: 'tuiIconInfo',
|
|
95
|
-
tuiIconLike: 'tuiIconThumbsUp',
|
|
96
|
-
tuiIconLockOpen: 'tuiIconUnlock',
|
|
97
|
-
tuiIconMobile: 'tuiIconSmartphone',
|
|
98
|
-
tuiIconMoreHor: 'tuiIconMoreHorizontal',
|
|
99
|
-
tuiIconMoreVer: 'tuiIconMoreVertical',
|
|
100
|
-
tuiIconMoreVert: 'tuiIconMoreVertical',
|
|
101
|
-
tuiIconPicture: 'tuiIconImage',
|
|
102
|
-
tuiIconPin: 'tuiIconMapPin',
|
|
103
|
-
tuiIconPrint: 'tuiIconPrinter',
|
|
104
|
-
tuiIconRefresh: 'tuiIconRefreshCw',
|
|
105
|
-
tuiIconRemove: 'tuiIconX',
|
|
106
|
-
tuiIconShow: 'tuiIconEye',
|
|
107
|
-
tuiIconSound: 'tuiIconVolume',
|
|
108
|
-
tuiIconSoundOff: 'tuiIconVolumeX',
|
|
109
|
-
tuiIconStarFilled: 'tuiIconStar',
|
|
110
|
-
tuiIconStop: 'tuiIconSquare',
|
|
111
|
-
tuiIconStructure: 'tuiIconLayoutGrid',
|
|
112
|
-
tuiIconTime: 'tuiIconClock',
|
|
113
|
-
tuiIconTooltip: 'tuiIconHelpCircle',
|
|
114
|
-
tuiIconViewList: 'tuiIconList',
|
|
115
|
-
tuiIconWifiOn: 'tuiIconWifi',
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
/// <reference types="@taiga-ui/tsconfig/ng-dev-mode" />
|
|
119
|
-
/**
|
|
120
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
121
|
-
* Service for reusing SVGs without inlining each instance
|
|
122
|
-
*/
|
|
123
|
-
class TuiSvgService {
|
|
124
|
-
constructor() {
|
|
125
|
-
this.tuiSanitizer = inject(TUI_SANITIZER, { optional: true });
|
|
126
|
-
this.sanitizer = inject(DomSanitizer);
|
|
127
|
-
this.originals = {};
|
|
128
|
-
this.items$ = new BehaviorSubject(new Map());
|
|
129
|
-
this.define(inject(TUI_ICON_STARTS));
|
|
130
|
-
}
|
|
131
|
-
define(icons) {
|
|
132
|
-
const { value } = this.items$;
|
|
133
|
-
Object.keys(icons).forEach((key) => {
|
|
134
|
-
this.defineIcon(key, icons[key] ?? '', value);
|
|
135
|
-
});
|
|
136
|
-
this.items$.next(value);
|
|
137
|
-
}
|
|
138
|
-
getOriginal(name) {
|
|
139
|
-
return this.originals[name] || null;
|
|
140
|
-
}
|
|
141
|
-
defineIcon(name, src, map) {
|
|
142
|
-
if (map.has(name)) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const parsed = this.parseSrc(name, src);
|
|
146
|
-
if (!parsed) {
|
|
147
|
-
ngDevMode && console.assert(false, 'Unable to parse given SVG src');
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
map.set(name, parsed);
|
|
151
|
-
this.originals = {
|
|
152
|
-
...this.originals,
|
|
153
|
-
[name]: src,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
parseSrc(name, src) {
|
|
157
|
-
return this.sanitize(tuiProcessIcon(src, name));
|
|
158
|
-
}
|
|
159
|
-
sanitize(src) {
|
|
160
|
-
return this.sanitizer.bypassSecurityTrustHtml((this.tuiSanitizer
|
|
161
|
-
? this.tuiSanitizer.sanitize(SecurityContext.HTML, src)
|
|
162
|
-
: this.sanitizer.sanitize(SecurityContext.HTML, src)) || '');
|
|
163
|
-
}
|
|
164
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiSvgService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
|
165
|
-
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiSvgService, providedIn: 'root' }); }
|
|
166
|
-
}
|
|
167
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiSvgService, decorators: [{
|
|
168
|
-
type: Injectable,
|
|
169
|
-
args: [{
|
|
170
|
-
providedIn: 'root',
|
|
171
|
-
}]
|
|
172
|
-
}], ctorParameters: () => [] });
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
176
|
-
* https://taiga-ui.dev/components/icon
|
|
177
|
-
*/
|
|
178
|
-
const TUI_DEFAULT_ICONS_PLACE = 'assets/taiga-ui/icons';
|
|
179
|
-
/**
|
|
180
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
181
|
-
* https://taiga-ui.dev/components/icon
|
|
182
|
-
*/
|
|
183
|
-
const TUI_SVG_DEFAULT_OPTIONS = {
|
|
184
|
-
iconsPlace: TUI_DEFAULT_ICONS_PLACE,
|
|
185
|
-
path: tuiIconsPathFactory(TUI_DEFAULT_ICONS_PLACE),
|
|
186
|
-
srcProcessor: identity,
|
|
187
|
-
contentProcessor: tuiSvgLinearGradientProcessor,
|
|
188
|
-
deprecated: (src) => {
|
|
189
|
-
const oldIcon = src.replace('Large', '').replace('Outline', '');
|
|
190
|
-
const newIcon = TUI_DEPRECATED_ICONS[oldIcon];
|
|
191
|
-
return newIcon
|
|
192
|
-
? `${oldIcon}/(Large|Outline) is deprecated, use ${newIcon}/(Large|Outline) instead`
|
|
193
|
-
: '';
|
|
194
|
-
},
|
|
195
|
-
};
|
|
196
|
-
/**
|
|
197
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
198
|
-
* https://taiga-ui.dev/components/icon
|
|
199
|
-
*/
|
|
200
|
-
const TUI_SVG_OPTIONS = new InjectionToken(ngDevMode ? 'TUI_SVG_OPTIONS' : '', {
|
|
201
|
-
factory: () => ({
|
|
202
|
-
iconsPlace: TUI_DEFAULT_ICONS_PLACE,
|
|
203
|
-
path: tuiIconsPathFactory(TUI_DEFAULT_ICONS_PLACE),
|
|
204
|
-
deprecated: TUI_SVG_DEFAULT_OPTIONS.deprecated,
|
|
205
|
-
srcProcessor: identity,
|
|
206
|
-
contentProcessor: tuiSvgLinearGradientProcessor,
|
|
207
|
-
}),
|
|
208
|
-
});
|
|
209
|
-
/**
|
|
210
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
211
|
-
* https://taiga-ui.dev/components/icon
|
|
212
|
-
*/
|
|
213
|
-
const TUI_SVG_SRC_INTERCEPTORS = new InjectionToken(ngDevMode ? 'TUI_SVG_SRC_INTERCEPTORS' : '');
|
|
214
|
-
/**
|
|
215
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
216
|
-
* https://taiga-ui.dev/components/icon
|
|
217
|
-
*/
|
|
218
|
-
function tuiSvgSrcInterceptors(interceptor) {
|
|
219
|
-
return {
|
|
220
|
-
provide: TUI_SVG_SRC_INTERCEPTORS,
|
|
221
|
-
useValue: interceptor,
|
|
222
|
-
multi: true,
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
227
|
-
* https://taiga-ui.dev/components/icon
|
|
228
|
-
*/
|
|
229
|
-
const tuiSvgOptionsProvider = (options) => ({
|
|
230
|
-
provide: TUI_SVG_OPTIONS,
|
|
231
|
-
deps: [[new SkipSelf(), new Optional(), TUI_SVG_OPTIONS]],
|
|
232
|
-
useFactory: (fallback) => ({
|
|
233
|
-
iconsPlace: options.iconsPlace ??
|
|
234
|
-
fallback?.iconsPlace ??
|
|
235
|
-
TUI_SVG_DEFAULT_OPTIONS.iconsPlace,
|
|
236
|
-
path: tuiIsString(options.path)
|
|
237
|
-
? tuiIconsPathFactory(options.path)
|
|
238
|
-
: (options.path ?? fallback?.path ?? TUI_SVG_DEFAULT_OPTIONS.path),
|
|
239
|
-
deprecated: options.deprecated ??
|
|
240
|
-
fallback?.deprecated ??
|
|
241
|
-
TUI_SVG_DEFAULT_OPTIONS.deprecated,
|
|
242
|
-
srcProcessor: options.srcProcessor ??
|
|
243
|
-
fallback?.srcProcessor ??
|
|
244
|
-
TUI_SVG_DEFAULT_OPTIONS.srcProcessor,
|
|
245
|
-
contentProcessor: options.contentProcessor ??
|
|
246
|
-
fallback?.contentProcessor ??
|
|
247
|
-
TUI_SVG_DEFAULT_OPTIONS.contentProcessor,
|
|
248
|
-
}),
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
const UNDEFINED_NAMED_ICON = 'Attempted to use undefined named icon';
|
|
252
|
-
const MISSING_EXTERNAL_ICON = 'External icon is missing on the given URL';
|
|
253
|
-
const FAILED_EXTERNAL_ICON = 'Failed to load external SVG';
|
|
254
|
-
/**
|
|
255
|
-
* @deprecated: drop in v5.0 use {@link TuiIcon}
|
|
256
|
-
* https://taiga-ui.dev/components/icon
|
|
257
|
-
*/
|
|
258
|
-
class TuiSvgComponent {
|
|
259
|
-
constructor() {
|
|
260
|
-
this.icon = '';
|
|
261
|
-
this.doc = inject(DOCUMENT);
|
|
262
|
-
this.win = inject(WA_WINDOW);
|
|
263
|
-
this.options = inject(TUI_SVG_OPTIONS);
|
|
264
|
-
this.tuiSanitizer = inject(TUI_SANITIZER, { optional: true });
|
|
265
|
-
this.svgService = inject(TuiSvgService);
|
|
266
|
-
this.staticRequestService = inject(TuiStaticRequestService);
|
|
267
|
-
this.sanitizer = inject(DomSanitizer);
|
|
268
|
-
this.el = tuiInjectElement();
|
|
269
|
-
this.baseHref = inject(TUI_BASE_HREF);
|
|
270
|
-
this.src$ = new ReplaySubject(1);
|
|
271
|
-
this.srcInterceptors = inject(TUI_SVG_SRC_INTERCEPTORS, {
|
|
272
|
-
optional: true,
|
|
273
|
-
});
|
|
274
|
-
this.innerHTML$ = this.src$.pipe(switchMap(() => {
|
|
275
|
-
if (tuiIsString(this.icon)) {
|
|
276
|
-
return this.isExternal
|
|
277
|
-
? this.getExternalIcon(this.icon)
|
|
278
|
-
: of(this.getSafeHtml(this.icon));
|
|
279
|
-
}
|
|
280
|
-
return of(this.icon);
|
|
281
|
-
}), startWith(''));
|
|
282
|
-
}
|
|
283
|
-
set src(src) {
|
|
284
|
-
const deprecated = this.options.deprecated(String(src));
|
|
285
|
-
ngDevMode && console.assert(!deprecated, deprecated);
|
|
286
|
-
this.icon = (this.srcInterceptors ?? []).reduce((newSrc, interceptor) => interceptor(newSrc, this.options), this.options.srcProcessor(src || ''));
|
|
287
|
-
this.src$.next();
|
|
288
|
-
}
|
|
289
|
-
get src() {
|
|
290
|
-
return this.icon;
|
|
291
|
-
}
|
|
292
|
-
get use() {
|
|
293
|
-
if (tuiIsString(this.icon)) {
|
|
294
|
-
return this.icon.includes('.svg#')
|
|
295
|
-
? this.icon
|
|
296
|
-
: this.resolveName(this.icon, this.options.path);
|
|
297
|
-
}
|
|
298
|
-
return '';
|
|
299
|
-
}
|
|
300
|
-
get isInnerHTML() {
|
|
301
|
-
return (!tuiIsString(this.icon) ||
|
|
302
|
-
this.isSrc ||
|
|
303
|
-
this.isExternal ||
|
|
304
|
-
(this.isName && this.isShadowDOM));
|
|
305
|
-
}
|
|
306
|
-
onError(message = MISSING_EXTERNAL_ICON) {
|
|
307
|
-
const { icon } = this;
|
|
308
|
-
const event = new CustomEvent('tui-icon-error', {
|
|
309
|
-
bubbles: true,
|
|
310
|
-
detail: {
|
|
311
|
-
message,
|
|
312
|
-
icon: icon,
|
|
313
|
-
},
|
|
314
|
-
});
|
|
315
|
-
ngDevMode && console.assert(false, message, icon);
|
|
316
|
-
this.el.dispatchEvent(event);
|
|
317
|
-
}
|
|
318
|
-
get isShadowDOM() {
|
|
319
|
-
return tuiGetDocumentOrShadowRoot(this.el) !== this.doc;
|
|
320
|
-
}
|
|
321
|
-
get isUse() {
|
|
322
|
-
return this.use.replace(TUI_CACHE_BUSTING_PAYLOAD, '').includes('.svg#');
|
|
323
|
-
}
|
|
324
|
-
get isExternal() {
|
|
325
|
-
return (this.isUrl ||
|
|
326
|
-
this.isCrossDomain ||
|
|
327
|
-
(!this.isSrc && !this.svgService.getOriginal(String(this.icon))));
|
|
328
|
-
}
|
|
329
|
-
get isUrl() {
|
|
330
|
-
return (tuiIsString(this.icon) &&
|
|
331
|
-
this.icon.replace(TUI_CACHE_BUSTING_PAYLOAD, '').endsWith('.svg'));
|
|
332
|
-
}
|
|
333
|
-
get isSrc() {
|
|
334
|
-
return tuiIsString(this.icon) && tuiIsPresumedHTMLString(this.icon);
|
|
335
|
-
}
|
|
336
|
-
get isName() {
|
|
337
|
-
return !this.isUrl && !this.isUse && !this.isSrc;
|
|
338
|
-
}
|
|
339
|
-
get isCrossDomain() {
|
|
340
|
-
const { use, isUse, win } = this;
|
|
341
|
-
return (isUse && use.startsWith('http') && !!win.origin && !use.startsWith(win.origin));
|
|
342
|
-
}
|
|
343
|
-
resolveName(name, iconsPath) {
|
|
344
|
-
return iconsPath(name, this.baseHref);
|
|
345
|
-
}
|
|
346
|
-
getSafeHtml(src) {
|
|
347
|
-
return this.isSrc ? this.sanitize(src) : this.process(src);
|
|
348
|
-
}
|
|
349
|
-
process(src) {
|
|
350
|
-
const icon = this.svgService.getOriginal(src);
|
|
351
|
-
if (this.isName && !icon && !!src) {
|
|
352
|
-
this.onError(UNDEFINED_NAMED_ICON);
|
|
353
|
-
}
|
|
354
|
-
return this.sanitize(icon || '');
|
|
355
|
-
}
|
|
356
|
-
sanitize(src) {
|
|
357
|
-
src = this.options.contentProcessor(src);
|
|
358
|
-
return this.tuiSanitizer && tuiIsString(src)
|
|
359
|
-
? this.sanitizer.bypassSecurityTrustHtml(this.tuiSanitizer.sanitize(SecurityContext.HTML, src) || '')
|
|
360
|
-
: src;
|
|
361
|
-
}
|
|
362
|
-
getExternalIcon(src) {
|
|
363
|
-
const url = src.includes('.svg') ? src : this.use;
|
|
364
|
-
return this.staticRequestService.request(url).pipe(catchError(() => {
|
|
365
|
-
this.onError(FAILED_EXTERNAL_ICON);
|
|
366
|
-
return of('');
|
|
367
|
-
}), map((response) => this.sanitize(response.replace('<svg', '<svg focusable="false"'))));
|
|
368
|
-
}
|
|
369
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiSvgComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
|
370
|
-
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.15", type: TuiSvgComponent, isStandalone: true, selector: "tui-svg", inputs: { src: "src" }, ngImport: i0, template: "<div\n class=\"t-src\"\n [innerHTML]=\"innerHTML$ | async\"\n></div>\n", styles: [":host{display:inline-flex;vertical-align:middle;flex-shrink:0;align-items:center;justify-content:center;line-height:0;block-size:1.5rem;inline-size:1.5rem;fill:transparent;stroke:transparent;font-size:1rem}.t-src{display:flex;inline-size:100%;block-size:100%;align-items:center;justify-content:center}.t-svg{overflow:visible}\n"], dependencies: [{ kind: "pipe", type: AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
|
371
|
-
}
|
|
372
|
-
__decorate([
|
|
373
|
-
tuiPure
|
|
374
|
-
], TuiSvgComponent.prototype, "resolveName", null);
|
|
375
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: TuiSvgComponent, decorators: [{
|
|
376
|
-
type: Component,
|
|
377
|
-
args: [{ selector: 'tui-svg', imports: [AsyncPipe], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n class=\"t-src\"\n [innerHTML]=\"innerHTML$ | async\"\n></div>\n", styles: [":host{display:inline-flex;vertical-align:middle;flex-shrink:0;align-items:center;justify-content:center;line-height:0;block-size:1.5rem;inline-size:1.5rem;fill:transparent;stroke:transparent;font-size:1rem}.t-src{display:flex;inline-size:100%;block-size:100%;align-items:center;justify-content:center}.t-svg{overflow:visible}\n"] }]
|
|
378
|
-
}], propDecorators: { src: [{
|
|
379
|
-
type: Input
|
|
380
|
-
}], resolveName: [] } });
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* Generated bundle index. Do not edit.
|
|
384
|
-
*/
|
|
385
|
-
|
|
386
|
-
export { TUI_DEFAULT_ICONS_PLACE, TUI_DEPRECATED_ICONS, TUI_SVG_DEFAULT_OPTIONS, TUI_SVG_OPTIONS, TUI_SVG_SRC_INTERCEPTORS, TuiSvgComponent, TuiSvgService, tuiSvgLinearGradientProcessor, tuiSvgOptionsProvider, tuiSvgSrcInterceptors };
|
|
387
|
-
//# sourceMappingURL=taiga-ui-legacy-components-svg.mjs.map
|