@snabcentr/client-ui 0.0.0-test
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -0
- package/README.md +9 -0
- package/banner/index.d.ts +2 -0
- package/banner/sc-banner.component.d.ts +130 -0
- package/banner/sc-banner.module.d.ts +17 -0
- package/cart/cart-item-mobile/sc-cart-item-mobile.component.d.ts +77 -0
- package/cart/index.d.ts +2 -0
- package/cart/sc-cart.module.d.ts +16 -0
- package/catalog/category-card/sc-category-card.component.d.ts +68 -0
- package/catalog/index.d.ts +7 -0
- package/catalog/input-quantity/sc-input-quantity.component.d.ts +75 -0
- package/catalog/price-card/sc-price-card.component.d.ts +114 -0
- package/catalog/price-history/sc-chart-option.d.ts +7 -0
- package/catalog/price-history/sc-i-chart-data-item.d.ts +13 -0
- package/catalog/price-history/sc-lang-RU.d.ts +113 -0
- package/catalog/price-history/sc-price-history.component.d.ts +73 -0
- package/catalog/price-warehouse-stock/sc-price-warehouse-stock.component.d.ts +37 -0
- package/catalog/sc-catalog.module.d.ts +21 -0
- package/catalog/sc-favorite-btn/sc-favorite-btn.component.d.ts +13 -0
- package/esm2020/banner/index.mjs +3 -0
- package/esm2020/banner/sc-banner.component.mjs +222 -0
- package/esm2020/banner/sc-banner.module.mjs +27 -0
- package/esm2020/cart/cart-item-mobile/sc-cart-item-mobile.component.mjs +119 -0
- package/esm2020/cart/index.mjs +3 -0
- package/esm2020/cart/sc-cart.module.mjs +58 -0
- package/esm2020/catalog/category-card/sc-category-card.component.mjs +109 -0
- package/esm2020/catalog/index.mjs +8 -0
- package/esm2020/catalog/input-quantity/sc-input-quantity.component.mjs +154 -0
- package/esm2020/catalog/price-card/sc-price-card.component.mjs +154 -0
- package/esm2020/catalog/price-history/sc-chart-option.mjs +79 -0
- package/esm2020/catalog/price-history/sc-i-chart-data-item.mjs +2 -0
- package/esm2020/catalog/price-history/sc-lang-RU.mjs +113 -0
- package/esm2020/catalog/price-history/sc-price-history.component.mjs +104 -0
- package/esm2020/catalog/price-warehouse-stock/sc-price-warehouse-stock.component.mjs +44 -0
- package/esm2020/catalog/sc-catalog.module.mjs +88 -0
- package/esm2020/catalog/sc-favorite-btn/sc-favorite-btn.component.mjs +24 -0
- package/esm2020/files/directives/index.mjs +3 -0
- package/esm2020/files/directives/tree-top.directive.mjs +63 -0
- package/esm2020/files/directives/tree.directive.mjs +47 -0
- package/esm2020/files/file-tree-item/file-tree-item.component.mjs +18 -0
- package/esm2020/files/files-and-documents.component.mjs +60 -0
- package/esm2020/files/files-and-documents.module.mjs +26 -0
- package/esm2020/files/index.mjs +6 -0
- package/esm2020/files/interfaces/tree-node.mjs +2 -0
- package/esm2020/files/services/index.mjs +3 -0
- package/esm2020/files/services/tree-icon.service.mjs +48 -0
- package/esm2020/files/services/tree-loader.service.mjs +60 -0
- package/esm2020/helpers/index.mjs +2 -0
- package/esm2020/helpers/sc-px-converter.mjs +27 -0
- package/esm2020/helpers/sc-units-helper.mjs +44 -0
- package/esm2020/icons/index.mjs +2 -0
- package/esm2020/icons/sc-client-ui-icons-name.mjs +107 -0
- package/esm2020/loader/index.mjs +2 -0
- package/esm2020/loader/sc-i-loader.mjs +2 -0
- package/esm2020/news/index.mjs +4 -0
- package/esm2020/news/news-card/sc-news-card.component.mjs +31 -0
- package/esm2020/news/news-card-skeleton/sc-news-card-skeleton.component.mjs +23 -0
- package/esm2020/news/sc-news.module.mjs +24 -0
- package/esm2020/order/index.mjs +3 -0
- package/esm2020/order/order-item-mobile/order-item-mobile.component.mjs +79 -0
- package/esm2020/order/sc-order.module.mjs +23 -0
- package/esm2020/public-api.mjs +15 -0
- package/esm2020/share-button/index.mjs +3 -0
- package/esm2020/share-button/sc-share-button.component.mjs +35 -0
- package/esm2020/share-button/sc-share-button.module.mjs +22 -0
- package/esm2020/snabcentr-client-ui.mjs +5 -0
- package/esm2020/tokens/index.mjs +2 -0
- package/esm2020/tokens/sc-linear-values-token.mjs +10 -0
- package/esm2020/validators/index.mjs +2 -0
- package/esm2020/validators/stepValidator.mjs +13 -0
- package/fesm2015/snabcentr-client-ui.mjs +1929 -0
- package/fesm2015/snabcentr-client-ui.mjs.map +1 -0
- package/fesm2020/snabcentr-client-ui.mjs +1901 -0
- package/fesm2020/snabcentr-client-ui.mjs.map +1 -0
- package/files/directives/index.d.ts +2 -0
- package/files/directives/tree-top.directive.d.ts +33 -0
- package/files/directives/tree.directive.d.ts +35 -0
- package/files/file-tree-item/file-tree-item.component.d.ts +9 -0
- package/files/files-and-documents.component.d.ts +27 -0
- package/files/files-and-documents.module.d.ts +16 -0
- package/files/index.d.ts +5 -0
- package/files/interfaces/tree-node.d.ts +29 -0
- package/files/services/index.d.ts +2 -0
- package/files/services/tree-icon.service.d.ts +23 -0
- package/files/services/tree-loader.service.d.ts +43 -0
- package/helpers/index.d.ts +1 -0
- package/helpers/sc-px-converter.d.ts +15 -0
- package/helpers/sc-units-helper.d.ts +28 -0
- package/icons/index.d.ts +1 -0
- package/icons/sc-client-ui-icons-name.d.ts +5 -0
- package/icons/svg-pack/scIconAddProfile.svg +11 -0
- package/icons/svg-pack/scIconApplication.svg +11 -0
- package/icons/svg-pack/scIconArrowDown.svg +11 -0
- package/icons/svg-pack/scIconArrowDownLarge.svg +11 -0
- package/icons/svg-pack/scIconArrowDownLargeEnd.svg +12 -0
- package/icons/svg-pack/scIconArrowLeft.svg +11 -0
- package/icons/svg-pack/scIconArrowReturn.svg +11 -0
- package/icons/svg-pack/scIconArrowRight.svg +11 -0
- package/icons/svg-pack/scIconArrowUp.svg +11 -0
- package/icons/svg-pack/scIconAttention.svg +11 -0
- package/icons/svg-pack/scIconBag.svg +11 -0
- package/icons/svg-pack/scIconBasket.svg +11 -0
- package/icons/svg-pack/scIconBell.svg +11 -0
- package/icons/svg-pack/scIconBook.svg +11 -0
- package/icons/svg-pack/scIconBubble.svg +11 -0
- package/icons/svg-pack/scIconCalendar.svg +11 -0
- package/icons/svg-pack/scIconCancel.svg +18 -0
- package/icons/svg-pack/scIconCart.svg +11 -0
- package/icons/svg-pack/scIconCatalog.svg +16 -0
- package/icons/svg-pack/scIconClients.svg +11 -0
- package/icons/svg-pack/scIconClip.svg +11 -0
- package/icons/svg-pack/scIconClock.svg +11 -0
- package/icons/svg-pack/scIconConfigurator.svg +18 -0
- package/icons/svg-pack/scIconContacts.svg +11 -0
- package/icons/svg-pack/scIconCross.svg +11 -0
- package/icons/svg-pack/scIconDeleteProfile.svg +12 -0
- package/icons/svg-pack/scIconDone.svg +12 -0
- package/icons/svg-pack/scIconDownloading.svg +11 -0
- package/icons/svg-pack/scIconEdit.svg +11 -0
- package/icons/svg-pack/scIconError.svg +12 -0
- package/icons/svg-pack/scIconExcelFile.svg +11 -0
- package/icons/svg-pack/scIconEye.svg +11 -0
- package/icons/svg-pack/scIconFavorite.svg +11 -0
- package/icons/svg-pack/scIconFavoriteFill.svg +11 -0
- package/icons/svg-pack/scIconFile.svg +11 -0
- package/icons/svg-pack/scIconFilter.svg +11 -0
- package/icons/svg-pack/scIconFolder.svg +11 -0
- package/icons/svg-pack/scIconFolderOpen.svg +11 -0
- package/icons/svg-pack/scIconFolderPlus.svg +11 -0
- package/icons/svg-pack/scIconGraph.svg +11 -0
- package/icons/svg-pack/scIconHamburger.svg +13 -0
- package/icons/svg-pack/scIconHeart.svg +11 -0
- package/icons/svg-pack/scIconHeartFill.svg +11 -0
- package/icons/svg-pack/scIconHistory.svg +11 -0
- package/icons/svg-pack/scIconHome.svg +12 -0
- package/icons/svg-pack/scIconImage.svg +11 -0
- package/icons/svg-pack/scIconLike.svg +11 -0
- package/icons/svg-pack/scIconList.svg +11 -0
- package/icons/svg-pack/scIconLocation.svg +11 -0
- package/icons/svg-pack/scIconLock.svg +11 -0
- package/icons/svg-pack/scIconLockOpen.svg +11 -0
- package/icons/svg-pack/scIconLogIn.svg +11 -0
- package/icons/svg-pack/scIconLogOut.svg +13 -0
- package/icons/svg-pack/scIconLogOut2.svg +13 -0
- package/icons/svg-pack/scIconMail.svg +11 -0
- package/icons/svg-pack/scIconMinus.svg +11 -0
- package/icons/svg-pack/scIconMoney.svg +11 -0
- package/icons/svg-pack/scIconMoney2.svg +11 -0
- package/icons/svg-pack/scIconNews.svg +11 -0
- package/icons/svg-pack/scIconOffer.svg +11 -0
- package/icons/svg-pack/scIconPalette.svg +18 -0
- package/icons/svg-pack/scIconPdfFile.svg +12 -0
- package/icons/svg-pack/scIconPercentage.svg +11 -0
- package/icons/svg-pack/scIconPhone.svg +11 -0
- package/icons/svg-pack/scIconPlus.svg +11 -0
- package/icons/svg-pack/scIconPrice.svg +11 -0
- package/icons/svg-pack/scIconProfile.svg +11 -0
- package/icons/svg-pack/scIconQRCodeScan.svg +18 -0
- package/icons/svg-pack/scIconQuestion.svg +11 -0
- package/icons/svg-pack/scIconReclamation.svg +11 -0
- package/icons/svg-pack/scIconRefresh.svg +11 -0
- package/icons/svg-pack/scIconRepeat.svg +11 -0
- package/icons/svg-pack/scIconRequisites.svg +11 -0
- package/icons/svg-pack/scIconRocket.svg +18 -0
- package/icons/svg-pack/scIconSave.svg +11 -0
- package/icons/svg-pack/scIconSearch.svg +12 -0
- package/icons/svg-pack/scIconSend.svg +11 -0
- package/icons/svg-pack/scIconSettings.svg +11 -0
- package/icons/svg-pack/scIconShare.svg +15 -0
- package/icons/svg-pack/scIconSocialCopy.svg +13 -0
- package/icons/svg-pack/scIconSocialEmail.svg +13 -0
- package/icons/svg-pack/scIconSocialFacebook.svg +12 -0
- package/icons/svg-pack/scIconSocialInstagram.svg +33 -0
- package/icons/svg-pack/scIconSocialQR.svg +12 -0
- package/icons/svg-pack/scIconSocialTelegram.svg +20 -0
- package/icons/svg-pack/scIconSocialViber.svg +16 -0
- package/icons/svg-pack/scIconSocialVk.svg +12 -0
- package/icons/svg-pack/scIconSocialWhatsapp.svg +12 -0
- package/icons/svg-pack/scIconStar.svg +11 -0
- package/icons/svg-pack/scIconSuitcase.svg +11 -0
- package/icons/svg-pack/scIconTasks.svg +11 -0
- package/icons/svg-pack/scIconTick.svg +11 -0
- package/icons/svg-pack/scIconTop.svg +11 -0
- package/icons/svg-pack/scIconVerticalThreeDots.svg +11 -0
- package/icons/svg-pack/scIconViewGrid.svg +11 -0
- package/icons/svg-pack/scIconViewInline.svg +11 -0
- package/icons/svg-pack/scIconViewTree.svg +15 -0
- package/icons/svg-pack/scIconWallet.svg +11 -0
- package/icons/svg-pack/scIconWarning.svg +11 -0
- package/icons/svg-pack/scIconWordFile.svg +12 -0
- package/index.d.ts +5 -0
- package/loader/index.d.ts +1 -0
- package/loader/sc-i-loader.d.ts +9 -0
- package/news/index.d.ts +3 -0
- package/news/news-card/sc-news-card.component.d.ts +22 -0
- package/news/news-card-skeleton/sc-news-card-skeleton.component.d.ts +12 -0
- package/news/sc-news.module.d.ts +14 -0
- package/order/index.d.ts +2 -0
- package/order/order-item-mobile/order-item-mobile.component.d.ts +53 -0
- package/order/sc-order.module.d.ts +13 -0
- package/package.json +62 -0
- package/public-api.d.ts +11 -0
- package/share-button/index.d.ts +2 -0
- package/share-button/sc-share-button.component.d.ts +22 -0
- package/share-button/sc-share-button.module.d.ts +12 -0
- package/styles/taiga/taiga-tailwind-preset.js +163 -0
- package/styles/taiga/variables.less +44 -0
- package/styles/tailwind/tailwind.scss +1461 -0
- package/tokens/index.d.ts +1 -0
- package/tokens/sc-linear-values-token.d.ts +8 -0
- package/validators/index.d.ts +1 -0
- package/validators/stepValidator.d.ts +7 -0
@@ -0,0 +1,1901 @@
|
|
1
|
+
import { __decorate } from 'tslib';
|
2
|
+
import * as i0 from '@angular/core';
|
3
|
+
import { Injectable, EventEmitter, ElementRef, Component, ChangeDetectionStrategy, Inject, Input, Output, ContentChildren, ViewChild, HostBinding, HostListener, NgModule, ChangeDetectorRef, Optional, Self, Directive, forwardRef } from '@angular/core';
|
4
|
+
import { Subject, map, tap, shareReplay, filter, switchMap, interval, takeUntil, skip } from 'rxjs';
|
5
|
+
import { untilDestroyed, UntilDestroy } from '@ngneat/until-destroy';
|
6
|
+
import * as i8 from '@ng-web-apis/intersection-observer';
|
7
|
+
import { IntersectionObserverService, IntersectionObserverModule } from '@ng-web-apis/intersection-observer';
|
8
|
+
import * as i3$1 from '@taiga-ui/core';
|
9
|
+
import { tuiFadeIn, TuiButtonModule, TuiModeModule, TuiLoaderModule, tuiFormatNumber, TuiSvgModule, TuiLabelModule, TuiTextfieldControllerModule, TuiHintModule, TuiLinkModule } from '@taiga-ui/core';
|
10
|
+
import * as i1 from '@snabcentr/client-core';
|
11
|
+
import { SC_URLS, SC_PATH_IMAGE_NOT_FOUND, ScIconTypesEnum } from '@snabcentr/client-core';
|
12
|
+
import * as i3 from '@angular/common';
|
13
|
+
import { CommonModule, formatDate } from '@angular/common';
|
14
|
+
import * as i5 from '@angular/material/core';
|
15
|
+
import { MatRippleModule } from '@angular/material/core';
|
16
|
+
import * as i3$2 from '@taiga-ui/kit';
|
17
|
+
import { TuiCarouselModule, TUI_NUMBER_VALUE_TRANSFORMER, TuiInputNumberComponent, TuiIslandModule, TuiInputNumberModule, TuiFieldErrorPipeModule, TuiElasticContainerModule, TuiTreeService, TuiTreeItemContentComponent, TUI_TREE_START, TUI_TREE_CONTENT, TUI_TREE_LOADING, TUI_TREE_LOADER, TuiTreeModule } from '@taiga-ui/kit';
|
18
|
+
import * as i7 from '@taiga-ui/cdk';
|
19
|
+
import { TuiLetModule, tuiCreateToken, AbstractTuiNullableControl } from '@taiga-ui/cdk';
|
20
|
+
import { RouterModule } from '@angular/router';
|
21
|
+
import * as i4 from '@angular/forms';
|
22
|
+
import { NgControl, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
23
|
+
import * as i7$1 from '@taiga-ui/addon-preview';
|
24
|
+
import { TuiPreviewDialogService, TuiPreviewModule } from '@taiga-ui/addon-preview';
|
25
|
+
import * as i8$1 from '@tinkoff/ng-polymorpheus';
|
26
|
+
import { PolymorpheusModule, PolymorpheusComponent } from '@tinkoff/ng-polymorpheus';
|
27
|
+
import * as i2 from 'ngx-echarts';
|
28
|
+
import { NgxEchartsModule } from 'ngx-echarts';
|
29
|
+
import * as echarts from 'echarts/core';
|
30
|
+
import { LineChart } from 'echarts/charts';
|
31
|
+
import { TitleComponent, TooltipComponent, GridComponent } from 'echarts/components';
|
32
|
+
import { SVGRenderer } from 'echarts/renderers';
|
33
|
+
|
34
|
+
/**
|
35
|
+
* Класс-помощник для конвертации пикселей.
|
36
|
+
*/
|
37
|
+
class ScPxConverter {
|
38
|
+
constructor() {
|
39
|
+
this.rootFontSize = 16;
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* Конвертирует пиксели в rem.
|
43
|
+
*
|
44
|
+
* @param px Значение которое необходимо конвертировать.
|
45
|
+
*/
|
46
|
+
pxToRem(px) {
|
47
|
+
return px / this.rootFontSize;
|
48
|
+
}
|
49
|
+
}
|
50
|
+
ScPxConverter.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPxConverter, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
51
|
+
ScPxConverter.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPxConverter, providedIn: 'root' });
|
52
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPxConverter, decorators: [{
|
53
|
+
type: Injectable,
|
54
|
+
args: [{
|
55
|
+
providedIn: 'root',
|
56
|
+
}]
|
57
|
+
}] });
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Баннер с прокруткой переданных {@link TemplateRef} элементов, и баннеров локации.
|
61
|
+
*/
|
62
|
+
let ScBannerComponent = class ScBannerComponent {
|
63
|
+
/**
|
64
|
+
* Инициализирует экземпляр класса {@link ScBannerComponent}.
|
65
|
+
*
|
66
|
+
* @param cdr Объект для работы с обнаружением изменений.
|
67
|
+
* @param bannerService Сервис для работы с баннерами.
|
68
|
+
* @param pxConverter Класс хэлпер для конвертации пикселей.
|
69
|
+
*/
|
70
|
+
constructor(cdr, bannerService, entries$, element, pxConverter) {
|
71
|
+
this.cdr = cdr;
|
72
|
+
this.bannerService = bannerService;
|
73
|
+
this.entries$ = entries$;
|
74
|
+
this.element = element;
|
75
|
+
this.pxConverter = pxConverter;
|
76
|
+
/**
|
77
|
+
* Признак, что необходимо показывать кнопки навигации.
|
78
|
+
*/
|
79
|
+
this.navigateButton = true;
|
80
|
+
/**
|
81
|
+
* Интервал показа слайдов в миллисекундах.
|
82
|
+
*/
|
83
|
+
this.playerInterval = 5000;
|
84
|
+
/**
|
85
|
+
* Признак, что прокрутка выключена.
|
86
|
+
*/
|
87
|
+
this.disabled = false;
|
88
|
+
/**
|
89
|
+
* Признак, что компонент должен растягиваться.
|
90
|
+
*/
|
91
|
+
this.resizable = true;
|
92
|
+
/**
|
93
|
+
* Событие загрузки баннеров с количеством полученных баннеров.
|
94
|
+
*/
|
95
|
+
this.loadBannersEvent = new EventEmitter();
|
96
|
+
/**
|
97
|
+
* Событие нажатия на изображение баннера.
|
98
|
+
*/
|
99
|
+
this.clickBannerEvent = new EventEmitter();
|
100
|
+
/**
|
101
|
+
* Идентификатор текущего баннера.
|
102
|
+
*/
|
103
|
+
this.currentBannerId = 0;
|
104
|
+
/**
|
105
|
+
* {@link Subject} изменения состояния таймера.
|
106
|
+
*/
|
107
|
+
this.toggleTimer$ = new Subject();
|
108
|
+
/**
|
109
|
+
* Признак, что необходимо показывать кнопки старта видео баннера.
|
110
|
+
*/
|
111
|
+
this.showPlayBtn = false;
|
112
|
+
/**
|
113
|
+
* {@link Observable} Обновления списка баннеров.
|
114
|
+
*/
|
115
|
+
this.banners$ = this.bannerService.banners$.pipe(map((banners) => banners.filter((banner) => banner.location === this.bannerLocation).reverse()), tap((banners) => {
|
116
|
+
if (banners.length) {
|
117
|
+
if (this.resizable) {
|
118
|
+
this.width = `100%`;
|
119
|
+
}
|
120
|
+
else {
|
121
|
+
this.height = `${this.pxConverter.pxToRem(banners[0].height)}rem`;
|
122
|
+
this.width = `${this.pxConverter.pxToRem(banners[0].width)}rem`;
|
123
|
+
}
|
124
|
+
this.aspectRatio = `${banners[0].width} / ${banners[0].height}`;
|
125
|
+
this.banners = banners;
|
126
|
+
this.toggleTimer$.next(true);
|
127
|
+
}
|
128
|
+
this.loadBannersEvent.emit(banners.length);
|
129
|
+
}), shareReplay(1));
|
130
|
+
/**
|
131
|
+
* Список баннеров.
|
132
|
+
*/
|
133
|
+
this.banners = [];
|
134
|
+
/**
|
135
|
+
* Свойство, от которого зависит высота `:host` компонента.
|
136
|
+
*/
|
137
|
+
this.height = 'auto';
|
138
|
+
/**
|
139
|
+
* Свойство, от которого зависит ширина `:host` компонента.
|
140
|
+
*/
|
141
|
+
this.width = '';
|
142
|
+
/**
|
143
|
+
* Свойство, от которого зависит соотношение `:host` компонента.
|
144
|
+
*/
|
145
|
+
this.aspectRatio = '';
|
146
|
+
/**
|
147
|
+
* Обработчик события mouseenter.
|
148
|
+
*
|
149
|
+
* @private
|
150
|
+
*/
|
151
|
+
this.mouseEnterHandler = () => this.toggleTimer$.next(false);
|
152
|
+
/**
|
153
|
+
* Обработчик события mouseleave.
|
154
|
+
*
|
155
|
+
* @private
|
156
|
+
*/
|
157
|
+
this.mouseLeaveHandler = () => this.toggleTimer$.next(true);
|
158
|
+
}
|
159
|
+
/**
|
160
|
+
* Свойство, от которого зависит наличие класса `!hidden` у `:host` компонента.
|
161
|
+
*/
|
162
|
+
get isHidden() {
|
163
|
+
return !this.banners || this.bannersListRef.length + this.banners.length === 0;
|
164
|
+
}
|
165
|
+
/** @inheritDoc */
|
166
|
+
ngAfterViewInit() {
|
167
|
+
this.toggleTimer$
|
168
|
+
.pipe(filter((toggle) => toggle), switchMap(() => interval(this.playerInterval).pipe(takeUntil(this.toggleTimer$))), filter(() => !this.disabled && (this.banners?.[this.currentBannerId]?.mediaType === 'image' || this.showPlayBtn)), untilDestroyed(this))
|
169
|
+
.subscribe(() => this.onNextBanner());
|
170
|
+
// Отслеживание пересечения компонента с экраном пользователя.
|
171
|
+
// Если баннера не находится в поле видимости пользователя, то он перестаёт переключатся, а видео останавливается.
|
172
|
+
this.entries$.pipe(map((entries) => entries.find((item) => item.target === this.element.nativeElement))).subscribe((entry) => {
|
173
|
+
this.toggleTimer$.next(!!entry?.isIntersecting);
|
174
|
+
});
|
175
|
+
}
|
176
|
+
/**
|
177
|
+
* Переключает на предыдущий баннер.
|
178
|
+
*/
|
179
|
+
onPreviousBanner() {
|
180
|
+
const previous = this.currentBannerId - 1;
|
181
|
+
this.currentBannerId = previous < 0 ? this.bannersListRef.length + (this.banners?.length ?? 0) - 1 : previous;
|
182
|
+
this.cdr.markForCheck();
|
183
|
+
}
|
184
|
+
/**
|
185
|
+
* Переключает на следующий баннер.
|
186
|
+
*/
|
187
|
+
onNextBanner() {
|
188
|
+
const next = this.currentBannerId + 1;
|
189
|
+
this.currentBannerId = next === this.bannersListRef.length + (this.banners?.length ?? 0) ? 0 : next;
|
190
|
+
this.cdr.markForCheck();
|
191
|
+
}
|
192
|
+
/**
|
193
|
+
* Переключает на следующий баннер.
|
194
|
+
*/
|
195
|
+
onEndedVideo() {
|
196
|
+
this.onNextBanner();
|
197
|
+
this.toggleTimer$.next(true);
|
198
|
+
this.showPlayBtn = true;
|
199
|
+
}
|
200
|
+
/**
|
201
|
+
* Обработчик нажатия на баннер, генерирующий событие {@link clickBannerImgEvent}.
|
202
|
+
*
|
203
|
+
* @param banner Баннер, по ссылке которого совершён переход.
|
204
|
+
*/
|
205
|
+
onClick(banner) {
|
206
|
+
if (banner.url) {
|
207
|
+
this.clickBannerEvent.emit(banner);
|
208
|
+
}
|
209
|
+
}
|
210
|
+
};
|
211
|
+
ScBannerComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScBannerComponent, deps: [{ token: i0.ChangeDetectorRef }, { token: i1.ScBannerService }, { token: IntersectionObserverService }, { token: ElementRef }, { token: ScPxConverter }], target: i0.ɵɵFactoryTarget.Component });
|
212
|
+
ScBannerComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScBannerComponent, selector: "sc-banner", inputs: { navigateButton: "navigateButton", playerInterval: "playerInterval", disabled: "disabled", bannerLocation: "bannerLocation", resizable: "resizable" }, outputs: { loadBannersEvent: "loadBannersEvent", clickBannerEvent: "clickBannerEvent" }, host: { listeners: { "mouseenter": "mouseEnterHandler()", "mouseleave": "mouseLeaveHandler()" }, properties: { "class.!hidden": "this.isHidden", "style.height": "this.height", "style.width": "this.width", "style.aspect-ratio": "this.aspectRatio" } }, providers: [IntersectionObserverService], queries: [{ propertyName: "bannersListRef", predicate: ["banner"] }], viewQueries: [{ propertyName: "videoRef", first: true, predicate: ["videoPlayer"], descendants: true }], ngImport: i0, template: "<ng-container *tuiLet=\"banners$ | async\">\n <tui-carousel class=\"bg-white w-full h-full shadow-sc-2 rounded-xl overflow-hidden\" [(index)]=\"currentBannerId\">\n <ng-container *ngFor=\"let banner of banners; let index = index\">\n <a\n *tuiItem\n (click)=\"onClick(banner)\"\n [style.aspect-ratio]=\"aspectRatio\"\n [attr.href]=\"banner.url ? banner.url : null\"\n target=\"_blank\"\n [title]=\"banner.title\"\n class=\"relative\"\n >\n <ng-container [ngSwitch]=\"banner.mediaType\">\n <ng-container *ngSwitchCase=\"'video'\">\n <video\n #videoPlayer\n (suspend)=\"showPlayBtn = true\"\n (play)=\"showPlayBtn = false\"\n [src]=\"banner.mediaFile\"\n (ended)=\"onEndedVideo()\"\n (mouseover)=\"videoPlayer.pause()\"\n (mouseout)=\"videoPlayer.play()\"\n class=\"object-cover h-full\"\n muted\n autoplay\n ></video>\n <button\n *ngIf=\"showPlayBtn\"\n tuiIconButton\n [@tuiFadeIn]=\"200\"\n matRipple\n (click)=\"$event.preventDefault(); videoPlayer.play()\"\n size=\"s\"\n appearance=\"secondary\"\n class=\"!absolute left-8 bottom-4\"\n >\n <i class=\"icon-refresh text-black\"></i>\n </button>\n </ng-container>\n\n <img *ngSwitchCase=\"'image'\" [src]=\"banner.mediaFile\" alt=\"\u0411\u0430\u043D\u043D\u0435\u0440\" class=\"object-cover h-full\" />\n </ng-container>\n </a>\n </ng-container>\n <ng-container *ngFor=\"let item of bannersListRef\">\n <div *tuiItem [style.height]=\"height\" [style.width]=\"width\" [style.aspect-ratio]=\"aspectRatio\" class=\"overflow-hidden\">\n <ng-container [ngTemplateOutlet]=\"item\"></ng-container>\n </div>\n </ng-container>\n </tui-carousel>\n</ng-container>\n<div *ngIf=\"navigateButton && !disabled && this.banners && (this.bannersListRef.length + this.banners.length) > 1\" tuiMode=\"onLight\" class=\"flex items-center\">\n <button tuiIconButton icon=\"tuiIconChevronLeftLarge\" size=\"m\" shape=\"rounded\" appearance=\"flat\" (click)=\"onPreviousBanner()\" class=\"!absolute left-2\"></button>\n <button tuiIconButton icon=\"tuiIconChevronRightLarge\" size=\"m\" shape=\"rounded\" appearance=\"flat\" (click)=\"onNextBanner()\" class=\"!absolute right-2\"></button>\n</div>\n", styles: [":host{--tui-carousel-padding: 0;display:flex;position:relative}\n"], dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: i3.NgSwitch, selector: "[ngSwitch]", inputs: ["ngSwitch"] }, { kind: "directive", type: i3.NgSwitchCase, selector: "[ngSwitchCase]", inputs: ["ngSwitchCase"] }, { kind: "component", type: i3$1.TuiButtonComponent, selector: "button[tuiButton], button[tuiIconButton], a[tuiButton], a[tuiIconButton]", inputs: ["appearance", "disabled", "icon", "iconRight", "shape", "showLoader", "size"] }, { kind: "directive", type: i5.MatRipple, selector: "[mat-ripple], [matRipple]", inputs: ["matRippleColor", "matRippleUnbounded", "matRippleCentered", "matRippleRadius", "matRippleAnimation", "matRippleDisabled", "matRippleTrigger"], exportAs: ["matRipple"] }, { kind: "component", type: i3$2.TuiCarouselComponent, selector: "tui-carousel", inputs: ["draggable", "itemsCount", "index"], outputs: ["indexChange"] }, { kind: "directive", type: i3$2.TuiCarouselDirective, selector: "tui-carousel", inputs: ["duration", "index"] }, { kind: "directive", type: i7.TuiItemDirective, selector: "[tuiItem]" }, { kind: "directive", type: i3$1.TuiModeDirective, selector: "[tuiMode]", inputs: ["tuiMode"] }, { kind: "directive", type: i7.TuiLetDirective, selector: "[tuiLet]", inputs: ["tuiLet"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }], animations: [tuiFadeIn], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
213
|
+
ScBannerComponent = __decorate([
|
214
|
+
UntilDestroy({ checkProperties: true })
|
215
|
+
], ScBannerComponent);
|
216
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScBannerComponent, decorators: [{
|
217
|
+
type: Component,
|
218
|
+
args: [{ selector: 'sc-banner', changeDetection: ChangeDetectionStrategy.OnPush, providers: [IntersectionObserverService], animations: [tuiFadeIn], template: "<ng-container *tuiLet=\"banners$ | async\">\n <tui-carousel class=\"bg-white w-full h-full shadow-sc-2 rounded-xl overflow-hidden\" [(index)]=\"currentBannerId\">\n <ng-container *ngFor=\"let banner of banners; let index = index\">\n <a\n *tuiItem\n (click)=\"onClick(banner)\"\n [style.aspect-ratio]=\"aspectRatio\"\n [attr.href]=\"banner.url ? banner.url : null\"\n target=\"_blank\"\n [title]=\"banner.title\"\n class=\"relative\"\n >\n <ng-container [ngSwitch]=\"banner.mediaType\">\n <ng-container *ngSwitchCase=\"'video'\">\n <video\n #videoPlayer\n (suspend)=\"showPlayBtn = true\"\n (play)=\"showPlayBtn = false\"\n [src]=\"banner.mediaFile\"\n (ended)=\"onEndedVideo()\"\n (mouseover)=\"videoPlayer.pause()\"\n (mouseout)=\"videoPlayer.play()\"\n class=\"object-cover h-full\"\n muted\n autoplay\n ></video>\n <button\n *ngIf=\"showPlayBtn\"\n tuiIconButton\n [@tuiFadeIn]=\"200\"\n matRipple\n (click)=\"$event.preventDefault(); videoPlayer.play()\"\n size=\"s\"\n appearance=\"secondary\"\n class=\"!absolute left-8 bottom-4\"\n >\n <i class=\"icon-refresh text-black\"></i>\n </button>\n </ng-container>\n\n <img *ngSwitchCase=\"'image'\" [src]=\"banner.mediaFile\" alt=\"\u0411\u0430\u043D\u043D\u0435\u0440\" class=\"object-cover h-full\" />\n </ng-container>\n </a>\n </ng-container>\n <ng-container *ngFor=\"let item of bannersListRef\">\n <div *tuiItem [style.height]=\"height\" [style.width]=\"width\" [style.aspect-ratio]=\"aspectRatio\" class=\"overflow-hidden\">\n <ng-container [ngTemplateOutlet]=\"item\"></ng-container>\n </div>\n </ng-container>\n </tui-carousel>\n</ng-container>\n<div *ngIf=\"navigateButton && !disabled && this.banners && (this.bannersListRef.length + this.banners.length) > 1\" tuiMode=\"onLight\" class=\"flex items-center\">\n <button tuiIconButton icon=\"tuiIconChevronLeftLarge\" size=\"m\" shape=\"rounded\" appearance=\"flat\" (click)=\"onPreviousBanner()\" class=\"!absolute left-2\"></button>\n <button tuiIconButton icon=\"tuiIconChevronRightLarge\" size=\"m\" shape=\"rounded\" appearance=\"flat\" (click)=\"onNextBanner()\" class=\"!absolute right-2\"></button>\n</div>\n", styles: [":host{--tui-carousel-padding: 0;display:flex;position:relative}\n"] }]
|
219
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }, { type: i1.ScBannerService }, { type: i8.IntersectionObserverService, decorators: [{
|
220
|
+
type: Inject,
|
221
|
+
args: [IntersectionObserverService]
|
222
|
+
}] }, { type: i0.ElementRef, decorators: [{
|
223
|
+
type: Inject,
|
224
|
+
args: [ElementRef]
|
225
|
+
}] }, { type: ScPxConverter }]; }, propDecorators: { navigateButton: [{
|
226
|
+
type: Input
|
227
|
+
}], playerInterval: [{
|
228
|
+
type: Input
|
229
|
+
}], disabled: [{
|
230
|
+
type: Input
|
231
|
+
}], bannerLocation: [{
|
232
|
+
type: Input
|
233
|
+
}], resizable: [{
|
234
|
+
type: Input
|
235
|
+
}], loadBannersEvent: [{
|
236
|
+
type: Output
|
237
|
+
}], clickBannerEvent: [{
|
238
|
+
type: Output
|
239
|
+
}], bannersListRef: [{
|
240
|
+
type: ContentChildren,
|
241
|
+
args: ['banner']
|
242
|
+
}], videoRef: [{
|
243
|
+
type: ViewChild,
|
244
|
+
args: ['videoPlayer']
|
245
|
+
}], isHidden: [{
|
246
|
+
type: HostBinding,
|
247
|
+
args: ['class.!hidden']
|
248
|
+
}], height: [{
|
249
|
+
type: HostBinding,
|
250
|
+
args: ['style.height']
|
251
|
+
}], width: [{
|
252
|
+
type: HostBinding,
|
253
|
+
args: ['style.width']
|
254
|
+
}], aspectRatio: [{
|
255
|
+
type: HostBinding,
|
256
|
+
args: ['style.aspect-ratio']
|
257
|
+
}], mouseEnterHandler: [{
|
258
|
+
type: HostListener,
|
259
|
+
args: ['mouseenter']
|
260
|
+
}], mouseLeaveHandler: [{
|
261
|
+
type: HostListener,
|
262
|
+
args: ['mouseleave']
|
263
|
+
}] } });
|
264
|
+
|
265
|
+
/**
|
266
|
+
* Модуль баннеров.
|
267
|
+
*/
|
268
|
+
class ScBannerModule {
|
269
|
+
}
|
270
|
+
ScBannerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScBannerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
271
|
+
ScBannerModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ScBannerModule, declarations: [ScBannerComponent], imports: [CommonModule, RouterModule, TuiButtonModule, MatRippleModule, TuiCarouselModule, TuiModeModule, TuiLoaderModule, IntersectionObserverModule, TuiLetModule], exports: [ScBannerComponent] });
|
272
|
+
ScBannerModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScBannerModule, imports: [CommonModule, RouterModule, TuiButtonModule, MatRippleModule, TuiCarouselModule, TuiModeModule, TuiLoaderModule, IntersectionObserverModule, TuiLetModule] });
|
273
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScBannerModule, decorators: [{
|
274
|
+
type: NgModule,
|
275
|
+
args: [{
|
276
|
+
declarations: [ScBannerComponent],
|
277
|
+
imports: [CommonModule, RouterModule, TuiButtonModule, MatRippleModule, TuiCarouselModule, TuiModeModule, TuiLoaderModule, IntersectionObserverModule, TuiLetModule],
|
278
|
+
exports: [ScBannerComponent],
|
279
|
+
}]
|
280
|
+
}] });
|
281
|
+
|
282
|
+
/**
|
283
|
+
* Единицы измерения линейной величины по умолчанию.
|
284
|
+
*/
|
285
|
+
const SC_LINEAR_VALUES = ['пог.м.', 'м.'];
|
286
|
+
/**
|
287
|
+
* Токен единиц измерения линейной величины по умолчанию.
|
288
|
+
*/
|
289
|
+
const SC_LINEAR_VALUES_TOKEN = tuiCreateToken(SC_LINEAR_VALUES);
|
290
|
+
|
291
|
+
/**
|
292
|
+
* Класс хэлпер для работы со значениями единиц измерения товара.
|
293
|
+
*/
|
294
|
+
class UnitsHelper {
|
295
|
+
/**
|
296
|
+
* Инициирует экземпляр класса {@link UnitsHelper}.
|
297
|
+
*
|
298
|
+
* @param linearValues Единицы измерения линейной величины.
|
299
|
+
*/
|
300
|
+
constructor(linearValues) {
|
301
|
+
this.linearValues = linearValues;
|
302
|
+
}
|
303
|
+
/**
|
304
|
+
* Возвращает признак возможности продажи товара на метраж.
|
305
|
+
*
|
306
|
+
* @param linearValues Товар для которого нужно проверить возможность продажи на метраж.
|
307
|
+
*/
|
308
|
+
productIsMeasurable(product) {
|
309
|
+
return this.linearValues.includes(product.unit);
|
310
|
+
}
|
311
|
+
/**
|
312
|
+
* Возвращает кратность количества для товара.
|
313
|
+
*
|
314
|
+
* @param linearValues Товар для которого нужно вернуть кратность количества.
|
315
|
+
*/
|
316
|
+
productMultiplicity(product) {
|
317
|
+
return product && product.minCount && !this.linearValues.includes(product.unit) ? product.minCount : 1;
|
318
|
+
}
|
319
|
+
}
|
320
|
+
UnitsHelper.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UnitsHelper, deps: [{ token: SC_LINEAR_VALUES_TOKEN }], target: i0.ɵɵFactoryTarget.Injectable });
|
321
|
+
UnitsHelper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UnitsHelper, providedIn: 'root' });
|
322
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UnitsHelper, decorators: [{
|
323
|
+
type: Injectable,
|
324
|
+
args: [{
|
325
|
+
providedIn: 'root',
|
326
|
+
}]
|
327
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
328
|
+
type: Inject,
|
329
|
+
args: [SC_LINEAR_VALUES_TOKEN]
|
330
|
+
}] }]; } });
|
331
|
+
|
332
|
+
/**
|
333
|
+
* Проверяет кратность значения.
|
334
|
+
*
|
335
|
+
* @param step Шаг кратности.
|
336
|
+
*/
|
337
|
+
function stepValidator(step) {
|
338
|
+
return (control) => {
|
339
|
+
// Умножение на 1000 нужно для уменьшения вероятности погрешности при выполнении вычислений над десятичными числами.
|
340
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
341
|
+
return control.value && (Number.parseFloat(control.value) * 1000) % (step * 1000) ? { error: `Число не кратно ${step}` } : null;
|
342
|
+
};
|
343
|
+
}
|
344
|
+
|
345
|
+
class ScInputQuantityComponent extends AbstractTuiNullableControl {
|
346
|
+
/**
|
347
|
+
* Инициализирует экземпляр класса {@link ScInputQuantityComponent}.
|
348
|
+
*
|
349
|
+
* @param ngControl Объект поля ввода для настройки валидации.
|
350
|
+
* @param cdr Объект для работы с обнаружением изменений.
|
351
|
+
* @param transformer Преобразователь значений элемента формы.
|
352
|
+
*/
|
353
|
+
constructor(ngControl, cdr, transformer) {
|
354
|
+
super(ngControl, cdr, transformer);
|
355
|
+
/**
|
356
|
+
* Шаг увеличения количества. Отвечает за проверку кратности ввода.
|
357
|
+
*/
|
358
|
+
this.step = 1;
|
359
|
+
/**
|
360
|
+
* Признак, что необходимо отобразить {@link TuiLoaderComponent} над компонентом.
|
361
|
+
*/
|
362
|
+
this.showLoader = false;
|
363
|
+
/**
|
364
|
+
* Признак, что необходимо отобразить кнопку очистки поля ввода.
|
365
|
+
*/
|
366
|
+
this.showCross = true;
|
367
|
+
/**
|
368
|
+
* Формат внешнего вида компонента.
|
369
|
+
*/
|
370
|
+
this.appearance = 'primary';
|
371
|
+
/**
|
372
|
+
* Признак, что компонент деактивирован.
|
373
|
+
*/
|
374
|
+
this.isDisabled = false;
|
375
|
+
/**
|
376
|
+
* Размер компонента.
|
377
|
+
*/
|
378
|
+
this.size = 'm';
|
379
|
+
/**
|
380
|
+
* Событие нажатия на кнопку "Очистить".
|
381
|
+
*/
|
382
|
+
this.clickClearEvent = new EventEmitter();
|
383
|
+
}
|
384
|
+
get focused() {
|
385
|
+
return !!this.numberInput?.focused;
|
386
|
+
}
|
387
|
+
get formControl() {
|
388
|
+
return this.control;
|
389
|
+
}
|
390
|
+
/** @inheritDoc */
|
391
|
+
ngOnInit() {
|
392
|
+
if (this.control) {
|
393
|
+
this.control.setValidators(stepValidator(this.step));
|
394
|
+
}
|
395
|
+
}
|
396
|
+
/**
|
397
|
+
* Обработчик события нажатия стрелок клавиатуры.
|
398
|
+
*
|
399
|
+
* @param step Шаг изменения количества.
|
400
|
+
*/
|
401
|
+
onArrow(step) {
|
402
|
+
if (!step) {
|
403
|
+
return;
|
404
|
+
}
|
405
|
+
if (step > 0) {
|
406
|
+
this.incident();
|
407
|
+
}
|
408
|
+
else {
|
409
|
+
this.decrement();
|
410
|
+
}
|
411
|
+
}
|
412
|
+
/**
|
413
|
+
* Увеличивает значение в поле ввода на 1 шаг. Если число в поле ввода не кратно шагу, то увеличит до ближайшего кратного значения.
|
414
|
+
*/
|
415
|
+
incident() {
|
416
|
+
this.numberInput.onArrow(this.step - ((this.numberInput.value || 0) % this.step));
|
417
|
+
}
|
418
|
+
/**
|
419
|
+
* Уменьшает значение в поле ввода на 1 шаг. Если число в поле ввода не кратно шагу, то уменьшит до ближайшего кратного значения.
|
420
|
+
*/
|
421
|
+
decrement() {
|
422
|
+
this.numberInput.onArrow(-((this.numberInput.value || 0) % this.step) || -this.step);
|
423
|
+
}
|
424
|
+
/**
|
425
|
+
* Очищает поля ввода.
|
426
|
+
*/
|
427
|
+
clear() {
|
428
|
+
this.control?.patchValue(null);
|
429
|
+
this.clickClearEvent.emit();
|
430
|
+
}
|
431
|
+
}
|
432
|
+
ScInputQuantityComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScInputQuantityComponent, deps: [{ token: NgControl, optional: true, self: true }, { token: ChangeDetectorRef }, { token: TUI_NUMBER_VALUE_TRANSFORMER, optional: true }], target: i0.ɵɵFactoryTarget.Component });
|
433
|
+
ScInputQuantityComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScInputQuantityComponent, selector: "sc-input-quantity", inputs: { step: "step", quantityUnit: "quantityUnit", showLoader: "showLoader", showCross: "showCross", appearance: "appearance", isDisabled: "isDisabled", size: "size" }, outputs: { clickClearEvent: "clickClearEvent" }, host: { listeners: { "keydown.arrowDown": "onArrow(-step)", "keydown.arrowUp": "onArrow(step)" }, properties: { "attr.data-appearance": "this.appearance", "attr.data-disabled": "this.isDisabled", "attr.data-size": "this.size" } }, viewQueries: [{ propertyName: "numberInput", first: true, predicate: TuiInputNumberComponent, descendants: true }], usesInheritance: true, ngImport: i0, template: "<tui-loader *ngIf=\"formControl\" class=\"w-full\" [overlay]=\"true\" [showLoader]=\"showLoader\" [size]=\"size\">\n <div class=\"flex items-center text-center gap-1\">\n <div class=\"field-with-button flex grow rounded-xl\">\n <button\n tuiIconButton\n tuiMode=\"onLight\"\n [appearance]=\"appearance\"\n [disabled]=\"!numberInput.canDecrement\"\n [focusable]=\"false\"\n [size]=\"size\"\n (click.prevent)=\"decrement()\"\n (mousedown.prevent)=\"numberInput.nativeFocusableElement?.focus()\"\n >\n <tui-svg src=\"scIconMinus\"></tui-svg>\n </button>\n <tui-input-number\n #numberInput\n [formControl]=\"formControl\"\n [tuiHint]=\"([] | tuiFieldError | async )?.message\"\n [tuiTextfieldPostfix]=\"quantityUnit || ''\"\n [tuiTextfieldLabelOutside]=\"true\"\n [min]=\"step\"\n [tuiTextfieldSize]=\"size\"\n [required]=\"true\"\n [style.text-align]=\"'center'\"\n [style.font-weight]=\"700\"\n class=\"grow\"\n >\n </tui-input-number>\n <button\n tuiIconButton\n tuiMode=\"onLight\"\n [appearance]=\"appearance\"\n [size]=\"size\"\n [disabled]=\"!numberInput.canIncrement\"\n [focusable]=\"false\"\n (click.prevent)=\"incident()\"\n (mousedown.prevent)=\"numberInput.nativeFocusableElement?.focus()\"\n >\n <tui-svg src=\"scIconPlus\"></tui-svg>\n </button>\n </div>\n <button\n *ngIf=\"showCross\"\n tuiIconButton\n tuiMode=\"onLight\"\n [appearance]=\"appearance\"\n [size]=\"size\"\n [disabled]=\"!numberInput.canIncrement\"\n [focusable]=\"false\"\n (click.prevent)=\"clear()\"\n (mousedown.prevent)=\"numberInput.nativeFocusableElement?.focus()\"\n >\n <tui-svg src=\"scIconCross\"></tui-svg>\n </button>\n </div>\n</tui-loader>\n", styles: [":host [data-size=l]{--tui-height-l: var(--tui-height-m);--tui-font-text-m: bold .875rem/1.25rem var(--tui-font-text);--tui-padding-l: 0}:host [data-size=m]{--tui-height-m: var(--tui-height-s);--tui-font-text-s: bold .75rem/1rem var(--tui-font-text);--tui-padding-m: 0}:host [data-size=m] tui-svg{font-size:12px!important}:host [data-size=s]{--tui-height-s: var(--tui-height-xs);--tui-font-text-s: bold .75rem/1rem var(--tui-font-text);--tui-padding-s: 0}:host [data-size=s] tui-svg{font-size:12px!important}:host[data-disabled=true]{pointer-events:none;opacity:var(--tui-disabled-opacity)}:host[data-appearance=secondary] .field-with-button{background-color:var(--tui-base-01);box-shadow:inset 0 0 0 .0625rem var(--tui-base-03)}:host[data-appearance=primary] .field-with-button{background-color:var(--tui-warning-bg)}:host .field-with-button:has(._invalid){background-color:var(--tui-error-bg)}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.TuiButtonComponent, selector: "button[tuiButton], button[tuiIconButton], a[tuiButton], a[tuiIconButton]", inputs: ["appearance", "disabled", "icon", "iconRight", "shape", "showLoader", "size"] }, { kind: "component", type: i3$1.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }, { kind: "component", type: i3$2.TuiInputNumberComponent, selector: "tui-input-number", inputs: ["min", "max", "decimal", "precision", "step", "prefix", "postfix"] }, { kind: "directive", type: i3$2.TuiInputNumberDirective, selector: "tui-input-number" }, { kind: "directive", type: i3$1.TuiTextfieldLabelOutsideDirective, selector: "[tuiTextfieldLabelOutside]", inputs: ["tuiTextfieldLabelOutside"] }, { kind: "directive", type: i3$1.TuiTextfieldSizeDirective, selector: "[tuiTextfieldSize]", inputs: ["tuiTextfieldSize"] }, { kind: "directive", type: i3$1.TuiTextfieldPostfixDirective, selector: "[tuiTextfieldPostfix]", inputs: ["tuiTextfieldPostfix"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3$1.TuiHintDirective, selector: "[tuiHint]:not(ng-container)", inputs: ["tuiHint", "tuiHintContext", "tuiHintAppearance"] }, { kind: "directive", type: i3$1.TuiHintDriverDirective, selector: "[tuiHint]" }, { kind: "directive", type: i3$1.TuiHintHoverDirective, selector: "[tuiHint]:not(ng-container)", inputs: ["tuiHintShowDelay", "tuiHintHideDelay"], exportAs: ["tuiHintHover"] }, { kind: "directive", type: i3$1.TuiHintPositionDirective, selector: "[tuiHint]:not([tuiHintCustomPosition])", inputs: ["tuiHintDirection"] }, { kind: "directive", type: i3$1.TuiModeDirective, selector: "[tuiMode]", inputs: ["tuiMode"] }, { kind: "component", type: i3$1.TuiLoaderComponent, selector: "tui-loader", inputs: ["size", "inheritColor", "overlay", "textContent", "showLoader"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }, { kind: "pipe", type: i3$2.TuiFieldErrorPipe, name: "tuiFieldError" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
434
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScInputQuantityComponent, decorators: [{
|
435
|
+
type: Component,
|
436
|
+
args: [{ selector: 'sc-input-quantity', changeDetection: ChangeDetectionStrategy.OnPush, template: "<tui-loader *ngIf=\"formControl\" class=\"w-full\" [overlay]=\"true\" [showLoader]=\"showLoader\" [size]=\"size\">\n <div class=\"flex items-center text-center gap-1\">\n <div class=\"field-with-button flex grow rounded-xl\">\n <button\n tuiIconButton\n tuiMode=\"onLight\"\n [appearance]=\"appearance\"\n [disabled]=\"!numberInput.canDecrement\"\n [focusable]=\"false\"\n [size]=\"size\"\n (click.prevent)=\"decrement()\"\n (mousedown.prevent)=\"numberInput.nativeFocusableElement?.focus()\"\n >\n <tui-svg src=\"scIconMinus\"></tui-svg>\n </button>\n <tui-input-number\n #numberInput\n [formControl]=\"formControl\"\n [tuiHint]=\"([] | tuiFieldError | async )?.message\"\n [tuiTextfieldPostfix]=\"quantityUnit || ''\"\n [tuiTextfieldLabelOutside]=\"true\"\n [min]=\"step\"\n [tuiTextfieldSize]=\"size\"\n [required]=\"true\"\n [style.text-align]=\"'center'\"\n [style.font-weight]=\"700\"\n class=\"grow\"\n >\n </tui-input-number>\n <button\n tuiIconButton\n tuiMode=\"onLight\"\n [appearance]=\"appearance\"\n [size]=\"size\"\n [disabled]=\"!numberInput.canIncrement\"\n [focusable]=\"false\"\n (click.prevent)=\"incident()\"\n (mousedown.prevent)=\"numberInput.nativeFocusableElement?.focus()\"\n >\n <tui-svg src=\"scIconPlus\"></tui-svg>\n </button>\n </div>\n <button\n *ngIf=\"showCross\"\n tuiIconButton\n tuiMode=\"onLight\"\n [appearance]=\"appearance\"\n [size]=\"size\"\n [disabled]=\"!numberInput.canIncrement\"\n [focusable]=\"false\"\n (click.prevent)=\"clear()\"\n (mousedown.prevent)=\"numberInput.nativeFocusableElement?.focus()\"\n >\n <tui-svg src=\"scIconCross\"></tui-svg>\n </button>\n </div>\n</tui-loader>\n", styles: [":host [data-size=l]{--tui-height-l: var(--tui-height-m);--tui-font-text-m: bold .875rem/1.25rem var(--tui-font-text);--tui-padding-l: 0}:host [data-size=m]{--tui-height-m: var(--tui-height-s);--tui-font-text-s: bold .75rem/1rem var(--tui-font-text);--tui-padding-m: 0}:host [data-size=m] tui-svg{font-size:12px!important}:host [data-size=s]{--tui-height-s: var(--tui-height-xs);--tui-font-text-s: bold .75rem/1rem var(--tui-font-text);--tui-padding-s: 0}:host [data-size=s] tui-svg{font-size:12px!important}:host[data-disabled=true]{pointer-events:none;opacity:var(--tui-disabled-opacity)}:host[data-appearance=secondary] .field-with-button{background-color:var(--tui-base-01);box-shadow:inset 0 0 0 .0625rem var(--tui-base-03)}:host[data-appearance=primary] .field-with-button{background-color:var(--tui-warning-bg)}:host .field-with-button:has(._invalid){background-color:var(--tui-error-bg)}\n"] }]
|
437
|
+
}], ctorParameters: function () { return [{ type: i4.NgControl, decorators: [{
|
438
|
+
type: Optional
|
439
|
+
}, {
|
440
|
+
type: Self
|
441
|
+
}, {
|
442
|
+
type: Inject,
|
443
|
+
args: [NgControl]
|
444
|
+
}] }, { type: i0.ChangeDetectorRef, decorators: [{
|
445
|
+
type: Inject,
|
446
|
+
args: [ChangeDetectorRef]
|
447
|
+
}] }, { type: i7.AbstractTuiValueTransformer, decorators: [{
|
448
|
+
type: Optional
|
449
|
+
}, {
|
450
|
+
type: Inject,
|
451
|
+
args: [TUI_NUMBER_VALUE_TRANSFORMER]
|
452
|
+
}] }]; }, propDecorators: { numberInput: [{
|
453
|
+
type: ViewChild,
|
454
|
+
args: [TuiInputNumberComponent]
|
455
|
+
}], step: [{
|
456
|
+
type: Input
|
457
|
+
}], quantityUnit: [{
|
458
|
+
type: Input
|
459
|
+
}], showLoader: [{
|
460
|
+
type: Input
|
461
|
+
}], showCross: [{
|
462
|
+
type: Input
|
463
|
+
}], appearance: [{
|
464
|
+
type: Input
|
465
|
+
}, {
|
466
|
+
type: HostBinding,
|
467
|
+
args: ['attr.data-appearance']
|
468
|
+
}], isDisabled: [{
|
469
|
+
type: Input
|
470
|
+
}, {
|
471
|
+
type: HostBinding,
|
472
|
+
args: ['attr.data-disabled']
|
473
|
+
}], size: [{
|
474
|
+
type: Input
|
475
|
+
}, {
|
476
|
+
type: HostBinding,
|
477
|
+
args: ['attr.data-size']
|
478
|
+
}], clickClearEvent: [{
|
479
|
+
type: Output
|
480
|
+
}], onArrow: [{
|
481
|
+
type: HostListener,
|
482
|
+
args: ['keydown.arrowDown', ['-step']]
|
483
|
+
}, {
|
484
|
+
type: HostListener,
|
485
|
+
args: ['keydown.arrowUp', ['step']]
|
486
|
+
}] } });
|
487
|
+
|
488
|
+
/**
|
489
|
+
* Компонент информации о наличии товара на складе.
|
490
|
+
*/
|
491
|
+
class ScPriceWarehouseStockComponent {
|
492
|
+
/**
|
493
|
+
* Инициализирует экземпляр класса {@link ScPriceWarehouseStockComponent}.
|
494
|
+
*
|
495
|
+
* @param warehouseService Сервис для работы со складами.
|
496
|
+
*/
|
497
|
+
constructor(warehouseService) {
|
498
|
+
this.warehouseService = warehouseService;
|
499
|
+
/**
|
500
|
+
* Признак, что необходимо отобразить подсказку по складам.
|
501
|
+
*/
|
502
|
+
this.withStockHint = true;
|
503
|
+
/**
|
504
|
+
* {@link Observable} изменения выбранного склада.
|
505
|
+
*/
|
506
|
+
this.warehouseSelect$ = this.warehouseService.getWarehouseSelectChange$();
|
507
|
+
/**
|
508
|
+
* {@link Observable} изменения списка складов.
|
509
|
+
*/
|
510
|
+
this.stockByWarehouses$ = this.warehouseSelect$.pipe(switchMap((warehouseSelect) => this.warehouseService.getWarehouses$().pipe(map((warehouses) => this.product.warehouseStockCount?.map((stock) => [warehouses.find((warehouse) => warehouse.id === stock.id), stock])), map((stockByWarehouses) => stockByWarehouses?.sort((stock) => (stock[0]?.id === warehouseSelect?.id ? -1 : 1))))));
|
511
|
+
}
|
512
|
+
}
|
513
|
+
ScPriceWarehouseStockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceWarehouseStockComponent, deps: [{ token: i1.ScWarehouseService }], target: i0.ɵɵFactoryTarget.Component });
|
514
|
+
ScPriceWarehouseStockComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScPriceWarehouseStockComponent, selector: "sc-price-warehouse-stock", inputs: { classList: "classList", product: "product", withStockHint: "withStockHint" }, ngImport: i0, template: "<ng-container *ngIf=\"product\">\n <ng-container>\n <div *ngIf=\"warehouseSelect$ | async as warehouseSelect\" class=\"flex items-center gap-1\">\n <span *ngIf=\"product.getNotStockMessage(warehouseSelect) as message\" class=\"text-xs min-w-2/5 text-tui-error-fill\" [ngClass]=\"classList\"> {{ message }} </span>\n <span *ngIf=\"product.isWarehouseStockExist(warehouseSelect.id)\" class=\"text-xs min-w-2/5 text-tui-success-fill\" [ngClass]=\"classList\">\n \u0412 \u043D\u0430\u043B\u0438\u0447\u0438\u0438<ng-container *ngIf=\"product.getWarehouseStockCount(warehouseSelect.id) as count\"\n >:\n <span class=\"whitespace-nowrap\">{{ count }} {{ product.quantityUnit }}</span>\n </ng-container>\n </span>\n <span *ngIf=\"product.onOrder\" class=\"text-xs min-w-2/5 text-sc-yellow\" [ngClass]=\"classList\">\u041F\u043E\u0434 \u0437\u0430\u043A\u0430\u0437</span>\n\n <tui-svg\n *ngIf=\"withStockHint && (stockByWarehouses$ | async)?.length\"\n src=\"tuiIconInfoLarge\"\n [tuiHint]=\"stockHint\"\n [tuiHintShowDelay]=\"100\"\n tuiHintDirection=\"top\"\n class=\"!text-xs !h-3\"\n ></tui-svg>\n </div>\n </ng-container>\n</ng-container>\n\n<ng-template #stockHint>\n <table *ngIf=\"warehouseSelect$ | async as warehouseSelect\" class=\"text-xs table-auto\" [ngClass]=\"classList\">\n <tbody>\n <tr *ngFor=\"let item of stockByWarehouses$ | async\" class=\"border-b\" [class.text-tui-primary]=\"warehouseSelect === item[0]\">\n <ng-container>\n <td class=\"px-1\">{{ item[0]?.name }}:</td>\n <td class=\"px-1\">{{ item[1].count ? item[1].count + ' ' + product.quantityUnit : '\u0412 \u043D\u0430\u043B\u0438\u0447\u0438\u0438' }}</td>\n </ng-container>\n </tr>\n </tbody>\n </table>\n</ng-template>\n", styles: ["[tuiIconButton]{--tui-radius-m: .75rem;--tui-height-xs: 1.25rem}\n"], dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }, { kind: "directive", type: i3$1.TuiHintDirective, selector: "[tuiHint]:not(ng-container)", inputs: ["tuiHint", "tuiHintContext", "tuiHintAppearance"] }, { kind: "directive", type: i3$1.TuiHintDriverDirective, selector: "[tuiHint]" }, { kind: "directive", type: i3$1.TuiHintHoverDirective, selector: "[tuiHint]:not(ng-container)", inputs: ["tuiHintShowDelay", "tuiHintHideDelay"], exportAs: ["tuiHintHover"] }, { kind: "directive", type: i3$1.TuiHintPositionDirective, selector: "[tuiHint]:not([tuiHintCustomPosition])", inputs: ["tuiHintDirection"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
515
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceWarehouseStockComponent, decorators: [{
|
516
|
+
type: Component,
|
517
|
+
args: [{ selector: 'sc-price-warehouse-stock', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"product\">\n <ng-container>\n <div *ngIf=\"warehouseSelect$ | async as warehouseSelect\" class=\"flex items-center gap-1\">\n <span *ngIf=\"product.getNotStockMessage(warehouseSelect) as message\" class=\"text-xs min-w-2/5 text-tui-error-fill\" [ngClass]=\"classList\"> {{ message }} </span>\n <span *ngIf=\"product.isWarehouseStockExist(warehouseSelect.id)\" class=\"text-xs min-w-2/5 text-tui-success-fill\" [ngClass]=\"classList\">\n \u0412 \u043D\u0430\u043B\u0438\u0447\u0438\u0438<ng-container *ngIf=\"product.getWarehouseStockCount(warehouseSelect.id) as count\"\n >:\n <span class=\"whitespace-nowrap\">{{ count }} {{ product.quantityUnit }}</span>\n </ng-container>\n </span>\n <span *ngIf=\"product.onOrder\" class=\"text-xs min-w-2/5 text-sc-yellow\" [ngClass]=\"classList\">\u041F\u043E\u0434 \u0437\u0430\u043A\u0430\u0437</span>\n\n <tui-svg\n *ngIf=\"withStockHint && (stockByWarehouses$ | async)?.length\"\n src=\"tuiIconInfoLarge\"\n [tuiHint]=\"stockHint\"\n [tuiHintShowDelay]=\"100\"\n tuiHintDirection=\"top\"\n class=\"!text-xs !h-3\"\n ></tui-svg>\n </div>\n </ng-container>\n</ng-container>\n\n<ng-template #stockHint>\n <table *ngIf=\"warehouseSelect$ | async as warehouseSelect\" class=\"text-xs table-auto\" [ngClass]=\"classList\">\n <tbody>\n <tr *ngFor=\"let item of stockByWarehouses$ | async\" class=\"border-b\" [class.text-tui-primary]=\"warehouseSelect === item[0]\">\n <ng-container>\n <td class=\"px-1\">{{ item[0]?.name }}:</td>\n <td class=\"px-1\">{{ item[1].count ? item[1].count + ' ' + product.quantityUnit : '\u0412 \u043D\u0430\u043B\u0438\u0447\u0438\u0438' }}</td>\n </ng-container>\n </tr>\n </tbody>\n </table>\n</ng-template>\n", styles: ["[tuiIconButton]{--tui-radius-m: .75rem;--tui-height-xs: 1.25rem}\n"] }]
|
518
|
+
}], ctorParameters: function () { return [{ type: i1.ScWarehouseService }]; }, propDecorators: { classList: [{
|
519
|
+
type: Input
|
520
|
+
}], product: [{
|
521
|
+
type: Input
|
522
|
+
}], withStockHint: [{
|
523
|
+
type: Input
|
524
|
+
}] } });
|
525
|
+
|
526
|
+
/**
|
527
|
+
* Компонент карточки элемента корзины.
|
528
|
+
*/
|
529
|
+
class ScCartItemMobileComponent {
|
530
|
+
/**
|
531
|
+
* Инициирует экземпляр класса {@link ScCartItemMobileComponent}.
|
532
|
+
*
|
533
|
+
* @param unitsHelper Объект-хэлпер для работы со значениями единиц измерения товара.
|
534
|
+
* @param previewDialogService Сервис диалогового окна предварительного просмотра.
|
535
|
+
* @param urls Список ссылок на разделы backend'a.
|
536
|
+
* @param pathImageNotFound Путь до изображения 'Товар не найден'.
|
537
|
+
*/
|
538
|
+
constructor(unitsHelper, previewDialogService, urls, pathImageNotFound) {
|
539
|
+
this.unitsHelper = unitsHelper;
|
540
|
+
this.previewDialogService = previewDialogService;
|
541
|
+
this.urls = urls;
|
542
|
+
this.pathImageNotFound = pathImageNotFound;
|
543
|
+
/**
|
544
|
+
* {@link FormControl} поля ввода количества товара в корзине.
|
545
|
+
*/
|
546
|
+
this.quantityControl = new FormControl(0);
|
547
|
+
/**
|
548
|
+
* {@link Observable} изменения количества товара в корзине.
|
549
|
+
*/
|
550
|
+
this.quantityValueChanges = this.quantityControl.valueChanges.pipe(skip(1));
|
551
|
+
/**
|
552
|
+
* Событие нажатия на кнопку "Удалить из корзины".
|
553
|
+
*/
|
554
|
+
this.clickDeleteEvent = new EventEmitter();
|
555
|
+
/**
|
556
|
+
* Событие нажатия на кнопку "Удалить из корзины".
|
557
|
+
*/
|
558
|
+
this.clickSettingsEvent = new EventEmitter();
|
559
|
+
/**
|
560
|
+
* Событие нажатия на карточку.
|
561
|
+
*/
|
562
|
+
this.clickCardEvent = new EventEmitter();
|
563
|
+
}
|
564
|
+
/**
|
565
|
+
* Элемент корзины.
|
566
|
+
*/
|
567
|
+
set cartItem(data) {
|
568
|
+
this._cartItem = data;
|
569
|
+
if (data) {
|
570
|
+
this.quantityControl.patchValue(data.quantity);
|
571
|
+
}
|
572
|
+
}
|
573
|
+
/**
|
574
|
+
* Элемент корзины.
|
575
|
+
*/
|
576
|
+
get cartItem() {
|
577
|
+
return this._cartItem;
|
578
|
+
}
|
579
|
+
/**
|
580
|
+
* Продукт элемента корзины.
|
581
|
+
*/
|
582
|
+
get product() {
|
583
|
+
return this.cartItem?.product;
|
584
|
+
}
|
585
|
+
/** @inheritDoc */
|
586
|
+
ngOnInit() {
|
587
|
+
this.quantityValueChanges = this.quantityControl.valueChanges;
|
588
|
+
}
|
589
|
+
/**
|
590
|
+
* Отобразить спецификацию.
|
591
|
+
*/
|
592
|
+
showSpecification() {
|
593
|
+
this.previewDialogService.open(this.specificationPreviewRef || '').subscribe();
|
594
|
+
}
|
595
|
+
/**
|
596
|
+
* Возвращает ссылку на изображение карточки товара.
|
597
|
+
*/
|
598
|
+
getCardImage() {
|
599
|
+
return this.product?.getImage(this.urls.imgServerUrl) ?? this.urls.imgServerUrl + this.pathImageNotFound;
|
600
|
+
}
|
601
|
+
}
|
602
|
+
ScCartItemMobileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCartItemMobileComponent, deps: [{ token: UnitsHelper }, { token: TuiPreviewDialogService }, { token: SC_URLS }, { token: SC_PATH_IMAGE_NOT_FOUND }], target: i0.ɵɵFactoryTarget.Component });
|
603
|
+
ScCartItemMobileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScCartItemMobileComponent, selector: "sc-cart-item-mobile", inputs: { cartItem: "cartItem" }, outputs: { quantityValueChanges: "quantityValueChanges", clickDeleteEvent: "clickDeleteEvent", clickSettingsEvent: "clickSettingsEvent", clickCardEvent: "clickCardEvent" }, viewQueries: [{ propertyName: "specificationPreviewRef", first: true, predicate: ["specificationPreview"], descendants: true }], ngImport: i0, template: "<div class=\"ml-2 mt-2 relative p-4 gap-y-2 gap-x-4 flex flex-wrap bg-white border border-tui-base-04 shadow-sc-2 rounded-xl\">\n <ng-container *ngIf=\"cartItem && product; else skeleton\">\n <!--\n TODO: \u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u0430 \u0440\u0435\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u0444\u0443\u043D\u043A\u0446\u0438\u043E\u043D\u0430\u043B\u0430.\n <button tuiIconButton size=\"m\" icon=\"scIconVerticalThreeDots\" appearance=\"float\" tuiMode=\"onLight\" class=\"!absolute right-0 top-0\"></button>\n -->\n <button\n tuiIconButton\n size=\"m\"\n icon=\"scIconBasket\"\n appearance=\"secondary\"\n tuiMode=\"onLight\"\n (click)=\"clickDeleteEvent.emit()\"\n class=\"shadow-sc-2 !absolute -left-2 -top-2\"\n ></button>\n <div class=\"flex gap-2\">\n <div class=\"flex shrink-0 h-20 w-20 justify-center items-center overflow-hidden\">\n <img (click)=\"clickCardEvent.emit()\" [src]=\"getCardImage()\" [alt]=\"product.name\" [class.p-5]=\"!product.images?.length\" class=\"cursor-pointer\" />\n </div>\n\n <div class=\"flex flex-wrap self-center gap-x-8 gap-y-0.5\">\n <div class=\"w-[13rem]\">\n <a tuiLink (click)=\"clickCardEvent.emit()\">\n <span class=\"font-bold\">{{ product.name }}</span>\n </a>\n <div class=\"text-tui-text-02 text-xs\">\n <p>\u0410\u0440\u0442\u0438\u043A\u0443\u043B: {{ product.code }}</p>\n <p *ngIf=\"product.pack\">\u041D\u043E\u0440\u043C\u0430 \u0443\u043F\u0430\u043A\u043E\u0432\u043A\u0438: {{ product.pack }}</p>\n <a tuiLink *ngIf=\"cartItem.specificationImgUrl\" (click)=\"showSpecification()\">\u0421\u043F\u0435\u0446\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F</a>\n <ng-template #specificationPreview let-preview>\n <tui-preview [rotatable]=\"false\" [zoomable]=\"false\">\n <img *polymorpheusOutlet=\"cartItem.specificationImgUrl as src\" alt=\"preview\" [src]=\"cartItem.specificationImgUrl\" />\n <button icon=\"tuiIconClose\" title=\"Close\" tuiIconButton tuiPreviewAction type=\"button\" (click)=\"preview.complete()\"></button>\n </tui-preview>\n </ng-template>\n </div>\n </div>\n <div class=\"flex flex-col self-center w-[10rem] gap-x-8 gap-y-0.5\">\n <span *ngIf=\"product.discount\" class=\"flex items-center text-xs text-tui-text-02\">\n <span class=\"line-through\">{{ product.discountCostString }}</span> \n <span class=\"text-tui-success-fill font-bold\"> -{{ product.discount.percent }}% </span>\n <tui-svg src=\"tuiIconInfoLarge\" [tuiHint]=\"discountHint\" [tuiHintShowDelay]=\"100\" tuiHintDirection=\"top\" class=\"text-black !text-xs !h-4\"></tui-svg>\n <ng-template #discountHint>\n <div class=\"font-bold\">{{ product.discount.name }}</div>\n <div *ngIf=\"product.discount.expiredAt as expiredAt\">\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F: {{ expiredAt }}</div>\n </ng-template>\n </span>\n <p class=\"flex flex-col items-baseline gap-x-2 font-bold\">\n <span>{{ product.costRubString }}</span>\n <span *ngIf=\"!product.priceInRub\" class=\"text-xs text-tui-text-02\">{{ product.costString }}</span>\n </p>\n <sc-price-warehouse-stock [product]=\"product\"></sc-price-warehouse-stock>\n </div>\n </div>\n </div>\n\n <div class=\"flex gap-2 items-center w-44 text-xs text-tui-text-02\">\n <!--\n TODO: \u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u0430 \u0440\u0435\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u0444\u0443\u043D\u043A\u0446\u0438\u043E\u043D\u0430\u043B\u0430.\n <button tuiIconButton (click)=\"clickSettingsEvent.emit()\" size=\"m\" icon=\"scIconSettings\" appearance=\"secondary\" tuiMode=\"onLight\"></button>\n -->\n <div>\n <ng-container *ngIf=\"unitsHelper.productIsMeasurable(product); else notMeasurable\">\n <p>\u0414\u043B\u0438\u043D\u0430: {{ cartItem.length }} {{ product.unit }}</p>\n </ng-container>\n <ng-template #notMeasurable>\n <p *ngIf=\"cartItem.length && !unitsHelper.productIsMeasurable(product)\">\u0414\u043B\u0438\u043D\u0430: {{ cartItem.length }} \u043C.</p>\n <p *ngIf=\"cartItem.width\">\u0428\u0438\u0440\u0438\u043D\u0430: {{ cartItem.width }} \u043C.</p>\n <p *ngIf=\"cartItem.height\">\u0412\u044B\u0441\u043E\u0442\u0430: {{ cartItem.height }} \u043C.</p>\n </ng-template>\n </div>\n </div>\n <div class=\"flex items-center grow justify-end\">\n <sc-input-quantity\n class=\"w-28\"\n *ngIf=\"quantityControl\"\n [formControl]=\"quantityControl\"\n [quantityUnit]=\"product.quantityUnit\"\n [showCross]=\"false\"\n size=\"s\"\n [step]=\"unitsHelper.productMultiplicity(product)\"\n ></sc-input-quantity>\n </div>\n </ng-container>\n\n <ng-template #skeleton>\n <div class=\"flex gap-2 w-full\">\n <div class=\"h-20 w-20 bg-tui-base-02 rounded-xl \"></div>\n <div class=\"flex flex-col grow gap-2.5 bg-white\">\n <div class=\"w-full h-4 rounded-xl bg-tui-base-02\"></div>\n <div class=\"w-3/5 h-4 rounded-xl bg-tui-base-02\"></div>\n <div class=\"w-4/5 h-4 rounded-xl bg-tui-base-02\"></div>\n </div>\n </div>\n </ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.TuiLinkComponent, selector: "a[tuiLink], button[tuiLink]", inputs: ["pseudo", "icon", "iconAlign", "iconRotated", "mode"], exportAs: ["tuiLink"] }, { kind: "component", type: ScInputQuantityComponent, selector: "sc-input-quantity", inputs: ["step", "quantityUnit", "showLoader", "showCross", "appearance", "isDisabled", "size"], outputs: ["clickClearEvent"] }, { kind: "component", type: ScPriceWarehouseStockComponent, selector: "sc-price-warehouse-stock", inputs: ["classList", "product", "withStockHint"] }, { kind: "component", type: i3$1.TuiButtonComponent, selector: "button[tuiButton], button[tuiIconButton], a[tuiButton], a[tuiIconButton]", inputs: ["appearance", "disabled", "icon", "iconRight", "shape", "showLoader", "size"] }, { kind: "directive", type: i3$1.TuiModeDirective, selector: "[tuiMode]", inputs: ["tuiMode"] }, { kind: "component", type: i3$1.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }, { kind: "directive", type: i3$1.TuiHintDirective, selector: "[tuiHint]:not(ng-container)", inputs: ["tuiHint", "tuiHintContext", "tuiHintAppearance"] }, { kind: "directive", type: i3$1.TuiHintDriverDirective, selector: "[tuiHint]" }, { kind: "directive", type: i3$1.TuiHintHoverDirective, selector: "[tuiHint]:not(ng-container)", inputs: ["tuiHintShowDelay", "tuiHintHideDelay"], exportAs: ["tuiHintHover"] }, { kind: "directive", type: i3$1.TuiHintPositionDirective, selector: "[tuiHint]:not([tuiHintCustomPosition])", inputs: ["tuiHintDirection"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "component", type: i7$1.TuiPreviewComponent, selector: "tui-preview", inputs: ["zoomable", "rotatable"] }, { kind: "directive", type: i7$1.TuiPreviewActionDirective, selector: "[tuiPreviewAction]" }, { kind: "directive", type: i8$1.PolymorpheusOutletDirective, selector: "[polymorpheusOutlet]", inputs: ["polymorpheusOutlet", "polymorpheusOutletContext"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
604
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCartItemMobileComponent, decorators: [{
|
605
|
+
type: Component,
|
606
|
+
args: [{ selector: 'sc-cart-item-mobile', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"ml-2 mt-2 relative p-4 gap-y-2 gap-x-4 flex flex-wrap bg-white border border-tui-base-04 shadow-sc-2 rounded-xl\">\n <ng-container *ngIf=\"cartItem && product; else skeleton\">\n <!--\n TODO: \u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u0430 \u0440\u0435\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u0444\u0443\u043D\u043A\u0446\u0438\u043E\u043D\u0430\u043B\u0430.\n <button tuiIconButton size=\"m\" icon=\"scIconVerticalThreeDots\" appearance=\"float\" tuiMode=\"onLight\" class=\"!absolute right-0 top-0\"></button>\n -->\n <button\n tuiIconButton\n size=\"m\"\n icon=\"scIconBasket\"\n appearance=\"secondary\"\n tuiMode=\"onLight\"\n (click)=\"clickDeleteEvent.emit()\"\n class=\"shadow-sc-2 !absolute -left-2 -top-2\"\n ></button>\n <div class=\"flex gap-2\">\n <div class=\"flex shrink-0 h-20 w-20 justify-center items-center overflow-hidden\">\n <img (click)=\"clickCardEvent.emit()\" [src]=\"getCardImage()\" [alt]=\"product.name\" [class.p-5]=\"!product.images?.length\" class=\"cursor-pointer\" />\n </div>\n\n <div class=\"flex flex-wrap self-center gap-x-8 gap-y-0.5\">\n <div class=\"w-[13rem]\">\n <a tuiLink (click)=\"clickCardEvent.emit()\">\n <span class=\"font-bold\">{{ product.name }}</span>\n </a>\n <div class=\"text-tui-text-02 text-xs\">\n <p>\u0410\u0440\u0442\u0438\u043A\u0443\u043B: {{ product.code }}</p>\n <p *ngIf=\"product.pack\">\u041D\u043E\u0440\u043C\u0430 \u0443\u043F\u0430\u043A\u043E\u0432\u043A\u0438: {{ product.pack }}</p>\n <a tuiLink *ngIf=\"cartItem.specificationImgUrl\" (click)=\"showSpecification()\">\u0421\u043F\u0435\u0446\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F</a>\n <ng-template #specificationPreview let-preview>\n <tui-preview [rotatable]=\"false\" [zoomable]=\"false\">\n <img *polymorpheusOutlet=\"cartItem.specificationImgUrl as src\" alt=\"preview\" [src]=\"cartItem.specificationImgUrl\" />\n <button icon=\"tuiIconClose\" title=\"Close\" tuiIconButton tuiPreviewAction type=\"button\" (click)=\"preview.complete()\"></button>\n </tui-preview>\n </ng-template>\n </div>\n </div>\n <div class=\"flex flex-col self-center w-[10rem] gap-x-8 gap-y-0.5\">\n <span *ngIf=\"product.discount\" class=\"flex items-center text-xs text-tui-text-02\">\n <span class=\"line-through\">{{ product.discountCostString }}</span> \n <span class=\"text-tui-success-fill font-bold\"> -{{ product.discount.percent }}% </span>\n <tui-svg src=\"tuiIconInfoLarge\" [tuiHint]=\"discountHint\" [tuiHintShowDelay]=\"100\" tuiHintDirection=\"top\" class=\"text-black !text-xs !h-4\"></tui-svg>\n <ng-template #discountHint>\n <div class=\"font-bold\">{{ product.discount.name }}</div>\n <div *ngIf=\"product.discount.expiredAt as expiredAt\">\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F: {{ expiredAt }}</div>\n </ng-template>\n </span>\n <p class=\"flex flex-col items-baseline gap-x-2 font-bold\">\n <span>{{ product.costRubString }}</span>\n <span *ngIf=\"!product.priceInRub\" class=\"text-xs text-tui-text-02\">{{ product.costString }}</span>\n </p>\n <sc-price-warehouse-stock [product]=\"product\"></sc-price-warehouse-stock>\n </div>\n </div>\n </div>\n\n <div class=\"flex gap-2 items-center w-44 text-xs text-tui-text-02\">\n <!--\n TODO: \u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u0430 \u0440\u0435\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u044F \u0444\u0443\u043D\u043A\u0446\u0438\u043E\u043D\u0430\u043B\u0430.\n <button tuiIconButton (click)=\"clickSettingsEvent.emit()\" size=\"m\" icon=\"scIconSettings\" appearance=\"secondary\" tuiMode=\"onLight\"></button>\n -->\n <div>\n <ng-container *ngIf=\"unitsHelper.productIsMeasurable(product); else notMeasurable\">\n <p>\u0414\u043B\u0438\u043D\u0430: {{ cartItem.length }} {{ product.unit }}</p>\n </ng-container>\n <ng-template #notMeasurable>\n <p *ngIf=\"cartItem.length && !unitsHelper.productIsMeasurable(product)\">\u0414\u043B\u0438\u043D\u0430: {{ cartItem.length }} \u043C.</p>\n <p *ngIf=\"cartItem.width\">\u0428\u0438\u0440\u0438\u043D\u0430: {{ cartItem.width }} \u043C.</p>\n <p *ngIf=\"cartItem.height\">\u0412\u044B\u0441\u043E\u0442\u0430: {{ cartItem.height }} \u043C.</p>\n </ng-template>\n </div>\n </div>\n <div class=\"flex items-center grow justify-end\">\n <sc-input-quantity\n class=\"w-28\"\n *ngIf=\"quantityControl\"\n [formControl]=\"quantityControl\"\n [quantityUnit]=\"product.quantityUnit\"\n [showCross]=\"false\"\n size=\"s\"\n [step]=\"unitsHelper.productMultiplicity(product)\"\n ></sc-input-quantity>\n </div>\n </ng-container>\n\n <ng-template #skeleton>\n <div class=\"flex gap-2 w-full\">\n <div class=\"h-20 w-20 bg-tui-base-02 rounded-xl \"></div>\n <div class=\"flex flex-col grow gap-2.5 bg-white\">\n <div class=\"w-full h-4 rounded-xl bg-tui-base-02\"></div>\n <div class=\"w-3/5 h-4 rounded-xl bg-tui-base-02\"></div>\n <div class=\"w-4/5 h-4 rounded-xl bg-tui-base-02\"></div>\n </div>\n </div>\n </ng-template>\n</div>\n" }]
|
607
|
+
}], ctorParameters: function () { return [{ type: UnitsHelper }, { type: i7$1.TuiPreviewDialogService, decorators: [{
|
608
|
+
type: Inject,
|
609
|
+
args: [TuiPreviewDialogService]
|
610
|
+
}] }, { type: undefined, decorators: [{
|
611
|
+
type: Inject,
|
612
|
+
args: [SC_URLS]
|
613
|
+
}] }, { type: undefined, decorators: [{
|
614
|
+
type: Inject,
|
615
|
+
args: [SC_PATH_IMAGE_NOT_FOUND]
|
616
|
+
}] }]; }, propDecorators: { specificationPreviewRef: [{
|
617
|
+
type: ViewChild,
|
618
|
+
args: ['specificationPreview']
|
619
|
+
}], cartItem: [{
|
620
|
+
type: Input
|
621
|
+
}], quantityValueChanges: [{
|
622
|
+
type: Output
|
623
|
+
}], clickDeleteEvent: [{
|
624
|
+
type: Output
|
625
|
+
}], clickSettingsEvent: [{
|
626
|
+
type: Output
|
627
|
+
}], clickCardEvent: [{
|
628
|
+
type: Output
|
629
|
+
}] } });
|
630
|
+
|
631
|
+
// TODO: TASK[#6771]: Реализовать кнопку избранных товаров.
|
632
|
+
/**
|
633
|
+
* Компонент кнопки избранных товаров и категорий.
|
634
|
+
*/
|
635
|
+
class ScFavoriteBtnComponent {
|
636
|
+
constructor() {
|
637
|
+
/**
|
638
|
+
* Событие нажатия на кнопку.
|
639
|
+
*/
|
640
|
+
this.clickEvent = new EventEmitter();
|
641
|
+
}
|
642
|
+
}
|
643
|
+
ScFavoriteBtnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScFavoriteBtnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
644
|
+
ScFavoriteBtnComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScFavoriteBtnComponent, selector: "sc-favorite-btn", outputs: { clickEvent: "clickEvent" }, ngImport: i0, template: "<button tuiIconButton (click)=\"clickEvent.emit()\" appearance=\"flat\" size=\"s\">\n <tui-svg class=\"text-tui-primary\" src=\"tuiIconBookmarkLarge\"></tui-svg>\n</button>\n", dependencies: [{ kind: "component", type: i3$1.TuiButtonComponent, selector: "button[tuiButton], button[tuiIconButton], a[tuiButton], a[tuiIconButton]", inputs: ["appearance", "disabled", "icon", "iconRight", "shape", "showLoader", "size"] }, { kind: "component", type: i3$1.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
645
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScFavoriteBtnComponent, decorators: [{
|
646
|
+
type: Component,
|
647
|
+
args: [{ selector: 'sc-favorite-btn', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button tuiIconButton (click)=\"clickEvent.emit()\" appearance=\"flat\" size=\"s\">\n <tui-svg class=\"text-tui-primary\" src=\"tuiIconBookmarkLarge\"></tui-svg>\n</button>\n" }]
|
648
|
+
}], propDecorators: { clickEvent: [{
|
649
|
+
type: Output
|
650
|
+
}] } });
|
651
|
+
|
652
|
+
/**
|
653
|
+
* Карточка категории.
|
654
|
+
*/
|
655
|
+
class ScCategoryCardComponent {
|
656
|
+
/**
|
657
|
+
* Инициализирует экземпляр класса {@link CategoryCardComponent}.
|
658
|
+
*
|
659
|
+
* @param urls Список ссылок на разделы backend'a.
|
660
|
+
* @param renderer Экземпляр базового класса для реализации пользовательского рендеринга.
|
661
|
+
* @param pathImageNotFound Путь до изображения 'Товар не найден'.
|
662
|
+
*/
|
663
|
+
constructor(urls, renderer, pathImageNotFound) {
|
664
|
+
this.urls = urls;
|
665
|
+
this.renderer = renderer;
|
666
|
+
this.pathImageNotFound = pathImageNotFound;
|
667
|
+
/**
|
668
|
+
* Размер карточки категории.
|
669
|
+
*/
|
670
|
+
this.size = 'm';
|
671
|
+
/**
|
672
|
+
* Признак, что карточка является скелетоном.
|
673
|
+
*/
|
674
|
+
this.isSkeleton = false;
|
675
|
+
/**
|
676
|
+
* Признак необходимости отобразить/скрыть кнопку избранной категории.
|
677
|
+
*/
|
678
|
+
this.showFavoriteBtn = true;
|
679
|
+
/**
|
680
|
+
* Признак что категория имеет поведение наведения и скрытия названия.
|
681
|
+
*/
|
682
|
+
this.isHovered = false;
|
683
|
+
/**
|
684
|
+
* Событие нажатия на карточку категории.
|
685
|
+
*/
|
686
|
+
this.clickOnCardEvent = new EventEmitter();
|
687
|
+
/**
|
688
|
+
* Событие нажатия на кнопку избранной категории.
|
689
|
+
*/
|
690
|
+
this.clickOnFavoriteEvent = new EventEmitter();
|
691
|
+
}
|
692
|
+
/**
|
693
|
+
* Возвращает путь к изображению категории. Если путь отсутствует, то вернёт изображение по-умолчанию ("product_not_found").
|
694
|
+
*
|
695
|
+
* @param category Информация о категории.
|
696
|
+
*/
|
697
|
+
getCategoryImgURL(category) {
|
698
|
+
return category.properties?.image ? this.urls.imgServerUrl + '/' + category.properties?.image : this.pathImageNotFound;
|
699
|
+
}
|
700
|
+
/**
|
701
|
+
* Обработчик события mousemove.
|
702
|
+
*/
|
703
|
+
moveEnterHandler() {
|
704
|
+
if (this.isHovered) {
|
705
|
+
this.name.nativeElement.style.maxHeight = `${this.name.nativeElement.scrollHeight / 16}rem`;
|
706
|
+
}
|
707
|
+
}
|
708
|
+
/**
|
709
|
+
* Обработчик события mouseleave.
|
710
|
+
*/
|
711
|
+
mouseLeaveHandler() {
|
712
|
+
if (this.isHovered) {
|
713
|
+
this.renderer.setStyle(this.name.nativeElement, 'maxHeight', null);
|
714
|
+
}
|
715
|
+
}
|
716
|
+
}
|
717
|
+
ScCategoryCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCategoryCardComponent, deps: [{ token: SC_URLS }, { token: i0.Renderer2 }, { token: SC_PATH_IMAGE_NOT_FOUND }], target: i0.ɵɵFactoryTarget.Component });
|
718
|
+
ScCategoryCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScCategoryCardComponent, selector: "sc-category-card", inputs: { category: "category", size: "size", isSkeleton: "isSkeleton", showFavoriteBtn: "showFavoriteBtn", isHovered: "isHovered" }, outputs: { clickOnCardEvent: "clickOnCardEvent", clickOnFavoriteEvent: "clickOnFavoriteEvent" }, host: { listeners: { "mousemove": "moveEnterHandler()", "mouseleave": "mouseLeaveHandler()" }, properties: { "attr.data-size": "this.size" } }, viewQueries: [{ propertyName: "name", first: true, predicate: ["name"], descendants: true }], ngImport: i0, template: "<div class=\"relative group\">\n <button\n (click)=\"clickOnCardEvent.emit(category)\"\n [class.pointer-events-none]=\"!category || isSkeleton\"\n class=\"category-btn flex flex-col relative rounded-tui-radius-m overflow-hidden shadow-sc-2\"\n >\n <div class=\"img-wrapper w-full grow bg-tui-base-02 overflow-hidden\">\n <img *ngIf=\"category && !isSkeleton\" [src]=\"getCategoryImgURL(category)\" [alt]=\"category.name\" class=\"w-full\" />\n </div>\n <div #name [attr.data-is-hovered]=\"!isHovered\" class=\"name grid items-center justify-center font-bold bg-white w-full overflow-hidden shrink-0 duration-300\">\n <span *ngIf=\"category && !isSkeleton; else skeletonName\">{{ category.name }}</span>\n <ng-template #skeletonName>\n <div class=\"skeleton-name bg-tui-base-02 rounded-tui-radius-s\"></div>\n </ng-template>\n </div>\n </button>\n <sc-favorite-btn *ngIf=\"category && !isSkeleton && showFavoriteBtn\" (clickEvent)=\"clickOnFavoriteEvent.emit()\" class=\"absolute left-1 top-1\"></sc-favorite-btn>\n</div>\n", styles: [":host[data-size=m] button.category-btn{width:100%;height:12.5rem}:host[data-size=m] button.category-btn .img-wrapper{max-height:8.75rem}:host[data-size=m] button.category-btn .name{min-height:2.5rem;padding-inline:.75rem;margin-block:.75rem}:host[data-size=m] button.category-btn .name:not([data-is-hovered=true]){max-height:2.5rem}:host[data-size=m] button.category-btn .name .skeleton-name{width:10rem;height:1rem}:host[data-size=s] button.category-btn{width:100%;height:10rem}:host[data-size=s] button.category-btn .img-wrapper{max-height:8.75rem}:host[data-size=s] button.category-btn .name{min-height:2rem;font-size:.75rem;line-height:1rem;padding-inline:.5rem;margin-block:.5rem}:host[data-size=s] button.category-btn .name:not([data-is-hovered=true]){max-height:2rem}:host[data-size=s] button.category-btn .name .skeleton-name{width:7rem;height:.75rem}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: ScFavoriteBtnComponent, selector: "sc-favorite-btn", outputs: ["clickEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
719
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCategoryCardComponent, decorators: [{
|
720
|
+
type: Component,
|
721
|
+
args: [{ selector: 'sc-category-card', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"relative group\">\n <button\n (click)=\"clickOnCardEvent.emit(category)\"\n [class.pointer-events-none]=\"!category || isSkeleton\"\n class=\"category-btn flex flex-col relative rounded-tui-radius-m overflow-hidden shadow-sc-2\"\n >\n <div class=\"img-wrapper w-full grow bg-tui-base-02 overflow-hidden\">\n <img *ngIf=\"category && !isSkeleton\" [src]=\"getCategoryImgURL(category)\" [alt]=\"category.name\" class=\"w-full\" />\n </div>\n <div #name [attr.data-is-hovered]=\"!isHovered\" class=\"name grid items-center justify-center font-bold bg-white w-full overflow-hidden shrink-0 duration-300\">\n <span *ngIf=\"category && !isSkeleton; else skeletonName\">{{ category.name }}</span>\n <ng-template #skeletonName>\n <div class=\"skeleton-name bg-tui-base-02 rounded-tui-radius-s\"></div>\n </ng-template>\n </div>\n </button>\n <sc-favorite-btn *ngIf=\"category && !isSkeleton && showFavoriteBtn\" (clickEvent)=\"clickOnFavoriteEvent.emit()\" class=\"absolute left-1 top-1\"></sc-favorite-btn>\n</div>\n", styles: [":host[data-size=m] button.category-btn{width:100%;height:12.5rem}:host[data-size=m] button.category-btn .img-wrapper{max-height:8.75rem}:host[data-size=m] button.category-btn .name{min-height:2.5rem;padding-inline:.75rem;margin-block:.75rem}:host[data-size=m] button.category-btn .name:not([data-is-hovered=true]){max-height:2.5rem}:host[data-size=m] button.category-btn .name .skeleton-name{width:10rem;height:1rem}:host[data-size=s] button.category-btn{width:100%;height:10rem}:host[data-size=s] button.category-btn .img-wrapper{max-height:8.75rem}:host[data-size=s] button.category-btn .name{min-height:2rem;font-size:.75rem;line-height:1rem;padding-inline:.5rem;margin-block:.5rem}:host[data-size=s] button.category-btn .name:not([data-is-hovered=true]){max-height:2rem}:host[data-size=s] button.category-btn .name .skeleton-name{width:7rem;height:.75rem}\n"] }]
|
722
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
723
|
+
type: Inject,
|
724
|
+
args: [SC_URLS]
|
725
|
+
}] }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
|
726
|
+
type: Inject,
|
727
|
+
args: [SC_PATH_IMAGE_NOT_FOUND]
|
728
|
+
}] }]; }, propDecorators: { category: [{
|
729
|
+
type: Input
|
730
|
+
}], name: [{
|
731
|
+
type: ViewChild,
|
732
|
+
args: ['name']
|
733
|
+
}], size: [{
|
734
|
+
type: Input
|
735
|
+
}, {
|
736
|
+
type: HostBinding,
|
737
|
+
args: ['attr.data-size']
|
738
|
+
}], isSkeleton: [{
|
739
|
+
type: Input
|
740
|
+
}], showFavoriteBtn: [{
|
741
|
+
type: Input
|
742
|
+
}], isHovered: [{
|
743
|
+
type: Input
|
744
|
+
}], clickOnCardEvent: [{
|
745
|
+
type: Output
|
746
|
+
}], clickOnFavoriteEvent: [{
|
747
|
+
type: Output
|
748
|
+
}], moveEnterHandler: [{
|
749
|
+
type: HostListener,
|
750
|
+
args: ['mousemove']
|
751
|
+
}], mouseLeaveHandler: [{
|
752
|
+
type: HostListener,
|
753
|
+
args: ['mouseleave']
|
754
|
+
}] } });
|
755
|
+
|
756
|
+
/**
|
757
|
+
* Компонент карточки товара.
|
758
|
+
*/
|
759
|
+
class ScPriceCardComponent {
|
760
|
+
/**
|
761
|
+
* Инициирует экземпляр класса {@link ScPriceCardComponent}.
|
762
|
+
*
|
763
|
+
* @param unitsHelper Объект-хэлпер для работы со значениями единиц измерения товара.
|
764
|
+
* @param authService Сервис аутентификации пользователей.
|
765
|
+
* @param warehouseService Сервис для работы со складами.
|
766
|
+
* @param urls Список ссылок на разделы backend'a.
|
767
|
+
* @param pathImageNotFound Путь до изображения 'Товар не найден'.
|
768
|
+
*/
|
769
|
+
constructor(unitsHelper, authService, warehouseService, urls, pathImageNotFound) {
|
770
|
+
this.unitsHelper = unitsHelper;
|
771
|
+
this.authService = authService;
|
772
|
+
this.warehouseService = warehouseService;
|
773
|
+
this.urls = urls;
|
774
|
+
this.pathImageNotFound = pathImageNotFound;
|
775
|
+
/**
|
776
|
+
* Признак, что необходимо отобразить лоадер для поля ввода количества товара.
|
777
|
+
*/
|
778
|
+
this.quantityShowLoader = false;
|
779
|
+
/**
|
780
|
+
* Признак, что необходимо отобразить поле ввода количества товара.
|
781
|
+
*/
|
782
|
+
this.showQuantityControl = false;
|
783
|
+
/**
|
784
|
+
* Событие нажатия на кнопку "В избранное".
|
785
|
+
*/
|
786
|
+
this.clickFavoriteEvent = new EventEmitter();
|
787
|
+
/**
|
788
|
+
* Событие нажатия на кнопку "В корзину".
|
789
|
+
*/
|
790
|
+
this.clickAddToCartEvent = new EventEmitter();
|
791
|
+
/**
|
792
|
+
* Событие нажатия на кнопку очистки количества товара.
|
793
|
+
*/
|
794
|
+
this.clickClearEvent = new EventEmitter();
|
795
|
+
/**
|
796
|
+
* Событие нажатия на карточку товара.
|
797
|
+
*/
|
798
|
+
this.clickCardEvent = new EventEmitter();
|
799
|
+
/**
|
800
|
+
* {@link Observable} изменения выбранного склада.
|
801
|
+
*/
|
802
|
+
this.warehouseSelect$ = this.warehouseService.getWarehouseSelectChange$();
|
803
|
+
/**
|
804
|
+
* {@link FormControl} поля ввода количества товара в корзине.
|
805
|
+
*/
|
806
|
+
this.quantityControl = new FormControl(null);
|
807
|
+
/**
|
808
|
+
* {@link Observable} изменения количества товара в корзине.
|
809
|
+
*/
|
810
|
+
this.quantityValueChanges = this.quantityControl.valueChanges;
|
811
|
+
/**
|
812
|
+
* {@link Observable} изменения статуса авторизации.
|
813
|
+
*/
|
814
|
+
this.authStatus$ = this.authService.getAuthChange();
|
815
|
+
/**
|
816
|
+
* Размер компонента.
|
817
|
+
*/
|
818
|
+
this.size = 'm';
|
819
|
+
/**
|
820
|
+
* Признак того, нужно ли компонент растягивать на всю ширину свободного пространства.
|
821
|
+
*/
|
822
|
+
this.isWidthFull = false;
|
823
|
+
}
|
824
|
+
/**
|
825
|
+
* Позиция товара в корзине.
|
826
|
+
*
|
827
|
+
* TODO: Сделать товар в корзине наблюдаемой переменной после реализации TASK:[#7144].
|
828
|
+
*/
|
829
|
+
get cartItem() {
|
830
|
+
return this._cartItem;
|
831
|
+
}
|
832
|
+
/**
|
833
|
+
* Позиция товара в корзине
|
834
|
+
*
|
835
|
+
* TODO: Сделать товар в корзине наблюдаемой переменной после реализации TASK:[#7144].
|
836
|
+
*/
|
837
|
+
set cartItem(value) {
|
838
|
+
this._cartItem = value;
|
839
|
+
this.quantityControl.patchValue(this._cartItem?.quantity ?? null, { emitEvent: false });
|
840
|
+
this.quantityShowLoader = false;
|
841
|
+
}
|
842
|
+
/**
|
843
|
+
* Конвертация размера для компонента sc-input-quantity.
|
844
|
+
* TODO: Решить проблему с функционалом size для разных платформ.
|
845
|
+
*/
|
846
|
+
get getQuantitySize() {
|
847
|
+
return this.size === 'xs' ? 's' : this.size;
|
848
|
+
}
|
849
|
+
/**
|
850
|
+
* Признак, что нужно показать скелетон.
|
851
|
+
*/
|
852
|
+
get skeletonVisible() {
|
853
|
+
return !this.product;
|
854
|
+
}
|
855
|
+
/**
|
856
|
+
* Возвращает ссылку на изображение карточки товара.
|
857
|
+
*/
|
858
|
+
getCardImage() {
|
859
|
+
return this.product?.getImage(this.urls.imgServerUrl) ?? this.pathImageNotFound;
|
860
|
+
}
|
861
|
+
}
|
862
|
+
ScPriceCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceCardComponent, deps: [{ token: UnitsHelper }, { token: i1.ScAuthService }, { token: i1.ScWarehouseService }, { token: SC_URLS }, { token: SC_PATH_IMAGE_NOT_FOUND }], target: i0.ɵɵFactoryTarget.Component });
|
863
|
+
ScPriceCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScPriceCardComponent, selector: "sc-price-card", inputs: { showQuantityControl: "showQuantityControl", cartItem: "cartItem", product: "product", size: "size", isWidthFull: "isWidthFull" }, outputs: { clickFavoriteEvent: "clickFavoriteEvent", clickAddToCartEvent: "clickAddToCartEvent", clickClearEvent: "clickClearEvent", clickCardEvent: "clickCardEvent", quantityValueChanges: "quantityValueChanges" }, host: { properties: { "attr.data-size": "this.size" } }, ngImport: i0, template: "<!-- TODO: \u0440\u0435\u0430\u043B\u0438\u0437\u043E\u0432\u0430\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0439 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442 \u0438 \u0434\u043B\u044F \u0434\u0435\u0441\u043A\u0442\u043E\u043F\u0430 \u0438 \u0434\u043B\u044F \u043C\u043E\u0431\u0438\u043B\u044C\u043D\u043E\u0433\u043E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F. \u0418\u0441\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0432\u0441\u0435 \u0433\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0435 \u0442\u0430\u0439\u0433\u043E\u0432\u0441\u043A\u0438\u0435 \u0441\u0442\u0438\u043B\u0438, \u043F\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0438\u0445 \u0432 \u043F\u043E\u0440\u044F\u0434\u043E\u043A \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u043E \u0441 \u0434\u0438\u0437\u0430\u0439\u043D\u043E\u043C. -->\n<div\n *ngIf=\"product; else skeleton\"\n class=\"h-[17rem] min-w-[10rem] shadow-md w-auto rounded-xl p-2 grid max-h-[17rem] text-[0.75rem] text-left text-tui-text-02\"\n [style.width]=\"isWidthFull\"\n>\n <div class=\"overflow-hidden relative\">\n <img (click)=\"clickCardEvent.emit()\" [src]=\"getCardImage()\" [alt]=\"product.name\" class=\"rounded-xl w-full max-h-full object-cover\" />\n <sc-favorite-btn *ngIf=\"authStatus$ | async\" [class.!block]=\"product.isFavorite\" class=\"top-0 left-0 absolute hidden\"></sc-favorite-btn>\n <tui-svg *ngIf=\"product.isPreviouslyOrdered\" src=\"scIconStar\" class=\"top-0 right-0 absolute hidden text-red-700\"></tui-svg>\n </div>\n <a class=\"p-0 m-0\" tuiLink iconAlign=\"left\" (click)=\"clickCardEvent.emit()\">\n <p class=\"font-bold text-[0.875rem] text-[#526ED3]\">{{ product.name }}</p>\n </a>\n <p *ngIf=\"product?.pack\">\u041D\u043E\u0440\u043C\u0430 \u0443\u043F\u0430\u043A\u043E\u0432\u043A\u0438: {{ product.pack }}</p>\n\n <p>\u0410\u0440\u0442\u0438\u043A\u0443\u043B: {{ product.code }}</p>\n <p *ngIf=\"(authStatus$ | async) && product?.costDate\">\u0414\u0430\u0442\u0430: {{ product.costDate }}</p>\n <div *ngIf=\"warehouseSelect$ | async as warehouseSelect\" class=\"flex flex-col\">\n <span *ngIf=\"product.discount\" class=\"flex items-center text-tui-text-02\">\n <span class=\"line-through\">{{ product.discountCostString }}</span> \n <span class=\"text-tui-success-fill font-bold\"> -{{ product.discount.percent }}% </span>\n <tui-svg src=\"tuiIconInfoLarge\" [tuiHint]=\"discountHint\" [tuiHintShowDelay]=\"100\" tuiHintDirection=\"top\" class=\"text-black !text-[0.75rem] !h-4\"></tui-svg>\n <ng-template #discountHint>\n <div class=\"font-bold\">{{ product.discount.name }}</div>\n <div *ngIf=\"product.discount.expiredAt as expiredAt\">\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F: {{ expiredAt }}</div>\n </ng-template>\n </span>\n <span [class.text-tui-text-02]=\"!product.isWarehouseStockExist(warehouseSelect.id)\" class=\"cost font-bold\">{{ product.costRubString }}</span>\n <span *ngIf=\"!product.priceInRub\" class=\"text-xs font-bold text-tui-text-02 hidden group-hover:block\">{{ product.costString }}</span>\n <sc-price-warehouse-stock [product]=\"product\"></sc-price-warehouse-stock>\n </div>\n <div *ngIf=\"!showQuantityControl\" class=\"flex gap-2 max-w-full items-center justify-stretch mt-1\">\n <button tuiButton (click)=\"clickAddToCartEvent.emit(product)\" [showLoader]=\"quantityShowLoader\" [size]=\"size\" class=\"grow\">\n <tui-svg src=\"scIconCart\" class=\"!text-xs !h-4\"> </tui-svg>\n \u0412 \u043A\u043E\u0440\u0437\u0438\u043D\u0443\n </button>\n <div *ngIf=\"cartItem\" class=\"flex justify-center\">\n <tui-svg src=\"tuiIconCheck\" class=\"!h-5 !w-5 bg-tui-primary text-black rounded-md\"></tui-svg>\n </div>\n </div>\n <sc-input-quantity\n *ngIf=\"showQuantityControl\"\n [formControl]=\"quantityControl\"\n [quantityUnit]=\"product.quantityUnit\"\n [size]=\"getQuantitySize\"\n [step]=\"unitsHelper.productMultiplicity(product)\"\n [showLoader]=\"quantityShowLoader\"\n (clickClearEvent)=\"clickClearEvent.emit(cartItem)\"\n class=\"w-full\"\n ></sc-input-quantity>\n</div>\n\n<ng-template #skeleton>\n <div class=\"flex flex-col card-wrapper bg-white rounded-xl overflow-hidden shadow-sc-1\">\n <!-- \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0442\u043E\u0432\u0430\u0440\u0430 -->\n <div class=\"w-full h-3/5 rounded-t bg-tui-base-02\"></div>\n <!-- \u041A\u0440\u0430\u0442\u043A\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u043E\u0432\u0430\u0440\u0435 -->\n <div class=\"flex flex-col grow gap-2.5 bg-white rounded-b p-5\">\n <div class=\"w-full h-4 rounded bg-tui-base-02\"></div>\n <div class=\"w-3/5 h-4 rounded bg-tui-base-02\"></div>\n <div class=\"w-full h-4 rounded bg-tui-base-02\"></div>\n </div>\n </div>\n</ng-template>\n", styles: [":host[data-size=s] .card-wrapper{width:10rem;height:16rem}:host[data-size=s] .card-wrapper .wrapper-info{padding:8px}:host[data-size=s] .card-wrapper .wrapper-info .cost{font-size:.875rem;line-height:1.25rem}:host[data-size=s] .card-wrapper .button-wrapper tui-svg{font-size:.75rem;line-height:1rem;width:1rem}:host[data-size=m] .card-wrapper{width:12.5rem;height:20rem}:host[data-size=m] .card-wrapper .wrapper-info{padding-inline:16px;padding-block:8px}:host[data-size=m] .card-wrapper .name{font-size:.875rem;line-height:1.25rem;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;max-height:3rem}:host[data-size=m] .card-wrapper .info{max-height:1rem}:host[data-size=m] .card-wrapper .cost{font-size:1.125rem;line-height:1.75rem}:host[data-size=m] .card-wrapper .button-wrapper{max-height:0px;font-size:.75rem;line-height:1rem}:host[data-size=m] .card-wrapper:hover .name{-webkit-line-clamp:unset;max-height:6rem}:host[data-size=m] .card-wrapper:hover .info{max-height:3rem}:host[data-size=m] .card-wrapper:hover .button-wrapper{max-height:3rem}\n"], dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.TuiButtonComponent, selector: "button[tuiButton], button[tuiIconButton], a[tuiButton], a[tuiIconButton]", inputs: ["appearance", "disabled", "icon", "iconRight", "shape", "showLoader", "size"] }, { kind: "component", type: i3$1.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }, { kind: "directive", type: i4.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i4.FormControlDirective, selector: "[formControl]", inputs: ["formControl", "disabled", "ngModel"], outputs: ["ngModelChange"], exportAs: ["ngForm"] }, { kind: "directive", type: i3$1.TuiHintDirective, selector: "[tuiHint]:not(ng-container)", inputs: ["tuiHint", "tuiHintContext", "tuiHintAppearance"] }, { kind: "directive", type: i3$1.TuiHintDriverDirective, selector: "[tuiHint]" }, { kind: "directive", type: i3$1.TuiHintHoverDirective, selector: "[tuiHint]:not(ng-container)", inputs: ["tuiHintShowDelay", "tuiHintHideDelay"], exportAs: ["tuiHintHover"] }, { kind: "directive", type: i3$1.TuiHintPositionDirective, selector: "[tuiHint]:not([tuiHintCustomPosition])", inputs: ["tuiHintDirection"] }, { kind: "component", type: i3$1.TuiLinkComponent, selector: "a[tuiLink], button[tuiLink]", inputs: ["pseudo", "icon", "iconAlign", "iconRotated", "mode"], exportAs: ["tuiLink"] }, { kind: "component", type: ScFavoriteBtnComponent, selector: "sc-favorite-btn", outputs: ["clickEvent"] }, { kind: "component", type: ScInputQuantityComponent, selector: "sc-input-quantity", inputs: ["step", "quantityUnit", "showLoader", "showCross", "appearance", "isDisabled", "size"], outputs: ["clickClearEvent"] }, { kind: "component", type: ScPriceWarehouseStockComponent, selector: "sc-price-warehouse-stock", inputs: ["classList", "product", "withStockHint"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
864
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceCardComponent, decorators: [{
|
865
|
+
type: Component,
|
866
|
+
args: [{ selector: 'sc-price-card', changeDetection: ChangeDetectionStrategy.OnPush, template: "<!-- TODO: \u0440\u0435\u0430\u043B\u0438\u0437\u043E\u0432\u0430\u0442\u044C \u0434\u0430\u043D\u043D\u044B\u0439 \u043A\u043E\u043C\u043F\u043E\u043D\u0435\u043D\u0442 \u0438 \u0434\u043B\u044F \u0434\u0435\u0441\u043A\u0442\u043E\u043F\u0430 \u0438 \u0434\u043B\u044F \u043C\u043E\u0431\u0438\u043B\u044C\u043D\u043E\u0433\u043E \u043F\u0440\u0438\u043B\u043E\u0436\u0435\u043D\u0438\u044F. \u0418\u0441\u043F\u0440\u0430\u0432\u0438\u0442\u044C \u0432\u0441\u0435 \u0433\u043B\u043E\u0431\u0430\u043B\u044C\u043D\u044B\u0435 \u0442\u0430\u0439\u0433\u043E\u0432\u0441\u043A\u0438\u0435 \u0441\u0442\u0438\u043B\u0438, \u043F\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0438\u0445 \u0432 \u043F\u043E\u0440\u044F\u0434\u043E\u043A \u0441\u043E\u0433\u043B\u0430\u0441\u043D\u043E \u0441 \u0434\u0438\u0437\u0430\u0439\u043D\u043E\u043C. -->\n<div\n *ngIf=\"product; else skeleton\"\n class=\"h-[17rem] min-w-[10rem] shadow-md w-auto rounded-xl p-2 grid max-h-[17rem] text-[0.75rem] text-left text-tui-text-02\"\n [style.width]=\"isWidthFull\"\n>\n <div class=\"overflow-hidden relative\">\n <img (click)=\"clickCardEvent.emit()\" [src]=\"getCardImage()\" [alt]=\"product.name\" class=\"rounded-xl w-full max-h-full object-cover\" />\n <sc-favorite-btn *ngIf=\"authStatus$ | async\" [class.!block]=\"product.isFavorite\" class=\"top-0 left-0 absolute hidden\"></sc-favorite-btn>\n <tui-svg *ngIf=\"product.isPreviouslyOrdered\" src=\"scIconStar\" class=\"top-0 right-0 absolute hidden text-red-700\"></tui-svg>\n </div>\n <a class=\"p-0 m-0\" tuiLink iconAlign=\"left\" (click)=\"clickCardEvent.emit()\">\n <p class=\"font-bold text-[0.875rem] text-[#526ED3]\">{{ product.name }}</p>\n </a>\n <p *ngIf=\"product?.pack\">\u041D\u043E\u0440\u043C\u0430 \u0443\u043F\u0430\u043A\u043E\u0432\u043A\u0438: {{ product.pack }}</p>\n\n <p>\u0410\u0440\u0442\u0438\u043A\u0443\u043B: {{ product.code }}</p>\n <p *ngIf=\"(authStatus$ | async) && product?.costDate\">\u0414\u0430\u0442\u0430: {{ product.costDate }}</p>\n <div *ngIf=\"warehouseSelect$ | async as warehouseSelect\" class=\"flex flex-col\">\n <span *ngIf=\"product.discount\" class=\"flex items-center text-tui-text-02\">\n <span class=\"line-through\">{{ product.discountCostString }}</span> \n <span class=\"text-tui-success-fill font-bold\"> -{{ product.discount.percent }}% </span>\n <tui-svg src=\"tuiIconInfoLarge\" [tuiHint]=\"discountHint\" [tuiHintShowDelay]=\"100\" tuiHintDirection=\"top\" class=\"text-black !text-[0.75rem] !h-4\"></tui-svg>\n <ng-template #discountHint>\n <div class=\"font-bold\">{{ product.discount.name }}</div>\n <div *ngIf=\"product.discount.expiredAt as expiredAt\">\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F: {{ expiredAt }}</div>\n </ng-template>\n </span>\n <span [class.text-tui-text-02]=\"!product.isWarehouseStockExist(warehouseSelect.id)\" class=\"cost font-bold\">{{ product.costRubString }}</span>\n <span *ngIf=\"!product.priceInRub\" class=\"text-xs font-bold text-tui-text-02 hidden group-hover:block\">{{ product.costString }}</span>\n <sc-price-warehouse-stock [product]=\"product\"></sc-price-warehouse-stock>\n </div>\n <div *ngIf=\"!showQuantityControl\" class=\"flex gap-2 max-w-full items-center justify-stretch mt-1\">\n <button tuiButton (click)=\"clickAddToCartEvent.emit(product)\" [showLoader]=\"quantityShowLoader\" [size]=\"size\" class=\"grow\">\n <tui-svg src=\"scIconCart\" class=\"!text-xs !h-4\"> </tui-svg>\n \u0412 \u043A\u043E\u0440\u0437\u0438\u043D\u0443\n </button>\n <div *ngIf=\"cartItem\" class=\"flex justify-center\">\n <tui-svg src=\"tuiIconCheck\" class=\"!h-5 !w-5 bg-tui-primary text-black rounded-md\"></tui-svg>\n </div>\n </div>\n <sc-input-quantity\n *ngIf=\"showQuantityControl\"\n [formControl]=\"quantityControl\"\n [quantityUnit]=\"product.quantityUnit\"\n [size]=\"getQuantitySize\"\n [step]=\"unitsHelper.productMultiplicity(product)\"\n [showLoader]=\"quantityShowLoader\"\n (clickClearEvent)=\"clickClearEvent.emit(cartItem)\"\n class=\"w-full\"\n ></sc-input-quantity>\n</div>\n\n<ng-template #skeleton>\n <div class=\"flex flex-col card-wrapper bg-white rounded-xl overflow-hidden shadow-sc-1\">\n <!-- \u0418\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u0435 \u0442\u043E\u0432\u0430\u0440\u0430 -->\n <div class=\"w-full h-3/5 rounded-t bg-tui-base-02\"></div>\n <!-- \u041A\u0440\u0430\u0442\u043A\u0430\u044F \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u043E\u0432\u0430\u0440\u0435 -->\n <div class=\"flex flex-col grow gap-2.5 bg-white rounded-b p-5\">\n <div class=\"w-full h-4 rounded bg-tui-base-02\"></div>\n <div class=\"w-3/5 h-4 rounded bg-tui-base-02\"></div>\n <div class=\"w-full h-4 rounded bg-tui-base-02\"></div>\n </div>\n </div>\n</ng-template>\n", styles: [":host[data-size=s] .card-wrapper{width:10rem;height:16rem}:host[data-size=s] .card-wrapper .wrapper-info{padding:8px}:host[data-size=s] .card-wrapper .wrapper-info .cost{font-size:.875rem;line-height:1.25rem}:host[data-size=s] .card-wrapper .button-wrapper tui-svg{font-size:.75rem;line-height:1rem;width:1rem}:host[data-size=m] .card-wrapper{width:12.5rem;height:20rem}:host[data-size=m] .card-wrapper .wrapper-info{padding-inline:16px;padding-block:8px}:host[data-size=m] .card-wrapper .name{font-size:.875rem;line-height:1.25rem;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;max-height:3rem}:host[data-size=m] .card-wrapper .info{max-height:1rem}:host[data-size=m] .card-wrapper .cost{font-size:1.125rem;line-height:1.75rem}:host[data-size=m] .card-wrapper .button-wrapper{max-height:0px;font-size:.75rem;line-height:1rem}:host[data-size=m] .card-wrapper:hover .name{-webkit-line-clamp:unset;max-height:6rem}:host[data-size=m] .card-wrapper:hover .info{max-height:3rem}:host[data-size=m] .card-wrapper:hover .button-wrapper{max-height:3rem}\n"] }]
|
867
|
+
}], ctorParameters: function () { return [{ type: UnitsHelper }, { type: i1.ScAuthService }, { type: i1.ScWarehouseService }, { type: undefined, decorators: [{
|
868
|
+
type: Inject,
|
869
|
+
args: [SC_URLS]
|
870
|
+
}] }, { type: undefined, decorators: [{
|
871
|
+
type: Inject,
|
872
|
+
args: [SC_PATH_IMAGE_NOT_FOUND]
|
873
|
+
}] }]; }, propDecorators: { showQuantityControl: [{
|
874
|
+
type: Input
|
875
|
+
}], cartItem: [{
|
876
|
+
type: Input
|
877
|
+
}], product: [{
|
878
|
+
type: Input
|
879
|
+
}], clickFavoriteEvent: [{
|
880
|
+
type: Output
|
881
|
+
}], clickAddToCartEvent: [{
|
882
|
+
type: Output
|
883
|
+
}], clickClearEvent: [{
|
884
|
+
type: Output
|
885
|
+
}], clickCardEvent: [{
|
886
|
+
type: Output
|
887
|
+
}], quantityValueChanges: [{
|
888
|
+
type: Output
|
889
|
+
}], size: [{
|
890
|
+
type: Input
|
891
|
+
}, {
|
892
|
+
type: HostBinding,
|
893
|
+
args: ['attr.data-size']
|
894
|
+
}], isWidthFull: [{
|
895
|
+
type: Input
|
896
|
+
}] } });
|
897
|
+
|
898
|
+
/**
|
899
|
+
* Настройки отрисовки графика.
|
900
|
+
*
|
901
|
+
* @see [Документация](https://echarts.apache.org/en/option.html#title)
|
902
|
+
*/
|
903
|
+
const scChartOption = {
|
904
|
+
grid: {
|
905
|
+
top: 12,
|
906
|
+
left: 64,
|
907
|
+
right: 0,
|
908
|
+
bottom: 24,
|
909
|
+
},
|
910
|
+
tooltip: {
|
911
|
+
trigger: 'axis',
|
912
|
+
formatter: (params) => {
|
913
|
+
const data = Array.isArray(params) ? params[0].data : params.data;
|
914
|
+
const date = new Date(data.value[0]);
|
915
|
+
const nextDate = new Date(data.value[2]);
|
916
|
+
return `
|
917
|
+
<div class="text-center text-black">
|
918
|
+
<span class="font-bold">${data.value[1]} ₽</span>
|
919
|
+
</br>
|
920
|
+
<span class="text-xs">${formatDate(date, 'dd.MM', 'en')} - ${formatDate(nextDate, 'dd.MM', 'en')}</span>
|
921
|
+
</div>
|
922
|
+
`;
|
923
|
+
},
|
924
|
+
axisPointer: {
|
925
|
+
animation: false,
|
926
|
+
type: 'cross',
|
927
|
+
},
|
928
|
+
textStyle: {
|
929
|
+
fontFamily: 'Roboto, "Helvetica Neue", sans-serif',
|
930
|
+
},
|
931
|
+
},
|
932
|
+
xAxis: {
|
933
|
+
type: 'time',
|
934
|
+
splitLine: {
|
935
|
+
show: false,
|
936
|
+
},
|
937
|
+
axisLine: {
|
938
|
+
show: false,
|
939
|
+
},
|
940
|
+
axisTick: {
|
941
|
+
show: false,
|
942
|
+
},
|
943
|
+
axisLabel: {
|
944
|
+
hideOverlap: true,
|
945
|
+
},
|
946
|
+
boundaryGap: ['3%', '3%'],
|
947
|
+
},
|
948
|
+
yAxis: {
|
949
|
+
splitLine: {
|
950
|
+
show: false,
|
951
|
+
},
|
952
|
+
axisLine: {
|
953
|
+
show: false,
|
954
|
+
},
|
955
|
+
axisTick: {
|
956
|
+
show: false,
|
957
|
+
},
|
958
|
+
axisLabel: {
|
959
|
+
formatter: (value) => tuiFormatNumber(value),
|
960
|
+
},
|
961
|
+
type: 'value',
|
962
|
+
boundaryGap: [0, '100%'],
|
963
|
+
},
|
964
|
+
series: {
|
965
|
+
name: 'История цены',
|
966
|
+
type: 'line',
|
967
|
+
showSymbol: false,
|
968
|
+
symbolSize: 12,
|
969
|
+
itemStyle: {
|
970
|
+
color: '#ffcc40',
|
971
|
+
},
|
972
|
+
},
|
973
|
+
};
|
974
|
+
|
975
|
+
/**
|
976
|
+
* График истории цен товара или услуги.
|
977
|
+
* TODO: TASK[#7482] Перепроверить возможность использования TuiLineDaysChart.
|
978
|
+
*/
|
979
|
+
class ScPriceHistoryComponent {
|
980
|
+
/**
|
981
|
+
* Инициализирует экземпляр класса {@link PriceHistoryChartComponent}.
|
982
|
+
*
|
983
|
+
* @param cdr Объект для работы с обнаружением изменений.
|
984
|
+
*/
|
985
|
+
constructor(cdr) {
|
986
|
+
this.cdr = cdr;
|
987
|
+
/**
|
988
|
+
* Настройки графика.
|
989
|
+
*/
|
990
|
+
this.initOption = { locale: 'RU' };
|
991
|
+
/**
|
992
|
+
* Параметры отрисовки графика истории цены.
|
993
|
+
*/
|
994
|
+
this.chartOption = scChartOption;
|
995
|
+
/**
|
996
|
+
* Данные об истории цены на товар или услугу.
|
997
|
+
*/
|
998
|
+
this.data = [];
|
999
|
+
}
|
1000
|
+
/** @inheritDoc */
|
1001
|
+
ngOnInit() {
|
1002
|
+
if (this.chartOption.series && !Array.isArray(this.chartOption.series)) {
|
1003
|
+
this.chartOption.series.data = [];
|
1004
|
+
}
|
1005
|
+
Object.keys(this.history)
|
1006
|
+
.map((key) => {
|
1007
|
+
// ? Можно избежать переведя даты в api в формат ECMAScript® 2023: https://tc39.es/ecma262/#sec-date-time-string-format
|
1008
|
+
const dataString = key.split('.').reverse(), data = new Date(+dataString[0], +dataString[1] - 1, +dataString[2]);
|
1009
|
+
return { data: data, cost: this.history[String(key)].cost };
|
1010
|
+
})
|
1011
|
+
.sort((a, b) => +a.data - +b.data)
|
1012
|
+
.forEach((item, index, array) => {
|
1013
|
+
let nextDate;
|
1014
|
+
if (array[index + 1]?.data) {
|
1015
|
+
nextDate = new Date(array[index + 1]?.data);
|
1016
|
+
nextDate.setDate(nextDate.getDate() - 1);
|
1017
|
+
}
|
1018
|
+
else {
|
1019
|
+
nextDate = new Date();
|
1020
|
+
}
|
1021
|
+
this.pushDataItem(item.cost, item.data, nextDate);
|
1022
|
+
});
|
1023
|
+
if (this.eChartsInstance) {
|
1024
|
+
this.setChartData();
|
1025
|
+
}
|
1026
|
+
}
|
1027
|
+
/**
|
1028
|
+
* Перехватчик жизненного цикла {@link ECharts}, который вызывается при его инициализации.
|
1029
|
+
*
|
1030
|
+
* @param eChartsInstance Экземпляр {@link ECharts}.
|
1031
|
+
*/
|
1032
|
+
onChartInit(eChartsInstance) {
|
1033
|
+
this.eChartsInstance = eChartsInstance;
|
1034
|
+
if (this.data.length) {
|
1035
|
+
this.setChartData();
|
1036
|
+
}
|
1037
|
+
}
|
1038
|
+
/**
|
1039
|
+
* Устанавливает новые данные {@link PriceHistoryChartComponent.eChartsInstance}.
|
1040
|
+
*/
|
1041
|
+
setChartData() {
|
1042
|
+
if (this.chartOption.series && !Array.isArray(this.chartOption.series)) {
|
1043
|
+
this.maxPrice = Math.max(...this.data.map((item) => item.value[1]));
|
1044
|
+
this.minPrice = Math.min(...this.data.map((item) => item.value[1]));
|
1045
|
+
this.chartOption.series.data = this.data;
|
1046
|
+
this.eChartsInstance.clear();
|
1047
|
+
this.eChartsInstance.setOption(this.chartOption, true, true);
|
1048
|
+
this.cdr.markForCheck();
|
1049
|
+
}
|
1050
|
+
}
|
1051
|
+
/**
|
1052
|
+
* Добавляет значение цены товара в массив истории цен.
|
1053
|
+
*
|
1054
|
+
* @param value Цена товара или услуги.
|
1055
|
+
* @param date Дата установки цены.
|
1056
|
+
* @param nextDate Следующая дата установки цены.
|
1057
|
+
*/
|
1058
|
+
pushDataItem(value, date, nextDate) {
|
1059
|
+
this.data.push({
|
1060
|
+
name: date.toString(),
|
1061
|
+
value: [date, value, nextDate],
|
1062
|
+
});
|
1063
|
+
}
|
1064
|
+
}
|
1065
|
+
ScPriceHistoryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceHistoryComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
1066
|
+
ScPriceHistoryComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScPriceHistoryComponent, selector: "sc-price-history", inputs: { history: "history" }, ngImport: i0, template: "<div class=\"flex flex-col items-center\">\n <div *ngIf=\"maxPrice && minPrice\" class=\"w-full font-bold text-end text-lg mb-1\">\u043E\u0442 {{ minPrice.toLocaleString() }} \u20BD \u0434\u043E {{ maxPrice.toLocaleString() }} \u20BD</div>\n <div class=\"relative w-full h-56\">\n <div class=\"h-48 bg-tui-base-02 mt-2 absolute rounded right-0 left-16\"></div>\n <div echarts [initOpts]=\"initOption\" (chartInit)=\"onChartInit($event)\" [options]=\"chartOption\" class=\"w-full !h-full touch-none\"></div>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2.NgxEchartsDirective, selector: "echarts, [echarts]", inputs: ["options", "theme", "loading", "initOpts", "merge", "autoResize", "loadingType", "loadingOpts"], outputs: ["chartInit", "optionsError", "chartClick", "chartDblClick", "chartMouseDown", "chartMouseMove", "chartMouseUp", "chartMouseOver", "chartMouseOut", "chartGlobalOut", "chartContextMenu", "chartLegendSelectChanged", "chartLegendSelected", "chartLegendUnselected", "chartLegendScroll", "chartDataZoom", "chartDataRangeSelected", "chartTimelineChanged", "chartTimelinePlayChanged", "chartRestore", "chartDataViewChanged", "chartMagicTypeChanged", "chartPieSelectChanged", "chartPieSelected", "chartPieUnselected", "chartMapSelectChanged", "chartMapSelected", "chartMapUnselected", "chartAxisAreaSelected", "chartFocusNodeAdjacency", "chartUnfocusNodeAdjacency", "chartBrush", "chartBrushEnd", "chartBrushSelected", "chartRendered", "chartFinished"], exportAs: ["echarts"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1067
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceHistoryComponent, decorators: [{
|
1068
|
+
type: Component,
|
1069
|
+
args: [{ selector: 'sc-price-history', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"flex flex-col items-center\">\n <div *ngIf=\"maxPrice && minPrice\" class=\"w-full font-bold text-end text-lg mb-1\">\u043E\u0442 {{ minPrice.toLocaleString() }} \u20BD \u0434\u043E {{ maxPrice.toLocaleString() }} \u20BD</div>\n <div class=\"relative w-full h-56\">\n <div class=\"h-48 bg-tui-base-02 mt-2 absolute rounded right-0 left-16\"></div>\n <div echarts [initOpts]=\"initOption\" (chartInit)=\"onChartInit($event)\" [options]=\"chartOption\" class=\"w-full !h-full touch-none\"></div>\n </div>\n</div>\n" }]
|
1070
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { history: [{
|
1071
|
+
type: Input
|
1072
|
+
}] } });
|
1073
|
+
|
1074
|
+
/**
|
1075
|
+
* Language: Russian.
|
1076
|
+
*/
|
1077
|
+
var scLangRU = {
|
1078
|
+
time: {
|
1079
|
+
month: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
|
1080
|
+
monthAbbr: ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'],
|
1081
|
+
dayOfWeek: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
|
1082
|
+
dayOfWeekAbbr: ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
|
1083
|
+
},
|
1084
|
+
legend: {
|
1085
|
+
selector: {
|
1086
|
+
all: 'Всё',
|
1087
|
+
inverse: 'Обратить',
|
1088
|
+
},
|
1089
|
+
},
|
1090
|
+
toolbox: {
|
1091
|
+
brush: {
|
1092
|
+
title: {
|
1093
|
+
rect: 'Выделить область',
|
1094
|
+
polygon: 'Инструмент «Лассо»',
|
1095
|
+
lineX: 'Горизонтальное выделение',
|
1096
|
+
lineY: 'Вертикальное выделение',
|
1097
|
+
keep: 'Оставить выбранное',
|
1098
|
+
clear: 'Очистить выбранное',
|
1099
|
+
},
|
1100
|
+
},
|
1101
|
+
dataView: {
|
1102
|
+
title: 'Данные',
|
1103
|
+
lang: ['Данные', 'Закрыть', 'Обновить'],
|
1104
|
+
},
|
1105
|
+
dataZoom: {
|
1106
|
+
title: {
|
1107
|
+
zoom: 'Увеличить',
|
1108
|
+
back: 'Сбросить увеличение',
|
1109
|
+
},
|
1110
|
+
},
|
1111
|
+
magicType: {
|
1112
|
+
title: {
|
1113
|
+
line: 'Переключиться на линейный график',
|
1114
|
+
bar: 'Переключиться на столбчатую диаграмму',
|
1115
|
+
stack: 'Стопка',
|
1116
|
+
tiled: 'Плитка',
|
1117
|
+
},
|
1118
|
+
},
|
1119
|
+
restore: {
|
1120
|
+
title: 'Восстановить',
|
1121
|
+
},
|
1122
|
+
saveAsImage: {
|
1123
|
+
title: 'Сохранить картинку',
|
1124
|
+
lang: ['Правый клик, чтобы сохранить картинку'],
|
1125
|
+
},
|
1126
|
+
},
|
1127
|
+
series: {
|
1128
|
+
typeNames: {
|
1129
|
+
pie: 'Круговая диаграмма',
|
1130
|
+
bar: 'Столбчатая диаграмма',
|
1131
|
+
line: 'Линейный график',
|
1132
|
+
scatter: 'Точечная диаграмма',
|
1133
|
+
effectScatter: 'Точечная диаграмма с волнами',
|
1134
|
+
radar: 'Лепестковая диаграмма',
|
1135
|
+
tree: 'Дерево',
|
1136
|
+
treemap: 'Плоское дерево',
|
1137
|
+
boxplot: 'Ящик с усами',
|
1138
|
+
candlestick: 'Свечной график',
|
1139
|
+
k: 'График К-линий',
|
1140
|
+
heatmap: 'Тепловая карта',
|
1141
|
+
map: 'Карта',
|
1142
|
+
parallel: 'Диаграмма параллельных координат',
|
1143
|
+
lines: 'Линейный граф',
|
1144
|
+
graph: 'Граф отношений',
|
1145
|
+
sankey: 'Диаграмма Санкей',
|
1146
|
+
funnel: 'Воронкообразная диаграмма',
|
1147
|
+
gauge: 'Шкала',
|
1148
|
+
pictorialBar: 'Столбец-картинка',
|
1149
|
+
themeRiver: 'Тематическая река',
|
1150
|
+
sunburst: 'Солнечные лучи',
|
1151
|
+
},
|
1152
|
+
},
|
1153
|
+
aria: {
|
1154
|
+
general: {
|
1155
|
+
withTitle: 'Это график, показывающий "{title}"',
|
1156
|
+
withoutTitle: 'Это график',
|
1157
|
+
},
|
1158
|
+
series: {
|
1159
|
+
single: {
|
1160
|
+
prefix: '',
|
1161
|
+
withName: ' с типом {seriesType} и именем {seriesName}.',
|
1162
|
+
withoutName: ' с типом {seriesType}.',
|
1163
|
+
},
|
1164
|
+
multiple: {
|
1165
|
+
prefix: '. Он состоит из {seriesCount} серий.',
|
1166
|
+
withName: ' Серия {seriesId} имеет тип {seriesType} и показывает {seriesName}.',
|
1167
|
+
withoutName: ' Серия {seriesId} имеет тип {seriesType}.',
|
1168
|
+
separator: {
|
1169
|
+
middle: '',
|
1170
|
+
end: '',
|
1171
|
+
},
|
1172
|
+
},
|
1173
|
+
},
|
1174
|
+
data: {
|
1175
|
+
allData: 'Данные таковы: ',
|
1176
|
+
partialData: 'Первые {displayCnt} элементов: ',
|
1177
|
+
withName: 'значение для {name} — {value}',
|
1178
|
+
withoutName: '{value}',
|
1179
|
+
separator: {
|
1180
|
+
middle: ', ',
|
1181
|
+
end: '. ',
|
1182
|
+
},
|
1183
|
+
},
|
1184
|
+
},
|
1185
|
+
};
|
1186
|
+
|
1187
|
+
echarts.registerLocale('RU', scLangRU);
|
1188
|
+
echarts.use([TitleComponent, TooltipComponent, GridComponent, LineChart, SVGRenderer]);
|
1189
|
+
/**
|
1190
|
+
* Модуль каталога.
|
1191
|
+
*/
|
1192
|
+
class ScCatalogModule {
|
1193
|
+
}
|
1194
|
+
ScCatalogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCatalogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1195
|
+
ScCatalogModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ScCatalogModule, declarations: [ScCategoryCardComponent, ScFavoriteBtnComponent, ScInputQuantityComponent, ScPriceCardComponent, ScPriceWarehouseStockComponent, ScPriceHistoryComponent], imports: [CommonModule,
|
1196
|
+
RouterModule,
|
1197
|
+
TuiButtonModule,
|
1198
|
+
TuiSvgModule,
|
1199
|
+
TuiIslandModule,
|
1200
|
+
TuiInputNumberModule,
|
1201
|
+
TuiLabelModule,
|
1202
|
+
TuiTextfieldControllerModule,
|
1203
|
+
FormsModule,
|
1204
|
+
ReactiveFormsModule,
|
1205
|
+
TuiHintModule,
|
1206
|
+
TuiModeModule,
|
1207
|
+
TuiFieldErrorPipeModule,
|
1208
|
+
TuiLoaderModule,
|
1209
|
+
TuiLinkModule,
|
1210
|
+
TuiElasticContainerModule, i2.NgxEchartsModule], exports: [ScCategoryCardComponent, ScFavoriteBtnComponent, ScInputQuantityComponent, ScPriceCardComponent, ScPriceWarehouseStockComponent, ScPriceHistoryComponent] });
|
1211
|
+
ScCatalogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCatalogModule, imports: [CommonModule,
|
1212
|
+
RouterModule,
|
1213
|
+
TuiButtonModule,
|
1214
|
+
TuiSvgModule,
|
1215
|
+
TuiIslandModule,
|
1216
|
+
TuiInputNumberModule,
|
1217
|
+
TuiLabelModule,
|
1218
|
+
TuiTextfieldControllerModule,
|
1219
|
+
FormsModule,
|
1220
|
+
ReactiveFormsModule,
|
1221
|
+
TuiHintModule,
|
1222
|
+
TuiModeModule,
|
1223
|
+
TuiFieldErrorPipeModule,
|
1224
|
+
TuiLoaderModule,
|
1225
|
+
TuiLinkModule,
|
1226
|
+
TuiElasticContainerModule,
|
1227
|
+
NgxEchartsModule.forRoot({ echarts })] });
|
1228
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCatalogModule, decorators: [{
|
1229
|
+
type: NgModule,
|
1230
|
+
args: [{
|
1231
|
+
declarations: [ScCategoryCardComponent, ScFavoriteBtnComponent, ScInputQuantityComponent, ScPriceCardComponent, ScPriceWarehouseStockComponent, ScPriceHistoryComponent],
|
1232
|
+
exports: [ScCategoryCardComponent, ScFavoriteBtnComponent, ScInputQuantityComponent, ScPriceCardComponent, ScPriceWarehouseStockComponent, ScPriceHistoryComponent],
|
1233
|
+
imports: [
|
1234
|
+
CommonModule,
|
1235
|
+
RouterModule,
|
1236
|
+
TuiButtonModule,
|
1237
|
+
TuiSvgModule,
|
1238
|
+
TuiIslandModule,
|
1239
|
+
TuiInputNumberModule,
|
1240
|
+
TuiLabelModule,
|
1241
|
+
TuiTextfieldControllerModule,
|
1242
|
+
FormsModule,
|
1243
|
+
ReactiveFormsModule,
|
1244
|
+
TuiHintModule,
|
1245
|
+
TuiModeModule,
|
1246
|
+
TuiFieldErrorPipeModule,
|
1247
|
+
TuiLoaderModule,
|
1248
|
+
TuiLinkModule,
|
1249
|
+
TuiElasticContainerModule,
|
1250
|
+
NgxEchartsModule.forRoot({ echarts }),
|
1251
|
+
],
|
1252
|
+
}]
|
1253
|
+
}] });
|
1254
|
+
|
1255
|
+
/**
|
1256
|
+
* Модуль корзины.
|
1257
|
+
*/
|
1258
|
+
class ScCartModule {
|
1259
|
+
}
|
1260
|
+
ScCartModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1261
|
+
ScCartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ScCartModule, declarations: [ScCartItemMobileComponent], imports: [CommonModule,
|
1262
|
+
TuiLinkModule,
|
1263
|
+
ScCatalogModule,
|
1264
|
+
TuiButtonModule,
|
1265
|
+
TuiModeModule,
|
1266
|
+
TuiSvgModule,
|
1267
|
+
TuiHintModule,
|
1268
|
+
FormsModule,
|
1269
|
+
ReactiveFormsModule,
|
1270
|
+
TuiPreviewModule,
|
1271
|
+
PolymorpheusModule], exports: [ScCartItemMobileComponent] });
|
1272
|
+
ScCartModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCartModule, imports: [CommonModule,
|
1273
|
+
TuiLinkModule,
|
1274
|
+
ScCatalogModule,
|
1275
|
+
TuiButtonModule,
|
1276
|
+
TuiModeModule,
|
1277
|
+
TuiSvgModule,
|
1278
|
+
TuiHintModule,
|
1279
|
+
FormsModule,
|
1280
|
+
ReactiveFormsModule,
|
1281
|
+
TuiPreviewModule,
|
1282
|
+
PolymorpheusModule] });
|
1283
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCartModule, decorators: [{
|
1284
|
+
type: NgModule,
|
1285
|
+
args: [{
|
1286
|
+
declarations: [ScCartItemMobileComponent],
|
1287
|
+
exports: [ScCartItemMobileComponent],
|
1288
|
+
imports: [
|
1289
|
+
CommonModule,
|
1290
|
+
TuiLinkModule,
|
1291
|
+
ScCatalogModule,
|
1292
|
+
TuiButtonModule,
|
1293
|
+
TuiModeModule,
|
1294
|
+
TuiSvgModule,
|
1295
|
+
TuiHintModule,
|
1296
|
+
FormsModule,
|
1297
|
+
ReactiveFormsModule,
|
1298
|
+
TuiPreviewModule,
|
1299
|
+
PolymorpheusModule,
|
1300
|
+
],
|
1301
|
+
}]
|
1302
|
+
}] });
|
1303
|
+
|
1304
|
+
/**
|
1305
|
+
* Сервис работающий с значками элементов дерева.
|
1306
|
+
*/
|
1307
|
+
class TreeIconService {
|
1308
|
+
/**
|
1309
|
+
* Назначает значок элементу дерева в зависимости от типа файла.
|
1310
|
+
*
|
1311
|
+
* @param info Объект пришедших данных о файле.
|
1312
|
+
* @returns Возвращает название значка в виде строки.
|
1313
|
+
*/
|
1314
|
+
getIconName(info) {
|
1315
|
+
switch (info.getIcon()) {
|
1316
|
+
case ScIconTypesEnum.iconImage:
|
1317
|
+
return 'scIconImage';
|
1318
|
+
case ScIconTypesEnum.iconPdfFile:
|
1319
|
+
return 'scIconPdfFile';
|
1320
|
+
case ScIconTypesEnum.iconWordFile:
|
1321
|
+
return 'scIconWordFile';
|
1322
|
+
case ScIconTypesEnum.iconExcelFile:
|
1323
|
+
return 'scIconExcelFile';
|
1324
|
+
case ScIconTypesEnum.iconFolder:
|
1325
|
+
return 'scIconFolder';
|
1326
|
+
default:
|
1327
|
+
return 'scIconFile';
|
1328
|
+
}
|
1329
|
+
}
|
1330
|
+
/**
|
1331
|
+
* Проверяет на признак наличия дочерних элементов.
|
1332
|
+
*
|
1333
|
+
* @param info Объект пришедших данных о файле.
|
1334
|
+
* @returns Возвращает true при наличии дочерних элементов и false при их отсутсвии.
|
1335
|
+
*/
|
1336
|
+
hasChildren(info) {
|
1337
|
+
return info.type === 'dir';
|
1338
|
+
}
|
1339
|
+
}
|
1340
|
+
TreeIconService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeIconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
1341
|
+
TreeIconService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeIconService, providedIn: 'root' });
|
1342
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeIconService, decorators: [{
|
1343
|
+
type: Injectable,
|
1344
|
+
args: [{
|
1345
|
+
providedIn: 'root',
|
1346
|
+
}]
|
1347
|
+
}] });
|
1348
|
+
|
1349
|
+
/**
|
1350
|
+
* Сервис для асинхронного раскрытия вложенности.
|
1351
|
+
*/
|
1352
|
+
class TreeLoaderService {
|
1353
|
+
/**
|
1354
|
+
* Инициализирует экземпляр класса {@link TreeLoaderService}
|
1355
|
+
*
|
1356
|
+
* @param filesService Сервис для получения файлов директории.
|
1357
|
+
* @param iconService Сервис для определения и назначения значка элементу дерева.
|
1358
|
+
*/
|
1359
|
+
constructor(filesService, iconService) {
|
1360
|
+
this.filesService = filesService;
|
1361
|
+
this.iconService = iconService;
|
1362
|
+
}
|
1363
|
+
/**
|
1364
|
+
* Загружает дочерние элементы дерева.
|
1365
|
+
*
|
1366
|
+
* @param item Элемент дерева.
|
1367
|
+
* @returns Массив дочерних элементов.
|
1368
|
+
*/
|
1369
|
+
loadChildren(item) {
|
1370
|
+
return item.id ? this.initData(item.id) : this.initData(undefined);
|
1371
|
+
}
|
1372
|
+
/**
|
1373
|
+
* Проверяет указанный элемент дерева на наличие дочерних элементов и возвращает массив дочерних элементов, если они есть, либо пустой массив.
|
1374
|
+
*
|
1375
|
+
* @param node Элемент дерева.
|
1376
|
+
* @returns Возвращает массив типа TreeNode[].
|
1377
|
+
*/
|
1378
|
+
hasChildren(node) {
|
1379
|
+
return node.hasChildren && !!node.id;
|
1380
|
+
}
|
1381
|
+
/**
|
1382
|
+
* Загружает и заполняет массив дочерних элементов.
|
1383
|
+
*
|
1384
|
+
* @param id Идентификатор директории, чьи дочернии элементы загружаются.
|
1385
|
+
* @returns Возвращает массив дочерних элементов.
|
1386
|
+
*/
|
1387
|
+
initData(id) {
|
1388
|
+
return this.filesService.getFiles(id).pipe(map((data) => data.map((item) => ({
|
1389
|
+
text: item.name,
|
1390
|
+
icon: this.iconService.getIconName(item),
|
1391
|
+
hasChildren: this.iconService.hasChildren(item),
|
1392
|
+
createdAt: item.createdAt,
|
1393
|
+
id: item.id,
|
1394
|
+
link: item.link,
|
1395
|
+
}))));
|
1396
|
+
}
|
1397
|
+
}
|
1398
|
+
TreeLoaderService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeLoaderService, deps: [{ token: i1.ScFilesService }, { token: TreeIconService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1399
|
+
TreeLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeLoaderService });
|
1400
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeLoaderService, decorators: [{
|
1401
|
+
type: Injectable
|
1402
|
+
}], ctorParameters: function () { return [{ type: i1.ScFilesService }, { type: TreeIconService }]; } });
|
1403
|
+
|
1404
|
+
/**
|
1405
|
+
* Директива отвечающая за обработку действий над элементами дерева.
|
1406
|
+
*/
|
1407
|
+
class TreeDirective {
|
1408
|
+
/**
|
1409
|
+
* Инициализирует экземпляр класса {@link TreeDirective}.
|
1410
|
+
*
|
1411
|
+
* @param service Сервис для работы с деревом.
|
1412
|
+
*/
|
1413
|
+
constructor(service) {
|
1414
|
+
this.service = service;
|
1415
|
+
/**
|
1416
|
+
* Карта данных дерева.
|
1417
|
+
*/
|
1418
|
+
this.map = new Map();
|
1419
|
+
/**
|
1420
|
+
* Проверяет указанный элемент дерева на наличие дочерних элементов и возвращает массив дочерних элементов, если они есть, либо пустой массив.
|
1421
|
+
*
|
1422
|
+
* @param node Элемент дерева.
|
1423
|
+
* @returns Возвращает массив типа TreeNode[].
|
1424
|
+
*/
|
1425
|
+
this.childrenHandler = (node) => (node.hasChildren ? this.service.getChildren(node) : []);
|
1426
|
+
}
|
1427
|
+
/**
|
1428
|
+
* Обрабатывает нажатие на указанный элемент дерева.
|
1429
|
+
*
|
1430
|
+
* @param node Элемент дерева.
|
1431
|
+
*/
|
1432
|
+
onToggled(node) {
|
1433
|
+
this.service.loadChildren(node);
|
1434
|
+
}
|
1435
|
+
}
|
1436
|
+
TreeDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDirective, deps: [{ token: i3$2.TuiTreeService }], target: i0.ɵɵFactoryTarget.Directive });
|
1437
|
+
TreeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: TreeDirective, selector: "[scTree]", providers: [TuiTreeService], exportAs: ["scTree"], ngImport: i0 });
|
1438
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDirective, decorators: [{
|
1439
|
+
type: Directive,
|
1440
|
+
args: [{
|
1441
|
+
selector: '[scTree]',
|
1442
|
+
exportAs: 'scTree',
|
1443
|
+
providers: [TuiTreeService],
|
1444
|
+
}]
|
1445
|
+
}], ctorParameters: function () { return [{ type: i3$2.TuiTreeService }]; } });
|
1446
|
+
|
1447
|
+
/**
|
1448
|
+
* Компонент для удаления стандартного значка элемента дерева.
|
1449
|
+
*/
|
1450
|
+
class FileTreeItemComponent extends TuiTreeItemContentComponent {
|
1451
|
+
}
|
1452
|
+
FileTreeItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FileTreeItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
1453
|
+
FileTreeItemComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: FileTreeItemComponent, selector: "sc-file-tree-item", host: { listeners: { "click": "onClick()" } }, usesInheritance: true, ngImport: i0, template: "<ng-container [ngTemplateOutlet]=\"context.template\"></ng-container>\n", styles: [":host{position:relative;min-height:var(--tui-height-s);display:flex;align-items:center;padding:.5rem;margin:.5rem 0;border-radius:12px;background:var(--tui-base-03)}:host._expandable:hover{cursor:pointer;background:var(--tui-base-03)}tui-svg{position:relative;background:inherit;z-index:1}\n"], dependencies: [{ kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1454
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FileTreeItemComponent, decorators: [{
|
1455
|
+
type: Component,
|
1456
|
+
args: [{ selector: 'sc-file-tree-item', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
1457
|
+
'(click)': `onClick()`,
|
1458
|
+
}, template: "<ng-container [ngTemplateOutlet]=\"context.template\"></ng-container>\n", styles: [":host{position:relative;min-height:var(--tui-height-s);display:flex;align-items:center;padding:.5rem;margin:.5rem 0;border-radius:12px;background:var(--tui-base-03)}:host._expandable:hover{cursor:pointer;background:var(--tui-base-03)}tui-svg{position:relative;background:inherit;z-index:1}\n"] }]
|
1459
|
+
}] });
|
1460
|
+
|
1461
|
+
/* eslint-disable @angular-eslint/no-input-rename */
|
1462
|
+
/**
|
1463
|
+
* Директива отвечающая за корневые элементы дерева.
|
1464
|
+
*/
|
1465
|
+
class TreeTopDirective {
|
1466
|
+
constructor() {
|
1467
|
+
/**
|
1468
|
+
* Отображаемое имя корневого элемента дерева.
|
1469
|
+
*/
|
1470
|
+
this.text = '';
|
1471
|
+
}
|
1472
|
+
}
|
1473
|
+
TreeTopDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeTopDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
1474
|
+
TreeTopDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: TreeTopDirective, selector: "[scTopNodeText]", inputs: { text: ["scTopNodeText", "text"], icon: ["scTopNodeIcon", "icon"], link: ["scTopNodeLink", "link"], hasChildren: ["scTopNodeChilds", "hasChildren"], id: ["scTopNodeParent", "id"], createdAt: ["scTopNodeDate", "createdAt"] }, providers: [
|
1475
|
+
{
|
1476
|
+
provide: TUI_TREE_START,
|
1477
|
+
useExisting: forwardRef(() => TreeTopDirective),
|
1478
|
+
},
|
1479
|
+
{
|
1480
|
+
provide: TUI_TREE_CONTENT,
|
1481
|
+
useValue: new PolymorpheusComponent(FileTreeItemComponent),
|
1482
|
+
},
|
1483
|
+
], ngImport: i0 });
|
1484
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeTopDirective, decorators: [{
|
1485
|
+
type: Directive,
|
1486
|
+
args: [{
|
1487
|
+
selector: '[scTopNodeText]',
|
1488
|
+
providers: [
|
1489
|
+
{
|
1490
|
+
provide: TUI_TREE_START,
|
1491
|
+
useExisting: forwardRef(() => TreeTopDirective),
|
1492
|
+
},
|
1493
|
+
{
|
1494
|
+
provide: TUI_TREE_CONTENT,
|
1495
|
+
useValue: new PolymorpheusComponent(FileTreeItemComponent),
|
1496
|
+
},
|
1497
|
+
],
|
1498
|
+
}]
|
1499
|
+
}], propDecorators: { text: [{
|
1500
|
+
type: Input,
|
1501
|
+
args: ['scTopNodeText']
|
1502
|
+
}], icon: [{
|
1503
|
+
type: Input,
|
1504
|
+
args: ['scTopNodeIcon']
|
1505
|
+
}], link: [{
|
1506
|
+
type: Input,
|
1507
|
+
args: ['scTopNodeLink']
|
1508
|
+
}], hasChildren: [{
|
1509
|
+
type: Input,
|
1510
|
+
args: ['scTopNodeChilds']
|
1511
|
+
}], id: [{
|
1512
|
+
type: Input,
|
1513
|
+
args: ['scTopNodeParent']
|
1514
|
+
}], createdAt: [{
|
1515
|
+
type: Input,
|
1516
|
+
args: ['scTopNodeDate']
|
1517
|
+
}] } });
|
1518
|
+
|
1519
|
+
/**
|
1520
|
+
* Компонент файлов и документов.
|
1521
|
+
*/
|
1522
|
+
class FilesAndDocumentsComponent {
|
1523
|
+
/**
|
1524
|
+
* Инициализирует экземпляр класса {@link FilesAndDocumentsComponent}.
|
1525
|
+
*
|
1526
|
+
* @param loading Объект отвечающий за значок загрузки, в момент раскрытия элемента дерева.
|
1527
|
+
* @param iconService Сервис для определения и назначения значка элементу дерева.
|
1528
|
+
* @param filesService Сервис для загрузки файлов.
|
1529
|
+
*/
|
1530
|
+
constructor(loading, iconService, filesService) {
|
1531
|
+
this.loading = loading;
|
1532
|
+
this.iconService = iconService;
|
1533
|
+
this.filesService = filesService;
|
1534
|
+
/**
|
1535
|
+
* Данные визуализации и их начальное получение.
|
1536
|
+
*/
|
1537
|
+
this.data$ = this.filesService.getFiles().pipe(map((data) => data.map((item) => ({
|
1538
|
+
text: item.name,
|
1539
|
+
icon: this.iconService.getIconName(item),
|
1540
|
+
hasChildren: this.iconService.hasChildren(item),
|
1541
|
+
createdAt: item.createdAt,
|
1542
|
+
id: item.id,
|
1543
|
+
link: item.link,
|
1544
|
+
}))));
|
1545
|
+
}
|
1546
|
+
}
|
1547
|
+
FilesAndDocumentsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsComponent, deps: [{ token: TUI_TREE_LOADING }, { token: TreeIconService }, { token: i1.ScFilesService }], target: i0.ɵɵFactoryTarget.Component });
|
1548
|
+
FilesAndDocumentsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: FilesAndDocumentsComponent, selector: "sc-files-and-documents", providers: [
|
1549
|
+
{
|
1550
|
+
provide: TUI_TREE_LOADER,
|
1551
|
+
useClass: TreeLoaderService,
|
1552
|
+
},
|
1553
|
+
], ngImport: i0, template: "<ng-container *ngIf=\"data$ | async as data; else skeleton\">\n <tui-tree\n *ngFor=\"let node of data\"\n #tree=\"scTree\"\n scTree\n [scTopNodeText]=\"node.text\"\n [scTopNodeIcon]=\"node.icon\"\n [scTopNodeLink]=\"node.link\"\n [scTopNodeChilds]=\"node.hasChildren\"\n [scTopNodeParent]=\"node.id\"\n [scTopNodeDate]=\"node.createdAt\"\n [childrenHandler]=\"tree.childrenHandler\"\n [content]=\"content\"\n [map]=\"tree.map\"\n [tuiTreeController]=\"false\"\n [value]=\"tree.service.data$ | async\"\n (toggled)=\"tree.onToggled($event)\"\n class=\"overflow-hidden\"\n ></tui-tree>\n</ng-container>\n\n<ng-template #content let-item>\n <tui-loader *ngIf=\"item === loading; else text\" class=\"w-8 my-4\"></tui-loader>\n <ng-template #text>\n <tui-svg [src]=\"item.icon\" class=\"tui-space_right-2\"></tui-svg>\n <a tuiLink [pseudo]=\"true\" *ngIf=\"item.link\" href=\"{{ item.link }}\" class=\"grow\">{{ item.text }}</a>\n <p *ngIf=\"!item.link\" class=\"grow\">{{ item.text }}</p>\n <p>{{ item.createdAt }}</p>\n </ng-template>\n</ng-template>\n\n<ng-template #skeleton>\n <div class=\"flex flex-col gap-2\">\n <div *ngFor=\"let _ of [].constructor(7)\" class=\"flex items-center gap-2\">\n <div class=\"tui-skeleton h-6 w-6\"></div>\n <div class=\"tui-skeleton h-4 w-40\"></div>\n </div>\n </div>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$2.TuiTreeComponent, selector: "tui-tree[value]", inputs: ["value", "trackBy", "content"] }, { kind: "directive", type: i3$2.TuiTreeChildrenDirective, selector: "tui-tree[childrenHandler]", inputs: ["childrenHandler"] }, { kind: "directive", type: i3$2.TuiTreeControllerDirective, selector: "[tuiTreeController][map]", inputs: ["tuiTreeController", "map"], outputs: ["toggled"], exportAs: ["tuiTreeController"] }, { kind: "component", type: i3$1.TuiSvgComponent, selector: "tui-svg", inputs: ["src"] }, { kind: "component", type: i3$1.TuiLoaderComponent, selector: "tui-loader", inputs: ["size", "inheritColor", "overlay", "textContent", "showLoader"] }, { kind: "component", type: i3$1.TuiLinkComponent, selector: "a[tuiLink], button[tuiLink]", inputs: ["pseudo", "icon", "iconAlign", "iconRotated", "mode"], exportAs: ["tuiLink"] }, { kind: "directive", type: TreeDirective, selector: "[scTree]", exportAs: ["scTree"] }, { kind: "directive", type: TreeTopDirective, selector: "[scTopNodeText]", inputs: ["scTopNodeText", "scTopNodeIcon", "scTopNodeLink", "scTopNodeChilds", "scTopNodeParent", "scTopNodeDate"] }, { kind: "pipe", type: i3.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1554
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsComponent, decorators: [{
|
1555
|
+
type: Component,
|
1556
|
+
args: [{ selector: 'sc-files-and-documents', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
1557
|
+
{
|
1558
|
+
provide: TUI_TREE_LOADER,
|
1559
|
+
useClass: TreeLoaderService,
|
1560
|
+
},
|
1561
|
+
], template: "<ng-container *ngIf=\"data$ | async as data; else skeleton\">\n <tui-tree\n *ngFor=\"let node of data\"\n #tree=\"scTree\"\n scTree\n [scTopNodeText]=\"node.text\"\n [scTopNodeIcon]=\"node.icon\"\n [scTopNodeLink]=\"node.link\"\n [scTopNodeChilds]=\"node.hasChildren\"\n [scTopNodeParent]=\"node.id\"\n [scTopNodeDate]=\"node.createdAt\"\n [childrenHandler]=\"tree.childrenHandler\"\n [content]=\"content\"\n [map]=\"tree.map\"\n [tuiTreeController]=\"false\"\n [value]=\"tree.service.data$ | async\"\n (toggled)=\"tree.onToggled($event)\"\n class=\"overflow-hidden\"\n ></tui-tree>\n</ng-container>\n\n<ng-template #content let-item>\n <tui-loader *ngIf=\"item === loading; else text\" class=\"w-8 my-4\"></tui-loader>\n <ng-template #text>\n <tui-svg [src]=\"item.icon\" class=\"tui-space_right-2\"></tui-svg>\n <a tuiLink [pseudo]=\"true\" *ngIf=\"item.link\" href=\"{{ item.link }}\" class=\"grow\">{{ item.text }}</a>\n <p *ngIf=\"!item.link\" class=\"grow\">{{ item.text }}</p>\n <p>{{ item.createdAt }}</p>\n </ng-template>\n</ng-template>\n\n<ng-template #skeleton>\n <div class=\"flex flex-col gap-2\">\n <div *ngFor=\"let _ of [].constructor(7)\" class=\"flex items-center gap-2\">\n <div class=\"tui-skeleton h-6 w-6\"></div>\n <div class=\"tui-skeleton h-4 w-40\"></div>\n </div>\n </div>\n</ng-template>\n" }]
|
1562
|
+
}], ctorParameters: function () { return [{ type: undefined, decorators: [{
|
1563
|
+
type: Inject,
|
1564
|
+
args: [TUI_TREE_LOADING]
|
1565
|
+
}] }, { type: TreeIconService }, { type: i1.ScFilesService }]; } });
|
1566
|
+
|
1567
|
+
/**
|
1568
|
+
* Модуль файлов и документов.
|
1569
|
+
*/
|
1570
|
+
class FilesAndDocumentsModule {
|
1571
|
+
}
|
1572
|
+
FilesAndDocumentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1573
|
+
FilesAndDocumentsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsModule, declarations: [FilesAndDocumentsComponent, TreeDirective, TreeTopDirective, FileTreeItemComponent], imports: [CommonModule, TuiTreeModule, TuiSvgModule, TuiLoaderModule, TuiLinkModule], exports: [FilesAndDocumentsComponent] });
|
1574
|
+
FilesAndDocumentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsModule, imports: [CommonModule, TuiTreeModule, TuiSvgModule, TuiLoaderModule, TuiLinkModule] });
|
1575
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsModule, decorators: [{
|
1576
|
+
type: NgModule,
|
1577
|
+
args: [{
|
1578
|
+
imports: [CommonModule, TuiTreeModule, TuiSvgModule, TuiLoaderModule, TuiLinkModule],
|
1579
|
+
declarations: [FilesAndDocumentsComponent, TreeDirective, TreeTopDirective, FileTreeItemComponent],
|
1580
|
+
exports: [FilesAndDocumentsComponent],
|
1581
|
+
}]
|
1582
|
+
}] });
|
1583
|
+
|
1584
|
+
/**
|
1585
|
+
* Список иконок.
|
1586
|
+
* TODO: TASK[#7779] Добавить иконки отдельных значков для соц. сетей после добавления их в кит дизайна.
|
1587
|
+
*/
|
1588
|
+
const scClientUiIconsName = [
|
1589
|
+
'scIconCalendar',
|
1590
|
+
'scIconWordFile',
|
1591
|
+
'scIconWarning',
|
1592
|
+
'scIconWallet',
|
1593
|
+
'scIconViewTree',
|
1594
|
+
'scIconMinus',
|
1595
|
+
'scIconViewInline',
|
1596
|
+
'scIconViewGrid',
|
1597
|
+
'scIconVerticalThreeDots',
|
1598
|
+
'scIconTop',
|
1599
|
+
'scIconTick',
|
1600
|
+
'scIconTasks',
|
1601
|
+
'scIconSuitcase',
|
1602
|
+
'scIconStar',
|
1603
|
+
'scIconShare',
|
1604
|
+
'scIconSettings',
|
1605
|
+
'scIconSend',
|
1606
|
+
'scIconSearch',
|
1607
|
+
'scIconSave',
|
1608
|
+
'scIconRocket',
|
1609
|
+
'scIconRequisites',
|
1610
|
+
'scIconRepeat',
|
1611
|
+
'scIconRefresh',
|
1612
|
+
'scIconReclamation',
|
1613
|
+
'scIconQuestion',
|
1614
|
+
'scIconQRCodeScan',
|
1615
|
+
'scIconProfile',
|
1616
|
+
'scIconPrice',
|
1617
|
+
'scIconPlus',
|
1618
|
+
'scIconPhone',
|
1619
|
+
'scIconPercentage',
|
1620
|
+
'scIconPdfFile',
|
1621
|
+
'scIconPalette',
|
1622
|
+
'scIconOffer',
|
1623
|
+
'scIconNews',
|
1624
|
+
'scIconMoney2',
|
1625
|
+
'scIconMoney',
|
1626
|
+
'scIconMail',
|
1627
|
+
'scIconLogOut2',
|
1628
|
+
'scIconLogOut',
|
1629
|
+
'scIconLogIn',
|
1630
|
+
'scIconLockOpen',
|
1631
|
+
'scIconLock',
|
1632
|
+
'scIconLocation',
|
1633
|
+
'scIconList',
|
1634
|
+
'scIconLike',
|
1635
|
+
'scIconImage',
|
1636
|
+
'scIconHome',
|
1637
|
+
'scIconHistory',
|
1638
|
+
'scIconHeartFill',
|
1639
|
+
'scIconHeart',
|
1640
|
+
'scIconHamburger',
|
1641
|
+
'scIconGraph',
|
1642
|
+
'scIconFolderPlus',
|
1643
|
+
'scIconFolderOpen',
|
1644
|
+
'scIconFolder',
|
1645
|
+
'scIconFilter',
|
1646
|
+
'scIconFile',
|
1647
|
+
'scIconFavoriteFill',
|
1648
|
+
'scIconFavorite',
|
1649
|
+
'scIconEye',
|
1650
|
+
'scIconExcelFile',
|
1651
|
+
'scIconError',
|
1652
|
+
'scIconEdit',
|
1653
|
+
'scIconDownloading',
|
1654
|
+
'scIconDone',
|
1655
|
+
'scIconDeleteProfile',
|
1656
|
+
'scIconCross',
|
1657
|
+
'scIconContacts',
|
1658
|
+
'scIconConfigurator',
|
1659
|
+
'scIconClock',
|
1660
|
+
'scIconClip',
|
1661
|
+
'scIconClients',
|
1662
|
+
'scIconCatalog',
|
1663
|
+
'scIconCart',
|
1664
|
+
'scIconCancel',
|
1665
|
+
'scIconBubble',
|
1666
|
+
'scIconBook',
|
1667
|
+
'scIconBell',
|
1668
|
+
'scIconBasket',
|
1669
|
+
'scIconBag',
|
1670
|
+
'scIconAttention',
|
1671
|
+
'scIconArrowUp',
|
1672
|
+
'scIconArrowRight',
|
1673
|
+
'scIconArrowReturn',
|
1674
|
+
'scIconArrowLeft',
|
1675
|
+
'scIconArrowDownLargeEnd',
|
1676
|
+
'scIconArrowDownLarge',
|
1677
|
+
'scIconArrowDown',
|
1678
|
+
'scIconApplication',
|
1679
|
+
'scIconAddProfile',
|
1680
|
+
'scIconSocialCopy',
|
1681
|
+
'scIconSocialEmail',
|
1682
|
+
'scIconSocialFacebook',
|
1683
|
+
'scIconSocialInstagram',
|
1684
|
+
'scIconSocialQR',
|
1685
|
+
'scIconSocialTelegram',
|
1686
|
+
'scIconSocialViber',
|
1687
|
+
'scIconSocialVk',
|
1688
|
+
'scIconSocialWhatsapp',
|
1689
|
+
];
|
1690
|
+
|
1691
|
+
/**
|
1692
|
+
* Компонент кнопки "Поделиться".
|
1693
|
+
*/
|
1694
|
+
class ScShareButtonComponent {
|
1695
|
+
constructor() {
|
1696
|
+
/**
|
1697
|
+
* Формат внешнего вида кнопки.
|
1698
|
+
*/
|
1699
|
+
this.appearance = 'secondary';
|
1700
|
+
/**
|
1701
|
+
* Размер кнопки.
|
1702
|
+
*/
|
1703
|
+
this.size = 'm';
|
1704
|
+
/**
|
1705
|
+
* Событие клика по кнопке "Поделиться".
|
1706
|
+
*/
|
1707
|
+
this.clickShareEvent = new EventEmitter();
|
1708
|
+
}
|
1709
|
+
}
|
1710
|
+
ScShareButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1711
|
+
ScShareButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScShareButtonComponent, selector: "sc-share-button", inputs: { appearance: "appearance", size: "size" }, outputs: { clickShareEvent: "clickShareEvent" }, ngImport: i0, template: "<button tuiIconButton icon=\"scIconShare\" [appearance]=\"appearance\" [size]=\"size\" (click)=\"$event.stopPropagation(); clickShareEvent.emit()\"></button>\n", dependencies: [{ kind: "component", type: i3$1.TuiButtonComponent, selector: "button[tuiButton], button[tuiIconButton], a[tuiButton], a[tuiIconButton]", inputs: ["appearance", "disabled", "icon", "iconRight", "shape", "showLoader", "size"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1712
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonComponent, decorators: [{
|
1713
|
+
type: Component,
|
1714
|
+
args: [{ selector: 'sc-share-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button tuiIconButton icon=\"scIconShare\" [appearance]=\"appearance\" [size]=\"size\" (click)=\"$event.stopPropagation(); clickShareEvent.emit()\"></button>\n" }]
|
1715
|
+
}], propDecorators: { appearance: [{
|
1716
|
+
type: Input
|
1717
|
+
}], size: [{
|
1718
|
+
type: Input
|
1719
|
+
}], clickShareEvent: [{
|
1720
|
+
type: Output
|
1721
|
+
}] } });
|
1722
|
+
|
1723
|
+
/**
|
1724
|
+
* Компонент карточки новости.
|
1725
|
+
*/
|
1726
|
+
class ScNewsCardComponent {
|
1727
|
+
constructor() {
|
1728
|
+
/**
|
1729
|
+
* Событие клика по карточке новости.
|
1730
|
+
*/
|
1731
|
+
this.clickCardEvent = new EventEmitter();
|
1732
|
+
/**
|
1733
|
+
* Событие клика по кнопке "Поделиться" карточки новости.
|
1734
|
+
*/
|
1735
|
+
this.clickShareEvent = new EventEmitter();
|
1736
|
+
}
|
1737
|
+
}
|
1738
|
+
ScNewsCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1739
|
+
ScNewsCardComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScNewsCardComponent, selector: "sc-news-card", inputs: { news: "news" }, outputs: { clickCardEvent: "clickCardEvent", clickShareEvent: "clickShareEvent" }, ngImport: i0, template: "<div (click)=\"clickCardEvent.emit(news)\" class=\"block relative h-82 w-70 cursor-pointer shadow-sc-2 rounded-lg overflow-hidden bg-white\">\n <div [style.background-image]=\"'url(' + news.image + ')'\" class=\"bg-no-repeat bg-center bg-cover bg-tui-base-02 w-full h-50\"></div>\n <div class=\"px-6 py-4.5 h-32 w-full w-full flex justify-between align-baseline bg-white overflow-hidden\">\n <div class=\"flex flex-col gap-2.5\">\n <p class=\"text-sm text-tui-text-02\">{{ news.created_at }}</p>\n <a class=\"text-sm font-bold text-black line-clamp-3\">{{ news.subject }}</a>\n </div>\n <sc-share-button (clickShareEvent)=\"clickShareEvent.emit()\"></sc-share-button>\n </div>\n</div>\n", dependencies: [{ kind: "component", type: ScShareButtonComponent, selector: "sc-share-button", inputs: ["appearance", "size"], outputs: ["clickShareEvent"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1740
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsCardComponent, decorators: [{
|
1741
|
+
type: Component,
|
1742
|
+
args: [{ selector: 'sc-news-card', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div (click)=\"clickCardEvent.emit(news)\" class=\"block relative h-82 w-70 cursor-pointer shadow-sc-2 rounded-lg overflow-hidden bg-white\">\n <div [style.background-image]=\"'url(' + news.image + ')'\" class=\"bg-no-repeat bg-center bg-cover bg-tui-base-02 w-full h-50\"></div>\n <div class=\"px-6 py-4.5 h-32 w-full w-full flex justify-between align-baseline bg-white overflow-hidden\">\n <div class=\"flex flex-col gap-2.5\">\n <p class=\"text-sm text-tui-text-02\">{{ news.created_at }}</p>\n <a class=\"text-sm font-bold text-black line-clamp-3\">{{ news.subject }}</a>\n </div>\n <sc-share-button (clickShareEvent)=\"clickShareEvent.emit()\"></sc-share-button>\n </div>\n</div>\n" }]
|
1743
|
+
}], propDecorators: { news: [{
|
1744
|
+
type: Input
|
1745
|
+
}], clickCardEvent: [{
|
1746
|
+
type: Output
|
1747
|
+
}], clickShareEvent: [{
|
1748
|
+
type: Output
|
1749
|
+
}] } });
|
1750
|
+
|
1751
|
+
/**
|
1752
|
+
* Компонент скелетона карточки новости.
|
1753
|
+
*/
|
1754
|
+
class ScNewsCardSkeletonComponent {
|
1755
|
+
constructor() {
|
1756
|
+
/**
|
1757
|
+
* Признак, что необходимо отобразить скелетон изображения новости.
|
1758
|
+
*/
|
1759
|
+
this.hasImg = true;
|
1760
|
+
}
|
1761
|
+
}
|
1762
|
+
ScNewsCardSkeletonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsCardSkeletonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
1763
|
+
ScNewsCardSkeletonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScNewsCardSkeletonComponent, selector: "sc-news-card-skeleton", inputs: { hasImg: "hasImg" }, ngImport: i0, template: "<div class=\"block relative h-82 w-70 shadow-sc-2 rounded-lg overflow-hidden bg-white\">\n <div *ngIf=\"hasImg; else textBlock\" class=\"bg-tui-base-02 w-full h-50\"></div>\n <ng-template #textBlock>\n <div class=\"px-6 py-4.5 w-full flex flex-col gap-2\">\n <div class=\"h-3 rounded bg-tui-base-02 w-full\"></div>\n <div class=\"h-3 rounded bg-tui-base-02 w-3/4\"></div>\n <div class=\"h-3 rounded bg-tui-base-02 w-full\"></div>\n <div class=\"h-3 rounded bg-tui-base-02 w-3/4\"></div>\n <div class=\"h-3 rounded bg-tui-base-02 w-full\"></div>\n </div>\n </ng-template>\n\n <div class=\"w-3/4\">\n <ng-container *ngTemplateOutlet=\"textBlock\"></ng-container>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1764
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsCardSkeletonComponent, decorators: [{
|
1765
|
+
type: Component,
|
1766
|
+
args: [{ selector: 'sc-news-card-skeleton', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"block relative h-82 w-70 shadow-sc-2 rounded-lg overflow-hidden bg-white\">\n <div *ngIf=\"hasImg; else textBlock\" class=\"bg-tui-base-02 w-full h-50\"></div>\n <ng-template #textBlock>\n <div class=\"px-6 py-4.5 w-full flex flex-col gap-2\">\n <div class=\"h-3 rounded bg-tui-base-02 w-full\"></div>\n <div class=\"h-3 rounded bg-tui-base-02 w-3/4\"></div>\n <div class=\"h-3 rounded bg-tui-base-02 w-full\"></div>\n <div class=\"h-3 rounded bg-tui-base-02 w-3/4\"></div>\n <div class=\"h-3 rounded bg-tui-base-02 w-full\"></div>\n </div>\n </ng-template>\n\n <div class=\"w-3/4\">\n <ng-container *ngTemplateOutlet=\"textBlock\"></ng-container>\n </div>\n</div>\n" }]
|
1767
|
+
}], propDecorators: { hasImg: [{
|
1768
|
+
type: Input
|
1769
|
+
}] } });
|
1770
|
+
|
1771
|
+
/**
|
1772
|
+
* Модуль работы кнопки "Поделиться".
|
1773
|
+
*/
|
1774
|
+
class ScShareButtonModule {
|
1775
|
+
}
|
1776
|
+
ScShareButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1777
|
+
ScShareButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonModule, declarations: [ScShareButtonComponent], imports: [CommonModule, TuiButtonModule], exports: [ScShareButtonComponent] });
|
1778
|
+
ScShareButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonModule, imports: [CommonModule, TuiButtonModule] });
|
1779
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonModule, decorators: [{
|
1780
|
+
type: NgModule,
|
1781
|
+
args: [{
|
1782
|
+
declarations: [ScShareButtonComponent],
|
1783
|
+
imports: [CommonModule, TuiButtonModule],
|
1784
|
+
exports: [ScShareButtonComponent],
|
1785
|
+
}]
|
1786
|
+
}] });
|
1787
|
+
|
1788
|
+
/**
|
1789
|
+
* Модуль работы с новостями.
|
1790
|
+
*/
|
1791
|
+
class ScNewsModule {
|
1792
|
+
}
|
1793
|
+
ScNewsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1794
|
+
ScNewsModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ScNewsModule, declarations: [ScNewsCardComponent, ScNewsCardSkeletonComponent], imports: [CommonModule, RouterModule, ScShareButtonModule], exports: [ScNewsCardComponent, ScNewsCardSkeletonComponent] });
|
1795
|
+
ScNewsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsModule, imports: [CommonModule, RouterModule, ScShareButtonModule] });
|
1796
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsModule, decorators: [{
|
1797
|
+
type: NgModule,
|
1798
|
+
args: [{
|
1799
|
+
declarations: [ScNewsCardComponent, ScNewsCardSkeletonComponent],
|
1800
|
+
imports: [CommonModule, RouterModule, ScShareButtonModule],
|
1801
|
+
exports: [ScNewsCardComponent, ScNewsCardSkeletonComponent],
|
1802
|
+
}]
|
1803
|
+
}] });
|
1804
|
+
|
1805
|
+
/**
|
1806
|
+
* Компонент карточки элемента заказа.
|
1807
|
+
*/
|
1808
|
+
class ScOrderItemMobileComponent {
|
1809
|
+
/**
|
1810
|
+
* Инициирует экземпляр класса {@link ScOrderItemMobileComponent}.
|
1811
|
+
*
|
1812
|
+
* @param unitsHelper Объект-хэлпер для работы со значениями единиц измерения товара.
|
1813
|
+
* @param previewDialogService Сервис диалогового окна предварительного просмотра.
|
1814
|
+
* @param urls Список ссылок на разделы backend'a.
|
1815
|
+
* @param pathImageNotFound Путь до изображения 'Товар не найден'.
|
1816
|
+
*/
|
1817
|
+
constructor(unitsHelper, previewDialogService, urls, pathImageNotFound) {
|
1818
|
+
this.unitsHelper = unitsHelper;
|
1819
|
+
this.previewDialogService = previewDialogService;
|
1820
|
+
this.urls = urls;
|
1821
|
+
this.pathImageNotFound = pathImageNotFound;
|
1822
|
+
/**
|
1823
|
+
* Событие нажатия на карточку.
|
1824
|
+
*/
|
1825
|
+
this.clickCardEvent = new EventEmitter();
|
1826
|
+
/**
|
1827
|
+
* Событие нажатия на дополнительные действия.
|
1828
|
+
*/
|
1829
|
+
this.clickActionsEvent = new EventEmitter();
|
1830
|
+
}
|
1831
|
+
/**
|
1832
|
+
* Продукт элемента заказа.
|
1833
|
+
*/
|
1834
|
+
get product() {
|
1835
|
+
return this.orderItem?.product;
|
1836
|
+
}
|
1837
|
+
/**
|
1838
|
+
* Отобразить спецификацию.
|
1839
|
+
*/
|
1840
|
+
showSpecification() {
|
1841
|
+
this.previewDialogService.open(this.specificationPreviewRef || '').subscribe();
|
1842
|
+
}
|
1843
|
+
/**
|
1844
|
+
* Возвращает ссылку на изображение карточки товара.
|
1845
|
+
*/
|
1846
|
+
getCardImage() {
|
1847
|
+
return this.product?.getImage(this.urls.imgServerUrl) ?? this.urls.imgServerUrl + this.pathImageNotFound;
|
1848
|
+
}
|
1849
|
+
}
|
1850
|
+
ScOrderItemMobileComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScOrderItemMobileComponent, deps: [{ token: UnitsHelper }, { token: TuiPreviewDialogService }, { token: SC_URLS }, { token: SC_PATH_IMAGE_NOT_FOUND }], target: i0.ɵɵFactoryTarget.Component });
|
1851
|
+
ScOrderItemMobileComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScOrderItemMobileComponent, selector: "sc-order-item-mobile", inputs: { orderItem: "orderItem" }, outputs: { clickCardEvent: "clickCardEvent", clickActionsEvent: "clickActionsEvent" }, viewQueries: [{ propertyName: "specificationPreviewRef", first: true, predicate: ["specificationPreview"], descendants: true }], ngImport: i0, template: "<div class=\"relative p-4 gap-y-2 gap-x-4 flex flex-wrap bg-white border border-tui-base-04 shadow-sc-2 rounded-xl\">\n <ng-container *ngIf=\"orderItem && product; else skeleton\">\n <button\n tuiIconButton\n (click)=\"clickActionsEvent.emit()\"\n size=\"m\"\n icon=\"scIconVerticalThreeDots\"\n appearance=\"float\"\n tuiMode=\"onLight\"\n class=\"!hidden !absolute right-0 top-0\"\n ></button>\n <div class=\"flex gap-2 grow\">\n <div class=\"flex shrink-0 h-20 w-20 justify-center items-center overflow-hidden\">\n <img (click)=\"clickCardEvent.emit()\" [src]=\"getCardImage()\" [alt]=\"product.name\" [class.p-5]=\"!product.images?.length\" class=\"cursor-pointer\" />\n </div>\n\n <div class=\"flex flex-wrap self-center gap-x-8 grow\">\n <div class=\"basis-min-content flex flex-col grow\">\n <a tuiLink (click)=\"clickCardEvent.emit()\">\n <span class=\"font-bold\">{{ product.name }}</span>\n </a>\n <div class=\"text-tui-text-02 text-xs flex flex-col gap-y-0.5\">\n <div class=\"flex flex-wrap gap-y-0.5\">\n <p class=\"w-40\">\u0410\u0440\u0442\u0438\u043A\u0443\u043B: {{ product.code }}</p>\n <p class=\"w-40\" *ngIf=\"product.pack\">\u041D\u043E\u0440\u043C\u0430 \u0443\u043F\u0430\u043A\u043E\u0432\u043A\u0438: {{ product.pack }}</p>\n </div>\n <a tuiLink *ngIf=\"orderItem.specificationImgUrl\" (click)=\"showSpecification()\">\u0421\u043F\u0435\u0446\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F</a>\n </div>\n </div>\n <div class=\"flex flex-wrap content-center\">\n <div class=\"flex flex-col w-40 gap-x-8 gap-y-0.5\">\n <span *ngIf=\"product.discount\" class=\"flex items-center text-xs text-tui-text-02\">\n <span class=\"line-through\">{{ product.discountCostString }}</span> \n <span class=\"text-tui-success-fill font-bold\"> -{{ product.discount.percent }}% </span>\n <ng-template #discountHint>\n <div class=\"font-bold\">{{ product.discount.name }}</div>\n <div *ngIf=\"product.discount.expiredAt as expiredAt\">\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F: {{ expiredAt }}</div>\n </ng-template>\n </span>\n <p class=\"flex flex-col items-baseline gap-x-2 font-bold\">\n <span>{{ product.costRubString }}</span>\n <span *ngIf=\"!product.priceInRub\" class=\"text-xs text-tui-text-02\">{{ product.costString }}</span>\n </p>\n <sc-price-warehouse-stock [product]=\"product\"></sc-price-warehouse-stock>\n </div>\n\n <div class=\"w-40 text-xs text-tui-text-02\">\n <ng-container *ngIf=\"unitsHelper.productIsMeasurable(product); else notMeasurable\">\n <p>\u0414\u043B\u0438\u043D\u0430: {{ orderItem.length }} {{ product.unit }}</p>\n </ng-container>\n <ng-template #notMeasurable>\n <p *ngIf=\"orderItem.length && !unitsHelper.productIsMeasurable(product)\">\u0414\u043B\u0438\u043D\u0430: {{ orderItem.length }} \u043C.</p>\n <p *ngIf=\"orderItem.width\">\u0428\u0438\u0440\u0438\u043D\u0430: {{ orderItem.width }} \u043C.</p>\n <p *ngIf=\"orderItem.height\">\u0412\u044B\u0441\u043E\u0442\u0430: {{ orderItem.height }} \u043C.</p>\n </ng-template>\n <p class=\"text-tui-base-09 text-sm\">\n \u0421\u0443\u043C\u043C\u0430: <span class=\"font-bold whitespace-nowrap\"> {{ orderItem.getCostRubStr() }} </span>\n </p>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-template #skeleton>\n <div class=\"flex gap-2 w-full\">\n <div class=\"h-20 w-20 bg-tui-base-02 rounded-xl \"></div>\n <div class=\"flex flex-col grow gap-2.5 bg-white\">\n <div class=\"w-full h-4 rounded-xl bg-tui-base-02\"></div>\n <div class=\"w-3/5 h-4 rounded-xl bg-tui-base-02\"></div>\n <div class=\"w-4/5 h-4 rounded-xl bg-tui-base-02\"></div>\n </div>\n </div>\n </ng-template>\n</div>\n", dependencies: [{ kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3$1.TuiLinkComponent, selector: "a[tuiLink], button[tuiLink]", inputs: ["pseudo", "icon", "iconAlign", "iconRotated", "mode"], exportAs: ["tuiLink"] }, { kind: "component", type: i3$1.TuiButtonComponent, selector: "button[tuiButton], button[tuiIconButton], a[tuiButton], a[tuiIconButton]", inputs: ["appearance", "disabled", "icon", "iconRight", "shape", "showLoader", "size"] }, { kind: "directive", type: i3$1.TuiModeDirective, selector: "[tuiMode]", inputs: ["tuiMode"] }, { kind: "component", type: ScPriceWarehouseStockComponent, selector: "sc-price-warehouse-stock", inputs: ["classList", "product", "withStockHint"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
1852
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScOrderItemMobileComponent, decorators: [{
|
1853
|
+
type: Component,
|
1854
|
+
args: [{ selector: 'sc-order-item-mobile', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"relative p-4 gap-y-2 gap-x-4 flex flex-wrap bg-white border border-tui-base-04 shadow-sc-2 rounded-xl\">\n <ng-container *ngIf=\"orderItem && product; else skeleton\">\n <button\n tuiIconButton\n (click)=\"clickActionsEvent.emit()\"\n size=\"m\"\n icon=\"scIconVerticalThreeDots\"\n appearance=\"float\"\n tuiMode=\"onLight\"\n class=\"!hidden !absolute right-0 top-0\"\n ></button>\n <div class=\"flex gap-2 grow\">\n <div class=\"flex shrink-0 h-20 w-20 justify-center items-center overflow-hidden\">\n <img (click)=\"clickCardEvent.emit()\" [src]=\"getCardImage()\" [alt]=\"product.name\" [class.p-5]=\"!product.images?.length\" class=\"cursor-pointer\" />\n </div>\n\n <div class=\"flex flex-wrap self-center gap-x-8 grow\">\n <div class=\"basis-min-content flex flex-col grow\">\n <a tuiLink (click)=\"clickCardEvent.emit()\">\n <span class=\"font-bold\">{{ product.name }}</span>\n </a>\n <div class=\"text-tui-text-02 text-xs flex flex-col gap-y-0.5\">\n <div class=\"flex flex-wrap gap-y-0.5\">\n <p class=\"w-40\">\u0410\u0440\u0442\u0438\u043A\u0443\u043B: {{ product.code }}</p>\n <p class=\"w-40\" *ngIf=\"product.pack\">\u041D\u043E\u0440\u043C\u0430 \u0443\u043F\u0430\u043A\u043E\u0432\u043A\u0438: {{ product.pack }}</p>\n </div>\n <a tuiLink *ngIf=\"orderItem.specificationImgUrl\" (click)=\"showSpecification()\">\u0421\u043F\u0435\u0446\u0438\u0444\u0438\u043A\u0430\u0446\u0438\u044F</a>\n </div>\n </div>\n <div class=\"flex flex-wrap content-center\">\n <div class=\"flex flex-col w-40 gap-x-8 gap-y-0.5\">\n <span *ngIf=\"product.discount\" class=\"flex items-center text-xs text-tui-text-02\">\n <span class=\"line-through\">{{ product.discountCostString }}</span> \n <span class=\"text-tui-success-fill font-bold\"> -{{ product.discount.percent }}% </span>\n <ng-template #discountHint>\n <div class=\"font-bold\">{{ product.discount.name }}</div>\n <div *ngIf=\"product.discount.expiredAt as expiredAt\">\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F: {{ expiredAt }}</div>\n </ng-template>\n </span>\n <p class=\"flex flex-col items-baseline gap-x-2 font-bold\">\n <span>{{ product.costRubString }}</span>\n <span *ngIf=\"!product.priceInRub\" class=\"text-xs text-tui-text-02\">{{ product.costString }}</span>\n </p>\n <sc-price-warehouse-stock [product]=\"product\"></sc-price-warehouse-stock>\n </div>\n\n <div class=\"w-40 text-xs text-tui-text-02\">\n <ng-container *ngIf=\"unitsHelper.productIsMeasurable(product); else notMeasurable\">\n <p>\u0414\u043B\u0438\u043D\u0430: {{ orderItem.length }} {{ product.unit }}</p>\n </ng-container>\n <ng-template #notMeasurable>\n <p *ngIf=\"orderItem.length && !unitsHelper.productIsMeasurable(product)\">\u0414\u043B\u0438\u043D\u0430: {{ orderItem.length }} \u043C.</p>\n <p *ngIf=\"orderItem.width\">\u0428\u0438\u0440\u0438\u043D\u0430: {{ orderItem.width }} \u043C.</p>\n <p *ngIf=\"orderItem.height\">\u0412\u044B\u0441\u043E\u0442\u0430: {{ orderItem.height }} \u043C.</p>\n </ng-template>\n <p class=\"text-tui-base-09 text-sm\">\n \u0421\u0443\u043C\u043C\u0430: <span class=\"font-bold whitespace-nowrap\"> {{ orderItem.getCostRubStr() }} </span>\n </p>\n </div>\n </div>\n </div>\n </div>\n </ng-container>\n\n <ng-template #skeleton>\n <div class=\"flex gap-2 w-full\">\n <div class=\"h-20 w-20 bg-tui-base-02 rounded-xl \"></div>\n <div class=\"flex flex-col grow gap-2.5 bg-white\">\n <div class=\"w-full h-4 rounded-xl bg-tui-base-02\"></div>\n <div class=\"w-3/5 h-4 rounded-xl bg-tui-base-02\"></div>\n <div class=\"w-4/5 h-4 rounded-xl bg-tui-base-02\"></div>\n </div>\n </div>\n </ng-template>\n</div>\n" }]
|
1855
|
+
}], ctorParameters: function () { return [{ type: UnitsHelper }, { type: i7$1.TuiPreviewDialogService, decorators: [{
|
1856
|
+
type: Inject,
|
1857
|
+
args: [TuiPreviewDialogService]
|
1858
|
+
}] }, { type: undefined, decorators: [{
|
1859
|
+
type: Inject,
|
1860
|
+
args: [SC_URLS]
|
1861
|
+
}] }, { type: undefined, decorators: [{
|
1862
|
+
type: Inject,
|
1863
|
+
args: [SC_PATH_IMAGE_NOT_FOUND]
|
1864
|
+
}] }]; }, propDecorators: { specificationPreviewRef: [{
|
1865
|
+
type: ViewChild,
|
1866
|
+
args: ['specificationPreview']
|
1867
|
+
}], orderItem: [{
|
1868
|
+
type: Input
|
1869
|
+
}], clickCardEvent: [{
|
1870
|
+
type: Output
|
1871
|
+
}], clickActionsEvent: [{
|
1872
|
+
type: Output
|
1873
|
+
}] } });
|
1874
|
+
|
1875
|
+
/**
|
1876
|
+
* Модуль заказов.
|
1877
|
+
*/
|
1878
|
+
class ScOrderModule {
|
1879
|
+
}
|
1880
|
+
ScOrderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScOrderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
1881
|
+
ScOrderModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ScOrderModule, declarations: [ScOrderItemMobileComponent], imports: [CommonModule, TuiLinkModule, TuiButtonModule, TuiModeModule, TuiSvgModule, ScCatalogModule], exports: [ScOrderItemMobileComponent] });
|
1882
|
+
ScOrderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScOrderModule, imports: [CommonModule, TuiLinkModule, TuiButtonModule, TuiModeModule, TuiSvgModule, ScCatalogModule] });
|
1883
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScOrderModule, decorators: [{
|
1884
|
+
type: NgModule,
|
1885
|
+
args: [{
|
1886
|
+
declarations: [ScOrderItemMobileComponent],
|
1887
|
+
exports: [ScOrderItemMobileComponent],
|
1888
|
+
imports: [CommonModule, TuiLinkModule, TuiButtonModule, TuiModeModule, TuiSvgModule, ScCatalogModule],
|
1889
|
+
}]
|
1890
|
+
}] });
|
1891
|
+
|
1892
|
+
/*
|
1893
|
+
* Public API Surface of ui
|
1894
|
+
*/
|
1895
|
+
|
1896
|
+
/**
|
1897
|
+
* Generated bundle index. Do not edit.
|
1898
|
+
*/
|
1899
|
+
|
1900
|
+
export { FilesAndDocumentsComponent, FilesAndDocumentsModule, SC_LINEAR_VALUES, SC_LINEAR_VALUES_TOKEN, ScBannerComponent, ScBannerModule, ScCartItemMobileComponent, ScCartModule, ScCatalogModule, ScCategoryCardComponent, ScFavoriteBtnComponent, ScInputQuantityComponent, ScNewsCardComponent, ScNewsCardSkeletonComponent, ScNewsModule, ScOrderItemMobileComponent, ScOrderModule, ScPriceCardComponent, ScPriceHistoryComponent, ScPriceWarehouseStockComponent, ScShareButtonComponent, ScShareButtonModule, TreeDirective, TreeIconService, TreeLoaderService, TreeTopDirective, scClientUiIconsName, stepValidator };
|
1901
|
+
//# sourceMappingURL=snabcentr-client-ui.mjs.map
|