@snabcentr/client-ui 1.8.2 → 1.8.4
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/catalog/price-list-pagination/sc-price-list-pagination.component.d.ts +10 -5
- package/esm2020/catalog/price-list-pagination/sc-price-list-pagination.component.mjs +22 -10
- package/esm2020/providers/index.mjs +1 -2
- package/fesm2015/snabcentr-client-ui.mjs +23 -107
- package/fesm2015/snabcentr-client-ui.mjs.map +1 -1
- package/fesm2020/snabcentr-client-ui.mjs +23 -107
- package/fesm2020/snabcentr-client-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/providers/index.d.ts +0 -1
- package/esm2020/providers/productsPagination.mjs +0 -99
- package/providers/productsPagination.d.ts +0 -43
@@ -1,9 +1,9 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { EventEmitter, Component, ChangeDetectionStrategy, Inject, Input, Output, SkipSelf, inject, Directive, HostBinding, ContentChild, ViewChild, NgModule, ContentChildren, HostListener, Injectable, Renderer2, ElementRef, Pipe, Optional, ChangeDetectorRef, Self,
|
2
|
+
import { EventEmitter, Component, ChangeDetectionStrategy, Inject, Input, Output, SkipSelf, inject, Directive, HostBinding, ContentChild, ViewChild, NgModule, ContentChildren, HostListener, Injectable, Renderer2, ElementRef, Pipe, Optional, ChangeDetectorRef, Self, forwardRef, InjectionToken } from '@angular/core';
|
3
3
|
import * as i1 from '@snabcentr/client-core';
|
4
|
-
import { ScUserMetrikaGoalsEnum, ScISuggestionType, ScOpfList, ScWarehouseService, ScAuthService, SEARCH_TERM, ScImageHelper, SC_PATH_IMAGE_NOT_FOUND, ScPhoneService, IS_RUNNING_ON_TERMINAL, SC_URLS, TERMINAL_PROVIDERS, SEARCH_TERM_PROVIDERS,
|
4
|
+
import { ScUserMetrikaGoalsEnum, ScISuggestionType, ScOpfList, ScWarehouseService, ScAuthService, SEARCH_TERM, ScImageHelper, SC_PATH_IMAGE_NOT_FOUND, ScPhoneService, IS_RUNNING_ON_TERMINAL, SC_URLS, TERMINAL_PROVIDERS, SEARCH_TERM_PROVIDERS, ScPaginationService, SC_NEXT_PAGE_PAGINATION_CLICK, SC_PRODUCT_PAGINATION_OPTIONS, ScIconTypesEnum, ScUserService } from '@snabcentr/client-core';
|
5
5
|
import * as i5 from 'rxjs';
|
6
|
-
import { Subject, map, filter, switchMap, tap, catchError, of, finalize, startWith, share, timer, scan, takeWhile, endWith, distinctUntilChanged, combineLatest, debounceTime, throwError, shareReplay, interval, takeUntil,
|
6
|
+
import { Subject, map, filter, switchMap, tap, catchError, of, finalize, startWith, share, timer, scan, takeWhile, endWith, distinctUntilChanged, combineLatest, debounceTime, throwError, shareReplay, interval, takeUntil, skip } from 'rxjs';
|
7
7
|
import * as i2 from '@angular/common';
|
8
8
|
import { CommonModule } from '@angular/common';
|
9
9
|
import * as i4 from '@taiga-ui/core';
|
@@ -12,7 +12,7 @@ import { HttpErrorResponse } from '@angular/common/http';
|
|
12
12
|
import * as i3 from '@angular/forms';
|
13
13
|
import { FormGroupDirective, FormGroup, FormControl, Validators, NgControl, FormArray, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
14
14
|
import * as i6 from '@taiga-ui/cdk';
|
15
|
-
import { tuiControlValue, tuiIsFalsy, tuiIsPresent, tuiMarkControlAsTouchedAndValidate, AbstractTuiControl, tuiCreateToken, TuiLetModule, TuiRepeatTimesModule, TUI_IS_MOBILE, tuiPure, AbstractTuiNullableControl, TuiDay, TuiDayRange, TuiMonth,
|
15
|
+
import { tuiControlValue, tuiIsFalsy, tuiIsPresent, tuiMarkControlAsTouchedAndValidate, AbstractTuiControl, tuiCreateToken, TuiLetModule, TuiRepeatTimesModule, TUI_IS_MOBILE, tuiPure, AbstractTuiNullableControl, TuiDay, TuiDayRange, TuiMonth, TuiHoveredModule, TuiDestroyService, ALWAYS_TRUE_HANDLER } from '@taiga-ui/cdk';
|
16
16
|
import * as i4$1 from '@taiga-ui/kit';
|
17
17
|
import { TuiAccordionItemComponent, TuiAccordionModule, TuiElasticContainerModule, TuiInputModule, TuiFieldErrorPipeModule, TuiComboBoxModule, TuiDataListWrapperModule, TuiFilterByInputPipeModule, TuiStringifyContentPipeModule, TuiInputPhoneModule, TuiSelectModule, TuiCarouselModule, TuiInputPasswordModule, TuiCheckboxModule, TuiCheckboxLabeledModule, TuiStepperModule, TUI_NUMBER_VALUE_TRANSFORMER, TuiInputNumberComponent, TuiIslandModule, TuiInputNumberModule, TuiHighlightModule, TuiTreeService, TuiTreeItemContentComponent, TUI_TREE_START, TUI_TREE_CONTENT, TUI_TREE_LOADING, TUI_TREE_LOADER, TuiTreeModule, TuiAvatarModule } from '@taiga-ui/kit';
|
18
18
|
import * as i6$1 from '@maskito/angular';
|
@@ -27,7 +27,7 @@ import * as i7$1 from '@taiga-ui/addon-preview';
|
|
27
27
|
import { TuiPreviewModule, TuiPreviewDialogService } from '@taiga-ui/addon-preview';
|
28
28
|
import * as i7 from '@ng-web-apis/intersection-observer';
|
29
29
|
import { IntersectionObserverService, IntersectionObserverModule } from '@ng-web-apis/intersection-observer';
|
30
|
-
import { RouterModule
|
30
|
+
import { RouterModule } from '@angular/router';
|
31
31
|
import * as i9 from '@taiga-ui/addon-commerce';
|
32
32
|
import { TuiCurrencyPipeModule } from '@taiga-ui/addon-commerce';
|
33
33
|
import * as i4$2 from '@taiga-ui/addon-charts';
|
@@ -3713,100 +3713,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
3713
3713
|
type: Input
|
3714
3714
|
}], computeLabels$: [], computeValue: [] } });
|
3715
3715
|
|
3716
|
-
/**
|
3717
|
-
* Значения пагинации списка товаров категории по умолчанию.
|
3718
|
-
*/
|
3719
|
-
const SC_PRODUCT_PAGINATION_DEFAULT_OPTIONS = {
|
3720
|
-
perPage: 20,
|
3721
|
-
page: 0
|
3722
|
-
};
|
3723
|
-
/**
|
3724
|
-
* Токен значений пагинации списка товаров в категории по умолчанию.
|
3725
|
-
*/
|
3726
|
-
const SC_PRODUCT_PAGINATION_OPTIONS = tuiCreateToken(SC_PRODUCT_PAGINATION_DEFAULT_OPTIONS);
|
3727
|
-
/**
|
3728
|
-
* {@link Subject} параметров пагинации списка товаров в категории.
|
3729
|
-
*/
|
3730
|
-
const paginationParams$ = new Subject();
|
3731
|
-
/**
|
3732
|
-
* Токен {@link Subject} параметров пагинации списка товаров в категории для получения их из вне.
|
3733
|
-
*/
|
3734
|
-
const SC_PRODUCT_PAGINATION_PARAMS = tuiCreateToken(paginationParams$);
|
3735
|
-
/**
|
3736
|
-
* Фабрика создания потока данных о товарах категории с пагинацией, включая данные о количестве этих товаров в корзине.
|
3737
|
-
*
|
3738
|
-
* @param paramMap Данные о параметрах запроса.
|
3739
|
-
* @param catalogService Сервис для работы с каталогом.
|
3740
|
-
* @param cartService Сервис для работы с корзиной.
|
3741
|
-
* @param authService Сервис для работы с аутентификации пользователей.
|
3742
|
-
* @param destroy$ Сервис завершения {@link Observable} через `takeUntil`.
|
3743
|
-
*/
|
3744
|
-
function productsPaginationChangeFactory({ paramMap }, catalogService, cartService, authService, destroy$) {
|
3745
|
-
return paramMap.pipe(map((params) => params.get('categoryId')), filter(tuiIsPresent), switchMap((categoryId) => paginationParams$.pipe(debounceTime(20), switchMap((paginationParams) => authService.getAuthChange().pipe(switchMap(() => catalogService.getCategoryProducts$(Number(categoryId), paginationParams)))), filter(tuiIsPresent), scan((acc, value) => {
|
3746
|
-
if (acc && value && value.meta.currentPage > 1)
|
3747
|
-
value.data.unshift(...acc.data);
|
3748
|
-
return value;
|
3749
|
-
}, null), switchMap((productsPaginate) => cartService.getCartChange$().pipe(map((cart) => {
|
3750
|
-
productsPaginate?.data.forEach((product) => (product.cartItem = cart.items.find((cartItem) => cartItem.product.id === product.id)));
|
3751
|
-
return productsPaginate;
|
3752
|
-
}))), startWith(null))), share(), takeUntil(destroy$));
|
3753
|
-
}
|
3754
|
-
/**
|
3755
|
-
* Токен потока данных о товарах категории, включая данные о количестве этих товаров в корзине.
|
3756
|
-
*/
|
3757
|
-
const SC_PRODUCT_PAGINATION_CHANGE_INFO = new InjectionToken('SC_PRODUCT_PAGINATION_CHANGE_INFO');
|
3758
|
-
/**
|
3759
|
-
* {@link EventEmitter} событие нажатия на кнопку "Показать следующие позиции категории".
|
3760
|
-
*/
|
3761
|
-
const nextPageClickEvent = new EventEmitter();
|
3762
|
-
/**
|
3763
|
-
* Токен {@link EventEmitter} событие нажатия на кнопку "Показать следующие позиции категории".
|
3764
|
-
*/
|
3765
|
-
const SC_NEXT_PAGE_PAGINATION_CLICK = tuiCreateToken(nextPageClickEvent);
|
3766
|
-
/**
|
3767
|
-
* Фабрика создания потока данных о состоянии загрузки запроса списка товаров с пагинацией пагинации.
|
3768
|
-
*/
|
3769
|
-
function loadingPaginationFactory(productsData$, destroy$) {
|
3770
|
-
return merge(paginationParams$.pipe(map(() => true)), productsData$.pipe(map((data) => data === null))).pipe(share(), takeUntil(destroy$));
|
3771
|
-
}
|
3772
|
-
/**
|
3773
|
-
* Токен потока данных о состоянии загрузки товаров пагинации.
|
3774
|
-
*/
|
3775
|
-
const SC_LOADING_PAGINATION_CHANGE_INFO = new InjectionToken('SC_LOADING_PAGINATION_CHANGE_INFO');
|
3776
|
-
/**
|
3777
|
-
* Фабрика создания потока данных прокрутки страницы с сигналами о необходимости пагинации товара.
|
3778
|
-
*/
|
3779
|
-
function nextPagePaginationChangeFactory({ events }, nextPagePaginationClick, productsData$, destroy$) {
|
3780
|
-
return nextPagePaginationClick
|
3781
|
-
.pipe(scan((acc) => ++acc, 1), startWith(1))
|
3782
|
-
.pipe(takeUntil(merge(events.pipe(filter((e) => e instanceof NavigationEnd)), productsData$.pipe(filter((paginate) => paginate !== null && paginate.meta.currentPage >= paginate.meta.lastPage)), destroy$)));
|
3783
|
-
}
|
3784
|
-
/**
|
3785
|
-
* Токен потока данных прокрутки страницы с сигналами о необходимости пагинации товара.
|
3786
|
-
*/
|
3787
|
-
const SC_NEXT_PAGE_PAGINATION_CHANGE_INFO = new InjectionToken('SC_NEXT_PAGE_PAGINATION_CHANGE_INFO');
|
3788
|
-
/**
|
3789
|
-
* Провайдеры потока данных о товарах категории, включая данные о количестве этих товаров в корзине.
|
3790
|
-
*/
|
3791
|
-
const SC_PRODUCT_PAGINATION_CHANGE_PROVIDERS = [
|
3792
|
-
TuiDestroyService,
|
3793
|
-
{
|
3794
|
-
provide: SC_PRODUCT_PAGINATION_CHANGE_INFO,
|
3795
|
-
deps: [ActivatedRoute, ScCatalogService, ScCartService, ScAuthService, TuiDestroyService],
|
3796
|
-
useFactory: productsPaginationChangeFactory
|
3797
|
-
},
|
3798
|
-
{
|
3799
|
-
provide: SC_NEXT_PAGE_PAGINATION_CHANGE_INFO,
|
3800
|
-
deps: [Router, SC_NEXT_PAGE_PAGINATION_CLICK, SC_PRODUCT_PAGINATION_CHANGE_INFO, TuiDestroyService],
|
3801
|
-
useFactory: nextPagePaginationChangeFactory
|
3802
|
-
},
|
3803
|
-
{
|
3804
|
-
provide: SC_LOADING_PAGINATION_CHANGE_INFO,
|
3805
|
-
deps: [SC_PRODUCT_PAGINATION_CHANGE_INFO, TuiDestroyService],
|
3806
|
-
useFactory: loadingPaginationFactory
|
3807
|
-
}
|
3808
|
-
];
|
3809
|
-
|
3810
3716
|
/**
|
3811
3717
|
* Компонент элементов управления пагинацией списка товаров.
|
3812
3718
|
*/
|
@@ -3820,24 +3726,34 @@ class ScPriceListPaginationComponent {
|
|
3820
3726
|
constructor(nextPageClickEvent, options) {
|
3821
3727
|
this.nextPageClickEvent = nextPageClickEvent;
|
3822
3728
|
this.options = options;
|
3729
|
+
/**
|
3730
|
+
* Сервис пагинации.
|
3731
|
+
*/
|
3732
|
+
this.paginationService = inject((ScPaginationService), {
|
3733
|
+
skipSelf: true,
|
3734
|
+
});
|
3735
|
+
/**
|
3736
|
+
* Дополнительные данные пагинации.
|
3737
|
+
*/
|
3738
|
+
this.meta$ = this.paginationService.dataAccumulated$.pipe(filter(tuiIsPresent), map((pagination) => pagination.meta));
|
3739
|
+
/**
|
3740
|
+
* Признак, что кнопка неактивна.
|
3741
|
+
*/
|
3742
|
+
this.disabled$ = this.paginationService.dataAccumulated$.pipe(map(tuiIsFalsy));
|
3823
3743
|
}
|
3824
3744
|
}
|
3825
3745
|
ScPriceListPaginationComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceListPaginationComponent, deps: [{ token: SC_NEXT_PAGE_PAGINATION_CLICK }, { token: SC_PRODUCT_PAGINATION_OPTIONS }], target: i0.ɵɵFactoryTarget.Component });
|
3826
|
-
ScPriceListPaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScPriceListPaginationComponent, selector: "sc-price-list-pagination",
|
3746
|
+
ScPriceListPaginationComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: ScPriceListPaginationComponent, selector: "sc-price-list-pagination", ngImport: i0, template: "<ng-container *ngIf=\"meta$ | async as meta\">\n <button\n *ngIf=\"meta?.currentPage !== meta?.lastPage\"\n tuiButton\n (click)=\"nextPageClickEvent.emit()\"\n [disabled]=\"!!(disabled$ | async)\"\n appearance=\"secondary\"\n class=\"!font-bold\"\n >\n \u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0435\u0449\u0451 {{ options.perPage }} \u0442\u043E\u0432\u0430\u0440\u043E\u0432\n </button>\n</ng-container>\n", dependencies: [{ kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i4.TuiButtonComponent, selector: "button[tuiButton], button[tuiIconButton], a[tuiButton], a[tuiIconButton]", inputs: ["appearance", "disabled", "icon", "iconRight", "shape", "showLoader", "size"] }, { kind: "pipe", type: i2.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
3827
3747
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: ScPriceListPaginationComponent, decorators: [{
|
3828
3748
|
type: Component,
|
3829
|
-
args: [{ selector: 'sc-price-list-pagination', changeDetection: ChangeDetectionStrategy.OnPush,
|
3749
|
+
args: [{ selector: 'sc-price-list-pagination', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"meta$ | async as meta\">\n <button\n *ngIf=\"meta?.currentPage !== meta?.lastPage\"\n tuiButton\n (click)=\"nextPageClickEvent.emit()\"\n [disabled]=\"!!(disabled$ | async)\"\n appearance=\"secondary\"\n class=\"!font-bold\"\n >\n \u041F\u043E\u043A\u0430\u0437\u0430\u0442\u044C \u0435\u0449\u0451 {{ options.perPage }} \u0442\u043E\u0432\u0430\u0440\u043E\u0432\n </button>\n</ng-container>\n" }]
|
3830
3750
|
}], ctorParameters: function () { return [{ type: i0.EventEmitter, decorators: [{
|
3831
3751
|
type: Inject,
|
3832
3752
|
args: [SC_NEXT_PAGE_PAGINATION_CLICK]
|
3833
3753
|
}] }, { type: undefined, decorators: [{
|
3834
3754
|
type: Inject,
|
3835
3755
|
args: [SC_PRODUCT_PAGINATION_OPTIONS]
|
3836
|
-
}] }]; }
|
3837
|
-
type: Input
|
3838
|
-
}], loadingPagination: [{
|
3839
|
-
type: Input
|
3840
|
-
}] } });
|
3756
|
+
}] }]; } });
|
3841
3757
|
|
3842
3758
|
/**
|
3843
3759
|
* Модуль каталога.
|
@@ -5909,5 +5825,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
|
|
5909
5825
|
* Generated bundle index. Do not edit.
|
5910
5826
|
*/
|
5911
5827
|
|
5912
|
-
export { AbstractScPriceCard, AuthMethod, FilesAndDocumentsComponent, FilesAndDocumentsModule, SC_LINEAR_VALUES, SC_LINEAR_VALUES_TOKEN,
|
5828
|
+
export { AbstractScPriceCard, AuthMethod, FilesAndDocumentsComponent, FilesAndDocumentsModule, SC_LINEAR_VALUES, SC_LINEAR_VALUES_TOKEN, SC_USER_INFO, SC_USER_PROVIDERS, ScAccordionComponent, ScAccordionContentDirective, ScAccordionModule, ScAddContactDialogComponent, ScAddContragentBankAccountsDialogComponent, ScAddContragentDialogComponent, ScAddDeliveryAddressDialogComponent, ScAddressesSelectionFieldComponent, ScAskToSampleFormComponent, ScAuthModule, ScBannerComponent, ScBannerModule, ScBrandsListComponent, ScBrandsListModule, ScCartItemMobileComponent, ScCartModule, ScCatalogModule, ScCategoriesListComponent, ScCategoryCardComponent, ScContactsAccordionComponent, ScContactsModule, ScContragentsAccordionComponent, ScContragentsAccordionItemComponent, ScContragentsModule, ScDeliveryAddressAccordionComponent, ScDeliveryAddressAccordionItemComponent, ScDeliveryAddressModule, ScFavoriteBtnComponent, ScFormFieldsModule, ScFormatePhonePipe, ScInputQuantityComponent, ScNewContactFormComponent, ScNewContragentBankAccountsFormComponent, ScNewContragentFormComponent, ScNewsCardComponent, ScNewsCardSkeletonComponent, ScNewsModule, ScNextInputFocusDirective, ScNextInputFocusModule, ScOrderItemMobileComponent, ScOrderModule, ScPaymentStatusComponent, ScPreviewSampleComponent, ScPreviewSampleModule, ScPriceCardComponent, ScPriceHistoryComponent, ScPriceListPaginationComponent, ScPriceWarehouseStockComponent, ScProfileAccordionsContentComponent, ScProfileModule, ScQRCodeDialogComponent, ScQRCodeModule, ScResetUserPasswordComponent, ScShareButtonComponent, ScShareButtonModule, ScSignInFormByEmailComponent, ScSignInFormByPhoneComponent, ScSignInFormComponent, ScSignUpFormComponent, ScSuggestionFieldComponent, ScTelLinkDirective, ScTelLinkModule, ScTerminalLinkDirective, ScUpdateUserInfoDialogComponent, ScUserManagersComponent, ScUserModule, ScUserPhoneApproveDialogComponent, ScVerificationModule, ScVerificationPhoneCheckFormComponent, TreeDirective, TreeIconService, TreeLoaderService, TreeTopDirective, scBicValidator, scClientUiIconsName, scCorrespondentAccountValidator, scPasswordConfirmMatchingValidator, scUserFactory, stepValidator };
|
5913
5829
|
//# sourceMappingURL=snabcentr-client-ui.mjs.map
|