@kuzntsv/uikit 0.0.52 → 0.0.54

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,11 +1,11 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, ChangeDetectorRef, ChangeDetectionStrategy, Component, Injectable, input, output, effect, viewChild, HostListener, ElementRef, Directive, signal, Pipe, linkedSignal } from '@angular/core';
2
+ import { inject, ChangeDetectorRef, ChangeDetectionStrategy, Component, Injectable, input, output, effect, viewChild, HostListener, ElementRef, Directive, signal, NgZone, 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, Subject, forkJoin, startWith } from 'rxjs';
8
+ import { BehaviorSubject, Subscription, ReplaySubject, Subject, forkJoin, startWith } from 'rxjs';
9
9
  import { MatSnackBar } from '@angular/material/snack-bar';
10
10
  import * as i1 from '@angular/forms';
11
11
  import { FormGroup, FormControl, Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -940,6 +940,70 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
940
940
  }]
941
941
  }] });
942
942
 
943
+ class SseService {
944
+ zone = inject(NgZone);
945
+ eventSource = null;
946
+ isConnected = false;
947
+ constructor() { }
948
+ createSseEventSource(user, topic) {
949
+ const subject = new ReplaySubject(1);
950
+ // Close any existing connection
951
+ this.closeSseEventSource();
952
+ const topicUri = topic.getTopic(user);
953
+ // environment.sse_url
954
+ this.eventSource = new EventSource(topicUri
955
+ //, {withCredentials: true}
956
+ );
957
+ if (this.eventSource) {
958
+ this.isConnected = true;
959
+ // Listen for messages
960
+ this.eventSource.onmessage = (event) => {
961
+ console.log(event);
962
+ const messageData = JSON.parse(event.data);
963
+ this.zone.run(() => {
964
+ subject.next(messageData);
965
+ });
966
+ };
967
+ this.eventSource.onopen = () => {
968
+ console.log('SSE connection opened.');
969
+ };
970
+ // Process error
971
+ this.eventSource.onerror = (error) => {
972
+ console.error('SSE error:', error);
973
+ this.reconnectOnError(user, topic, subject);
974
+ };
975
+ }
976
+ return subject.asObservable();
977
+ }
978
+ reconnectOnError(user, topic, subject) {
979
+ this.closeSseEventSource();
980
+ if (this.isConnected)
981
+ return; // Prevent duplicate connections
982
+ console.log('Reconnecting to SSE in 1 second...');
983
+ setTimeout(() => {
984
+ this.zone.run(() => {
985
+ this.createSseEventSource(user, topic).subscribe(subject);
986
+ });
987
+ }, 1000);
988
+ }
989
+ closeSseEventSource() {
990
+ if (this.eventSource) {
991
+ this.eventSource.close();
992
+ this.eventSource = null;
993
+ this.isConnected = false;
994
+ console.log('SSE Connection closed');
995
+ }
996
+ }
997
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
998
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SseService, providedIn: 'root' });
999
+ }
1000
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: SseService, decorators: [{
1001
+ type: Injectable,
1002
+ args: [{
1003
+ providedIn: 'root'
1004
+ }]
1005
+ }], ctorParameters: () => [] });
1006
+
943
1007
  class BaseEditClass {
944
1008
  /** Сервис индиатор загрузки. */
945
1009
  loaderService = inject(LoaderService);
@@ -1129,11 +1193,11 @@ class DialogComponent {
1129
1193
  this.dialogRef.close();
1130
1194
  }
1131
1195
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DialogComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
1132
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", type: DialogComponent, isStandalone: true, selector: "ngx-uik-dialog", ngImport: i0, template: "<h1 mat-dialog-title>{{ data.title }}</h1>\n<div mat-dialog-content>\n <div style=\"white-space: pre-line\">{{ data.message }}</div>\n</div>\n<div mat-dialog-actions align=\"end\">\n <button mat-raised-button (click)=\"onNoClick()\" cdkFocusInitial>{{ data.btnNoTitle }}</button>\n <button mat-raised-button color=\"warn\" [mat-dialog-close]=\"data.id\">{{ data.btnYesTitle }}</button>\n</div>\n\n", styles: [""], dependencies: [{ kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] });
1196
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.2", type: DialogComponent, isStandalone: true, selector: "ngx-uik-dialog", ngImport: i0, template: "<h1 mat-dialog-title>{{ data.title }}</h1>\r\n<div mat-dialog-content>\r\n <div style=\"white-space: pre-line\">{{ data.message }}</div>\r\n</div>\r\n<div mat-dialog-actions align=\"end\">\r\n <button mat-raised-button (click)=\"onNoClick()\" cdkFocusInitial>{{ data.btnNoTitle }}</button>\r\n <button mat-raised-button color=\"warn\" [mat-dialog-close]=\"data.id\">{{ data.btnYesTitle }}</button>\r\n</div>\r\n\r\n", styles: [""], dependencies: [{ kind: "directive", type: MatDialogTitle, selector: "[mat-dialog-title], [matDialogTitle]", inputs: ["id"], exportAs: ["matDialogTitle"] }, { kind: "directive", type: MatDialogContent, selector: "[mat-dialog-content], mat-dialog-content, [matDialogContent]" }, { kind: "directive", type: MatDialogActions, selector: "[mat-dialog-actions], mat-dialog-actions, [matDialogActions]", inputs: ["align"] }, { kind: "component", type: MatButton, selector: " button[mat-button], button[mat-raised-button], button[mat-flat-button], button[mat-stroked-button] ", exportAs: ["matButton"] }, { kind: "directive", type: MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }] });
1133
1197
  }
