barsa-novin-ray-core 2.3.101 → 2.3.102

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,6 +1,6 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, inject, ElementRef, Input, ChangeDetectionStrategy, Component, Pipe, ComponentFactoryResolver, Injector, ApplicationRef, Compiler, DOCUMENT, NgModuleFactory, InjectionToken, NgZone, signal, effect, EventEmitter, ChangeDetectorRef, Renderer2, HostBinding, Output, HostListener, ViewContainerRef, ViewChild, Directive, TemplateRef, input, NgModule, NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA, provideAppInitializer, ErrorHandler } from '@angular/core';
3
- import { Subject, from, BehaviorSubject, of, exhaustMap, map as map$1, combineLatest, withLatestFrom as withLatestFrom$1, fromEvent, forkJoin, takeUntil as takeUntil$1, filter as filter$1, throwError, merge, interval, lastValueFrom, take, debounceTime as debounceTime$1, skip, Observable, tap as tap$1, catchError as catchError$1, timer, mergeWith, Subscription } from 'rxjs';
2
+ import { Injectable, inject, ElementRef, Input, ChangeDetectionStrategy, Component, Pipe, ComponentFactoryResolver, Injector, ApplicationRef, Compiler, DOCUMENT, NgModuleFactory, InjectionToken, NgZone, signal, EventEmitter, ChangeDetectorRef, Renderer2, HostBinding, Output, HostListener, ViewContainerRef, ViewChild, Directive, TemplateRef, input, NgModule, NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA, provideAppInitializer, ErrorHandler } from '@angular/core';
3
+ import { Subject, from, BehaviorSubject, of, exhaustMap, map as map$1, combineLatest, withLatestFrom as withLatestFrom$1, fromEvent, forkJoin, takeUntil as takeUntil$1, filter as filter$1, throwError, merge, interval, lastValueFrom, timeout, catchError as catchError$1, take, debounceTime as debounceTime$1, skip, Observable, tap as tap$1, timer, mergeWith, Subscription } from 'rxjs';
4
4
  import * as i1 from '@angular/router';
5
5
  import { Router, NavigationEnd, ActivatedRoute, RouterEvent, NavigationStart, RouterModule } from '@angular/router';
6
6
  import { DomSanitizer, Title } from '@angular/platform-browser';
@@ -4473,6 +4473,8 @@ class FormPanelService extends BaseComponent {
4473
4473
  this._headerDescriptionSource = new BehaviorSubject('');
4474
4474
  this._hideFooter$ = new BehaviorSubject(false);
4475
4475
  this._canSend$ = new BehaviorSubject(false);
4476
+ this._router = inject(Router);
4477
+ this._activatedRoute = inject(ActivatedRoute);
4476
4478
  this.context$ = this._contextSource.asObservable().pipe(tap((context) => this._prepareContext(context)), takeUntil(this._onDestroy$));
4477
4479
  this.searchPanelIsObject$ = this._searchPanelIsObjectSource.asObservable().pipe(takeUntil(this._onDestroy$));
4478
4480
  this.isSearchPanel$ = this._isSearchPanelSource.asObservable().pipe(takeUntil(this._onDestroy$));
@@ -4821,7 +4823,38 @@ class FormPanelService extends BaseComponent {
4821
4823
  }
4822
4824
  _refresh() {
4823
4825
  this._initialize(this._context);
4824
- // this._prepareView(this._context.Setting.View);
4826
+ const mo = this._moSource.getValue();
4827
+ if (!mo) {
4828
+ return;
4829
+ }
4830
+ const breadCrumb = this._headerLayoutSource.getValue();
4831
+ const mainChild = this._activatedRoute.children.find((c) => c.outlet === 'main');
4832
+ const currentParams = mainChild?.snapshot.params ?? {};
4833
+ const queryParamsToUpdate = {
4834
+ id: mo.$State === 'New' ? '0' : mo.Id,
4835
+ tyid: mo.$TypeDefId,
4836
+ tycp: mo.$Caption ? mo.$Caption : null,
4837
+ repid: mo.$ReportId,
4838
+ vid: this._viewSource.getValue()?.TypeViewId,
4839
+ bc: breadCrumb ? breadCrumb : mo.$State === 'New' ? mo.$TypeDefName : mo.$Caption
4840
+ };
4841
+ if (currentParams.id === queryParamsToUpdate.id &&
4842
+ currentParams.tyid === queryParamsToUpdate.tyid &&
4843
+ currentParams.repid === queryParamsToUpdate.repid &&
4844
+ currentParams.vid === queryParamsToUpdate.vid) {
4845
+ return;
4846
+ }
4847
+ const newParams = {
4848
+ ...currentParams,
4849
+ ...queryParamsToUpdate // پارامترهایی که می‌خواهی تغییر دهی
4850
+ };
4851
+ this._router.navigate([
4852
+ {
4853
+ outlets: {
4854
+ main: ['show', newParams]
4855
+ }
4856
+ }
4857
+ ], { relativeTo: this._activatedRoute.parent, skipLocationChange: false });
4825
4858
  }
4826
4859
  _forceClose() {
4827
4860
  this._forceCloseSource.next();
@@ -8168,66 +8201,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
8168
8201
  type: Injectable
8169
8202
  }], ctorParameters: () => [] });
