@kuzntsv/uikit 0.21.24 → 0.21.26
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';
|
|
@@ -20,7 +20,6 @@ import { MatMenu, MatMenuTrigger, MatMenuItem, MatMenuContent } from '@angular/m
|
|
|
20
20
|
import { MatToolbar } from '@angular/material/toolbar';
|
|
21
21
|
import * as i1$1 from '@angular/material/tooltip';
|
|
22
22
|
import { MatTooltip, MatTooltipModule } from '@angular/material/tooltip';
|
|
23
|
-
import * as XLSX from 'xlsx';
|
|
24
23
|
import { MAT_DIALOG_DATA, MatDialogRef, MatDialogTitle, MatDialogContent, MatDialogActions, MatDialogClose, MatDialog, MatDialogConfig } from '@angular/material/dialog';
|
|
25
24
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
26
25
|
import { ENTER, COMMA } from '@angular/cdk/keycodes';
|
|
@@ -920,15 +919,6 @@ class ExportService {
|
|
|
920
919
|
}
|
|
921
920
|
return str;
|
|
922
921
|
}
|
|
923
|
-
// Экспорт в Excel
|
|
924
|
-
exportExcel(data, heading, sheetName = 'sheet1', filename = 'data') {
|
|
925
|
-
const wb = XLSX.utils.book_new();
|
|
926
|
-
const ws = XLSX.utils.json_to_sheet([]);
|
|
927
|
-
XLSX.utils.sheet_add_aoa(ws, heading);
|
|
928
|
-
XLSX.utils.sheet_add_json(ws, data, { origin: 'A2', skipHeader: true });
|
|
929
|
-
XLSX.utils.book_append_sheet(wb, ws, sheetName);
|
|
930
|
-
XLSX.writeFile(wb, filename + '.xlsx');
|
|
931
|
-
}
|
|
932
922
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ExportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
933
923
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.1.0", ngImport: i0, type: ExportService, providedIn: 'root' });
|
|
934
924
|
}
|
|
@@ -1214,6 +1204,38 @@ class BasePageClass {
|
|
|
1214
1204
|
ngOnDestroy() {
|
|
1215
1205
|
this.subscription.unsubscribe();
|
|
1216
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
|
+
}
|
|
1217
1239
|
onPageChange(pageState) {
|
|
1218
1240
|
this.tableState.pageIndex = pageState.pageIndex;
|
|
1219
1241
|
this.tableState.pageSize = pageState.pageSize;
|
|
@@ -1540,6 +1562,23 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
1540
1562
|
}]
|
|
1541
1563
|
}] });
|
|
1542
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
|
+
|
|
1543
1582
|
class RedirectGuard {
|
|
1544
1583
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1545
1584
|
canActivate(route, state) {
|
|
@@ -2229,5 +2268,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.0", ngImpor
|
|
|
2229
2268
|
* Generated bundle index. Do not edit.
|
|
2230
2269
|
*/
|
|
2231
2270
|
|
|
2232
|
-
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 };
|
|
2233
2272
|
//# sourceMappingURL=kuzntsv-uikit.mjs.map
|