1134
1198
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DialogComponent, decorators: [{
1135
1199
  type: Component,
1136
- args: [{ selector: 'ngx-uik-dialog', imports: [MatDialogTitle, MatDialogContent, MatDialogActions, MatButton, MatDialogClose], template: "<h1 mat-dialog-title>{{ data.title }}</h1>\n<div mat-dialog-content>\n <div style=\"white-space: pre-line\">{{ data.message }}</div>\n</div>\n<div mat-dialog-actions align=\"end\">\n <button mat-raised-button (click)=\"onNoClick()\" cdkFocusInitial>{{ data.btnNoTitle }}</button>\n <button mat-raised-button color=\"warn\" [mat-dialog-close]=\"data.id\">{{ data.btnYesTitle }}</button>\n</div>\n\n" }]
1200
+ args: [{ selector: 'ngx-uik-dialog', imports: [MatDialogTitle, MatDialogContent, MatDialogActions, MatButton, MatDialogClose], template: "<h1 mat-dialog-title>{{ data.title }}</h1>\r\n<div mat-dialog-content>\r\n <div style=\"white-space: pre-line\">{{ data.message }}</div>\r\n</div>\r\n<div mat-dialog-actions align=\"end\">\r\n <button mat-raised-button (click)=\"onNoClick()\" cdkFocusInitial>{{ data.btnNoTitle }}</button>\r\n <button mat-raised-button color=\"warn\" [mat-dialog-close]=\"data.id\">{{ data.btnYesTitle }}</button>\r\n</div>\r\n\r\n" }]
1137
1201
  }], ctorParameters: () => [] });
1138
1202
 
1139
1203
  class BasePageClass {
@@ -1782,7 +1846,7 @@ class DateRangeInputComponent {
1782
1846
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "19.2.2", type: DateRangeInputComponent, isStandalone: true, selector: "ngx-uik-date-range-input", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, dateRange: { classPropertyName: "dateRange", publicName: "dateRange", isSignal: true, isRequired: false, transformFunction: null }, minDate: { classPropertyName: "minDate", publicName: "minDate", isSignal: true, isRequired: false, transformFunction: null }, clearInput: { classPropertyName: "clearInput", publicName: "clearInput", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { dateRangeChange: "dateRangeChange" }, providers: [
1783
1847
  { provide: MAT_DATE_LOCALE, useValue: 'ru' },
1784
1848
  { provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
1785
- ], ngImport: i0, template: "<mat-form-field appearance=\"fill\">\n <mat-label>{{label()}}</mat-label>\n <mat-date-range-input\n [rangePicker]=\"picker\"\n [formGroup]=\"form\"\n [min]=\"minDate()\">\n <input matStartDate formControlName=\"begin\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430\">\n <input matEndDate formControlName=\"end\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F\">\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-date-range-picker #picker></mat-date-range-picker>\n <mat-error>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434</mat-error>\n</mat-form-field>\n\n", styles: ["mat-form-field{margin-right:16px}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: MatStartDate, selector: "input[matStartDate]", outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: MatEndDate, selector: "input[matEndDate]", outputs: ["dateChange", "dateInput"] }, { kind: "component", type: MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }] });
1849
+ ], ngImport: i0, template: "<mat-form-field appearance=\"fill\">\r\n <mat-label>{{label()}}</mat-label>\r\n <mat-date-range-input\r\n [rangePicker]=\"picker\"\r\n [formGroup]=\"form\"\r\n [min]=\"minDate()\">\r\n <input matStartDate formControlName=\"begin\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430\">\r\n <input matEndDate formControlName=\"end\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F\">\r\n </mat-date-range-input>\r\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-date-range-picker #picker></mat-date-range-picker>\r\n <mat-error>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434</mat-error>\r\n</mat-form-field>\r\n\r\n", styles: ["mat-form-field{margin-right:16px}\n"], dependencies: [{ kind: "component", type: MatFormField, selector: "mat-form-field", inputs: ["hideRequiredMarker", "color", "floatLabel", "appearance", "subscriptSizing", "hintLabel"], exportAs: ["matFormField"] }, { kind: "directive", type: MatLabel, selector: "mat-label" }, { kind: "component", type: MatDateRangeInput, selector: "mat-date-range-input", inputs: ["rangePicker", "required", "dateFilter", "min", "max", "disabled", "separator", "comparisonStart", "comparisonEnd"], exportAs: ["matDateRangeInput"] }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: MatStartDate, selector: "input[matStartDate]", outputs: ["dateChange", "dateInput"] }, { kind: "directive", type: MatEndDate, selector: "input[matEndDate]", outputs: ["dateChange", "dateInput"] }, { kind: "component", type: MatDatepickerToggle, selector: "mat-datepicker-toggle", inputs: ["for", "tabIndex", "aria-label", "disabled", "disableRipple"], exportAs: ["matDatepickerToggle"] }, { kind: "directive", type: MatSuffix, selector: "[matSuffix], [matIconSuffix], [matTextSuffix]", inputs: ["matTextSuffix"] }, { kind: "component", type: MatDateRangePicker, selector: "mat-date-range-picker", exportAs: ["matDateRangePicker"] }, { kind: "directive", type: MatError, selector: "mat-error, [matError]", inputs: ["id"] }] });
1786
1850
  }