8170
8203
 
8171
- class PushCheckService {
8172
- async checkPushReady() {
8173
- if (!this.baseSupport()) {
8174
- return 'مرورگر شما Push API را پشتیبانی نمی‌کند';
8175
- }
8176
- const iosCheck = this.iosSupport();
8177
- if (iosCheck !== true) {
8178
- return iosCheck;
8179
- }
8180
- if (Notification.permission === 'denied') {
8181
- return 'شما قبلاً اجازه نوتیفیکیشن را رد کرده‌اید. از تنظیمات مرورگر آن را فعال کنید';
8182
- }
8183
- const regs = await navigator.serviceWorker.getRegistrations();
8184
- if (!regs.length) {
8185
- return 'Service Worker ثبت نشده است';
8186
- }
8187
- return true;
8188
- }
8189
- getIosVersion() {
8190
- const ua = navigator.userAgent;
8191
- if (/iP(hone|od|ad)/.test(ua)) {
8192
- const v = ua.match(/OS (\d+)_/);
8193
- return v ? parseInt(v[1], 10) : null;
8194
- }
8195
- return null;
8196
- }
8197
- isIosStandalone() {
8198
- return 'standalone' in navigator && navigator.standalone === true;
8199
- }
8200
- isSafari() {
8201
- const ua = navigator.userAgent.toLowerCase();
8202
- return ua.includes('safari') && !ua.includes('chrome');
8203
- }
8204
- baseSupport() {
8205
- return 'Notification' in window && 'serviceWorker' in navigator && 'PushManager' in window;
8206
- }
8207
- iosSupport() {
8208
- const v = this.getIosVersion();
8209
- if (v && v < 16) {
8210
- return 'نسخه iOS کمتر از 16 است (Push پشتیبانی نمی‌شود)';
8211
- }
8212
- if (v && v < 16.4) {
8213
- return 'iOS باید حداقل نسخه 16.4 باشد تا Push فعال شود';
8214
- }
8215
- if (v && !this.isSafari()) {
8216
- return 'Push فقط در Safari iOS پشتیبانی می‌شود';
8217
- }
8218
- if (v && !this.isIosStandalone()) {
8219
- return 'برای فعال شدن Push، برنامه را با Add to Home Screen نصب کنید';
8220
- }
8221
- return true;
8222
- }
8223
- static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushCheckService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
8224
- static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushCheckService, providedIn: 'root' }); }
8225
- }
8226
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushCheckService, decorators: [{
8227
- type: Injectable,
8228
- args: [{ providedIn: 'root' }]
8229
- }] });
8230
-
8231
8204
  // src/app/services/idb.service.ts
