@kuzntsv/uikit 0.21.25 → 0.21.27
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.
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { inject, ChangeDetectorRef, ChangeDetectionStrategy, Component, Injectable, input, output, effect, viewChild, HostListener, ElementRef, Directive, signal, NgZone, Pipe, linkedSignal } from '@angular/core';
|
|
2
|
+
import { inject, ChangeDetectorRef, ChangeDetectionStrategy, Component, Injectable, input, output, effect, viewChild, HostListener, ElementRef, Directive, signal, NgZone, Input, Pipe, linkedSignal } from '@angular/core';
|
|
3
3
|
import { Router, DefaultUrlSerializer, ActivatedRoute, RouterLink } from '@angular/router';
|
|
4
4
|
import { Overlay } from '@angular/cdk/overlay';
|
|
5
5
|
import { ComponentPortal } from '@angular/cdk/portal';
|
|
6
6
|
import { MatProgressSpinner } from '@angular/material/progress-spinner';
|
|
7
7
|
import { HttpHeaders, HttpClient, HttpParams } from '@angular/common/http';
|
|
8
|
-
import { BehaviorSubject, Subscription, ReplaySubject, Subject, forkJoin, startWith } from 'rxjs';
|
|
8
|
+
import { BehaviorSubject, Subscription, ReplaySubject, Subject, tap, switchMap, map as map$1, forkJoin, startWith } from 'rxjs';
|
|
9
9
|
import { MatSnackBar } from '@angular/material/snack-bar';
|
|
10
10
|
import * as i1 from '@angular/forms';
|
|
11
|
-
import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|
11
|
+
import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule, NgControl } from '@angular/forms';
|
|
12
12
|
import { MatButton, MatIconButton, MatAnchor } from '@angular/material/button';
|
|
13
13
|
import { MatCard, MatCardHeader, MatCardTitle, MatCardContent } from '@angular/material/card';
|
|
14
14
|
import { MatFormField, MatLabel, MatError, MatSuffix, MatHint } from '@angular/material/form-field';
|
|
@@ -1204,6 +1204,38 @@ class BasePageClass {
|
|
|
1204
1204
|
ngOnDestroy() {
|
|
1205
1205
|
this.subscription.unsubscribe();
|
|
1206
1206
|
}
|
|
1207
|
+
subscribeToLoadData(fnGetData, fnGetCount, fnMapEntity) {
|
|
1208
|
+
// отменять стримы, созданные ранее
|
|
1209
|
+
const subs = this.loadData$
|
|
1210
|
+
.pipe(tap(() => this.loaderService.show()), switchMap(fnGetData()), map$1(v => fnMapEntity ? v.map(fnMapEntity()) : v))
|
|
1211
|
+
.subscribe({
|
|
1212
|
+
next: (response) => {
|
|
1213
|
+
this.data.set(response);
|
|
1214
|
+
this.loaderService.hide();
|
|
1215
|
+
},
|
|
1216
|
+
error: (error) => {
|
|
1217
|
+
this.loaderService.hide();
|
|
1218
|
+
console.log(error);
|
|
1219
|
+
this.alertService.error('Произошла ошибка: ' + error, 0);
|
|
1220
|
+
}
|
|
1221
|
+
});
|
|
1222
|
+
this.subscription?.add(subs);
|
|
1223
|
+
const subs2 = this.loadLength$
|
|
1224
|
+
.pipe(switchMap(fnGetCount()))
|
|
1225
|
+
.subscribe({
|
|
1226
|
+
next: (response) => {
|
|
1227
|
+
this.length.set(response);
|
|
1228
|
+
},
|
|
1229
|
+
error: (error) => {
|
|
1230
|
+
console.log(error);
|
|
1231
|
+
this.alertService.error('Произошла ошибка: ' + error, 0);
|
|
1232
|
+
}
|
|
1233
|
+
});
|
|
1234
|
+
this.subscription?.add(subs2);
|
|
1235
|
+
// загрузить данные и количество записей
|
|
1236
|
+
this.loadData$.next(null);
|
|
1237
|
+
this.loadLength$.next(null);
|
|
1238
|
+
}
|
|
1207
1239
|
onPageChange(pageState) {
|
|
1208
1240
|
this.tableState.pageIndex = pageState.pageIndex;
|
|
1209
1241
|
this.tableState.pageSize = pageState.pageSize;
|
|
@@ -1530,6 +1562,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
1530
1562
|
}]
|
|
1531
1563
|
}] });
|
|
1532
1564
|
|
|
1565
|
+
class SetValueDirective {
|
|
1566
|
+
ngControl = inject(NgControl);
|
|
1567
|
+
set setValue(val) {
|
|
1568
|
+
this.ngControl.control?.setValue(val, { emitEvent: false });
|
|
1569
|
+
}
|
|
1570
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SetValueDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1571
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.1.0", type: SetValueDirective, isStandalone: true, selector: "[setValue]", inputs: { setValue: "setValue" }, ngImport: i0 });
|
|
1572
|
+
}
|
|
1573
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: SetValueDirective, decorators: [{
|
|
1574
|
+
type: Directive,
|
|
1575
|
+
args: [{
|
|
1576
|
+
selector: "[setValue]"
|
|
1577
|
+
}]
|
|
1578
|
+
}], propDecorators: { setValue: [{
|
|
1579
|
+
type: Input
|
|
1580
|
+
}] } });
|
|
1581
|
+
|
|
1533
1582
|
class RedirectGuard {
|
|
1534
1583
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1535
1584
|
canActivate(route, state) {
|
|
@@ -2219,5 +2268,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
2219
2268
|
* Generated bundle index. Do not edit.
|
|
2220
2269
|
*/
|
|
2221
2270
|
|
|
2222
|
-
export { Action, AlertService, AuthService, AvatarService, BaseEditClass, BaseFilterClass, BaseMatChipComponent, BaseNavBarMenuClass, BasePageClass, BaseSelectAutocompleteWithVsComponent, BaseSelectWithGroupComponent, BaseServiceClass, BaseToolbarComponent, DateRangeInputComponent, DialogAction, DialogComponent, DisableIfRoleDirective, DisableIfUnauthorizedDirective, EntityAction, Environment, ExportService, HideIfRoleNotDirective, HideIfUnauthorizedDirective, LoaderService, LocalStorageService, LoginPageComponent, MY_FORMATS, NavBarComponent, NotFoundComponent, ProgressSpinnerComponent, RedirectGuard, RoleService, SafePipe, SecUser, SseService, TableComponent, TimePipe, TruncatePipe, User, UserService, authGuard, dateFormat, roleGuard };
|
|
2271
|
+
export { Action, AlertService, AuthService, AvatarService, BaseEditClass, BaseFilterClass, BaseMatChipComponent, BaseNavBarMenuClass, BasePageClass, BaseSelectAutocompleteWithVsComponent, BaseSelectWithGroupComponent, BaseServiceClass, BaseToolbarComponent, DateRangeInputComponent, DialogAction, DialogComponent, DisableIfRoleDirective, DisableIfUnauthorizedDirective, EntityAction, Environment, ExportService, HideIfRoleNotDirective, HideIfUnauthorizedDirective, LoaderService, LocalStorageService, LoginPageComponent, MY_FORMATS, NavBarComponent, NotFoundComponent, ProgressSpinnerComponent, RedirectGuard, RoleService, SafePipe, SecUser, SetValueDirective, SseService, TableComponent, TimePipe, TruncatePipe, User, UserService, authGuard, dateFormat, roleGuard };
|
|
2223
2272
|
//# sourceMappingURL=kuzntsv-uikit.mjs.map
|