@senior-gestao-empresarial/angular-components 6.9.2 → 6.10.0

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.
@@ -3,7 +3,7 @@ import { Input, Component, NgModule, Injectable, Inject, ɵɵdefineInjectable,
3
3
  import { CommonModule } from '@angular/common';
4
4
  import { BreadcrumbModule as BreadcrumbModule$1 } from 'primeng/breadcrumb';
5
5
  import { NavigationEnd, PRIMARY_OUTLET, ActivatedRoute, Router, RouterModule } from '@angular/router';
6
- import { Subject, throwError, interval, of, race, timer, iif, fromEvent, ReplaySubject } from 'rxjs';
6
+ import { Subject, throwError, interval, of, BehaviorSubject, race, timer, iif, fromEvent, ReplaySubject } from 'rxjs';
7
7
  import { takeUntil, filter, catchError, map, takeWhile, switchMap, take, finalize, first } from 'rxjs/operators';
8
8
  import * as moment_ from 'moment';
9
9
  import { FormField, FieldType } from '@seniorsistemas/angular-components';
@@ -7032,15 +7032,14 @@ var WebsocketService = /** @class */ (function () {
7032
7032
  /** @private */
7033
7033
  this.primitiveManagers = new Map();
7034
7034
  /** @private */
7035
- this.connect$ = new Subject();
7035
+ this.connected$ = new BehaviorSubject(false);
7036
7036
  /** @private */
7037
7037
  this.disconnect$ = new Subject();
7038
7038
  /** @private */
7039
7039
  this.reconnect$ = new Subject();
7040
7040
  /** @private */
7041
7041
  this.error$ = new Subject();
7042
- this.subscribe$ = new Subject();
7043
- this.connect();
7042
+ this.subscribed$ = new Subject();
7044
7043
  }
7045
7044
  WebsocketService_1 = WebsocketService;
7046
7045
  /**
@@ -7048,10 +7047,7 @@ var WebsocketService = /** @class */ (function () {
7048
7047
  * @return Um `Observable<void>` que emite uma notificação quando a conexão websocket é estabelecida pela primeira vez.
7049
7048
  */
7050
7049
  WebsocketService.prototype.onConnect = function () {
7051
- if (this.isConnected || this.wasConnected) {
7052
- return of(undefined).pipe(take(1));
7053
- }
7054
- return this.connect$.asObservable().pipe(take(1));
7050
+ return this.connected$.asObservable().pipe(filter(Boolean), map(function () { return undefined; }), take(1));
7055
7051
  };
7056
7052
  /**
7057
7053
  * Observable responsável por emitir uma notificação quando a conexão é desconectada.
@@ -7076,12 +7072,14 @@ var WebsocketService = /** @class */ (function () {
7076
7072
  var domain = _a.domain, service = _a.service, primitive = _a.primitive;
7077
7073
  var key = this.getPrimitiveManagerKey(domain, service, primitive);
7078
7074
  return this.onConnect().pipe(switchMap(function () {
7079
- return _this.primitiveManagers.has(key) &&
7080
- _this.primitiveManagers.get(key).isSubscribed
7081
- ? of(void 0).pipe(take(1))
7082
- : _this.subscribe$.pipe(filter(function (primitiveManager) {
7083
- return _this.getPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive) === key;
7084
- }), take(1), map(function () { return void 0; }));
7075
+ if (_this.primitiveManagers.has(key))
7076
+ return _this.primitiveManagers
7077
+ .get(key)
7078
+ .subscribed$.asObservable()
7079
+ .pipe(map(function () { return undefined; }), take(1));
7080
+ return _this.subscribed$.asObservable().pipe(filter(function (primitiveManager) {
7081
+ return _this.getPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive) === key;
7082
+ }), map(function () { return undefined; }), take(1));
7085
7083
  }));
7086
7084
  };
7087
7085
  /**
@@ -7101,6 +7099,7 @@ var WebsocketService = /** @class */ (function () {
7101
7099
  */
7102
7100
  WebsocketService.prototype.onEvent = function (options) {
7103
7101
  var _this = this;
7102
+ this.connect();
7104
7103
  var domain = options.domain, service = options.service, primitive = options.primitive;
7105
7104
  var key = this.getPrimitiveManagerKey(domain, service, primitive);
7106
7105
  if (this.primitiveManagers.has(key)) {
@@ -7112,30 +7111,17 @@ var WebsocketService = /** @class */ (function () {
7112
7111
  primitive: primitive,
7113
7112
  stompSubscriptions: [],
7114
7113
  event$: new Subject(),
7115
- isSubscribed: false
7114
+ subscribed$: new BehaviorSubject(false)
7116
7115
  };
7117
7116
  this.primitiveManagers.set(key, primitiveManager);
7118
- if (this.isConnected) {
7119
- this.createStompSubscriptions(primitiveManager);
7120
- return primitiveManager.event$
7121
- .asObservable()
7122
- .pipe(finalize(function () {
7123
- return _this.disconnectPrimitiveOnFinalize(primitiveManager);
7124
- }));
7125
- }
7126
- else {
7127
- if (!this.isConnecting) {
7128
- this.connect();
7129
- }
7130
- this.connect$.pipe(first()).subscribe(function () {
7131
- _this.createStompSubscriptions(primitiveManager);
7132
- });
7133
- return primitiveManager.event$
7134
- .asObservable()
7135
- .pipe(finalize(function () {
7136
- return _this.disconnectPrimitiveOnFinalize(primitiveManager);
7137
- }));
7138
- }
7117
+ this.onConnect()
7118
+ .pipe(take(1))
7119
+ .subscribe(function () {
7120
+ _this.createStompSubscriptions(primitiveManager);
7121
+ });
7122
+ return primitiveManager.event$
7123
+ .asObservable()
7124
+ .pipe(finalize(function () { return _this.disconnectPrimitiveOnFinalize(primitiveManager); }));
7139
7125
  };
7140
7126
  /** @private */
7141
7127
  WebsocketService.prototype.createStompSubscriptions = function (primitiveManager) {
@@ -7147,12 +7133,14 @@ var WebsocketService = /** @class */ (function () {
7147
7133
  stompSubscriptionWithToken,
7148
7134
  stompSubscriptionWithoutToken
7149
7135
  ];
7150
- primitiveManager.isSubscribed = true;
7151
- this.subscribe$.next(primitiveManager);
7136
+ primitiveManager.subscribed$.next(true);
7137
+ this.subscribed$.next(primitiveManager);
7152
7138
  };
7153
7139
  /** @private */
7154
7140
  WebsocketService.prototype.connect = function () {
7155
7141
  var _this = this;
7142
+ if (this.isConnected || this.isConnecting)
7143
+ return;
7156
7144
  this.createStompClient();
7157
7145
  this.isConnecting = true;
7158
7146
  this._stompClient.connect({}, function () {
@@ -7160,15 +7148,16 @@ var WebsocketService = /** @class */ (function () {
7160
7148
  _this.isConnected = true;
7161
7149
  if (_this.wasConnected) {
7162
7150
  _this.reconnectPrimitives();
7163
- _this.connect$.next();
7151
+ _this.connected$.next(true);
7164
7152
  _this.reconnect$.next();
7165
7153
  }
7166
7154
  else {
7167
7155
  _this.wasConnected = true;
7168
- _this.connect$.next();
7156
+ _this.connected$.next(true);
7169
7157
  }
7170
7158
  }, function (error) {
7171
7159
  _this.isConnected = false;
7160
+ _this.connected$.next(false);
7172
7161
  _this.error$.next(error);
7173
7162
  race(_this.disconnect$.pipe(take(1), map(function () { return ({ wasDisconnected: true }); })), timer(WebsocketService_1.RECONNECT_INTERVAL).pipe(take(1), switchMap(function () {
7174
7163
  return iif(function () { return document.hidden; }, fromEvent(document, 'visibilitychange').pipe(first()), of(void 0));
@@ -7234,6 +7223,7 @@ var WebsocketService = /** @class */ (function () {
7234
7223
  this.isConnected = false;
7235
7224
  this.isConnecting = false;
7236
7225
  this.wasConnected = false;
7226
+ this.connected$.next(false);
7237
7227
  this.disconnect$.next();
7238
7228
  };
7239
7229
  /** @private */
@@ -7323,6 +7313,7 @@ var WebsocketService = /** @class */ (function () {
7323
7313
  }
7324
7314
  finally { if (e_6) throw e_6.error; }
7325
7315
  }
7316
+ primitiveManager.subscribed$.complete();
7326
7317
  var key = this.getPrimitiveManagerKey(primitiveManager.domain, primitiveManager.service, primitiveManager.primitive);
7327
7318
  this.primitiveManagers.delete(key);
7328
7319
  this.disconnect();
@@ -7429,5 +7420,5 @@ var ModulesEnum;
7429
7420
  * Generated bundle index. Do not edit.
7430
7421
  */
7431
7422
 
7432
- export { AgreementLookup, BankLookup, BeneficioFiscalLookup, BreadcrumbComponent, BreadcrumbModule, Breakpoints, CountryLookup, CplTriNotaSaidaE001EndLookup, CplTriNotaSaidaE001PesLookup, CplTriNotaSaidaE001TnsLookup, CplTriNotaSaidaE007UfsLookup, CplTriNotaSaidaE008RaiLookup, CplTriNotaSaidaE015MedLookup, CplTriNotaSaidaE020SnfLookup, CplTriNotaSaidaE024MsgLookup, CplTriNotaSaidaE028CpgLookup, CplTriNotaSaidaE032EdcLookup, CplTriNotaSaidaE051DisLookup, CplTriNotaSaidaE066FpgLookup, CplTriNotaSaidaE070EmpLookup, CplTriNotaSaidaE070FilLookup, CplTriNotaSaidaE075DerLookup, CplTriNotaSaidaE080SerLookup, CplTriNotaSaidaNaturezaReceitaPisCofinsLookup, CplTriNotaSaidaNcmLookup, CplTriNotaSaidaNfEntradaLookup, CplTriNotaSaidaNfSaidaLookup, CurrencyLookup, DocumentoLookup, E001EndLookup, E001PesLookup, E001TnsLookup, E001TnsSupEstLookup, E002TptLookup, E007UfsLookup, E008CepLookup, E008RaiLookup, E012FamLookup, E015MedLookup, E020SnfLookup, E021MotLookup, E023CrpLookup, E024MsgLookup, E027EqiLookup, E027StrLookup, E028CpgLookup, E030AgeLookup, E030BanLookup, E031MoeLookup, E032EdcLookup, E035OcrLookup, E036InsLookup, E039PorLookup, E044CcuFinRatDepLookup, E044CcuLookup, E045PlaLookup, E046HpdLookup, E047NtgLookup, E048FctLookup, E048SfcLookup, E051DisLookup, E066FpgLookup, E067FinLookup, E069GreLookup, E070EmpLookup, E070EntLookup, E070FilLookup, E073PesLookup, E073VeiLookup, E075DerLookup, E080SerLookup, E081TabLookup, E082TprLookup, E085PesLookup, E090HrpComGerLookup, E090PesLookup, E091PlfFinRatLookup, E095PesLookup, E099UsuComGerLookup, E099UsuSupCprLookup, E140InsLookup, E140NfsLookup, E200LotLookup, E200SerLookup, E205DepLookup, E210DxpE075DerLookup, E210DxpLookup, E301TcrLookup, E403FprLookup, E420IcpLookup, E420IpcLookup, E420OcpLookup, E501TcpLookup, E600CcoLookup, E640LotLookup, EnumLogicalOperator, EquipmentLookup, ErpLookups, ErpLookupsModule, ErpPolling, ExportUtils, FiltersStorageService, FormUtilsService, HTTP_STATUS_CODE, LigacaoItemFornecedorLookup, LookupValidationUtils, ModulesEnum, NcmLookup, NotaFiscalEntradaLookup, NpsService, ParametersLookup, ProdutoServicoLookup, QuantidadeDisponivelDemandaLookup, RequisicaoLookup, SegmentoLookup, TypeTaxesLookup, UnidadeMedidaLookup, UtilsModule, VerifyModulePermission, WebsocketService, naturezaReceitaPisCofins, ɵ0, ErpLookupsService as ɵa, EntityPersonProductLookup as ɵb, StorageService as ɵc, VerifyModulePermissionService as ɵd };
7423
+ export { AgreementLookup, BankLookup, BeneficioFiscalLookup, BreadcrumbComponent, BreadcrumbModule, Breakpoints, CountryLookup, CplTriNotaSaidaE001EndLookup, CplTriNotaSaidaE001PesLookup, CplTriNotaSaidaE001TnsLookup, CplTriNotaSaidaE007UfsLookup, CplTriNotaSaidaE008RaiLookup, CplTriNotaSaidaE015MedLookup, CplTriNotaSaidaE020SnfLookup, CplTriNotaSaidaE024MsgLookup, CplTriNotaSaidaE028CpgLookup, CplTriNotaSaidaE032EdcLookup, CplTriNotaSaidaE051DisLookup, CplTriNotaSaidaE066FpgLookup, CplTriNotaSaidaE070EmpLookup, CplTriNotaSaidaE070FilLookup, CplTriNotaSaidaE075DerLookup, CplTriNotaSaidaE080SerLookup, CplTriNotaSaidaNaturezaReceitaPisCofinsLookup, CplTriNotaSaidaNcmLookup, CplTriNotaSaidaNfEntradaLookup, CplTriNotaSaidaNfSaidaLookup, CurrencyLookup, DocumentoLookup, E001EndLookup, E001PesLookup, E001TnsLookup, E001TnsSupEstLookup, E002TptLookup, E007UfsLookup, E008CepLookup, E008RaiLookup, E012FamLookup, E015MedLookup, E020SnfLookup, E021MotLookup, E023CrpLookup, E024MsgLookup, E027EqiLookup, E027StrLookup, E028CpgLookup, E030AgeLookup, E030BanLookup, E031MoeLookup, E032EdcLookup, E035OcrLookup, E036InsLookup, E039PorLookup, E044CcuFinRatDepLookup, E044CcuLookup, E045PlaLookup, E046HpdLookup, E047NtgLookup, E048FctLookup, E048SfcLookup, E051DisLookup, E066FpgLookup, E067FinLookup, E069GreLookup, E070EmpLookup, E070EntLookup, E070FilLookup, E073PesLookup, E073VeiLookup, E075DerLookup, E080SerLookup, E081TabLookup, E082TprLookup, E085PesLookup, E090HrpComGerLookup, E090PesLookup, E091PlfFinRatLookup, E095PesLookup, E099UsuComGerLookup, E099UsuSupCprLookup, E140InsLookup, E140NfsLookup, E200LotLookup, E200SerLookup, E205DepLookup, E210DxpE075DerLookup, E210DxpLookup, E301TcrLookup, E403FprLookup, E420IcpLookup, E420IpcLookup, E420OcpLookup, E501TcpLookup, E600CcoLookup, E640LotLookup, EntityPersonProductLookup, EnumLogicalOperator, EquipmentLookup, ErpLookups, ErpLookupsModule, ErpPolling, ExportUtils, FiltersStorageService, FormUtilsService, HTTP_STATUS_CODE, LigacaoItemFornecedorLookup, LookupValidationUtils, ModulesEnum, NcmLookup, NotaFiscalEntradaLookup, NpsService, ParametersLookup, ProdutoServicoLookup, QuantidadeDisponivelDemandaLookup, RequisicaoLookup, SegmentoLookup, TypeTaxesLookup, UnidadeMedidaLookup, UtilsModule, VerifyModulePermission, WebsocketService, naturezaReceitaPisCofins, ɵ0, ErpLookupsService as ɵa, StorageService as ɵb, VerifyModulePermissionService as ɵc };
7433
7424
  //# sourceMappingURL=senior-gestao-empresarial-angular-components.js.map