@snabcentr/client-ui 1.6.1 → 1.6.3
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.
Potentially problematic release.
This version of @snabcentr/client-ui might be problematic. Click here for more details.
- package/esm2020/form-fields/suggestion-field/sc-suggestion-field.component.mjs +16 -7
- package/esm2020/qrcode/qrcode-dialog/sc-qrcode-dialog.component.mjs +12 -5
- package/fesm2015/snabcentr-client-ui.mjs +26 -11
- package/fesm2015/snabcentr-client-ui.mjs.map +1 -1
- package/fesm2020/snabcentr-client-ui.mjs +25 -10
- package/fesm2020/snabcentr-client-ui.mjs.map +1 -1
- package/form-fields/suggestion-field/sc-suggestion-field.component.d.ts +4 -0
- package/package.json +1 -1
- package/qrcode/qrcode-dialog/sc-qrcode-dialog.component.d.ts +4 -0
- package/styles/tailwind/tailwind.scss +1 -1
@@ -1,5 +1,5 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { EventEmitter, Component, ChangeDetectionStrategy, Inject, Input, Output, SkipSelf, Directive, HostBinding, ContentChild, ViewChild, NgModule, ContentChildren, HostListener, Injectable,
|
2
|
+
import { EventEmitter, Component, ChangeDetectionStrategy, Inject, Input, Output, SkipSelf, inject, Directive, HostBinding, ContentChild, ViewChild, NgModule, ContentChildren, HostListener, Injectable, ElementRef, Optional, ChangeDetectorRef, Self, InjectionToken, forwardRef } from '@angular/core';
|
3
3
|
import * as i1 from '@snabcentr/client-core';
|
4
4
|
import { ScUserMetrikaGoalsEnum, ScISuggestionType, ScOpfList, ScWarehouseService, ScAuthService, SEARCH_TERM, ScImageHelper, SC_PATH_IMAGE_NOT_FOUND, IS_RUNNING_ON_TERMINAL, SC_URLS, TERMINAL_PROVIDERS, SEARCH_TERM_PROVIDERS, ScCatalogService, ScCartService, ScIconTypesEnum, ScUserService } from '@snabcentr/client-core';
|
5
5
|
import * as i5 from 'rxjs';
|
@@ -7,7 +7,7 @@ import { Subject, map, filter, switchMap, tap, catchError, of, finalize, startWi
|
|
7
7
|
import * as i2 from '@angular/common';
|
8
8
|
import { CommonModule } from '@angular/common';
|
9
9
|
import * as i4 from '@taiga-ui/core';
|
10
|
-
import { TuiButtonModule, TuiModeModule, TuiDialogModule, TuiDialogService, TuiTextfieldControllerModule, TuiLabelModule, TuiErrorModule, TuiDataListModule, TuiLoaderModule, TuiNotificationModule, TuiLinkModule, TuiFormatPhonePipeModule, tuiFadeIn, TUI_MONTHS, TuiSvgModule, TuiHintModule, TuiFormatNumberPipeModule } from '@taiga-ui/core';
|
10
|
+
import { TUI_DATA_LIST_HOST, TuiButtonModule, TuiModeModule, TuiDialogModule, TuiDialogService, TuiTextfieldControllerModule, TuiLabelModule, TuiErrorModule, TuiDataListModule, TuiLoaderModule, TuiNotificationModule, TuiLinkModule, TuiFormatPhonePipeModule, tuiFadeIn, TUI_MONTHS, TuiSvgModule, TuiHintModule, TuiFormatNumberPipeModule } from '@taiga-ui/core';
|
11
11
|
import { HttpErrorResponse } from '@angular/common/http';
|
12
12
|
import * as i3 from '@angular/forms';
|
13
13
|
import { FormGroupDirective, FormGroup, FormControl, Validators, NgControl, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
@@ -672,6 +672,12 @@ class ScSuggestionFieldComponent {
|
|
672
672
|
* Перечисление типов подсказок.
|
673
673
|
*/
|
674
674
|
this.suggestionType = ScISuggestionType;
|
675
|
+
/**
|
676
|
+
* Компонент обёртка выпадающего списка.
|
677
|
+
*/
|
678
|
+
this.host = inject(TUI_DATA_LIST_HOST, {
|
679
|
+
optional: true,
|
680
|
+
});
|
675
681
|
}
|
676
682
|
/** @inheritDoc */
|
677
683
|
ngOnInit() {
|
@@ -699,12 +705,12 @@ class ScSuggestionFieldComponent {
|
|
699
705
|
switch (this.type) {
|
700
706
|
case ScISuggestionType.fio:
|
701
707
|
if ('fio' in suggestion) {
|
702
|
-
this.control.control?.patchValue(suggestion.fio);
|
708
|
+
this.control.control?.patchValue(suggestion.fio, { emitEvent: false });
|
703
709
|
}
|
704
710
|
break;
|
705
711
|
case ScISuggestionType.address:
|
706
712
|
if ('addressString' in suggestion) {
|
707
|
-
this.control.control?.patchValue(suggestion.addressString);
|
713
|
+
this.control.control?.patchValue(suggestion.addressString, { emitEvent: false });
|
708
714
|
}
|
709
715
|
break;
|
710
716
|
case ScISuggestionType.bank:
|
@@ -713,7 +719,7 @@ class ScSuggestionFieldComponent {
|
|
713
719
|
bankName: suggestion.name,
|
714
720
|
bic: suggestion.bic,
|
715
721
|
correspondentAccount: suggestion.correspondentAccount,
|
716
|
-
});
|
722
|
+
}, { emitEvent: false });
|
717
723
|
}
|
718
724
|
break;
|
719
725
|
case ScISuggestionType.organization:
|
@@ -728,17 +734,19 @@ class ScSuggestionFieldComponent {
|
|
728
734
|
legalAddress: suggestion.legalAddress,
|
729
735
|
postalAddress: suggestion.postalAddress,
|
730
736
|
actualAddress: suggestion.actualAddress,
|
731
|
-
});
|
737
|
+
}, { emitEvent: false });
|
732
738
|
}
|
733
739
|
break;
|
734
740
|
case ScISuggestionType.email:
|
735
741
|
if ('email' in suggestion) {
|
736
|
-
this.control.control?.patchValue(suggestion.email);
|
742
|
+
this.control.control?.patchValue(suggestion.email, { emitEvent: false });
|
737
743
|
}
|
738
744
|
break;
|
739
745
|
default:
|
740
746
|
break;
|
741
747
|
}
|
748
|
+
// Дёргаем внутренний обработчик выбора элемента выпадающего списка.
|
749
|
+
this.host?.handleOption(this.control.value);
|
742
750
|
this.selectedClick.emit(suggestion);
|
743
751
|
}
|
744
752
|
}
|
@@ -1685,6 +1693,10 @@ class ScQRCodeDialogComponent {
|
|
1685
1693
|
this.vCardService = vCardService;
|
1686
1694
|
this.context = context;
|
1687
1695
|
this.terminal = terminal;
|
1696
|
+
/**
|
1697
|
+
* Свойство, от которого зависит наличие атрибута `data-terminal-view` у `:host` компонента.
|
1698
|
+
*/
|
1699
|
+
this.terminalView = this.terminal.isRunningOnTerminal;
|
1688
1700
|
}
|
1689
1701
|
/**
|
1690
1702
|
* Выполняет скачивание генерируемого vCard файла контакта.
|
@@ -1703,17 +1715,20 @@ class ScQRCodeDialogComponent {
|
|
1703
1715
|
}
|
1704
1716
|
}
|
1705
1717
|
ScQRCodeDialogComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScQRCodeDialogComponent, deps: [{ token: i1.ScVCardService }, { token: POLYMORPHEUS_CONTEXT }, { token: IS_RUNNING_ON_TERMINAL }], target: i0.ɵɵFactoryTarget.Component });
|
1706
|
-
ScQRCodeDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScQRCodeDialogComponent, selector: "sc-qrcode-dialog", ngImport: i0, template: "<p class=\"-mt-2 mb-3 text-tui-text-02\">{{ terminal.isRunningOnTerminal && this.isVCardData() ? '\
|
1718
|
+
ScQRCodeDialogComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScQRCodeDialogComponent, selector: "sc-qrcode-dialog", host: { properties: { "attr.data-terminal-view": "this.terminalView" } }, ngImport: i0, template: "<p class=\"-mt-2 mb-3 text-tui-text-02\">{{ !terminal.isRunningOnTerminal && this.isVCardData() ? '\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438\u043B\u0438 \u043E' : '\u041E' }}\u0442\u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0439\u0442\u0435 QR-\u043A\u043E\u0434 \u0432\u0430\u0448\u0438\u043C \u043C\u043E\u0431\u0438\u043B\u044C\u043D\u044B\u043C \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u043E\u043C.</p>\n<qrcode\n (click)=\"downloadVCard()\"\n [margin]=\"0\"\n [qrdata]=\"this.context.data.qrdata\"\n [width]=\"800\"\n elementType=\"img\"\n class=\"cursor-pointer\"\n></qrcode>\n", styles: ["::ng-deep tui-dialog:has([data-terminal-view=true]){width:21rem!important}::ng-deep tui-dialog:has([data-terminal-view=true]) .t-heading{margin-bottom:.5rem!important;font:var(--tui-font-heading-6)!important}\n"], dependencies: [{ kind: "component", type: i2$2.QRCodeComponent, selector: "qrcode", inputs: ["allowEmptyString", "colorDark", "colorLight", "cssClass", "elementType", "errorCorrectionLevel", "imageSrc", "imageHeight", "imageWidth", "margin", "qrdata", "scale", "version", "width", "alt", "ariaLabel", "title"], outputs: ["qrCodeURL"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1707
1719
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScQRCodeDialogComponent, decorators: [{
|
1708
1720
|
type: Component,
|
1709
|
-
args: [{ selector: 'sc-qrcode-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<p class=\"-mt-2 mb-3 text-tui-text-02\">{{ terminal.isRunningOnTerminal && this.isVCardData() ? '\
|
1721
|
+
args: [{ selector: 'sc-qrcode-dialog', changeDetection: ChangeDetectionStrategy.OnPush, template: "<p class=\"-mt-2 mb-3 text-tui-text-02\">{{ !terminal.isRunningOnTerminal && this.isVCardData() ? '\u041D\u0430\u0436\u043C\u0438\u0442\u0435 \u0438\u043B\u0438 \u043E' : '\u041E' }}\u0442\u0441\u043A\u0430\u043D\u0438\u0440\u0443\u0439\u0442\u0435 QR-\u043A\u043E\u0434 \u0432\u0430\u0448\u0438\u043C \u043C\u043E\u0431\u0438\u043B\u044C\u043D\u044B\u043C \u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u043E\u043C.</p>\n<qrcode\n (click)=\"downloadVCard()\"\n [margin]=\"0\"\n [qrdata]=\"this.context.data.qrdata\"\n [width]=\"800\"\n elementType=\"img\"\n class=\"cursor-pointer\"\n></qrcode>\n", styles: ["::ng-deep tui-dialog:has([data-terminal-view=true]){width:21rem!important}::ng-deep tui-dialog:has([data-terminal-view=true]) .t-heading{margin-bottom:.5rem!important;font:var(--tui-font-heading-6)!important}\n"] }]
|
1710
1722
|
}], ctorParameters: function () { return [{ type: i1.ScVCardService }, { type: undefined, decorators: [{
|
1711
1723
|
type: Inject,
|
1712
1724
|
args: [POLYMORPHEUS_CONTEXT]
|
1713
1725
|
}] }, { type: undefined, decorators: [{
|
1714
1726
|
type: Inject,
|
1715
1727
|
args: [IS_RUNNING_ON_TERMINAL]
|
1716
|
-
}] }]; }
|
1728
|
+
}] }]; }, propDecorators: { terminalView: [{
|
1729
|
+
type: HostBinding,
|
1730
|
+
args: ['attr.data-terminal-view']
|
1731
|
+
}] } });
|
1717
1732
|
|
1718
1733
|
/**
|
1719
1734
|
* Модуль QR кода.
|