1787
1851
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImport: i0, type: DateRangeInputComponent, decorators: [{
1788
1852
  type: Component,
@@ -1790,7 +1854,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
1790
1854
  MatDatepickerToggle, MatSuffix, MatDateRangePicker, MatError], providers: [
1791
1855
  { provide: MAT_DATE_LOCALE, useValue: 'ru' },
1792
1856
  { provide: MAT_DATE_FORMATS, useValue: MY_FORMATS },
1793
- ], template: "<mat-form-field appearance=\"fill\">\n <mat-label>{{label()}}</mat-label>\n <mat-date-range-input\n [rangePicker]=\"picker\"\n [formGroup]=\"form\"\n [min]=\"minDate()\">\n <input matStartDate formControlName=\"begin\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430\">\n <input matEndDate formControlName=\"end\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F\">\n </mat-date-range-input>\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\n <mat-date-range-picker #picker></mat-date-range-picker>\n <mat-error>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434</mat-error>\n</mat-form-field>\n\n", styles: ["mat-form-field{margin-right:16px}\n"] }]
1857
+ ], template: "<mat-form-field appearance=\"fill\">\r\n <mat-label>{{label()}}</mat-label>\r\n <mat-date-range-input\r\n [rangePicker]=\"picker\"\r\n [formGroup]=\"form\"\r\n [min]=\"minDate()\">\r\n <input matStartDate formControlName=\"begin\" placeholder=\"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430\">\r\n <input matEndDate formControlName=\"end\" placeholder=\"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F\">\r\n </mat-date-range-input>\r\n <mat-datepicker-toggle matIconSuffix [for]=\"picker\"></mat-datepicker-toggle>\r\n <mat-date-range-picker #picker></mat-date-range-picker>\r\n <mat-error>\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u043F\u0435\u0440\u0438\u043E\u0434</mat-error>\r\n</mat-form-field>\r\n\r\n", styles: ["mat-form-field{margin-right:16px}\n"] }]
1794
1858
  }], ctorParameters: () => [] });
1795
1859
 
1796
1860
  var DialogAction;
@@ -2228,5 +2292,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.2", ngImpor
2228
2292
  * Generated bundle index. Do not edit.
2229
2293
  */
2230
2294
 
2231
- export { Action, AlertService, AnimationsService, 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, ROUTE_ANIMATIONS_ELEMENTS, RedirectGuard, RoleService, SafePipe, SecUser, TableComponent, TimePipe, TruncatePipe, User, UserService, authGuard, dateFormat, isRouteAnimationsAll, isRouteAnimationsElements, isRouteAnimationsNone, isRouteAnimationsPage, roleGuard, routeAnimations };
2295
+ export { Action, AlertService, AnimationsService, 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, ROUTE_ANIMATIONS_ELEMENTS, RedirectGuard, RoleService, SafePipe, SecUser, SseService, TableComponent, TimePipe, TruncatePipe, User, UserService, authGuard, dateFormat, isRouteAnimationsAll, isRouteAnimationsElements, isRouteAnimationsNone, isRouteAnimationsPage, roleGuard, routeAnimations };
2232
2296
  //# sourceMappingURL=kuzntsv-uikit.mjs.map