8232
8205
  class IdbService {
8233
8206
  constructor() {
@@ -8347,7 +8320,9 @@ class PushNotificationService {
8347
8320
  }
8348
8321
  async unsubscribe() {
8349
8322
  try {
8350
- const sub = await lastValueFrom(this.swPush.subscription);
8323
+ const sub = await lastValueFrom(this.swPush.subscription.pipe(timeout(500), // اگر در 500ms چیزی نداد
8324
+ catchError$1(() => of(null)) // مقدار null برگردان
8325
+ ));
8351
8326
  if (!sub) {
8352
8327
  return;
8353
8328
  }
@@ -8438,7 +8413,6 @@ class ServiceWorkerCommuncationService {
8438
8413
  this._toastService = inject(TOAST_SERVICE, { optional: true });
8439
8414
  this._localStorage = inject(LocalStorageService);
8440
8415
  this._portalService = inject(PortalService);
8441
- this._pushCheckService = inject(PushCheckService);
8442
8416
  this._pushNotificatioService = inject(PushNotificationService);
8443
8417
  }
8444
8418
  get token2() {
@@ -8464,19 +8438,6 @@ class ServiceWorkerCommuncationService {
8464
8438
  BarsaApi.Ul.ApplicationCtrlr.on({
8465
8439
  UserLoggedout: (_, doReturn) => this._handlePushUnSubscription(doReturn)
8466
8440
  });
8467
- // automatic effect: update operationName based on subscription
8468
- effect(() => {
8469
- const sub = this._pushNotificatioService.push().isSubscribed;
8470
- // اینجا می‌تونی متغیر operationName یا UI رو اتوماتیک آپدیت کنی
8471
- console.log('Push subscription changed:', sub);
8472
- });
8473
- // automatic effect: show toast on errors
8474
- effect(() => {
8475
- const err = this._pushNotificatioService.push().errorMessage;
8476
- if (err) {
8477
- this.toast(err);
8478
- }
8479
- });
8480
8441
  }
8481
8442
  _subscribe() {
8482
8443
  this._portalService.userLoggedIn$.pipe().subscribe((isLoggedIn) => this._isLoggedIn(isLoggedIn));
@@ -8694,6 +8655,66 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImpor
8694
8655
  args: [{ providedIn: 'root' }]
8695
8656
  }], ctorParameters: () => [] });
8696
8657
 
8658
+ class PushCheckService {
8659
+ async checkPushReady() {
8660
+ if (!this.baseSupport()) {
8661
+ return 'مرورگر شما Push API را پشتیبانی نمی‌کند';
8662
+ }
8663
+ const iosCheck = this.iosSupport();
8664
+ if (iosCheck !== true) {
8665
+ return iosCheck;
8666
+ }
8667
+ if (Notification.permission === 'denied') {
8668
+ return 'شما قبلاً اجازه نوتیفیکیشن را رد کرده‌اید. از تنظیمات مرورگر آن را فعال کنید';
8669
+ }
8670
+ const regs = await navigator.serviceWorker.getRegistrations();
8671
+ if (!regs.length) {
8672
+ return 'Service Worker ثبت نشده است';
8673
+ }
8674
+ return true;
8675
+ }
8676
+ getIosVersion() {
8677
+ const ua = navigator.userAgent;
8678
+ if (/iP(hone|od|ad)/.test(ua)) {
8679
+ const v = ua.match(/OS (\d+)_/);
8680
+ return v ? parseInt(v[1], 10) : null;
8681
+ }
8682
+ return null;
8683
+ }
8684
+ isIosStandalone() {
8685
+ return 'standalone' in navigator && navigator.standalone === true;
8686
+ }
8687
+ isSafari() {
8688
+ const ua = navigator.userAgent.toLowerCase();
8689
+ return ua.includes('safari') && !ua.includes('chrome');
8690
+ }
8691
+ baseSupport() {
8692
+ return 'Notification' in window && 'serviceWorker' in navigator && 'PushManager' in window;
8693
+ }
8694
+ iosSupport() {
8695
+ const v = this.getIosVersion();
8696
+ if (v && v < 16) {
8697
+ return 'نسخه iOS کمتر از 16 است (Push پشتیبانی نمی‌شود)';
8698
+ }
8699
+ if (v && v < 16.4) {
8700
+ return 'iOS باید حداقل نسخه 16.4 باشد تا Push فعال شود';
8701
+ }
8702
+ if (v && !this.isSafari()) {
8703
+ return 'Push فقط در Safari iOS پشتیبانی می‌شود';
8704
+ }
8705
+ if (v && !this.isIosStandalone()) {
8706
+ return 'برای فعال شدن Push، برنامه را با Add to Home Screen نصب کنید';
8707
+ }
8708
+ return true;
8709
+ }
8710
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushCheckService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
8711
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushCheckService, providedIn: 'root' }); }
8712
+ }
8713
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.0.6", ngImport: i0, type: PushCheckService, decorators: [{
8714
+ type: Injectable,
8715
+ args: [{ providedIn: 'root' }]
8716
+ }] });
8717
+
8697
8718
  class FieldBaseComponent extends BaseComponent {
8698
8719
  get customFieldInfo() {
8699
8720
  return this.context.Setting.CustomFieldInfo;
@@ -11162,8 +11183,8 @@ class FormComponent extends BaseComponent {
11162
11183
  const currVal = JSON.stringify(params.currentValue);
11163
11184
  const prevVal = JSON.stringify(params.previousValue);
11164
11185
  if (currVal !== prevVal) {
11165
- this.vcr.clear();
11166
- this.appendForm(currVal);
11186
+ // this.vcr.clear();
11187
+ // this.appendForm(currVal);
11167
11188
  }
11168
11189
  }
11169
11190
  }