@snabcentr/client-ui 0.0.0-test
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of @snabcentr/client-ui might be problematic. Click here for more details.
- package/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,1929 @@
|
|
|
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(() => { var _a, _b; return !this.disabled && (((_b = (_a = this.banners) === null || _a === void 0 ? void 0 : _a[this.currentBannerId]) === null || _b === void 0 ? void 0 : _b.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 === null || entry === void 0 ? void 0 : entry.isIntersecting));
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Переключает на предыдущий баннер.
|
|
178
|
+
*/
|
|
179
|
+
onPreviousBanner() {
|
|
180
|
+
var _a, _b;
|
|
181
|
+
const previous = this.currentBannerId - 1;
|
|
182
|
+
this.currentBannerId = previous < 0 ? this.bannersListRef.length + ((_b = (_a = this.banners) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) - 1 : previous;
|
|
183
|
+
this.cdr.markForCheck();
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Переключает на следующий баннер.
|
|
187
|
+
*/
|
|
188
|
+
onNextBanner() {
|
|
189
|
+
var _a, _b;
|
|
190
|
+
const next = this.currentBannerId + 1;
|
|
191
|
+
this.currentBannerId = next === this.bannersListRef.length + ((_b = (_a = this.banners) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) ? 0 : next;
|
|
192
|
+
this.cdr.markForCheck();
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Переключает на следующий баннер.
|
|
196
|
+
*/
|
|
197
|
+
onEndedVideo() {
|
|
198
|
+
this.onNextBanner();
|
|
199
|
+
this.toggleTimer$.next(true);
|
|
200
|
+
this.showPlayBtn = true;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Обработчик нажатия на баннер, генерирующий событие {@link clickBannerImgEvent}.
|
|
204
|
+
*
|
|
205
|
+
* @param banner Баннер, по ссылке которого совершён переход.
|
|
206
|
+
*/
|
|
207
|
+
onClick(banner) {
|
|
208
|
+
if (banner.url) {
|
|
209
|
+
this.clickBannerEvent.emit(banner);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
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 });
|
|
214
|
+
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 });
|
|
215
|
+
ScBannerComponent = __decorate([
|
|
216
|
+
UntilDestroy({ checkProperties: true })
|
|
217
|
+
], ScBannerComponent);
|
|
218
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScBannerComponent, decorators: [{
|
|
219
|
+
type: Component,
|
|
220
|
+
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"] }]
|
|
221
|
+
}], ctorParameters: function () {
|
|
222
|
+
return [{ type: i0.ChangeDetectorRef }, { type: i1.ScBannerService }, { type: i8.IntersectionObserverService, decorators: [{
|
|
223
|
+
type: Inject,
|
|
224
|
+
args: [IntersectionObserverService]
|
|
225
|
+
}] }, { type: i0.ElementRef, decorators: [{
|
|
226
|
+
type: Inject,
|
|
227
|
+
args: [ElementRef]
|
|
228
|
+
}] }, { type: ScPxConverter }];
|
|
229
|
+
}, propDecorators: { navigateButton: [{
|
|
230
|
+
type: Input
|
|
231
|
+
}], playerInterval: [{
|
|
232
|
+
type: Input
|
|
233
|
+
}], disabled: [{
|
|
234
|
+
type: Input
|
|
235
|
+
}], bannerLocation: [{
|
|
236
|
+
type: Input
|
|
237
|
+
}], resizable: [{
|
|
238
|
+
type: Input
|
|
239
|
+
}], loadBannersEvent: [{
|
|
240
|
+
type: Output
|
|
241
|
+
}], clickBannerEvent: [{
|
|
242
|
+
type: Output
|
|
243
|
+
}], bannersListRef: [{
|
|
244
|
+
type: ContentChildren,
|
|
245
|
+
args: ['banner']
|
|
246
|
+
}], videoRef: [{
|
|
247
|
+
type: ViewChild,
|
|
248
|
+
args: ['videoPlayer']
|
|
249
|
+
}], isHidden: [{
|
|
250
|
+
type: HostBinding,
|
|
251
|
+
args: ['class.!hidden']
|
|
252
|
+
}], height: [{
|
|
253
|
+
type: HostBinding,
|
|
254
|
+
args: ['style.height']
|
|
255
|
+
}], width: [{
|
|
256
|
+
type: HostBinding,
|
|
257
|
+
args: ['style.width']
|
|
258
|
+
}], aspectRatio: [{
|
|
259
|
+
type: HostBinding,
|
|
260
|
+
args: ['style.aspect-ratio']
|
|
261
|
+
}], mouseEnterHandler: [{
|
|
262
|
+
type: HostListener,
|
|
263
|
+
args: ['mouseenter']
|
|
264
|
+
}], mouseLeaveHandler: [{
|
|
265
|
+
type: HostListener,
|
|
266
|
+
args: ['mouseleave']
|
|
267
|
+
}] } });
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Модуль баннеров.
|
|
271
|
+
*/
|
|
272
|
+
class ScBannerModule {
|
|
273
|
+
}
|
|
274
|
+
ScBannerModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScBannerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
275
|
+
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] });
|
|
276
|
+
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] });
|
|
277
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScBannerModule, decorators: [{
|
|
278
|
+
type: NgModule,
|
|
279
|
+
args: [{
|
|
280
|
+
declarations: [ScBannerComponent],
|
|
281
|
+
imports: [CommonModule, RouterModule, TuiButtonModule, MatRippleModule, TuiCarouselModule, TuiModeModule, TuiLoaderModule, IntersectionObserverModule, TuiLetModule],
|
|
282
|
+
exports: [ScBannerComponent],
|
|
283
|
+
}]
|
|
284
|
+
}] });
|
|
285
|
+
|
|
286
|
+
/**
|
|
287
|
+
* Единицы измерения линейной величины по умолчанию.
|
|
288
|
+
*/
|
|
289
|
+
const SC_LINEAR_VALUES = ['пог.м.', 'м.'];
|
|
290
|
+
/**
|
|
291
|
+
* Токен единиц измерения линейной величины по умолчанию.
|
|
292
|
+
*/
|
|
293
|
+
const SC_LINEAR_VALUES_TOKEN = tuiCreateToken(SC_LINEAR_VALUES);
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Класс хэлпер для работы со значениями единиц измерения товара.
|
|
297
|
+
*/
|
|
298
|
+
class UnitsHelper {
|
|
299
|
+
/**
|
|
300
|
+
* Инициирует экземпляр класса {@link UnitsHelper}.
|
|
301
|
+
*
|
|
302
|
+
* @param linearValues Единицы измерения линейной величины.
|
|
303
|
+
*/
|
|
304
|
+
constructor(linearValues) {
|
|
305
|
+
this.linearValues = linearValues;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Возвращает признак возможности продажи товара на метраж.
|
|
309
|
+
*
|
|
310
|
+
* @param linearValues Товар для которого нужно проверить возможность продажи на метраж.
|
|
311
|
+
*/
|
|
312
|
+
productIsMeasurable(product) {
|
|
313
|
+
return this.linearValues.includes(product.unit);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Возвращает кратность количества для товара.
|
|
317
|
+
*
|
|
318
|
+
* @param linearValues Товар для которого нужно вернуть кратность количества.
|
|
319
|
+
*/
|
|
320
|
+
productMultiplicity(product) {
|
|
321
|
+
return product && product.minCount && !this.linearValues.includes(product.unit) ? product.minCount : 1;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
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 });
|
|
325
|
+
UnitsHelper.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UnitsHelper, providedIn: 'root' });
|
|
326
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: UnitsHelper, decorators: [{
|
|
327
|
+
type: Injectable,
|
|
328
|
+
args: [{
|
|
329
|
+
providedIn: 'root',
|
|
330
|
+
}]
|
|
331
|
+
}], ctorParameters: function () {
|
|
332
|
+
return [{ type: undefined, decorators: [{
|
|
333
|
+
type: Inject,
|
|
334
|
+
args: [SC_LINEAR_VALUES_TOKEN]
|
|
335
|
+
}] }];
|
|
336
|
+
} });
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* Проверяет кратность значения.
|
|
340
|
+
*
|
|
341
|
+
* @param step Шаг кратности.
|
|
342
|
+
*/
|
|
343
|
+
function stepValidator(step) {
|
|
344
|
+
return (control) => {
|
|
345
|
+
// Умножение на 1000 нужно для уменьшения вероятности погрешности при выполнении вычислений над десятичными числами.
|
|
346
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
347
|
+
return control.value && (Number.parseFloat(control.value) * 1000) % (step * 1000) ? { error: `Число не кратно ${step}` } : null;
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
class ScInputQuantityComponent extends AbstractTuiNullableControl {
|
|
352
|
+
/**
|
|
353
|
+
* Инициализирует экземпляр класса {@link ScInputQuantityComponent}.
|
|
354
|
+
*
|
|
355
|
+
* @param ngControl Объект поля ввода для настройки валидации.
|
|
356
|
+
* @param cdr Объект для работы с обнаружением изменений.
|
|
357
|
+
* @param transformer Преобразователь значений элемента формы.
|
|
358
|
+
*/
|
|
359
|
+
constructor(ngControl, cdr, transformer) {
|
|
360
|
+
super(ngControl, cdr, transformer);
|
|
361
|
+
/**
|
|
362
|
+
* Шаг увеличения количества. Отвечает за проверку кратности ввода.
|
|
363
|
+
*/
|
|
364
|
+
this.step = 1;
|
|
365
|
+
/**
|
|
366
|
+
* Признак, что необходимо отобразить {@link TuiLoaderComponent} над компонентом.
|
|
367
|
+
*/
|
|
368
|
+
this.showLoader = false;
|
|
369
|
+
/**
|
|
370
|
+
* Признак, что необходимо отобразить кнопку очистки поля ввода.
|
|
371
|
+
*/
|
|
372
|
+
this.showCross = true;
|
|
373
|
+
/**
|
|
374
|
+
* Формат внешнего вида компонента.
|
|
375
|
+
*/
|
|
376
|
+
this.appearance = 'primary';
|
|
377
|
+
/**
|
|
378
|
+
* Признак, что компонент деактивирован.
|
|
379
|
+
*/
|
|
380
|
+
this.isDisabled = false;
|
|
381
|
+
/**
|
|
382
|
+
* Размер компонента.
|
|
383
|
+
*/
|
|
384
|
+
this.size = 'm';
|
|
385
|
+
/**
|
|
386
|
+
* Событие нажатия на кнопку "Очистить".
|
|
387
|
+
*/
|
|
388
|
+
this.clickClearEvent = new EventEmitter();
|
|
389
|
+
}
|
|
390
|
+
get focused() {
|
|
391
|
+
var _a;
|
|
392
|
+
return !!((_a = this.numberInput) === null || _a === void 0 ? void 0 : _a.focused);
|
|
393
|
+
}
|
|
394
|
+
get formControl() {
|
|
395
|
+
return this.control;
|
|
396
|
+
}
|
|
397
|
+
/** @inheritDoc */
|
|
398
|
+
ngOnInit() {
|
|
399
|
+
if (this.control) {
|
|
400
|
+
this.control.setValidators(stepValidator(this.step));
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Обработчик события нажатия стрелок клавиатуры.
|
|
405
|
+
*
|
|
406
|
+
* @param step Шаг изменения количества.
|
|
407
|
+
*/
|
|
408
|
+
onArrow(step) {
|
|
409
|
+
if (!step) {
|
|
410
|
+
return;
|
|
411
|
+
}
|
|
412
|
+
if (step > 0) {
|
|
413
|
+
this.incident();
|
|
414
|
+
}
|
|
415
|
+
else {
|
|
416
|
+
this.decrement();
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Увеличивает значение в поле ввода на 1 шаг. Если число в поле ввода не кратно шагу, то увеличит до ближайшего кратного значения.
|
|
421
|
+
*/
|
|
422
|
+
incident() {
|
|
423
|
+
this.numberInput.onArrow(this.step - ((this.numberInput.value || 0) % this.step));
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Уменьшает значение в поле ввода на 1 шаг. Если число в поле ввода не кратно шагу, то уменьшит до ближайшего кратного значения.
|
|
427
|
+
*/
|
|
428
|
+
decrement() {
|
|
429
|
+
this.numberInput.onArrow(-((this.numberInput.value || 0) % this.step) || -this.step);
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Очищает поля ввода.
|
|
433
|
+
*/
|
|
434
|
+
clear() {
|
|
435
|
+
var _a;
|
|
436
|
+
(_a = this.control) === null || _a === void 0 ? void 0 : _a.patchValue(null);
|
|
437
|
+
this.clickClearEvent.emit();
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
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 });
|
|
441
|
+
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 });
|
|
442
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScInputQuantityComponent, decorators: [{
|
|
443
|
+
type: Component,
|
|
444
|
+
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"] }]
|
|
445
|
+
}], ctorParameters: function () {
|
|
446
|
+
return [{ type: i4.NgControl, decorators: [{
|
|
447
|
+
type: Optional
|
|
448
|
+
}, {
|
|
449
|
+
type: Self
|
|
450
|
+
}, {
|
|
451
|
+
type: Inject,
|
|
452
|
+
args: [NgControl]
|
|
453
|
+
}] }, { type: i0.ChangeDetectorRef, decorators: [{
|
|
454
|
+
type: Inject,
|
|
455
|
+
args: [ChangeDetectorRef]
|
|
456
|
+
}] }, { type: i7.AbstractTuiValueTransformer, decorators: [{
|
|
457
|
+
type: Optional
|
|
458
|
+
}, {
|
|
459
|
+
type: Inject,
|
|
460
|
+
args: [TUI_NUMBER_VALUE_TRANSFORMER]
|
|
461
|
+
}] }];
|
|
462
|
+
}, propDecorators: { numberInput: [{
|
|
463
|
+
type: ViewChild,
|
|
464
|
+
args: [TuiInputNumberComponent]
|
|
465
|
+
}], step: [{
|
|
466
|
+
type: Input
|
|
467
|
+
}], quantityUnit: [{
|
|
468
|
+
type: Input
|
|
469
|
+
}], showLoader: [{
|
|
470
|
+
type: Input
|
|
471
|
+
}], showCross: [{
|
|
472
|
+
type: Input
|
|
473
|
+
}], appearance: [{
|
|
474
|
+
type: Input
|
|
475
|
+
}, {
|
|
476
|
+
type: HostBinding,
|
|
477
|
+
args: ['attr.data-appearance']
|
|
478
|
+
}], isDisabled: [{
|
|
479
|
+
type: Input
|
|
480
|
+
}, {
|
|
481
|
+
type: HostBinding,
|
|
482
|
+
args: ['attr.data-disabled']
|
|
483
|
+
}], size: [{
|
|
484
|
+
type: Input
|
|
485
|
+
}, {
|
|
486
|
+
type: HostBinding,
|
|
487
|
+
args: ['attr.data-size']
|
|
488
|
+
}], clickClearEvent: [{
|
|
489
|
+
type: Output
|
|
490
|
+
}], onArrow: [{
|
|
491
|
+
type: HostListener,
|
|
492
|
+
args: ['keydown.arrowDown', ['-step']]
|
|
493
|
+
}, {
|
|
494
|
+
type: HostListener,
|
|
495
|
+
args: ['keydown.arrowUp', ['step']]
|
|
496
|
+
}] } });
|
|
497
|
+
|
|
498
|
+
/**
|
|
499
|
+
* Компонент информации о наличии товара на складе.
|
|
500
|
+
*/
|
|
501
|
+
class ScPriceWarehouseStockComponent {
|
|
502
|
+
/**
|
|
503
|
+
* Инициализирует экземпляр класса {@link ScPriceWarehouseStockComponent}.
|
|
504
|
+
*
|
|
505
|
+
* @param warehouseService Сервис для работы со складами.
|
|
506
|
+
*/
|
|
507
|
+
constructor(warehouseService) {
|
|
508
|
+
this.warehouseService = warehouseService;
|
|
509
|
+
/**
|
|
510
|
+
* Признак, что необходимо отобразить подсказку по складам.
|
|
511
|
+
*/
|
|
512
|
+
this.withStockHint = true;
|
|
513
|
+
/**
|
|
514
|
+
* {@link Observable} изменения выбранного склада.
|
|
515
|
+
*/
|
|
516
|
+
this.warehouseSelect$ = this.warehouseService.getWarehouseSelectChange$();
|
|
517
|
+
/**
|
|
518
|
+
* {@link Observable} изменения списка складов.
|
|
519
|
+
*/
|
|
520
|
+
this.stockByWarehouses$ = this.warehouseSelect$.pipe(switchMap((warehouseSelect) => this.warehouseService.getWarehouses$().pipe(map((warehouses) => { var _a; return (_a = this.product.warehouseStockCount) === null || _a === void 0 ? void 0 : _a.map((stock) => [warehouses.find((warehouse) => warehouse.id === stock.id), stock]); }), map((stockByWarehouses) => stockByWarehouses === null || stockByWarehouses === void 0 ? void 0 : stockByWarehouses.sort((stock) => { var _a; return (((_a = stock[0]) === null || _a === void 0 ? void 0 : _a.id) === (warehouseSelect === null || warehouseSelect === void 0 ? void 0 : warehouseSelect.id) ? -1 : 1); })))));
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
ScPriceWarehouseStockComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceWarehouseStockComponent, deps: [{ token: i1.ScWarehouseService }], target: i0.ɵɵFactoryTarget.Component });
|
|
524
|
+
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 });
|
|
525
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceWarehouseStockComponent, decorators: [{
|
|
526
|
+
type: Component,
|
|
527
|
+
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"] }]
|
|
528
|
+
}], ctorParameters: function () { return [{ type: i1.ScWarehouseService }]; }, propDecorators: { classList: [{
|
|
529
|
+
type: Input
|
|
530
|
+
}], product: [{
|
|
531
|
+
type: Input
|
|
532
|
+
}], withStockHint: [{
|
|
533
|
+
type: Input
|
|
534
|
+
}] } });
|
|
535
|
+
|
|
536
|
+
/**
|
|
537
|
+
* Компонент карточки элемента корзины.
|
|
538
|
+
*/
|
|
539
|
+
class ScCartItemMobileComponent {
|
|
540
|
+
/**
|
|
541
|
+
* Инициирует экземпляр класса {@link ScCartItemMobileComponent}.
|
|
542
|
+
*
|
|
543
|
+
* @param unitsHelper Объект-хэлпер для работы со значениями единиц измерения товара.
|
|
544
|
+
* @param previewDialogService Сервис диалогового окна предварительного просмотра.
|
|
545
|
+
* @param urls Список ссылок на разделы backend'a.
|
|
546
|
+
* @param pathImageNotFound Путь до изображения 'Товар не найден'.
|
|
547
|
+
*/
|
|
548
|
+
constructor(unitsHelper, previewDialogService, urls, pathImageNotFound) {
|
|
549
|
+
this.unitsHelper = unitsHelper;
|
|
550
|
+
this.previewDialogService = previewDialogService;
|
|
551
|
+
this.urls = urls;
|
|
552
|
+
this.pathImageNotFound = pathImageNotFound;
|
|
553
|
+
/**
|
|
554
|
+
* {@link FormControl} поля ввода количества товара в корзине.
|
|
555
|
+
*/
|
|
556
|
+
this.quantityControl = new FormControl(0);
|
|
557
|
+
/**
|
|
558
|
+
* {@link Observable} изменения количества товара в корзине.
|
|
559
|
+
*/
|
|
560
|
+
this.quantityValueChanges = this.quantityControl.valueChanges.pipe(skip(1));
|
|
561
|
+
/**
|
|
562
|
+
* Событие нажатия на кнопку "Удалить из корзины".
|
|
563
|
+
*/
|
|
564
|
+
this.clickDeleteEvent = new EventEmitter();
|
|
565
|
+
/**
|
|
566
|
+
* Событие нажатия на кнопку "Удалить из корзины".
|
|
567
|
+
*/
|
|
568
|
+
this.clickSettingsEvent = new EventEmitter();
|
|
569
|
+
/**
|
|
570
|
+
* Событие нажатия на карточку.
|
|
571
|
+
*/
|
|
572
|
+
this.clickCardEvent = new EventEmitter();
|
|
573
|
+
}
|
|
574
|
+
/**
|
|
575
|
+
* Элемент корзины.
|
|
576
|
+
*/
|
|
577
|
+
set cartItem(data) {
|
|
578
|
+
this._cartItem = data;
|
|
579
|
+
if (data) {
|
|
580
|
+
this.quantityControl.patchValue(data.quantity);
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
/**
|
|
584
|
+
* Элемент корзины.
|
|
585
|
+
*/
|
|
586
|
+
get cartItem() {
|
|
587
|
+
return this._cartItem;
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* Продукт элемента корзины.
|
|
591
|
+
*/
|
|
592
|
+
get product() {
|
|
593
|
+
var _a;
|
|
594
|
+
return (_a = this.cartItem) === null || _a === void 0 ? void 0 : _a.product;
|
|
595
|
+
}
|
|
596
|
+
/** @inheritDoc */
|
|
597
|
+
ngOnInit() {
|
|
598
|
+
this.quantityValueChanges = this.quantityControl.valueChanges;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* Отобразить спецификацию.
|
|
602
|
+
*/
|
|
603
|
+
showSpecification() {
|
|
604
|
+
this.previewDialogService.open(this.specificationPreviewRef || '').subscribe();
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Возвращает ссылку на изображение карточки товара.
|
|
608
|
+
*/
|
|
609
|
+
getCardImage() {
|
|
610
|
+
var _a, _b;
|
|
611
|
+
return (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.getImage(this.urls.imgServerUrl)) !== null && _b !== void 0 ? _b : this.urls.imgServerUrl + this.pathImageNotFound;
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
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 });
|
|
615
|
+
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 });
|
|
616
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCartItemMobileComponent, decorators: [{
|
|
617
|
+
type: Component,
|
|
618
|
+
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" }]
|
|
619
|
+
}], ctorParameters: function () {
|
|
620
|
+
return [{ type: UnitsHelper }, { type: i7$1.TuiPreviewDialogService, decorators: [{
|
|
621
|
+
type: Inject,
|
|
622
|
+
args: [TuiPreviewDialogService]
|
|
623
|
+
}] }, { type: undefined, decorators: [{
|
|
624
|
+
type: Inject,
|
|
625
|
+
args: [SC_URLS]
|
|
626
|
+
}] }, { type: undefined, decorators: [{
|
|
627
|
+
type: Inject,
|
|
628
|
+
args: [SC_PATH_IMAGE_NOT_FOUND]
|
|
629
|
+
}] }];
|
|
630
|
+
}, propDecorators: { specificationPreviewRef: [{
|
|
631
|
+
type: ViewChild,
|
|
632
|
+
args: ['specificationPreview']
|
|
633
|
+
}], cartItem: [{
|
|
634
|
+
type: Input
|
|
635
|
+
}], quantityValueChanges: [{
|
|
636
|
+
type: Output
|
|
637
|
+
}], clickDeleteEvent: [{
|
|
638
|
+
type: Output
|
|
639
|
+
}], clickSettingsEvent: [{
|
|
640
|
+
type: Output
|
|
641
|
+
}], clickCardEvent: [{
|
|
642
|
+
type: Output
|
|
643
|
+
}] } });
|
|
644
|
+
|
|
645
|
+
// TODO: TASK[#6771]: Реализовать кнопку избранных товаров.
|
|
646
|
+
/**
|
|
647
|
+
* Компонент кнопки избранных товаров и категорий.
|
|
648
|
+
*/
|
|
649
|
+
class ScFavoriteBtnComponent {
|
|
650
|
+
constructor() {
|
|
651
|
+
/**
|
|
652
|
+
* Событие нажатия на кнопку.
|
|
653
|
+
*/
|
|
654
|
+
this.clickEvent = new EventEmitter();
|
|
655
|
+
}
|
|
656
|
+
}
|
|
657
|
+
ScFavoriteBtnComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScFavoriteBtnComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
658
|
+
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 });
|
|
659
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScFavoriteBtnComponent, decorators: [{
|
|
660
|
+
type: Component,
|
|
661
|
+
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" }]
|
|
662
|
+
}], propDecorators: { clickEvent: [{
|
|
663
|
+
type: Output
|
|
664
|
+
}] } });
|
|
665
|
+
|
|
666
|
+
/**
|
|
667
|
+
* Карточка категории.
|
|
668
|
+
*/
|
|
669
|
+
class ScCategoryCardComponent {
|
|
670
|
+
/**
|
|
671
|
+
* Инициализирует экземпляр класса {@link CategoryCardComponent}.
|
|
672
|
+
*
|
|
673
|
+
* @param urls Список ссылок на разделы backend'a.
|
|
674
|
+
* @param renderer Экземпляр базового класса для реализации пользовательского рендеринга.
|
|
675
|
+
* @param pathImageNotFound Путь до изображения 'Товар не найден'.
|
|
676
|
+
*/
|
|
677
|
+
constructor(urls, renderer, pathImageNotFound) {
|
|
678
|
+
this.urls = urls;
|
|
679
|
+
this.renderer = renderer;
|
|
680
|
+
this.pathImageNotFound = pathImageNotFound;
|
|
681
|
+
/**
|
|
682
|
+
* Размер карточки категории.
|
|
683
|
+
*/
|
|
684
|
+
this.size = 'm';
|
|
685
|
+
/**
|
|
686
|
+
* Признак, что карточка является скелетоном.
|
|
687
|
+
*/
|
|
688
|
+
this.isSkeleton = false;
|
|
689
|
+
/**
|
|
690
|
+
* Признак необходимости отобразить/скрыть кнопку избранной категории.
|
|
691
|
+
*/
|
|
692
|
+
this.showFavoriteBtn = true;
|
|
693
|
+
/**
|
|
694
|
+
* Признак что категория имеет поведение наведения и скрытия названия.
|
|
695
|
+
*/
|
|
696
|
+
this.isHovered = false;
|
|
697
|
+
/**
|
|
698
|
+
* Событие нажатия на карточку категории.
|
|
699
|
+
*/
|
|
700
|
+
this.clickOnCardEvent = new EventEmitter();
|
|
701
|
+
/**
|
|
702
|
+
* Событие нажатия на кнопку избранной категории.
|
|
703
|
+
*/
|
|
704
|
+
this.clickOnFavoriteEvent = new EventEmitter();
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Возвращает путь к изображению категории. Если путь отсутствует, то вернёт изображение по-умолчанию ("product_not_found").
|
|
708
|
+
*
|
|
709
|
+
* @param category Информация о категории.
|
|
710
|
+
*/
|
|
711
|
+
getCategoryImgURL(category) {
|
|
712
|
+
var _a, _b;
|
|
713
|
+
return ((_a = category.properties) === null || _a === void 0 ? void 0 : _a.image) ? this.urls.imgServerUrl + '/' + ((_b = category.properties) === null || _b === void 0 ? void 0 : _b.image) : this.pathImageNotFound;
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Обработчик события mousemove.
|
|
717
|
+
*/
|
|
718
|
+
moveEnterHandler() {
|
|
719
|
+
if (this.isHovered) {
|
|
720
|
+
this.name.nativeElement.style.maxHeight = `${this.name.nativeElement.scrollHeight / 16}rem`;
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Обработчик события mouseleave.
|
|
725
|
+
*/
|
|
726
|
+
mouseLeaveHandler() {
|
|
727
|
+
if (this.isHovered) {
|
|
728
|
+
this.renderer.setStyle(this.name.nativeElement, 'maxHeight', null);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
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 });
|
|
733
|
+
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 });
|
|
734
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCategoryCardComponent, decorators: [{
|
|
735
|
+
type: Component,
|
|
736
|
+
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"] }]
|
|
737
|
+
}], ctorParameters: function () {
|
|
738
|
+
return [{ type: undefined, decorators: [{
|
|
739
|
+
type: Inject,
|
|
740
|
+
args: [SC_URLS]
|
|
741
|
+
}] }, { type: i0.Renderer2 }, { type: undefined, decorators: [{
|
|
742
|
+
type: Inject,
|
|
743
|
+
args: [SC_PATH_IMAGE_NOT_FOUND]
|
|
744
|
+
}] }];
|
|
745
|
+
}, propDecorators: { category: [{
|
|
746
|
+
type: Input
|
|
747
|
+
}], name: [{
|
|
748
|
+
type: ViewChild,
|
|
749
|
+
args: ['name']
|
|
750
|
+
}], size: [{
|
|
751
|
+
type: Input
|
|
752
|
+
}, {
|
|
753
|
+
type: HostBinding,
|
|
754
|
+
args: ['attr.data-size']
|
|
755
|
+
}], isSkeleton: [{
|
|
756
|
+
type: Input
|
|
757
|
+
}], showFavoriteBtn: [{
|
|
758
|
+
type: Input
|
|
759
|
+
}], isHovered: [{
|
|
760
|
+
type: Input
|
|
761
|
+
}], clickOnCardEvent: [{
|
|
762
|
+
type: Output
|
|
763
|
+
}], clickOnFavoriteEvent: [{
|
|
764
|
+
type: Output
|
|
765
|
+
}], moveEnterHandler: [{
|
|
766
|
+
type: HostListener,
|
|
767
|
+
args: ['mousemove']
|
|
768
|
+
}], mouseLeaveHandler: [{
|
|
769
|
+
type: HostListener,
|
|
770
|
+
args: ['mouseleave']
|
|
771
|
+
}] } });
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Компонент карточки товара.
|
|
775
|
+
*/
|
|
776
|
+
class ScPriceCardComponent {
|
|
777
|
+
/**
|
|
778
|
+
* Инициирует экземпляр класса {@link ScPriceCardComponent}.
|
|
779
|
+
*
|
|
780
|
+
* @param unitsHelper Объект-хэлпер для работы со значениями единиц измерения товара.
|
|
781
|
+
* @param authService Сервис аутентификации пользователей.
|
|
782
|
+
* @param warehouseService Сервис для работы со складами.
|
|
783
|
+
* @param urls Список ссылок на разделы backend'a.
|
|
784
|
+
* @param pathImageNotFound Путь до изображения 'Товар не найден'.
|
|
785
|
+
*/
|
|
786
|
+
constructor(unitsHelper, authService, warehouseService, urls, pathImageNotFound) {
|
|
787
|
+
this.unitsHelper = unitsHelper;
|
|
788
|
+
this.authService = authService;
|
|
789
|
+
this.warehouseService = warehouseService;
|
|
790
|
+
this.urls = urls;
|
|
791
|
+
this.pathImageNotFound = pathImageNotFound;
|
|
792
|
+
/**
|
|
793
|
+
* Признак, что необходимо отобразить лоадер для поля ввода количества товара.
|
|
794
|
+
*/
|
|
795
|
+
this.quantityShowLoader = false;
|
|
796
|
+
/**
|
|
797
|
+
* Признак, что необходимо отобразить поле ввода количества товара.
|
|
798
|
+
*/
|
|
799
|
+
this.showQuantityControl = false;
|
|
800
|
+
/**
|
|
801
|
+
* Событие нажатия на кнопку "В избранное".
|
|
802
|
+
*/
|
|
803
|
+
this.clickFavoriteEvent = new EventEmitter();
|
|
804
|
+
/**
|
|
805
|
+
* Событие нажатия на кнопку "В корзину".
|
|
806
|
+
*/
|
|
807
|
+
this.clickAddToCartEvent = new EventEmitter();
|
|
808
|
+
/**
|
|
809
|
+
* Событие нажатия на кнопку очистки количества товара.
|
|
810
|
+
*/
|
|
811
|
+
this.clickClearEvent = new EventEmitter();
|
|
812
|
+
/**
|
|
813
|
+
* Событие нажатия на карточку товара.
|
|
814
|
+
*/
|
|
815
|
+
this.clickCardEvent = new EventEmitter();
|
|
816
|
+
/**
|
|
817
|
+
* {@link Observable} изменения выбранного склада.
|
|
818
|
+
*/
|
|
819
|
+
this.warehouseSelect$ = this.warehouseService.getWarehouseSelectChange$();
|
|
820
|
+
/**
|
|
821
|
+
* {@link FormControl} поля ввода количества товара в корзине.
|
|
822
|
+
*/
|
|
823
|
+
this.quantityControl = new FormControl(null);
|
|
824
|
+
/**
|
|
825
|
+
* {@link Observable} изменения количества товара в корзине.
|
|
826
|
+
*/
|
|
827
|
+
this.quantityValueChanges = this.quantityControl.valueChanges;
|
|
828
|
+
/**
|
|
829
|
+
* {@link Observable} изменения статуса авторизации.
|
|
830
|
+
*/
|
|
831
|
+
this.authStatus$ = this.authService.getAuthChange();
|
|
832
|
+
/**
|
|
833
|
+
* Размер компонента.
|
|
834
|
+
*/
|
|
835
|
+
this.size = 'm';
|
|
836
|
+
/**
|
|
837
|
+
* Признак того, нужно ли компонент растягивать на всю ширину свободного пространства.
|
|
838
|
+
*/
|
|
839
|
+
this.isWidthFull = false;
|
|
840
|
+
}
|
|
841
|
+
/**
|
|
842
|
+
* Позиция товара в корзине.
|
|
843
|
+
*
|
|
844
|
+
* TODO: Сделать товар в корзине наблюдаемой переменной после реализации TASK:[#7144].
|
|
845
|
+
*/
|
|
846
|
+
get cartItem() {
|
|
847
|
+
return this._cartItem;
|
|
848
|
+
}
|
|
849
|
+
/**
|
|
850
|
+
* Позиция товара в корзине
|
|
851
|
+
*
|
|
852
|
+
* TODO: Сделать товар в корзине наблюдаемой переменной после реализации TASK:[#7144].
|
|
853
|
+
*/
|
|
854
|
+
set cartItem(value) {
|
|
855
|
+
var _a, _b;
|
|
856
|
+
this._cartItem = value;
|
|
857
|
+
this.quantityControl.patchValue((_b = (_a = this._cartItem) === null || _a === void 0 ? void 0 : _a.quantity) !== null && _b !== void 0 ? _b : null, { emitEvent: false });
|
|
858
|
+
this.quantityShowLoader = false;
|
|
859
|
+
}
|
|
860
|
+
/**
|
|
861
|
+
* Конвертация размера для компонента sc-input-quantity.
|
|
862
|
+
* TODO: Решить проблему с функционалом size для разных платформ.
|
|
863
|
+
*/
|
|
864
|
+
get getQuantitySize() {
|
|
865
|
+
return this.size === 'xs' ? 's' : this.size;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Признак, что нужно показать скелетон.
|
|
869
|
+
*/
|
|
870
|
+
get skeletonVisible() {
|
|
871
|
+
return !this.product;
|
|
872
|
+
}
|
|
873
|
+
/**
|
|
874
|
+
* Возвращает ссылку на изображение карточки товара.
|
|
875
|
+
*/
|
|
876
|
+
getCardImage() {
|
|
877
|
+
var _a, _b;
|
|
878
|
+
return (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.getImage(this.urls.imgServerUrl)) !== null && _b !== void 0 ? _b : this.pathImageNotFound;
|
|
879
|
+
}
|
|
880
|
+
}
|
|
881
|
+
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 });
|
|
882
|
+
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 });
|
|
883
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceCardComponent, decorators: [{
|
|
884
|
+
type: Component,
|
|
885
|
+
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"] }]
|
|
886
|
+
}], ctorParameters: function () {
|
|
887
|
+
return [{ type: UnitsHelper }, { type: i1.ScAuthService }, { type: i1.ScWarehouseService }, { type: undefined, decorators: [{
|
|
888
|
+
type: Inject,
|
|
889
|
+
args: [SC_URLS]
|
|
890
|
+
}] }, { type: undefined, decorators: [{
|
|
891
|
+
type: Inject,
|
|
892
|
+
args: [SC_PATH_IMAGE_NOT_FOUND]
|
|
893
|
+
}] }];
|
|
894
|
+
}, propDecorators: { showQuantityControl: [{
|
|
895
|
+
type: Input
|
|
896
|
+
}], cartItem: [{
|
|
897
|
+
type: Input
|
|
898
|
+
}], product: [{
|
|
899
|
+
type: Input
|
|
900
|
+
}], clickFavoriteEvent: [{
|
|
901
|
+
type: Output
|
|
902
|
+
}], clickAddToCartEvent: [{
|
|
903
|
+
type: Output
|
|
904
|
+
}], clickClearEvent: [{
|
|
905
|
+
type: Output
|
|
906
|
+
}], clickCardEvent: [{
|
|
907
|
+
type: Output
|
|
908
|
+
}], quantityValueChanges: [{
|
|
909
|
+
type: Output
|
|
910
|
+
}], size: [{
|
|
911
|
+
type: Input
|
|
912
|
+
}, {
|
|
913
|
+
type: HostBinding,
|
|
914
|
+
args: ['attr.data-size']
|
|
915
|
+
}], isWidthFull: [{
|
|
916
|
+
type: Input
|
|
917
|
+
}] } });
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Настройки отрисовки графика.
|
|
921
|
+
*
|
|
922
|
+
* @see [Документация](https://echarts.apache.org/en/option.html#title)
|
|
923
|
+
*/
|
|
924
|
+
const scChartOption = {
|
|
925
|
+
grid: {
|
|
926
|
+
top: 12,
|
|
927
|
+
left: 64,
|
|
928
|
+
right: 0,
|
|
929
|
+
bottom: 24,
|
|
930
|
+
},
|
|
931
|
+
tooltip: {
|
|
932
|
+
trigger: 'axis',
|
|
933
|
+
formatter: (params) => {
|
|
934
|
+
const data = Array.isArray(params) ? params[0].data : params.data;
|
|
935
|
+
const date = new Date(data.value[0]);
|
|
936
|
+
const nextDate = new Date(data.value[2]);
|
|
937
|
+
return `
|
|
938
|
+
<div class="text-center text-black">
|
|
939
|
+
<span class="font-bold">${data.value[1]} ₽</span>
|
|
940
|
+
</br>
|
|
941
|
+
<span class="text-xs">${formatDate(date, 'dd.MM', 'en')} - ${formatDate(nextDate, 'dd.MM', 'en')}</span>
|
|
942
|
+
</div>
|
|
943
|
+
`;
|
|
944
|
+
},
|
|
945
|
+
axisPointer: {
|
|
946
|
+
animation: false,
|
|
947
|
+
type: 'cross',
|
|
948
|
+
},
|
|
949
|
+
textStyle: {
|
|
950
|
+
fontFamily: 'Roboto, "Helvetica Neue", sans-serif',
|
|
951
|
+
},
|
|
952
|
+
},
|
|
953
|
+
xAxis: {
|
|
954
|
+
type: 'time',
|
|
955
|
+
splitLine: {
|
|
956
|
+
show: false,
|
|
957
|
+
},
|
|
958
|
+
axisLine: {
|
|
959
|
+
show: false,
|
|
960
|
+
},
|
|
961
|
+
axisTick: {
|
|
962
|
+
show: false,
|
|
963
|
+
},
|
|
964
|
+
axisLabel: {
|
|
965
|
+
hideOverlap: true,
|
|
966
|
+
},
|
|
967
|
+
boundaryGap: ['3%', '3%'],
|
|
968
|
+
},
|
|
969
|
+
yAxis: {
|
|
970
|
+
splitLine: {
|
|
971
|
+
show: false,
|
|
972
|
+
},
|
|
973
|
+
axisLine: {
|
|
974
|
+
show: false,
|
|
975
|
+
},
|
|
976
|
+
axisTick: {
|
|
977
|
+
show: false,
|
|
978
|
+
},
|
|
979
|
+
axisLabel: {
|
|
980
|
+
formatter: (value) => tuiFormatNumber(value),
|
|
981
|
+
},
|
|
982
|
+
type: 'value',
|
|
983
|
+
boundaryGap: [0, '100%'],
|
|
984
|
+
},
|
|
985
|
+
series: {
|
|
986
|
+
name: 'История цены',
|
|
987
|
+
type: 'line',
|
|
988
|
+
showSymbol: false,
|
|
989
|
+
symbolSize: 12,
|
|
990
|
+
itemStyle: {
|
|
991
|
+
color: '#ffcc40',
|
|
992
|
+
},
|
|
993
|
+
},
|
|
994
|
+
};
|
|
995
|
+
|
|
996
|
+
/**
|
|
997
|
+
* График истории цен товара или услуги.
|
|
998
|
+
* TODO: TASK[#7482] Перепроверить возможность использования TuiLineDaysChart.
|
|
999
|
+
*/
|
|
1000
|
+
class ScPriceHistoryComponent {
|
|
1001
|
+
/**
|
|
1002
|
+
* Инициализирует экземпляр класса {@link PriceHistoryChartComponent}.
|
|
1003
|
+
*
|
|
1004
|
+
* @param cdr Объект для работы с обнаружением изменений.
|
|
1005
|
+
*/
|
|
1006
|
+
constructor(cdr) {
|
|
1007
|
+
this.cdr = cdr;
|
|
1008
|
+
/**
|
|
1009
|
+
* Настройки графика.
|
|
1010
|
+
*/
|
|
1011
|
+
this.initOption = { locale: 'RU' };
|
|
1012
|
+
/**
|
|
1013
|
+
* Параметры отрисовки графика истории цены.
|
|
1014
|
+
*/
|
|
1015
|
+
this.chartOption = scChartOption;
|
|
1016
|
+
/**
|
|
1017
|
+
* Данные об истории цены на товар или услугу.
|
|
1018
|
+
*/
|
|
1019
|
+
this.data = [];
|
|
1020
|
+
}
|
|
1021
|
+
/** @inheritDoc */
|
|
1022
|
+
ngOnInit() {
|
|
1023
|
+
if (this.chartOption.series && !Array.isArray(this.chartOption.series)) {
|
|
1024
|
+
this.chartOption.series.data = [];
|
|
1025
|
+
}
|
|
1026
|
+
Object.keys(this.history)
|
|
1027
|
+
.map((key) => {
|
|
1028
|
+
// ? Можно избежать переведя даты в api в формат ECMAScript® 2023: https://tc39.es/ecma262/#sec-date-time-string-format
|
|
1029
|
+
const dataString = key.split('.').reverse(), data = new Date(+dataString[0], +dataString[1] - 1, +dataString[2]);
|
|
1030
|
+
return { data: data, cost: this.history[String(key)].cost };
|
|
1031
|
+
})
|
|
1032
|
+
.sort((a, b) => +a.data - +b.data)
|
|
1033
|
+
.forEach((item, index, array) => {
|
|
1034
|
+
var _a, _b;
|
|
1035
|
+
let nextDate;
|
|
1036
|
+
if ((_a = array[index + 1]) === null || _a === void 0 ? void 0 : _a.data) {
|
|
1037
|
+
nextDate = new Date((_b = array[index + 1]) === null || _b === void 0 ? void 0 : _b.data);
|
|
1038
|
+
nextDate.setDate(nextDate.getDate() - 1);
|
|
1039
|
+
}
|
|
1040
|
+
else {
|
|
1041
|
+
nextDate = new Date();
|
|
1042
|
+
}
|
|
1043
|
+
this.pushDataItem(item.cost, item.data, nextDate);
|
|
1044
|
+
});
|
|
1045
|
+
if (this.eChartsInstance) {
|
|
1046
|
+
this.setChartData();
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
/**
|
|
1050
|
+
* Перехватчик жизненного цикла {@link ECharts}, который вызывается при его инициализации.
|
|
1051
|
+
*
|
|
1052
|
+
* @param eChartsInstance Экземпляр {@link ECharts}.
|
|
1053
|
+
*/
|
|
1054
|
+
onChartInit(eChartsInstance) {
|
|
1055
|
+
this.eChartsInstance = eChartsInstance;
|
|
1056
|
+
if (this.data.length) {
|
|
1057
|
+
this.setChartData();
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
/**
|
|
1061
|
+
* Устанавливает новые данные {@link PriceHistoryChartComponent.eChartsInstance}.
|
|
1062
|
+
*/
|
|
1063
|
+
setChartData() {
|
|
1064
|
+
if (this.chartOption.series && !Array.isArray(this.chartOption.series)) {
|
|
1065
|
+
this.maxPrice = Math.max(...this.data.map((item) => item.value[1]));
|
|
1066
|
+
this.minPrice = Math.min(...this.data.map((item) => item.value[1]));
|
|
1067
|
+
this.chartOption.series.data = this.data;
|
|
1068
|
+
this.eChartsInstance.clear();
|
|
1069
|
+
this.eChartsInstance.setOption(this.chartOption, true, true);
|
|
1070
|
+
this.cdr.markForCheck();
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1074
|
+
* Добавляет значение цены товара в массив истории цен.
|
|
1075
|
+
*
|
|
1076
|
+
* @param value Цена товара или услуги.
|
|
1077
|
+
* @param date Дата установки цены.
|
|
1078
|
+
* @param nextDate Следующая дата установки цены.
|
|
1079
|
+
*/
|
|
1080
|
+
pushDataItem(value, date, nextDate) {
|
|
1081
|
+
this.data.push({
|
|
1082
|
+
name: date.toString(),
|
|
1083
|
+
value: [date, value, nextDate],
|
|
1084
|
+
});
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
ScPriceHistoryComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceHistoryComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
|
1088
|
+
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 });
|
|
1089
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceHistoryComponent, decorators: [{
|
|
1090
|
+
type: Component,
|
|
1091
|
+
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" }]
|
|
1092
|
+
}], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { history: [{
|
|
1093
|
+
type: Input
|
|
1094
|
+
}] } });
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Language: Russian.
|
|
1098
|
+
*/
|
|
1099
|
+
var scLangRU = {
|
|
1100
|
+
time: {
|
|
1101
|
+
month: ['Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'],
|
|
1102
|
+
monthAbbr: ['Янв', 'Фев', 'Мар', 'Апр', 'Май', 'Июн', 'Июл', 'Авг', 'Сен', 'Окт', 'Ноя', 'Дек'],
|
|
1103
|
+
dayOfWeek: ['Воскресенье', 'Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота'],
|
|
1104
|
+
dayOfWeekAbbr: ['вс', 'пн', 'вт', 'ср', 'чт', 'пт', 'сб'],
|
|
1105
|
+
},
|
|
1106
|
+
legend: {
|
|
1107
|
+
selector: {
|
|
1108
|
+
all: 'Всё',
|
|
1109
|
+
inverse: 'Обратить',
|
|
1110
|
+
},
|
|
1111
|
+
},
|
|
1112
|
+
toolbox: {
|
|
1113
|
+
brush: {
|
|
1114
|
+
title: {
|
|
1115
|
+
rect: 'Выделить область',
|
|
1116
|
+
polygon: 'Инструмент «Лассо»',
|
|
1117
|
+
lineX: 'Горизонтальное выделение',
|
|
1118
|
+
lineY: 'Вертикальное выделение',
|
|
1119
|
+
keep: 'Оставить выбранное',
|
|
1120
|
+
clear: 'Очистить выбранное',
|
|
1121
|
+
},
|
|
1122
|
+
},
|
|
1123
|
+
dataView: {
|
|
1124
|
+
title: 'Данные',
|
|
1125
|
+
lang: ['Данные', 'Закрыть', 'Обновить'],
|
|
1126
|
+
},
|
|
1127
|
+
dataZoom: {
|
|
1128
|
+
title: {
|
|
1129
|
+
zoom: 'Увеличить',
|
|
1130
|
+
back: 'Сбросить увеличение',
|
|
1131
|
+
},
|
|
1132
|
+
},
|
|
1133
|
+
magicType: {
|
|
1134
|
+
title: {
|
|
1135
|
+
line: 'Переключиться на линейный график',
|
|
1136
|
+
bar: 'Переключиться на столбчатую диаграмму',
|
|
1137
|
+
stack: 'Стопка',
|
|
1138
|
+
tiled: 'Плитка',
|
|
1139
|
+
},
|
|
1140
|
+
},
|
|
1141
|
+
restore: {
|
|
1142
|
+
title: 'Восстановить',
|
|
1143
|
+
},
|
|
1144
|
+
saveAsImage: {
|
|
1145
|
+
title: 'Сохранить картинку',
|
|
1146
|
+
lang: ['Правый клик, чтобы сохранить картинку'],
|
|
1147
|
+
},
|
|
1148
|
+
},
|
|
1149
|
+
series: {
|
|
1150
|
+
typeNames: {
|
|
1151
|
+
pie: 'Круговая диаграмма',
|
|
1152
|
+
bar: 'Столбчатая диаграмма',
|
|
1153
|
+
line: 'Линейный график',
|
|
1154
|
+
scatter: 'Точечная диаграмма',
|
|
1155
|
+
effectScatter: 'Точечная диаграмма с волнами',
|
|
1156
|
+
radar: 'Лепестковая диаграмма',
|
|
1157
|
+
tree: 'Дерево',
|
|
1158
|
+
treemap: 'Плоское дерево',
|
|
1159
|
+
boxplot: 'Ящик с усами',
|
|
1160
|
+
candlestick: 'Свечной график',
|
|
1161
|
+
k: 'График К-линий',
|
|
1162
|
+
heatmap: 'Тепловая карта',
|
|
1163
|
+
map: 'Карта',
|
|
1164
|
+
parallel: 'Диаграмма параллельных координат',
|
|
1165
|
+
lines: 'Линейный граф',
|
|
1166
|
+
graph: 'Граф отношений',
|
|
1167
|
+
sankey: 'Диаграмма Санкей',
|
|
1168
|
+
funnel: 'Воронкообразная диаграмма',
|
|
1169
|
+
gauge: 'Шкала',
|
|
1170
|
+
pictorialBar: 'Столбец-картинка',
|
|
1171
|
+
themeRiver: 'Тематическая река',
|
|
1172
|
+
sunburst: 'Солнечные лучи',
|
|
1173
|
+
},
|
|
1174
|
+
},
|
|
1175
|
+
aria: {
|
|
1176
|
+
general: {
|
|
1177
|
+
withTitle: 'Это график, показывающий "{title}"',
|
|
1178
|
+
withoutTitle: 'Это график',
|
|
1179
|
+
},
|
|
1180
|
+
series: {
|
|
1181
|
+
single: {
|
|
1182
|
+
prefix: '',
|
|
1183
|
+
withName: ' с типом {seriesType} и именем {seriesName}.',
|
|
1184
|
+
withoutName: ' с типом {seriesType}.',
|
|
1185
|
+
},
|
|
1186
|
+
multiple: {
|
|
1187
|
+
prefix: '. Он состоит из {seriesCount} серий.',
|
|
1188
|
+
withName: ' Серия {seriesId} имеет тип {seriesType} и показывает {seriesName}.',
|
|
1189
|
+
withoutName: ' Серия {seriesId} имеет тип {seriesType}.',
|
|
1190
|
+
separator: {
|
|
1191
|
+
middle: '',
|
|
1192
|
+
end: '',
|
|
1193
|
+
},
|
|
1194
|
+
},
|
|
1195
|
+
},
|
|
1196
|
+
data: {
|
|
1197
|
+
allData: 'Данные таковы: ',
|
|
1198
|
+
partialData: 'Первые {displayCnt} элементов: ',
|
|
1199
|
+
withName: 'значение для {name} — {value}',
|
|
1200
|
+
withoutName: '{value}',
|
|
1201
|
+
separator: {
|
|
1202
|
+
middle: ', ',
|
|
1203
|
+
end: '. ',
|
|
1204
|
+
},
|
|
1205
|
+
},
|
|
1206
|
+
},
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
echarts.registerLocale('RU', scLangRU);
|
|
1210
|
+
echarts.use([TitleComponent, TooltipComponent, GridComponent, LineChart, SVGRenderer]);
|
|
1211
|
+
/**
|
|
1212
|
+
* Модуль каталога.
|
|
1213
|
+
*/
|
|
1214
|
+
class ScCatalogModule {
|
|
1215
|
+
}
|
|
1216
|
+
ScCatalogModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCatalogModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1217
|
+
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,
|
|
1218
|
+
RouterModule,
|
|
1219
|
+
TuiButtonModule,
|
|
1220
|
+
TuiSvgModule,
|
|
1221
|
+
TuiIslandModule,
|
|
1222
|
+
TuiInputNumberModule,
|
|
1223
|
+
TuiLabelModule,
|
|
1224
|
+
TuiTextfieldControllerModule,
|
|
1225
|
+
FormsModule,
|
|
1226
|
+
ReactiveFormsModule,
|
|
1227
|
+
TuiHintModule,
|
|
1228
|
+
TuiModeModule,
|
|
1229
|
+
TuiFieldErrorPipeModule,
|
|
1230
|
+
TuiLoaderModule,
|
|
1231
|
+
TuiLinkModule,
|
|
1232
|
+
TuiElasticContainerModule, i2.NgxEchartsModule], exports: [ScCategoryCardComponent, ScFavoriteBtnComponent, ScInputQuantityComponent, ScPriceCardComponent, ScPriceWarehouseStockComponent, ScPriceHistoryComponent] });
|
|
1233
|
+
ScCatalogModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCatalogModule, imports: [CommonModule,
|
|
1234
|
+
RouterModule,
|
|
1235
|
+
TuiButtonModule,
|
|
1236
|
+
TuiSvgModule,
|
|
1237
|
+
TuiIslandModule,
|
|
1238
|
+
TuiInputNumberModule,
|
|
1239
|
+
TuiLabelModule,
|
|
1240
|
+
TuiTextfieldControllerModule,
|
|
1241
|
+
FormsModule,
|
|
1242
|
+
ReactiveFormsModule,
|
|
1243
|
+
TuiHintModule,
|
|
1244
|
+
TuiModeModule,
|
|
1245
|
+
TuiFieldErrorPipeModule,
|
|
1246
|
+
TuiLoaderModule,
|
|
1247
|
+
TuiLinkModule,
|
|
1248
|
+
TuiElasticContainerModule,
|
|
1249
|
+
NgxEchartsModule.forRoot({ echarts })] });
|
|
1250
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCatalogModule, decorators: [{
|
|
1251
|
+
type: NgModule,
|
|
1252
|
+
args: [{
|
|
1253
|
+
declarations: [ScCategoryCardComponent, ScFavoriteBtnComponent, ScInputQuantityComponent, ScPriceCardComponent, ScPriceWarehouseStockComponent, ScPriceHistoryComponent],
|
|
1254
|
+
exports: [ScCategoryCardComponent, ScFavoriteBtnComponent, ScInputQuantityComponent, ScPriceCardComponent, ScPriceWarehouseStockComponent, ScPriceHistoryComponent],
|
|
1255
|
+
imports: [
|
|
1256
|
+
CommonModule,
|
|
1257
|
+
RouterModule,
|
|
1258
|
+
TuiButtonModule,
|
|
1259
|
+
TuiSvgModule,
|
|
1260
|
+
TuiIslandModule,
|
|
1261
|
+
TuiInputNumberModule,
|
|
1262
|
+
TuiLabelModule,
|
|
1263
|
+
TuiTextfieldControllerModule,
|
|
1264
|
+
FormsModule,
|
|
1265
|
+
ReactiveFormsModule,
|
|
1266
|
+
TuiHintModule,
|
|
1267
|
+
TuiModeModule,
|
|
1268
|
+
TuiFieldErrorPipeModule,
|
|
1269
|
+
TuiLoaderModule,
|
|
1270
|
+
TuiLinkModule,
|
|
1271
|
+
TuiElasticContainerModule,
|
|
1272
|
+
NgxEchartsModule.forRoot({ echarts }),
|
|
1273
|
+
],
|
|
1274
|
+
}]
|
|
1275
|
+
}] });
|
|
1276
|
+
|
|
1277
|
+
/**
|
|
1278
|
+
* Модуль корзины.
|
|
1279
|
+
*/
|
|
1280
|
+
class ScCartModule {
|
|
1281
|
+
}
|
|
1282
|
+
ScCartModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCartModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1283
|
+
ScCartModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ScCartModule, declarations: [ScCartItemMobileComponent], imports: [CommonModule,
|
|
1284
|
+
TuiLinkModule,
|
|
1285
|
+
ScCatalogModule,
|
|
1286
|
+
TuiButtonModule,
|
|
1287
|
+
TuiModeModule,
|
|
1288
|
+
TuiSvgModule,
|
|
1289
|
+
TuiHintModule,
|
|
1290
|
+
FormsModule,
|
|
1291
|
+
ReactiveFormsModule,
|
|
1292
|
+
TuiPreviewModule,
|
|
1293
|
+
PolymorpheusModule], exports: [ScCartItemMobileComponent] });
|
|
1294
|
+
ScCartModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCartModule, imports: [CommonModule,
|
|
1295
|
+
TuiLinkModule,
|
|
1296
|
+
ScCatalogModule,
|
|
1297
|
+
TuiButtonModule,
|
|
1298
|
+
TuiModeModule,
|
|
1299
|
+
TuiSvgModule,
|
|
1300
|
+
TuiHintModule,
|
|
1301
|
+
FormsModule,
|
|
1302
|
+
ReactiveFormsModule,
|
|
1303
|
+
TuiPreviewModule,
|
|
1304
|
+
PolymorpheusModule] });
|
|
1305
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScCartModule, decorators: [{
|
|
1306
|
+
type: NgModule,
|
|
1307
|
+
args: [{
|
|
1308
|
+
declarations: [ScCartItemMobileComponent],
|
|
1309
|
+
exports: [ScCartItemMobileComponent],
|
|
1310
|
+
imports: [
|
|
1311
|
+
CommonModule,
|
|
1312
|
+
TuiLinkModule,
|
|
1313
|
+
ScCatalogModule,
|
|
1314
|
+
TuiButtonModule,
|
|
1315
|
+
TuiModeModule,
|
|
1316
|
+
TuiSvgModule,
|
|
1317
|
+
TuiHintModule,
|
|
1318
|
+
FormsModule,
|
|
1319
|
+
ReactiveFormsModule,
|
|
1320
|
+
TuiPreviewModule,
|
|
1321
|
+
PolymorpheusModule,
|
|
1322
|
+
],
|
|
1323
|
+
}]
|
|
1324
|
+
}] });
|
|
1325
|
+
|
|
1326
|
+
/**
|
|
1327
|
+
* Сервис работающий с значками элементов дерева.
|
|
1328
|
+
*/
|
|
1329
|
+
class TreeIconService {
|
|
1330
|
+
/**
|
|
1331
|
+
* Назначает значок элементу дерева в зависимости от типа файла.
|
|
1332
|
+
*
|
|
1333
|
+
* @param info Объект пришедших данных о файле.
|
|
1334
|
+
* @returns Возвращает название значка в виде строки.
|
|
1335
|
+
*/
|
|
1336
|
+
getIconName(info) {
|
|
1337
|
+
switch (info.getIcon()) {
|
|
1338
|
+
case ScIconTypesEnum.iconImage:
|
|
1339
|
+
return 'scIconImage';
|
|
1340
|
+
case ScIconTypesEnum.iconPdfFile:
|
|
1341
|
+
return 'scIconPdfFile';
|
|
1342
|
+
case ScIconTypesEnum.iconWordFile:
|
|
1343
|
+
return 'scIconWordFile';
|
|
1344
|
+
case ScIconTypesEnum.iconExcelFile:
|
|
1345
|
+
return 'scIconExcelFile';
|
|
1346
|
+
case ScIconTypesEnum.iconFolder:
|
|
1347
|
+
return 'scIconFolder';
|
|
1348
|
+
default:
|
|
1349
|
+
return 'scIconFile';
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
/**
|
|
1353
|
+
* Проверяет на признак наличия дочерних элементов.
|
|
1354
|
+
*
|
|
1355
|
+
* @param info Объект пришедших данных о файле.
|
|
1356
|
+
* @returns Возвращает true при наличии дочерних элементов и false при их отсутсвии.
|
|
1357
|
+
*/
|
|
1358
|
+
hasChildren(info) {
|
|
1359
|
+
return info.type === 'dir';
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
TreeIconService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeIconService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1363
|
+
TreeIconService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeIconService, providedIn: 'root' });
|
|
1364
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeIconService, decorators: [{
|
|
1365
|
+
type: Injectable,
|
|
1366
|
+
args: [{
|
|
1367
|
+
providedIn: 'root',
|
|
1368
|
+
}]
|
|
1369
|
+
}] });
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Сервис для асинхронного раскрытия вложенности.
|
|
1373
|
+
*/
|
|
1374
|
+
class TreeLoaderService {
|
|
1375
|
+
/**
|
|
1376
|
+
* Инициализирует экземпляр класса {@link TreeLoaderService}
|
|
1377
|
+
*
|
|
1378
|
+
* @param filesService Сервис для получения файлов директории.
|
|
1379
|
+
* @param iconService Сервис для определения и назначения значка элементу дерева.
|
|
1380
|
+
*/
|
|
1381
|
+
constructor(filesService, iconService) {
|
|
1382
|
+
this.filesService = filesService;
|
|
1383
|
+
this.iconService = iconService;
|
|
1384
|
+
}
|
|
1385
|
+
/**
|
|
1386
|
+
* Загружает дочерние элементы дерева.
|
|
1387
|
+
*
|
|
1388
|
+
* @param item Элемент дерева.
|
|
1389
|
+
* @returns Массив дочерних элементов.
|
|
1390
|
+
*/
|
|
1391
|
+
loadChildren(item) {
|
|
1392
|
+
return item.id ? this.initData(item.id) : this.initData(undefined);
|
|
1393
|
+
}
|
|
1394
|
+
/**
|
|
1395
|
+
* Проверяет указанный элемент дерева на наличие дочерних элементов и возвращает массив дочерних элементов, если они есть, либо пустой массив.
|
|
1396
|
+
*
|
|
1397
|
+
* @param node Элемент дерева.
|
|
1398
|
+
* @returns Возвращает массив типа TreeNode[].
|
|
1399
|
+
*/
|
|
1400
|
+
hasChildren(node) {
|
|
1401
|
+
return node.hasChildren && !!node.id;
|
|
1402
|
+
}
|
|
1403
|
+
/**
|
|
1404
|
+
* Загружает и заполняет массив дочерних элементов.
|
|
1405
|
+
*
|
|
1406
|
+
* @param id Идентификатор директории, чьи дочернии элементы загружаются.
|
|
1407
|
+
* @returns Возвращает массив дочерних элементов.
|
|
1408
|
+
*/
|
|
1409
|
+
initData(id) {
|
|
1410
|
+
return this.filesService.getFiles(id).pipe(map((data) => data.map((item) => ({
|
|
1411
|
+
text: item.name,
|
|
1412
|
+
icon: this.iconService.getIconName(item),
|
|
1413
|
+
hasChildren: this.iconService.hasChildren(item),
|
|
1414
|
+
createdAt: item.createdAt,
|
|
1415
|
+
id: item.id,
|
|
1416
|
+
link: item.link,
|
|
1417
|
+
}))));
|
|
1418
|
+
}
|
|
1419
|
+
}
|
|
1420
|
+
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 });
|
|
1421
|
+
TreeLoaderService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeLoaderService });
|
|
1422
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeLoaderService, decorators: [{
|
|
1423
|
+
type: Injectable
|
|
1424
|
+
}], ctorParameters: function () { return [{ type: i1.ScFilesService }, { type: TreeIconService }]; } });
|
|
1425
|
+
|
|
1426
|
+
/**
|
|
1427
|
+
* Директива отвечающая за обработку действий над элементами дерева.
|
|
1428
|
+
*/
|
|
1429
|
+
class TreeDirective {
|
|
1430
|
+
/**
|
|
1431
|
+
* Инициализирует экземпляр класса {@link TreeDirective}.
|
|
1432
|
+
*
|
|
1433
|
+
* @param service Сервис для работы с деревом.
|
|
1434
|
+
*/
|
|
1435
|
+
constructor(service) {
|
|
1436
|
+
this.service = service;
|
|
1437
|
+
/**
|
|
1438
|
+
* Карта данных дерева.
|
|
1439
|
+
*/
|
|
1440
|
+
this.map = new Map();
|
|
1441
|
+
/**
|
|
1442
|
+
* Проверяет указанный элемент дерева на наличие дочерних элементов и возвращает массив дочерних элементов, если они есть, либо пустой массив.
|
|
1443
|
+
*
|
|
1444
|
+
* @param node Элемент дерева.
|
|
1445
|
+
* @returns Возвращает массив типа TreeNode[].
|
|
1446
|
+
*/
|
|
1447
|
+
this.childrenHandler = (node) => (node.hasChildren ? this.service.getChildren(node) : []);
|
|
1448
|
+
}
|
|
1449
|
+
/**
|
|
1450
|
+
* Обрабатывает нажатие на указанный элемент дерева.
|
|
1451
|
+
*
|
|
1452
|
+
* @param node Элемент дерева.
|
|
1453
|
+
*/
|
|
1454
|
+
onToggled(node) {
|
|
1455
|
+
this.service.loadChildren(node);
|
|
1456
|
+
}
|
|
1457
|
+
}
|
|
1458
|
+
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 });
|
|
1459
|
+
TreeDirective.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "14.3.0", type: TreeDirective, selector: "[scTree]", providers: [TuiTreeService], exportAs: ["scTree"], ngImport: i0 });
|
|
1460
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeDirective, decorators: [{
|
|
1461
|
+
type: Directive,
|
|
1462
|
+
args: [{
|
|
1463
|
+
selector: '[scTree]',
|
|
1464
|
+
exportAs: 'scTree',
|
|
1465
|
+
providers: [TuiTreeService],
|
|
1466
|
+
}]
|
|
1467
|
+
}], ctorParameters: function () { return [{ type: i3$2.TuiTreeService }]; } });
|
|
1468
|
+
|
|
1469
|
+
/**
|
|
1470
|
+
* Компонент для удаления стандартного значка элемента дерева.
|
|
1471
|
+
*/
|
|
1472
|
+
class FileTreeItemComponent extends TuiTreeItemContentComponent {
|
|
1473
|
+
}
|
|
1474
|
+
FileTreeItemComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FileTreeItemComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1475
|
+
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 });
|
|
1476
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FileTreeItemComponent, decorators: [{
|
|
1477
|
+
type: Component,
|
|
1478
|
+
args: [{ selector: 'sc-file-tree-item', changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1479
|
+
'(click)': `onClick()`,
|
|
1480
|
+
}, 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"] }]
|
|
1481
|
+
}] });
|
|
1482
|
+
|
|
1483
|
+
/* eslint-disable @angular-eslint/no-input-rename */
|
|
1484
|
+
/**
|
|
1485
|
+
* Директива отвечающая за корневые элементы дерева.
|
|
1486
|
+
*/
|
|
1487
|
+
class TreeTopDirective {
|
|
1488
|
+
constructor() {
|
|
1489
|
+
/**
|
|
1490
|
+
* Отображаемое имя корневого элемента дерева.
|
|
1491
|
+
*/
|
|
1492
|
+
this.text = '';
|
|
1493
|
+
}
|
|
1494
|
+
}
|
|
1495
|
+
TreeTopDirective.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeTopDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1496
|
+
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: [
|
|
1497
|
+
{
|
|
1498
|
+
provide: TUI_TREE_START,
|
|
1499
|
+
useExisting: forwardRef(() => TreeTopDirective),
|
|
1500
|
+
},
|
|
1501
|
+
{
|
|
1502
|
+
provide: TUI_TREE_CONTENT,
|
|
1503
|
+
useValue: new PolymorpheusComponent(FileTreeItemComponent),
|
|
1504
|
+
},
|
|
1505
|
+
], ngImport: i0 });
|
|
1506
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: TreeTopDirective, decorators: [{
|
|
1507
|
+
type: Directive,
|
|
1508
|
+
args: [{
|
|
1509
|
+
selector: '[scTopNodeText]',
|
|
1510
|
+
providers: [
|
|
1511
|
+
{
|
|
1512
|
+
provide: TUI_TREE_START,
|
|
1513
|
+
useExisting: forwardRef(() => TreeTopDirective),
|
|
1514
|
+
},
|
|
1515
|
+
{
|
|
1516
|
+
provide: TUI_TREE_CONTENT,
|
|
1517
|
+
useValue: new PolymorpheusComponent(FileTreeItemComponent),
|
|
1518
|
+
},
|
|
1519
|
+
],
|
|
1520
|
+
}]
|
|
1521
|
+
}], propDecorators: { text: [{
|
|
1522
|
+
type: Input,
|
|
1523
|
+
args: ['scTopNodeText']
|
|
1524
|
+
}], icon: [{
|
|
1525
|
+
type: Input,
|
|
1526
|
+
args: ['scTopNodeIcon']
|
|
1527
|
+
}], link: [{
|
|
1528
|
+
type: Input,
|
|
1529
|
+
args: ['scTopNodeLink']
|
|
1530
|
+
}], hasChildren: [{
|
|
1531
|
+
type: Input,
|
|
1532
|
+
args: ['scTopNodeChilds']
|
|
1533
|
+
}], id: [{
|
|
1534
|
+
type: Input,
|
|
1535
|
+
args: ['scTopNodeParent']
|
|
1536
|
+
}], createdAt: [{
|
|
1537
|
+
type: Input,
|
|
1538
|
+
args: ['scTopNodeDate']
|
|
1539
|
+
}] } });
|
|
1540
|
+
|
|
1541
|
+
/**
|
|
1542
|
+
* Компонент файлов и документов.
|
|
1543
|
+
*/
|
|
1544
|
+
class FilesAndDocumentsComponent {
|
|
1545
|
+
/**
|
|
1546
|
+
* Инициализирует экземпляр класса {@link FilesAndDocumentsComponent}.
|
|
1547
|
+
*
|
|
1548
|
+
* @param loading Объект отвечающий за значок загрузки, в момент раскрытия элемента дерева.
|
|
1549
|
+
* @param iconService Сервис для определения и назначения значка элементу дерева.
|
|
1550
|
+
* @param filesService Сервис для загрузки файлов.
|
|
1551
|
+
*/
|
|
1552
|
+
constructor(loading, iconService, filesService) {
|
|
1553
|
+
this.loading = loading;
|
|
1554
|
+
this.iconService = iconService;
|
|
1555
|
+
this.filesService = filesService;
|
|
1556
|
+
/**
|
|
1557
|
+
* Данные визуализации и их начальное получение.
|
|
1558
|
+
*/
|
|
1559
|
+
this.data$ = this.filesService.getFiles().pipe(map((data) => data.map((item) => ({
|
|
1560
|
+
text: item.name,
|
|
1561
|
+
icon: this.iconService.getIconName(item),
|
|
1562
|
+
hasChildren: this.iconService.hasChildren(item),
|
|
1563
|
+
createdAt: item.createdAt,
|
|
1564
|
+
id: item.id,
|
|
1565
|
+
link: item.link,
|
|
1566
|
+
}))));
|
|
1567
|
+
}
|
|
1568
|
+
}
|
|
1569
|
+
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 });
|
|
1570
|
+
FilesAndDocumentsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: FilesAndDocumentsComponent, selector: "sc-files-and-documents", providers: [
|
|
1571
|
+
{
|
|
1572
|
+
provide: TUI_TREE_LOADER,
|
|
1573
|
+
useClass: TreeLoaderService,
|
|
1574
|
+
},
|
|
1575
|
+
], 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 });
|
|
1576
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsComponent, decorators: [{
|
|
1577
|
+
type: Component,
|
|
1578
|
+
args: [{ selector: 'sc-files-and-documents', changeDetection: ChangeDetectionStrategy.OnPush, providers: [
|
|
1579
|
+
{
|
|
1580
|
+
provide: TUI_TREE_LOADER,
|
|
1581
|
+
useClass: TreeLoaderService,
|
|
1582
|
+
},
|
|
1583
|
+
], 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" }]
|
|
1584
|
+
}], ctorParameters: function () {
|
|
1585
|
+
return [{ type: undefined, decorators: [{
|
|
1586
|
+
type: Inject,
|
|
1587
|
+
args: [TUI_TREE_LOADING]
|
|
1588
|
+
}] }, { type: TreeIconService }, { type: i1.ScFilesService }];
|
|
1589
|
+
} });
|
|
1590
|
+
|
|
1591
|
+
/**
|
|
1592
|
+
* Модуль файлов и документов.
|
|
1593
|
+
*/
|
|
1594
|
+
class FilesAndDocumentsModule {
|
|
1595
|
+
}
|
|
1596
|
+
FilesAndDocumentsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1597
|
+
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] });
|
|
1598
|
+
FilesAndDocumentsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsModule, imports: [CommonModule, TuiTreeModule, TuiSvgModule, TuiLoaderModule, TuiLinkModule] });
|
|
1599
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: FilesAndDocumentsModule, decorators: [{
|
|
1600
|
+
type: NgModule,
|
|
1601
|
+
args: [{
|
|
1602
|
+
imports: [CommonModule, TuiTreeModule, TuiSvgModule, TuiLoaderModule, TuiLinkModule],
|
|
1603
|
+
declarations: [FilesAndDocumentsComponent, TreeDirective, TreeTopDirective, FileTreeItemComponent],
|
|
1604
|
+
exports: [FilesAndDocumentsComponent],
|
|
1605
|
+
}]
|
|
1606
|
+
}] });
|
|
1607
|
+
|
|
1608
|
+
/**
|
|
1609
|
+
* Список иконок.
|
|
1610
|
+
* TODO: TASK[#7779] Добавить иконки отдельных значков для соц. сетей после добавления их в кит дизайна.
|
|
1611
|
+
*/
|
|
1612
|
+
const scClientUiIconsName = [
|
|
1613
|
+
'scIconCalendar',
|
|
1614
|
+
'scIconWordFile',
|
|
1615
|
+
'scIconWarning',
|
|
1616
|
+
'scIconWallet',
|
|
1617
|
+
'scIconViewTree',
|
|
1618
|
+
'scIconMinus',
|
|
1619
|
+
'scIconViewInline',
|
|
1620
|
+
'scIconViewGrid',
|
|
1621
|
+
'scIconVerticalThreeDots',
|
|
1622
|
+
'scIconTop',
|
|
1623
|
+
'scIconTick',
|
|
1624
|
+
'scIconTasks',
|
|
1625
|
+
'scIconSuitcase',
|
|
1626
|
+
'scIconStar',
|
|
1627
|
+
'scIconShare',
|
|
1628
|
+
'scIconSettings',
|
|
1629
|
+
'scIconSend',
|
|
1630
|
+
'scIconSearch',
|
|
1631
|
+
'scIconSave',
|
|
1632
|
+
'scIconRocket',
|
|
1633
|
+
'scIconRequisites',
|
|
1634
|
+
'scIconRepeat',
|
|
1635
|
+
'scIconRefresh',
|
|
1636
|
+
'scIconReclamation',
|
|
1637
|
+
'scIconQuestion',
|
|
1638
|
+
'scIconQRCodeScan',
|
|
1639
|
+
'scIconProfile',
|
|
1640
|
+
'scIconPrice',
|
|
1641
|
+
'scIconPlus',
|
|
1642
|
+
'scIconPhone',
|
|
1643
|
+
'scIconPercentage',
|
|
1644
|
+
'scIconPdfFile',
|
|
1645
|
+
'scIconPalette',
|
|
1646
|
+
'scIconOffer',
|
|
1647
|
+
'scIconNews',
|
|
1648
|
+
'scIconMoney2',
|
|
1649
|
+
'scIconMoney',
|
|
1650
|
+
'scIconMail',
|
|
1651
|
+
'scIconLogOut2',
|
|
1652
|
+
'scIconLogOut',
|
|
1653
|
+
'scIconLogIn',
|
|
1654
|
+
'scIconLockOpen',
|
|
1655
|
+
'scIconLock',
|
|
1656
|
+
'scIconLocation',
|
|
1657
|
+
'scIconList',
|
|
1658
|
+
'scIconLike',
|
|
1659
|
+
'scIconImage',
|
|
1660
|
+
'scIconHome',
|
|
1661
|
+
'scIconHistory',
|
|
1662
|
+
'scIconHeartFill',
|
|
1663
|
+
'scIconHeart',
|
|
1664
|
+
'scIconHamburger',
|
|
1665
|
+
'scIconGraph',
|
|
1666
|
+
'scIconFolderPlus',
|
|
1667
|
+
'scIconFolderOpen',
|
|
1668
|
+
'scIconFolder',
|
|
1669
|
+
'scIconFilter',
|
|
1670
|
+
'scIconFile',
|
|
1671
|
+
'scIconFavoriteFill',
|
|
1672
|
+
'scIconFavorite',
|
|
1673
|
+
'scIconEye',
|
|
1674
|
+
'scIconExcelFile',
|
|
1675
|
+
'scIconError',
|
|
1676
|
+
'scIconEdit',
|
|
1677
|
+
'scIconDownloading',
|
|
1678
|
+
'scIconDone',
|
|
1679
|
+
'scIconDeleteProfile',
|
|
1680
|
+
'scIconCross',
|
|
1681
|
+
'scIconContacts',
|
|
1682
|
+
'scIconConfigurator',
|
|
1683
|
+
'scIconClock',
|
|
1684
|
+
'scIconClip',
|
|
1685
|
+
'scIconClients',
|
|
1686
|
+
'scIconCatalog',
|
|
1687
|
+
'scIconCart',
|
|
1688
|
+
'scIconCancel',
|
|
1689
|
+
'scIconBubble',
|
|
1690
|
+
'scIconBook',
|
|
1691
|
+
'scIconBell',
|
|
1692
|
+
'scIconBasket',
|
|
1693
|
+
'scIconBag',
|
|
1694
|
+
'scIconAttention',
|
|
1695
|
+
'scIconArrowUp',
|
|
1696
|
+
'scIconArrowRight',
|
|
1697
|
+
'scIconArrowReturn',
|
|
1698
|
+
'scIconArrowLeft',
|
|
1699
|
+
'scIconArrowDownLargeEnd',
|
|
1700
|
+
'scIconArrowDownLarge',
|
|
1701
|
+
'scIconArrowDown',
|
|
1702
|
+
'scIconApplication',
|
|
1703
|
+
'scIconAddProfile',
|
|
1704
|
+
'scIconSocialCopy',
|
|
1705
|
+
'scIconSocialEmail',
|
|
1706
|
+
'scIconSocialFacebook',
|
|
1707
|
+
'scIconSocialInstagram',
|
|
1708
|
+
'scIconSocialQR',
|
|
1709
|
+
'scIconSocialTelegram',
|
|
1710
|
+
'scIconSocialViber',
|
|
1711
|
+
'scIconSocialVk',
|
|
1712
|
+
'scIconSocialWhatsapp',
|
|
1713
|
+
];
|
|
1714
|
+
|
|
1715
|
+
/**
|
|
1716
|
+
* Компонент кнопки "Поделиться".
|
|
1717
|
+
*/
|
|
1718
|
+
class ScShareButtonComponent {
|
|
1719
|
+
constructor() {
|
|
1720
|
+
/**
|
|
1721
|
+
* Формат внешнего вида кнопки.
|
|
1722
|
+
*/
|
|
1723
|
+
this.appearance = 'secondary';
|
|
1724
|
+
/**
|
|
1725
|
+
* Размер кнопки.
|
|
1726
|
+
*/
|
|
1727
|
+
this.size = 'm';
|
|
1728
|
+
/**
|
|
1729
|
+
* Событие клика по кнопке "Поделиться".
|
|
1730
|
+
*/
|
|
1731
|
+
this.clickShareEvent = new EventEmitter();
|
|
1732
|
+
}
|
|
1733
|
+
}
|
|
1734
|
+
ScShareButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1735
|
+
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 });
|
|
1736
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonComponent, decorators: [{
|
|
1737
|
+
type: Component,
|
|
1738
|
+
args: [{ selector: 'sc-share-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button tuiIconButton icon=\"scIconShare\" [appearance]=\"appearance\" [size]=\"size\" (click)=\"$event.stopPropagation(); clickShareEvent.emit()\"></button>\n" }]
|
|
1739
|
+
}], propDecorators: { appearance: [{
|
|
1740
|
+
type: Input
|
|
1741
|
+
}], size: [{
|
|
1742
|
+
type: Input
|
|
1743
|
+
}], clickShareEvent: [{
|
|
1744
|
+
type: Output
|
|
1745
|
+
}] } });
|
|
1746
|
+
|
|
1747
|
+
/**
|
|
1748
|
+
* Компонент карточки новости.
|
|
1749
|
+
*/
|
|
1750
|
+
class ScNewsCardComponent {
|
|
1751
|
+
constructor() {
|
|
1752
|
+
/**
|
|
1753
|
+
* Событие клика по карточке новости.
|
|
1754
|
+
*/
|
|
1755
|
+
this.clickCardEvent = new EventEmitter();
|
|
1756
|
+
/**
|
|
1757
|
+
* Событие клика по кнопке "Поделиться" карточки новости.
|
|
1758
|
+
*/
|
|
1759
|
+
this.clickShareEvent = new EventEmitter();
|
|
1760
|
+
}
|
|
1761
|
+
}
|
|
1762
|
+
ScNewsCardComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1763
|
+
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 });
|
|
1764
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsCardComponent, decorators: [{
|
|
1765
|
+
type: Component,
|
|
1766
|
+
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" }]
|
|
1767
|
+
}], propDecorators: { news: [{
|
|
1768
|
+
type: Input
|
|
1769
|
+
}], clickCardEvent: [{
|
|
1770
|
+
type: Output
|
|
1771
|
+
}], clickShareEvent: [{
|
|
1772
|
+
type: Output
|
|
1773
|
+
}] } });
|
|
1774
|
+
|
|
1775
|
+
/**
|
|
1776
|
+
* Компонент скелетона карточки новости.
|
|
1777
|
+
*/
|
|
1778
|
+
class ScNewsCardSkeletonComponent {
|
|
1779
|
+
constructor() {
|
|
1780
|
+
/**
|
|
1781
|
+
* Признак, что необходимо отобразить скелетон изображения новости.
|
|
1782
|
+
*/
|
|
1783
|
+
this.hasImg = true;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
ScNewsCardSkeletonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsCardSkeletonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1787
|
+
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 });
|
|
1788
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsCardSkeletonComponent, decorators: [{
|
|
1789
|
+
type: Component,
|
|
1790
|
+
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" }]
|
|
1791
|
+
}], propDecorators: { hasImg: [{
|
|
1792
|
+
type: Input
|
|
1793
|
+
}] } });
|
|
1794
|
+
|
|
1795
|
+
/**
|
|
1796
|
+
* Модуль работы кнопки "Поделиться".
|
|
1797
|
+
*/
|
|
1798
|
+
class ScShareButtonModule {
|
|
1799
|
+
}
|
|
1800
|
+
ScShareButtonModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1801
|
+
ScShareButtonModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonModule, declarations: [ScShareButtonComponent], imports: [CommonModule, TuiButtonModule], exports: [ScShareButtonComponent] });
|
|
1802
|
+
ScShareButtonModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonModule, imports: [CommonModule, TuiButtonModule] });
|
|
1803
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScShareButtonModule, decorators: [{
|
|
1804
|
+
type: NgModule,
|
|
1805
|
+
args: [{
|
|
1806
|
+
declarations: [ScShareButtonComponent],
|
|
1807
|
+
imports: [CommonModule, TuiButtonModule],
|
|
1808
|
+
exports: [ScShareButtonComponent],
|
|
1809
|
+
}]
|
|
1810
|
+
}] });
|
|
1811
|
+
|
|
1812
|
+
/**
|
|
1813
|
+
* Модуль работы с новостями.
|
|
1814
|
+
*/
|
|
1815
|
+
class ScNewsModule {
|
|
1816
|
+
}
|
|
1817
|
+
ScNewsModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1818
|
+
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] });
|
|
1819
|
+
ScNewsModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsModule, imports: [CommonModule, RouterModule, ScShareButtonModule] });
|
|
1820
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScNewsModule, decorators: [{
|
|
1821
|
+
type: NgModule,
|
|
1822
|
+
args: [{
|
|
1823
|
+
declarations: [ScNewsCardComponent, ScNewsCardSkeletonComponent],
|
|
1824
|
+
imports: [CommonModule, RouterModule, ScShareButtonModule],
|
|
1825
|
+
exports: [ScNewsCardComponent, ScNewsCardSkeletonComponent],
|
|
1826
|
+
}]
|
|
1827
|
+
}] });
|
|
1828
|
+
|
|
1829
|
+
/**
|
|
1830
|
+
* Компонент карточки элемента заказа.
|
|
1831
|
+
*/
|
|
1832
|
+
class ScOrderItemMobileComponent {
|
|
1833
|
+
/**
|
|
1834
|
+
* Инициирует экземпляр класса {@link ScOrderItemMobileComponent}.
|
|
1835
|
+
*
|
|
1836
|
+
* @param unitsHelper Объект-хэлпер для работы со значениями единиц измерения товара.
|
|
1837
|
+
* @param previewDialogService Сервис диалогового окна предварительного просмотра.
|
|
1838
|
+
* @param urls Список ссылок на разделы backend'a.
|
|
1839
|
+
* @param pathImageNotFound Путь до изображения 'Товар не найден'.
|
|
1840
|
+
*/
|
|
1841
|
+
constructor(unitsHelper, previewDialogService, urls, pathImageNotFound) {
|
|
1842
|
+
this.unitsHelper = unitsHelper;
|
|
1843
|
+
this.previewDialogService = previewDialogService;
|
|
1844
|
+
this.urls = urls;
|
|
1845
|
+
this.pathImageNotFound = pathImageNotFound;
|
|
1846
|
+
/**
|
|
1847
|
+
* Событие нажатия на карточку.
|
|
1848
|
+
*/
|
|
1849
|
+
this.clickCardEvent = new EventEmitter();
|
|
1850
|
+
/**
|
|
1851
|
+
* Событие нажатия на дополнительные действия.
|
|
1852
|
+
*/
|
|
1853
|
+
this.clickActionsEvent = new EventEmitter();
|
|
1854
|
+
}
|
|
1855
|
+
/**
|
|
1856
|
+
* Продукт элемента заказа.
|
|
1857
|
+
*/
|
|
1858
|
+
get product() {
|
|
1859
|
+
var _a;
|
|
1860
|
+
return (_a = this.orderItem) === null || _a === void 0 ? void 0 : _a.product;
|
|
1861
|
+
}
|
|
1862
|
+
/**
|
|
1863
|
+
* Отобразить спецификацию.
|
|
1864
|
+
*/
|
|
1865
|
+
showSpecification() {
|
|
1866
|
+
this.previewDialogService.open(this.specificationPreviewRef || '').subscribe();
|
|
1867
|
+
}
|
|
1868
|
+
/**
|
|
1869
|
+
* Возвращает ссылку на изображение карточки товара.
|
|
1870
|
+
*/
|
|
1871
|
+
getCardImage() {
|
|
1872
|
+
var _a, _b;
|
|
1873
|
+
return (_b = (_a = this.product) === null || _a === void 0 ? void 0 : _a.getImage(this.urls.imgServerUrl)) !== null && _b !== void 0 ? _b : this.urls.imgServerUrl + this.pathImageNotFound;
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
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 });
|
|
1877
|
+
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 });
|
|
1878
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScOrderItemMobileComponent, decorators: [{
|
|
1879
|
+
type: Component,
|
|
1880
|
+
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" }]
|
|
1881
|
+
}], ctorParameters: function () {
|
|
1882
|
+
return [{ type: UnitsHelper }, { type: i7$1.TuiPreviewDialogService, decorators: [{
|
|
1883
|
+
type: Inject,
|
|
1884
|
+
args: [TuiPreviewDialogService]
|
|
1885
|
+
}] }, { type: undefined, decorators: [{
|
|
1886
|
+
type: Inject,
|
|
1887
|
+
args: [SC_URLS]
|
|
1888
|
+
}] }, { type: undefined, decorators: [{
|
|
1889
|
+
type: Inject,
|
|
1890
|
+
args: [SC_PATH_IMAGE_NOT_FOUND]
|
|
1891
|
+
}] }];
|
|
1892
|
+
}, propDecorators: { specificationPreviewRef: [{
|
|
1893
|
+
type: ViewChild,
|
|
1894
|
+
args: ['specificationPreview']
|
|
1895
|
+
}], orderItem: [{
|
|
1896
|
+
type: Input
|
|
1897
|
+
}], clickCardEvent: [{
|
|
1898
|
+
type: Output
|
|
1899
|
+
}], clickActionsEvent: [{
|
|
1900
|
+
type: Output
|
|
1901
|
+
}] } });
|
|
1902
|
+
|
|
1903
|
+
/**
|
|
1904
|
+
* Модуль заказов.
|
|
1905
|
+
*/
|
|
1906
|
+
class ScOrderModule {
|
|
1907
|
+
}
|
|
1908
|
+
ScOrderModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScOrderModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
1909
|
+
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] });
|
|
1910
|
+
ScOrderModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScOrderModule, imports: [CommonModule, TuiLinkModule, TuiButtonModule, TuiModeModule, TuiSvgModule, ScCatalogModule] });
|
|
1911
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScOrderModule, decorators: [{
|
|
1912
|
+
type: NgModule,
|
|
1913
|
+
args: [{
|
|
1914
|
+
declarations: [ScOrderItemMobileComponent],
|
|
1915
|
+
exports: [ScOrderItemMobileComponent],
|
|
1916
|
+
imports: [CommonModule, TuiLinkModule, TuiButtonModule, TuiModeModule, TuiSvgModule, ScCatalogModule],
|
|
1917
|
+
}]
|
|
1918
|
+
}] });
|
|
1919
|
+
|
|
1920
|
+
/*
|
|
1921
|
+
* Public API Surface of ui
|
|
1922
|
+
*/
|
|
1923
|
+
|
|
1924
|
+
/**
|
|
1925
|
+
* Generated bundle index. Do not edit.
|
|
1926
|
+
*/
|
|
1927
|
+
|
|
1928
|
+
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 };
|
|
1929
|
+
//# sourceMappingURL=snabcentr-client-ui.mjs.map
|