@techextensor/tab-sdk 0.0.41 → 0.0.42
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.
- package/README.md +24 -24
- package/fesm2022/techextensor-tab-sdk.mjs +770 -48
- package/fesm2022/techextensor-tab-sdk.mjs.map +1 -1
- package/lib/interface/state.interface.d.ts +151 -0
- package/lib/model/component-state.model.d.ts +63 -0
- package/lib/model/query-state.model.d.ts +37 -0
- package/lib/model/screen-state.model.d.ts +56 -0
- package/lib/model/script-state.model.d.ts +21 -0
- package/lib/state/state.service.d.ts +101 -0
- package/lib/tab-sdk.service.d.ts +4 -0
- package/lib/ui/ui.service.d.ts +5 -5
- package/lib/workflow/workflow.service.d.ts +8 -0
- package/package.json +2 -4
- package/public-api.d.ts +1 -0
- package/esm2022/lib/app/analytics.service.mjs +0 -51
- package/esm2022/lib/app/app.service.mjs +0 -175
- package/esm2022/lib/app/file.service.mjs +0 -84
- package/esm2022/lib/app/release.service.mjs +0 -38
- package/esm2022/lib/app/report.service.mjs +0 -48
- package/esm2022/lib/app/translator.service.mjs +0 -77
- package/esm2022/lib/auth/auth.service.mjs +0 -95
- package/esm2022/lib/crud/crud.service.mjs +0 -191
- package/esm2022/lib/enum/store.enum.mjs +0 -6
- package/esm2022/lib/enum/ui.enum.mjs +0 -13
- package/esm2022/lib/http/http.service.mjs +0 -58
- package/esm2022/lib/interface/http.interface.mjs +0 -2
- package/esm2022/lib/interface/ui.interface.mjs +0 -2
- package/esm2022/lib/store/store.service.mjs +0 -829
- package/esm2022/lib/tab-sdk.service.mjs +0 -84
- package/esm2022/lib/ui/form.service.mjs +0 -79
- package/esm2022/lib/ui/ui.service.mjs +0 -344
- package/esm2022/lib/util/util.service.mjs +0 -54
- package/esm2022/lib/workflow/transition.service.mjs +0 -40
- package/esm2022/public-api.mjs +0 -9
- package/esm2022/techextensor-tab-sdk.mjs +0 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
2
|
import { inject, Injectable } from '@angular/core';
|
|
3
|
-
import { NotificationService, ConfirmationService, NotificationType, AuthService, TabFormioService, TemplateHelper, TabBlueprintService, AppHelper, MediaUploadHelper, ApiService, TabReleaseService, TranslationService, TabCrudService, TabGetService, LocalStorageService, SessionStorageService, StorageConstants, MetadataHelper } from '@techextensor/tab-core-utility';
|
|
3
|
+
import { NotificationService, ConfirmationService, NotificationType, AuthService, TabFormioService, TemplateHelper, TabBlueprintService, AppHelper, MediaUploadHelper, ApiService, TabReleaseService, TranslationService, TabCrudService, TabGetService, LocalStorageService, SessionStorageService, StorageConstants, TabWorkflowService, MetadataHelper } from '@techextensor/tab-core-utility';
|
|
4
4
|
import { firstValueFrom } from 'rxjs';
|
|
5
5
|
|
|
6
6
|
var ScreenDisplayMode;
|
|
@@ -345,10 +345,10 @@ class UiService {
|
|
|
345
345
|
// Use the copyToClipboard method to copy the current window URL
|
|
346
346
|
this.copyToClipboard(window.location.href);
|
|
347
347
|
}
|
|
348
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
349
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
348
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: UiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
349
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: UiService, providedIn: 'root' });
|
|
350
350
|
}
|
|
351
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
351
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: UiService, decorators: [{
|
|
352
352
|
type: Injectable,
|
|
353
353
|
args: [{
|
|
354
354
|
providedIn: 'root'
|
|
@@ -436,10 +436,10 @@ class AuthUtilService {
|
|
|
436
436
|
const response = await firstValueFrom(this._authService.getUserDetails(userDetailsRequest, headers));
|
|
437
437
|
return response;
|
|
438
438
|
}
|
|
439
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
440
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
439
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: AuthUtilService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
440
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: AuthUtilService, providedIn: 'root' });
|
|
441
441
|
}
|
|
442
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
442
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: AuthUtilService, decorators: [{
|
|
443
443
|
type: Injectable,
|
|
444
444
|
args: [{
|
|
445
445
|
providedIn: 'root'
|
|
@@ -511,10 +511,10 @@ class FormService {
|
|
|
511
511
|
// Return the response from the server.
|
|
512
512
|
return response;
|
|
513
513
|
}
|
|
514
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
515
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
514
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FormService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
515
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FormService, providedIn: 'root' });
|
|
516
516
|
}
|
|
517
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
517
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FormService, decorators: [{
|
|
518
518
|
type: Injectable,
|
|
519
519
|
args: [{
|
|
520
520
|
providedIn: 'root'
|
|
@@ -546,10 +546,10 @@ class TransitionService {
|
|
|
546
546
|
// Return the obtained response
|
|
547
547
|
return response;
|
|
548
548
|
}
|
|
549
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
550
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
549
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TransitionService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
550
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TransitionService, providedIn: 'root' });
|
|
551
551
|
}
|
|
552
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
552
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TransitionService, decorators: [{
|
|
553
553
|
type: Injectable,
|
|
554
554
|
args: [{
|
|
555
555
|
providedIn: 'root'
|
|
@@ -717,10 +717,10 @@ class AppService {
|
|
|
717
717
|
// Return the response from the server
|
|
718
718
|
return response;
|
|
719
719
|
}
|
|
720
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
721
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
720
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: AppService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
721
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: AppService, providedIn: 'root' });
|
|
722
722
|
}
|
|
723
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
723
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: AppService, decorators: [{
|
|
724
724
|
type: Injectable,
|
|
725
725
|
args: [{
|
|
726
726
|
providedIn: 'root'
|
|
@@ -796,10 +796,10 @@ class FileService {
|
|
|
796
796
|
return null;
|
|
797
797
|
}
|
|
798
798
|
}
|
|
799
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
800
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
799
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FileService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
800
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FileService, providedIn: 'root' });
|
|
801
801
|
}
|
|
802
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
802
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: FileService, decorators: [{
|
|
803
803
|
type: Injectable,
|
|
804
804
|
args: [{
|
|
805
805
|
providedIn: 'root'
|
|
@@ -840,10 +840,10 @@ class ReportService {
|
|
|
840
840
|
// Return the response from the server
|
|
841
841
|
return response;
|
|
842
842
|
}
|
|
843
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
844
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
843
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ReportService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
844
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ReportService, providedIn: 'root' });
|
|
845
845
|
}
|
|
846
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
846
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ReportService, decorators: [{
|
|
847
847
|
type: Injectable,
|
|
848
848
|
args: [{
|
|
849
849
|
providedIn: 'root'
|
|
@@ -874,10 +874,10 @@ class ReleaseService {
|
|
|
874
874
|
const response = await firstValueFrom(this._tabReleaseService.getMetaDataJsonDiff());
|
|
875
875
|
return response;
|
|
876
876
|
}
|
|
877
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
878
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
877
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ReleaseService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
878
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ReleaseService, providedIn: 'root' });
|
|
879
879
|
}
|
|
880
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
880
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: ReleaseService, decorators: [{
|
|
881
881
|
type: Injectable,
|
|
882
882
|
args: [{
|
|
883
883
|
providedIn: 'root'
|
|
@@ -921,10 +921,10 @@ class AnalyticsService {
|
|
|
921
921
|
// Return the response from the server
|
|
922
922
|
return response;
|
|
923
923
|
}
|
|
924
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
925
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
924
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: AnalyticsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
925
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: AnalyticsService, providedIn: 'root' });
|
|
926
926
|
}
|
|
927
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
927
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: AnalyticsService, decorators: [{
|
|
928
928
|
type: Injectable,
|
|
929
929
|
args: [{
|
|
930
930
|
providedIn: 'root'
|
|
@@ -994,10 +994,10 @@ class TranslatorService {
|
|
|
994
994
|
registerIntegration(handler) {
|
|
995
995
|
this._translationService.registerIntegration(handler);
|
|
996
996
|
}
|
|
997
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
998
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
997
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TranslatorService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
998
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TranslatorService, providedIn: 'root' });
|
|
999
999
|
}
|
|
1000
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1000
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TranslatorService, decorators: [{
|
|
1001
1001
|
type: Injectable,
|
|
1002
1002
|
args: [{
|
|
1003
1003
|
providedIn: 'root'
|
|
@@ -1181,10 +1181,10 @@ class CrudService {
|
|
|
1181
1181
|
// Return the response from the server
|
|
1182
1182
|
return response;
|
|
1183
1183
|
}
|
|
1184
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1185
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1184
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: CrudService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1185
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: CrudService, providedIn: 'root' });
|
|
1186
1186
|
}
|
|
1187
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1187
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: CrudService, decorators: [{
|
|
1188
1188
|
type: Injectable,
|
|
1189
1189
|
args: [{
|
|
1190
1190
|
providedIn: 'root'
|
|
@@ -1234,10 +1234,10 @@ class HttpService {
|
|
|
1234
1234
|
getRequestStatus(url) {
|
|
1235
1235
|
return TabSdk.util?.getLatestStatus(url);
|
|
1236
1236
|
}
|
|
1237
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1238
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
1237
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: HttpService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
1238
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: HttpService, providedIn: 'root' });
|
|
1239
1239
|
}
|
|
1240
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1240
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: HttpService, decorators: [{
|
|
1241
1241
|
type: Injectable,
|
|
1242
1242
|
args: [{
|
|
1243
1243
|
providedIn: 'root'
|
|
@@ -2065,10 +2065,10 @@ class StoreService {
|
|
|
2065
2065
|
return null;
|
|
2066
2066
|
}
|
|
2067
2067
|
}
|
|
2068
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2069
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
2068
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: StoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2069
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: StoreService, providedIn: 'root' });
|
|
2070
2070
|
}
|
|
2071
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2071
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: StoreService, decorators: [{
|
|
2072
2072
|
type: Injectable,
|
|
2073
2073
|
args: [{
|
|
2074
2074
|
providedIn: 'root'
|
|
@@ -2117,10 +2117,717 @@ class UtilService {
|
|
|
2117
2117
|
}
|
|
2118
2118
|
});
|
|
2119
2119
|
}
|
|
2120
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2121
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
2120
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: UtilService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2121
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: UtilService, providedIn: 'root' });
|
|
2122
2122
|
}
|
|
2123
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2123
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: UtilService, decorators: [{
|
|
2124
|
+
type: Injectable,
|
|
2125
|
+
args: [{
|
|
2126
|
+
providedIn: 'root'
|
|
2127
|
+
}]
|
|
2128
|
+
}] });
|
|
2129
|
+
|
|
2130
|
+
/**
|
|
2131
|
+
* ComponentStateModel
|
|
2132
|
+
* Provides access to component state data including value, properties, and instance
|
|
2133
|
+
* Handles both single and multi-instance components
|
|
2134
|
+
* Supports both runtime and designing modes via _isDesigning flag
|
|
2135
|
+
*/
|
|
2136
|
+
class ComponentStateModel {
|
|
2137
|
+
_screenId;
|
|
2138
|
+
_key;
|
|
2139
|
+
_data;
|
|
2140
|
+
_stateSdk;
|
|
2141
|
+
_isDesigning;
|
|
2142
|
+
constructor(_screenId, _key, _data, _stateSdk, _isDesigning = false) {
|
|
2143
|
+
this._screenId = _screenId;
|
|
2144
|
+
this._key = _key;
|
|
2145
|
+
this._data = _data;
|
|
2146
|
+
this._stateSdk = _stateSdk;
|
|
2147
|
+
this._isDesigning = _isDesigning;
|
|
2148
|
+
}
|
|
2149
|
+
get key() {
|
|
2150
|
+
return this._data.key;
|
|
2151
|
+
}
|
|
2152
|
+
get type() {
|
|
2153
|
+
return this._data.type;
|
|
2154
|
+
}
|
|
2155
|
+
get properties() {
|
|
2156
|
+
return this._data.properties;
|
|
2157
|
+
}
|
|
2158
|
+
get value() {
|
|
2159
|
+
// Designing components don't have value
|
|
2160
|
+
if (this._isDesigning)
|
|
2161
|
+
return undefined;
|
|
2162
|
+
return this._data.value;
|
|
2163
|
+
}
|
|
2164
|
+
get instance() {
|
|
2165
|
+
// Designing components don't have instance
|
|
2166
|
+
if (this._isDesigning)
|
|
2167
|
+
return undefined;
|
|
2168
|
+
return this._data.instance;
|
|
2169
|
+
}
|
|
2170
|
+
get screen() {
|
|
2171
|
+
return this._screenId;
|
|
2172
|
+
}
|
|
2173
|
+
/**
|
|
2174
|
+
* Check if this is a designing component
|
|
2175
|
+
*/
|
|
2176
|
+
get isDesigning() {
|
|
2177
|
+
return this._isDesigning;
|
|
2178
|
+
}
|
|
2179
|
+
get instanceCount() {
|
|
2180
|
+
if (this._isDesigning)
|
|
2181
|
+
return 0;
|
|
2182
|
+
if (Array.isArray(this._data.value)) {
|
|
2183
|
+
return this._data.value.length;
|
|
2184
|
+
}
|
|
2185
|
+
return 1;
|
|
2186
|
+
}
|
|
2187
|
+
get isSingleInstance() {
|
|
2188
|
+
if (this._isDesigning)
|
|
2189
|
+
return true;
|
|
2190
|
+
return !Array.isArray(this._data.value);
|
|
2191
|
+
}
|
|
2192
|
+
/**
|
|
2193
|
+
* Get a specific instance by index
|
|
2194
|
+
* @param index - Instance index (0-based)
|
|
2195
|
+
* @returns Object with value and instance, or null if index out of bounds or designing mode
|
|
2196
|
+
*/
|
|
2197
|
+
getInstance(index) {
|
|
2198
|
+
if (this._isDesigning)
|
|
2199
|
+
return null;
|
|
2200
|
+
if (this.isSingleInstance) {
|
|
2201
|
+
return index === 0 ? { value: this.value, instance: this.instance } : null;
|
|
2202
|
+
}
|
|
2203
|
+
const values = this._data.value;
|
|
2204
|
+
const instances = this._data.instance;
|
|
2205
|
+
if (index < 0 || index >= values.length) {
|
|
2206
|
+
return null;
|
|
2207
|
+
}
|
|
2208
|
+
return {
|
|
2209
|
+
value: values[index],
|
|
2210
|
+
instance: instances[index]
|
|
2211
|
+
};
|
|
2212
|
+
}
|
|
2213
|
+
/**
|
|
2214
|
+
* Get all values as array (always returns array, even for single instance)
|
|
2215
|
+
* Returns empty array for designing components
|
|
2216
|
+
*/
|
|
2217
|
+
getValues() {
|
|
2218
|
+
if (this._isDesigning)
|
|
2219
|
+
return [];
|
|
2220
|
+
if (this.isSingleInstance) {
|
|
2221
|
+
return [this.value];
|
|
2222
|
+
}
|
|
2223
|
+
return this._data.value;
|
|
2224
|
+
}
|
|
2225
|
+
/**
|
|
2226
|
+
* Get all instances as array (always returns array, even for single instance)
|
|
2227
|
+
* Returns empty array for designing components
|
|
2228
|
+
*/
|
|
2229
|
+
getInstances() {
|
|
2230
|
+
if (this._isDesigning)
|
|
2231
|
+
return [];
|
|
2232
|
+
if (this.isSingleInstance) {
|
|
2233
|
+
return [this.instance];
|
|
2234
|
+
}
|
|
2235
|
+
return this._data.instance;
|
|
2236
|
+
}
|
|
2237
|
+
/**
|
|
2238
|
+
* Set component value
|
|
2239
|
+
* @param value - New value to set
|
|
2240
|
+
* @param instanceIndex - Optional instance index (for multi-instance)
|
|
2241
|
+
* Note: Does nothing for designing components
|
|
2242
|
+
*/
|
|
2243
|
+
setValue(value, instanceIndex) {
|
|
2244
|
+
if (this._isDesigning)
|
|
2245
|
+
return;
|
|
2246
|
+
if (this.isSingleInstance) {
|
|
2247
|
+
this.instance?.setValue?.(value);
|
|
2248
|
+
}
|
|
2249
|
+
else if (instanceIndex !== undefined) {
|
|
2250
|
+
const instances = this.getInstances();
|
|
2251
|
+
instances[instanceIndex]?.setValue?.(value);
|
|
2252
|
+
}
|
|
2253
|
+
else {
|
|
2254
|
+
// Set all instances
|
|
2255
|
+
this.getInstances().forEach(inst => inst?.setValue?.(value));
|
|
2256
|
+
}
|
|
2257
|
+
}
|
|
2258
|
+
/**
|
|
2259
|
+
* Safely get a nested property from component properties
|
|
2260
|
+
* @param path - Dot-notation path (e.g., 'validate.required')
|
|
2261
|
+
* @returns Property value or undefined
|
|
2262
|
+
*/
|
|
2263
|
+
getProperty(path) {
|
|
2264
|
+
if (!path || !this.properties)
|
|
2265
|
+
return undefined;
|
|
2266
|
+
return path.split('.').reduce((obj, key) => obj?.[key], this.properties);
|
|
2267
|
+
}
|
|
2268
|
+
/**
|
|
2269
|
+
* Get the parent screen model
|
|
2270
|
+
*/
|
|
2271
|
+
getScreen() {
|
|
2272
|
+
if (this._isDesigning) {
|
|
2273
|
+
return this._stateSdk.getDesigningScreen(this._screenId);
|
|
2274
|
+
}
|
|
2275
|
+
return this._stateSdk.getScreen(this._screenId);
|
|
2276
|
+
}
|
|
2277
|
+
}
|
|
2278
|
+
|
|
2279
|
+
/**
|
|
2280
|
+
* QueryStateModel
|
|
2281
|
+
* Provides access to query state data with all properties from state
|
|
2282
|
+
*/
|
|
2283
|
+
class QueryStateModel {
|
|
2284
|
+
_screenId;
|
|
2285
|
+
_name;
|
|
2286
|
+
_data;
|
|
2287
|
+
_stateSdk;
|
|
2288
|
+
constructor(_screenId, _name, _data, _stateSdk) {
|
|
2289
|
+
this._screenId = _screenId;
|
|
2290
|
+
this._name = _name;
|
|
2291
|
+
this._data = _data;
|
|
2292
|
+
this._stateSdk = _stateSdk;
|
|
2293
|
+
}
|
|
2294
|
+
get ID() {
|
|
2295
|
+
return this._data.ID || this._data.Id || '';
|
|
2296
|
+
}
|
|
2297
|
+
get ObjectID() {
|
|
2298
|
+
return this._data.ObjectID ?? null;
|
|
2299
|
+
}
|
|
2300
|
+
get ObjectID_Tosave() {
|
|
2301
|
+
return this._data.ObjectID_Tosave || '';
|
|
2302
|
+
}
|
|
2303
|
+
get QueryName() {
|
|
2304
|
+
return this._data.QueryName || this._name;
|
|
2305
|
+
}
|
|
2306
|
+
get DisplayName() {
|
|
2307
|
+
return this._data.DisplayName || this._name;
|
|
2308
|
+
}
|
|
2309
|
+
get FilterLogic() {
|
|
2310
|
+
return this._data.FilterLogic ?? null;
|
|
2311
|
+
}
|
|
2312
|
+
get Fields() {
|
|
2313
|
+
return this._data.Fields || [];
|
|
2314
|
+
}
|
|
2315
|
+
get Filters() {
|
|
2316
|
+
return this._data.Filters || { Filters: [], FilterLogic: null };
|
|
2317
|
+
}
|
|
2318
|
+
get Sort() {
|
|
2319
|
+
return this._data.Sort || [];
|
|
2320
|
+
}
|
|
2321
|
+
get Parameters() {
|
|
2322
|
+
return this._data.Parameters || [];
|
|
2323
|
+
}
|
|
2324
|
+
get RequestId() {
|
|
2325
|
+
return this._data.RequestId || '';
|
|
2326
|
+
}
|
|
2327
|
+
get screen() {
|
|
2328
|
+
return this._screenId;
|
|
2329
|
+
}
|
|
2330
|
+
/**
|
|
2331
|
+
* Execute the query and get data
|
|
2332
|
+
* @param reqtokens - Request tokens to include in the payload
|
|
2333
|
+
* @param params - Additional parameters to include in the payload
|
|
2334
|
+
* @param useDefaultHeaders - Whether to use default headers
|
|
2335
|
+
* @param customHeaders - Custom headers to merge with default/final headers
|
|
2336
|
+
* @returns Promise that resolves to the query result
|
|
2337
|
+
*/
|
|
2338
|
+
async execute(reqtokens, params, useDefaultHeaders, customHeaders) {
|
|
2339
|
+
const response = await firstValueFrom(TabSdk.util.getDSQData(this.ID, reqtokens, params, useDefaultHeaders, customHeaders));
|
|
2340
|
+
return response;
|
|
2341
|
+
}
|
|
2342
|
+
/**
|
|
2343
|
+
* Get the parent screen model
|
|
2344
|
+
*/
|
|
2345
|
+
getScreen() {
|
|
2346
|
+
return this._stateSdk.getScreen(this._screenId);
|
|
2347
|
+
}
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
/**
|
|
2351
|
+
* ScriptStateModel
|
|
2352
|
+
* Provides access to script state data with all properties from state
|
|
2353
|
+
*/
|
|
2354
|
+
class ScriptStateModel {
|
|
2355
|
+
_screenId;
|
|
2356
|
+
_name;
|
|
2357
|
+
_data;
|
|
2358
|
+
_stateSdk;
|
|
2359
|
+
constructor(_screenId, _name, _data, _stateSdk) {
|
|
2360
|
+
this._screenId = _screenId;
|
|
2361
|
+
this._name = _name;
|
|
2362
|
+
this._data = _data;
|
|
2363
|
+
this._stateSdk = _stateSdk;
|
|
2364
|
+
}
|
|
2365
|
+
get ID() {
|
|
2366
|
+
return this._data.ID || this._data.Id || '';
|
|
2367
|
+
}
|
|
2368
|
+
get Name() {
|
|
2369
|
+
return this._data.Name || this._name;
|
|
2370
|
+
}
|
|
2371
|
+
get Type() {
|
|
2372
|
+
return this._data.Type;
|
|
2373
|
+
}
|
|
2374
|
+
get Content() {
|
|
2375
|
+
return this._data.Content || '';
|
|
2376
|
+
}
|
|
2377
|
+
get screen() {
|
|
2378
|
+
return this._screenId;
|
|
2379
|
+
}
|
|
2380
|
+
/**
|
|
2381
|
+
* Get the parent screen model
|
|
2382
|
+
*/
|
|
2383
|
+
getScreen() {
|
|
2384
|
+
return this._stateSdk.getScreen(this._screenId);
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
|
|
2388
|
+
/**
|
|
2389
|
+
* ScreenStateModel
|
|
2390
|
+
* Provides access to screen state data including components, queries, and scripts
|
|
2391
|
+
* Supports both runtime screens and designing screens via _isDesigning flag
|
|
2392
|
+
*/
|
|
2393
|
+
class ScreenStateModel {
|
|
2394
|
+
_screenData;
|
|
2395
|
+
_stateService;
|
|
2396
|
+
_stateSdk;
|
|
2397
|
+
_isDesigning;
|
|
2398
|
+
constructor(_screenData, _stateService, _stateSdk, _isDesigning = false) {
|
|
2399
|
+
this._screenData = _screenData;
|
|
2400
|
+
this._stateService = _stateService;
|
|
2401
|
+
this._stateSdk = _stateSdk;
|
|
2402
|
+
this._isDesigning = _isDesigning;
|
|
2403
|
+
}
|
|
2404
|
+
get screenId() {
|
|
2405
|
+
return this._screenData.screenId;
|
|
2406
|
+
}
|
|
2407
|
+
get parentScreenId() {
|
|
2408
|
+
return this._screenData.parentScreenId;
|
|
2409
|
+
}
|
|
2410
|
+
get screenMetadata() {
|
|
2411
|
+
return this._screenData.screenMetadata;
|
|
2412
|
+
}
|
|
2413
|
+
get form() {
|
|
2414
|
+
return this._screenData.form;
|
|
2415
|
+
}
|
|
2416
|
+
get renderer() {
|
|
2417
|
+
return this._screenData.renderer;
|
|
2418
|
+
}
|
|
2419
|
+
/**
|
|
2420
|
+
* Check if this is a designing screen
|
|
2421
|
+
*/
|
|
2422
|
+
get isDesigning() {
|
|
2423
|
+
return this._isDesigning;
|
|
2424
|
+
}
|
|
2425
|
+
/**
|
|
2426
|
+
* Get screen state data based on mode (runtime vs designing)
|
|
2427
|
+
*/
|
|
2428
|
+
getScreenState() {
|
|
2429
|
+
const state = this._stateService.getState()();
|
|
2430
|
+
if (this._isDesigning) {
|
|
2431
|
+
return state?.designingScreens?.[this.screenId];
|
|
2432
|
+
}
|
|
2433
|
+
return state[this.screenId];
|
|
2434
|
+
}
|
|
2435
|
+
/**
|
|
2436
|
+
* Get all components in this screen
|
|
2437
|
+
* @param filterFn - Optional filter function
|
|
2438
|
+
*/
|
|
2439
|
+
components(filterFn) {
|
|
2440
|
+
const screenState = this.getScreenState();
|
|
2441
|
+
if (!screenState?.components)
|
|
2442
|
+
return [];
|
|
2443
|
+
const models = Object.entries(screenState.components).map(([key, data]) => {
|
|
2444
|
+
return new ComponentStateModel(this.screenId, key, data, this._stateSdk, this._isDesigning);
|
|
2445
|
+
});
|
|
2446
|
+
return filterFn ? models.filter(filterFn) : models;
|
|
2447
|
+
}
|
|
2448
|
+
/**
|
|
2449
|
+
* Get a specific component by key
|
|
2450
|
+
* @param key - Component key
|
|
2451
|
+
*/
|
|
2452
|
+
component(key) {
|
|
2453
|
+
if (!key)
|
|
2454
|
+
return null;
|
|
2455
|
+
const screenState = this.getScreenState();
|
|
2456
|
+
const compData = screenState?.components?.[key];
|
|
2457
|
+
if (!compData)
|
|
2458
|
+
return null;
|
|
2459
|
+
return new ComponentStateModel(this.screenId, key, compData, this._stateSdk, this._isDesigning);
|
|
2460
|
+
}
|
|
2461
|
+
/**
|
|
2462
|
+
* Get all queries in this screen
|
|
2463
|
+
* @param filterFn - Optional filter function
|
|
2464
|
+
*/
|
|
2465
|
+
queries(filterFn) {
|
|
2466
|
+
const screenState = this.getScreenState();
|
|
2467
|
+
if (!screenState?.queries)
|
|
2468
|
+
return [];
|
|
2469
|
+
const models = Object.entries(screenState.queries).map(([name, data]) => {
|
|
2470
|
+
return new QueryStateModel(this.screenId, name, data, this._stateSdk);
|
|
2471
|
+
});
|
|
2472
|
+
return filterFn ? models.filter(filterFn) : models;
|
|
2473
|
+
}
|
|
2474
|
+
/**
|
|
2475
|
+
* Get a specific query by name or ID
|
|
2476
|
+
* @param nameOrId - Query name or ID
|
|
2477
|
+
*/
|
|
2478
|
+
query(nameOrId) {
|
|
2479
|
+
if (!nameOrId)
|
|
2480
|
+
return null;
|
|
2481
|
+
const screenState = this.getScreenState();
|
|
2482
|
+
// Try direct match first
|
|
2483
|
+
let queryData = screenState?.queries?.[nameOrId];
|
|
2484
|
+
// If not found, search by ID or QueryName
|
|
2485
|
+
if (!queryData && screenState?.queries) {
|
|
2486
|
+
const entry = Object.entries(screenState.queries).find(([_, data]) => data?.ID?.toLowerCase() === nameOrId?.toLowerCase() ||
|
|
2487
|
+
data?.Id?.toLowerCase() === nameOrId?.toLowerCase() ||
|
|
2488
|
+
data?.QueryName === nameOrId);
|
|
2489
|
+
if (entry) {
|
|
2490
|
+
queryData = entry[1];
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
if (!queryData)
|
|
2494
|
+
return null;
|
|
2495
|
+
return new QueryStateModel(this.screenId, nameOrId, queryData, this._stateSdk);
|
|
2496
|
+
}
|
|
2497
|
+
/**
|
|
2498
|
+
* Get all scripts in this screen
|
|
2499
|
+
* @param filterFn - Optional filter function
|
|
2500
|
+
*/
|
|
2501
|
+
scripts(filterFn) {
|
|
2502
|
+
const state = this._stateService.getState()();
|
|
2503
|
+
const screenState = state[this.screenId];
|
|
2504
|
+
if (!screenState?.scripts)
|
|
2505
|
+
return [];
|
|
2506
|
+
const models = Object.entries(screenState.scripts).map(([name, data]) => {
|
|
2507
|
+
return new ScriptStateModel(this.screenId, name, data, this._stateSdk);
|
|
2508
|
+
});
|
|
2509
|
+
return filterFn ? models.filter(filterFn) : models;
|
|
2510
|
+
}
|
|
2511
|
+
/**
|
|
2512
|
+
* Get a specific script by name
|
|
2513
|
+
* @param name - Script name
|
|
2514
|
+
*/
|
|
2515
|
+
script(name) {
|
|
2516
|
+
if (!name)
|
|
2517
|
+
return null;
|
|
2518
|
+
const state = this._stateService.getState()();
|
|
2519
|
+
const screenState = state[this.screenId];
|
|
2520
|
+
// Try direct match first
|
|
2521
|
+
let scriptData = screenState?.scripts?.[name];
|
|
2522
|
+
// If not found, search by Name
|
|
2523
|
+
if (!scriptData && screenState?.scripts) {
|
|
2524
|
+
const entry = Object.entries(screenState.scripts).find(([_, data]) => data?.Name === name);
|
|
2525
|
+
if (entry) {
|
|
2526
|
+
scriptData = entry[1];
|
|
2527
|
+
}
|
|
2528
|
+
}
|
|
2529
|
+
if (!scriptData)
|
|
2530
|
+
return null;
|
|
2531
|
+
return new ScriptStateModel(this.screenId, name, scriptData, this._stateSdk);
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
/**
|
|
2536
|
+
* StateSdkService
|
|
2537
|
+
* Provides access to application state through TabSdk.state
|
|
2538
|
+
* Follows the same patterns as MetadataHelper
|
|
2539
|
+
*/
|
|
2540
|
+
class StateSdkService {
|
|
2541
|
+
_stateService = null;
|
|
2542
|
+
/**
|
|
2543
|
+
* Initialize with StateService from main app
|
|
2544
|
+
* @param stateService - StateService instance from main application
|
|
2545
|
+
*/
|
|
2546
|
+
init(stateService) {
|
|
2547
|
+
this._stateService = stateService;
|
|
2548
|
+
}
|
|
2549
|
+
// ============================================
|
|
2550
|
+
// GLOBAL STATE
|
|
2551
|
+
// ============================================
|
|
2552
|
+
/**
|
|
2553
|
+
* Get global state (User, App, Tenant, Environment)
|
|
2554
|
+
*/
|
|
2555
|
+
get global() {
|
|
2556
|
+
const state = this._stateService?.getState()();
|
|
2557
|
+
return state?.global?.globals || {
|
|
2558
|
+
User: {},
|
|
2559
|
+
App: {},
|
|
2560
|
+
Tenant: {},
|
|
2561
|
+
Environment: {}
|
|
2562
|
+
};
|
|
2563
|
+
}
|
|
2564
|
+
// ============================================
|
|
2565
|
+
// SCREENS
|
|
2566
|
+
// ============================================
|
|
2567
|
+
/**
|
|
2568
|
+
* Get a screen by its ID or name
|
|
2569
|
+
* @param nameOrId - Screen ID (GUID) or screen name
|
|
2570
|
+
* @returns ScreenStateModel or null if not found
|
|
2571
|
+
*/
|
|
2572
|
+
getScreen(nameOrId) {
|
|
2573
|
+
if (!nameOrId || !this._stateService)
|
|
2574
|
+
return null;
|
|
2575
|
+
const state = this._stateService.getState()();
|
|
2576
|
+
const globalState = state?.global;
|
|
2577
|
+
// Search by screenId or screen name
|
|
2578
|
+
const screenData = Object.values(globalState?.screens || {}).find((s) => s.screenId === nameOrId ||
|
|
2579
|
+
s.screenId?.toLowerCase() === nameOrId?.toLowerCase() ||
|
|
2580
|
+
s.screenMetadata?.Name === nameOrId ||
|
|
2581
|
+
s.screenMetadata?.DisplayName === nameOrId);
|
|
2582
|
+
if (!screenData)
|
|
2583
|
+
return null;
|
|
2584
|
+
return new ScreenStateModel(screenData, this._stateService, this);
|
|
2585
|
+
}
|
|
2586
|
+
/**
|
|
2587
|
+
* Get all screens, optionally filtered
|
|
2588
|
+
* @param filterFn - Optional filter function
|
|
2589
|
+
* @returns Array of ScreenStateModel
|
|
2590
|
+
*/
|
|
2591
|
+
getScreens(filterFn) {
|
|
2592
|
+
if (!this._stateService)
|
|
2593
|
+
return [];
|
|
2594
|
+
const state = this._stateService.getState()();
|
|
2595
|
+
const globalState = state?.global;
|
|
2596
|
+
const models = Object.values(globalState?.screens || {}).map((screenData) => {
|
|
2597
|
+
return new ScreenStateModel(screenData, this._stateService, this);
|
|
2598
|
+
});
|
|
2599
|
+
return filterFn ? models.filter(filterFn) : models;
|
|
2600
|
+
}
|
|
2601
|
+
/**
|
|
2602
|
+
* Check if a screen exists in state
|
|
2603
|
+
* @param nameOrId - Screen ID or name
|
|
2604
|
+
*/
|
|
2605
|
+
hasScreen(nameOrId) {
|
|
2606
|
+
return this.getScreen(nameOrId) !== null;
|
|
2607
|
+
}
|
|
2608
|
+
// ============================================
|
|
2609
|
+
// DESIGNING SCREENS
|
|
2610
|
+
// ============================================
|
|
2611
|
+
/**
|
|
2612
|
+
* Get a designing screen by its ID or name
|
|
2613
|
+
* @param nameOrId - Screen ID (GUID) or screen name
|
|
2614
|
+
* @returns ScreenStateModel (in designing mode) or null if not found
|
|
2615
|
+
*/
|
|
2616
|
+
getDesigningScreen(nameOrId) {
|
|
2617
|
+
if (!nameOrId || !this._stateService)
|
|
2618
|
+
return null;
|
|
2619
|
+
const state = this._stateService.getState()();
|
|
2620
|
+
const designingScreens = state?.global?.designingScreens || {};
|
|
2621
|
+
// Search by screenId or screen name
|
|
2622
|
+
const screenData = Object.values(designingScreens).find((s) => s.screenId === nameOrId ||
|
|
2623
|
+
s.screenId?.toLowerCase() === nameOrId?.toLowerCase() ||
|
|
2624
|
+
s.screenMetadata?.Name === nameOrId ||
|
|
2625
|
+
s.screenMetadata?.DisplayName === nameOrId);
|
|
2626
|
+
if (!screenData)
|
|
2627
|
+
return null;
|
|
2628
|
+
// Use ScreenStateModel with isDesigning = true
|
|
2629
|
+
return new ScreenStateModel(screenData, this._stateService, this, true);
|
|
2630
|
+
}
|
|
2631
|
+
/**
|
|
2632
|
+
* Get all designing screens, optionally filtered
|
|
2633
|
+
* @param filterFn - Optional filter function
|
|
2634
|
+
* @returns Array of ScreenStateModel (in designing mode)
|
|
2635
|
+
*/
|
|
2636
|
+
getDesigningScreens(filterFn) {
|
|
2637
|
+
if (!this._stateService)
|
|
2638
|
+
return [];
|
|
2639
|
+
const state = this._stateService.getState()();
|
|
2640
|
+
const designingScreens = state?.global?.designingScreens || {};
|
|
2641
|
+
// Use ScreenStateModel with isDesigning = true
|
|
2642
|
+
const models = Object.values(designingScreens).map((screenData) => {
|
|
2643
|
+
return new ScreenStateModel(screenData, this._stateService, this, true);
|
|
2644
|
+
});
|
|
2645
|
+
return filterFn ? models.filter(filterFn) : models;
|
|
2646
|
+
}
|
|
2647
|
+
/**
|
|
2648
|
+
* Check if a designing screen exists in state
|
|
2649
|
+
* @param nameOrId - Screen ID or name
|
|
2650
|
+
*/
|
|
2651
|
+
hasDesigningScreen(nameOrId) {
|
|
2652
|
+
return this.getDesigningScreen(nameOrId) !== null;
|
|
2653
|
+
}
|
|
2654
|
+
// ============================================
|
|
2655
|
+
// COMPONENTS (across all screens)
|
|
2656
|
+
// ============================================
|
|
2657
|
+
/**
|
|
2658
|
+
* Get a component by key, optionally from a specific screen
|
|
2659
|
+
* @param key - Component key
|
|
2660
|
+
* @param screenNameOrId - Optional screen to search in (for collisions)
|
|
2661
|
+
* @returns ComponentStateModel or null if not found
|
|
2662
|
+
*/
|
|
2663
|
+
getComponent(key, screenNameOrId) {
|
|
2664
|
+
if (!key || !this._stateService)
|
|
2665
|
+
return null;
|
|
2666
|
+
// If screen specified, search only in that screen
|
|
2667
|
+
if (screenNameOrId) {
|
|
2668
|
+
const screen = this.getScreen(screenNameOrId);
|
|
2669
|
+
return screen?.component(key) || null;
|
|
2670
|
+
}
|
|
2671
|
+
// Search across all screens, return first match
|
|
2672
|
+
const screens = this.getScreens();
|
|
2673
|
+
for (const screen of screens) {
|
|
2674
|
+
const comp = screen.component(key);
|
|
2675
|
+
if (comp)
|
|
2676
|
+
return comp;
|
|
2677
|
+
}
|
|
2678
|
+
return null;
|
|
2679
|
+
}
|
|
2680
|
+
/**
|
|
2681
|
+
* Get all components across all screens, optionally filtered
|
|
2682
|
+
* @param filterFn - Optional filter function
|
|
2683
|
+
* @returns Array of ComponentStateModel
|
|
2684
|
+
*/
|
|
2685
|
+
getComponents(filterFn) {
|
|
2686
|
+
if (!this._stateService)
|
|
2687
|
+
return [];
|
|
2688
|
+
const allComponents = [];
|
|
2689
|
+
const screens = this.getScreens();
|
|
2690
|
+
for (const screen of screens) {
|
|
2691
|
+
allComponents.push(...screen.components());
|
|
2692
|
+
}
|
|
2693
|
+
return filterFn ? allComponents.filter(filterFn) : allComponents;
|
|
2694
|
+
}
|
|
2695
|
+
/**
|
|
2696
|
+
* Check if a component exists
|
|
2697
|
+
* @param key - Component key
|
|
2698
|
+
* @param screenNameOrId - Optional screen to check in
|
|
2699
|
+
*/
|
|
2700
|
+
hasComponent(key, screenNameOrId) {
|
|
2701
|
+
return this.getComponent(key, screenNameOrId) !== null;
|
|
2702
|
+
}
|
|
2703
|
+
// ============================================
|
|
2704
|
+
// QUERIES (across all screens)
|
|
2705
|
+
// ============================================
|
|
2706
|
+
/**
|
|
2707
|
+
* Get a query by ID or name, optionally from a specific screen
|
|
2708
|
+
* @param nameOrId - Query ID, QueryName, or DisplayName
|
|
2709
|
+
* @param screenNameOrId - Optional screen to search in
|
|
2710
|
+
*/
|
|
2711
|
+
getQuery(nameOrId, screenNameOrId) {
|
|
2712
|
+
if (!nameOrId || !this._stateService)
|
|
2713
|
+
return null;
|
|
2714
|
+
if (screenNameOrId) {
|
|
2715
|
+
const screen = this.getScreen(screenNameOrId);
|
|
2716
|
+
return screen?.query(nameOrId) || null;
|
|
2717
|
+
}
|
|
2718
|
+
const screens = this.getScreens();
|
|
2719
|
+
for (const screen of screens) {
|
|
2720
|
+
const query = screen.query(nameOrId);
|
|
2721
|
+
if (query)
|
|
2722
|
+
return query;
|
|
2723
|
+
}
|
|
2724
|
+
return null;
|
|
2725
|
+
}
|
|
2726
|
+
/**
|
|
2727
|
+
* Get all queries across all screens, optionally filtered
|
|
2728
|
+
* @param filterFn - Optional filter function
|
|
2729
|
+
*/
|
|
2730
|
+
getQueries(filterFn) {
|
|
2731
|
+
if (!this._stateService)
|
|
2732
|
+
return [];
|
|
2733
|
+
const allQueries = [];
|
|
2734
|
+
const screens = this.getScreens();
|
|
2735
|
+
for (const screen of screens) {
|
|
2736
|
+
allQueries.push(...screen.queries());
|
|
2737
|
+
}
|
|
2738
|
+
return filterFn ? allQueries.filter(filterFn) : allQueries;
|
|
2739
|
+
}
|
|
2740
|
+
// ============================================
|
|
2741
|
+
// SCRIPTS (across all screens)
|
|
2742
|
+
// ============================================
|
|
2743
|
+
/**
|
|
2744
|
+
* Get a script by name, optionally from a specific screen
|
|
2745
|
+
* @param name - Script name
|
|
2746
|
+
* @param screenNameOrId - Optional screen to search in
|
|
2747
|
+
*/
|
|
2748
|
+
getScript(name, screenNameOrId) {
|
|
2749
|
+
if (!name || !this._stateService)
|
|
2750
|
+
return null;
|
|
2751
|
+
if (screenNameOrId) {
|
|
2752
|
+
const screen = this.getScreen(screenNameOrId);
|
|
2753
|
+
return screen?.script(name) || null;
|
|
2754
|
+
}
|
|
2755
|
+
const screens = this.getScreens();
|
|
2756
|
+
for (const screen of screens) {
|
|
2757
|
+
const script = screen.script(name);
|
|
2758
|
+
if (script)
|
|
2759
|
+
return script;
|
|
2760
|
+
}
|
|
2761
|
+
return null;
|
|
2762
|
+
}
|
|
2763
|
+
/**
|
|
2764
|
+
* Get all scripts across all screens, optionally filtered
|
|
2765
|
+
* @param filterFn - Optional filter function
|
|
2766
|
+
*/
|
|
2767
|
+
getScripts(filterFn) {
|
|
2768
|
+
if (!this._stateService)
|
|
2769
|
+
return [];
|
|
2770
|
+
const allScripts = [];
|
|
2771
|
+
const screens = this.getScreens();
|
|
2772
|
+
for (const screen of screens) {
|
|
2773
|
+
allScripts.push(...screen.scripts());
|
|
2774
|
+
}
|
|
2775
|
+
return filterFn ? allScripts.filter(filterFn) : allScripts;
|
|
2776
|
+
}
|
|
2777
|
+
// ============================================
|
|
2778
|
+
// SEARCH
|
|
2779
|
+
// ============================================
|
|
2780
|
+
/**
|
|
2781
|
+
* Search across all state entities
|
|
2782
|
+
* @param term - Search term
|
|
2783
|
+
*/
|
|
2784
|
+
search(term) {
|
|
2785
|
+
if (!term || !this._stateService) {
|
|
2786
|
+
return { screens: [], components: [], queries: [], scripts: [] };
|
|
2787
|
+
}
|
|
2788
|
+
const searchTerm = term.toLowerCase();
|
|
2789
|
+
return {
|
|
2790
|
+
screens: this.getScreens(s => s.screenId?.toLowerCase().includes(searchTerm) ||
|
|
2791
|
+
s.screenMetadata?.Name?.toLowerCase().includes(searchTerm) ||
|
|
2792
|
+
s.screenMetadata?.DisplayName?.toLowerCase().includes(searchTerm)),
|
|
2793
|
+
components: this.getComponents(c => c.key?.toLowerCase().includes(searchTerm) ||
|
|
2794
|
+
c.type?.toLowerCase().includes(searchTerm) ||
|
|
2795
|
+
c.properties?.label?.toLowerCase()?.includes(searchTerm)),
|
|
2796
|
+
queries: this.getQueries(q => q.QueryName?.toLowerCase().includes(searchTerm) ||
|
|
2797
|
+
q.DisplayName?.toLowerCase().includes(searchTerm)),
|
|
2798
|
+
scripts: this.getScripts(s => s.Name?.toLowerCase().includes(searchTerm))
|
|
2799
|
+
};
|
|
2800
|
+
}
|
|
2801
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: StateSdkService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2802
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: StateSdkService, providedIn: 'root' });
|
|
2803
|
+
}
|
|
2804
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: StateSdkService, decorators: [{
|
|
2805
|
+
type: Injectable,
|
|
2806
|
+
args: [{
|
|
2807
|
+
providedIn: 'root'
|
|
2808
|
+
}]
|
|
2809
|
+
}] });
|
|
2810
|
+
|
|
2811
|
+
class WorkflowService {
|
|
2812
|
+
tabWorkflowService = inject(TabWorkflowService);
|
|
2813
|
+
async executeTABWorkflow(payload) {
|
|
2814
|
+
/**
|
|
2815
|
+
* Executes a TAB workflow using the provided payload.
|
|
2816
|
+
*
|
|
2817
|
+
* @param payload The execute TAB workflow payload.
|
|
2818
|
+
* @returns A promise that resolves to the response from the server.
|
|
2819
|
+
*/
|
|
2820
|
+
const response = await firstValueFrom(
|
|
2821
|
+
// Use the firstValueFrom RxJs operator to wait for the observable to complete
|
|
2822
|
+
// Call the executeTABWorkflow method of the TabWorkflowService and pass the payload
|
|
2823
|
+
this.tabWorkflowService.executeTABWorkflow(payload));
|
|
2824
|
+
return response;
|
|
2825
|
+
// Return the response from the server
|
|
2826
|
+
}
|
|
2827
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: WorkflowService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2828
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: WorkflowService, providedIn: 'root' });
|
|
2829
|
+
}
|
|
2830
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: WorkflowService, decorators: [{
|
|
2124
2831
|
type: Injectable,
|
|
2125
2832
|
args: [{
|
|
2126
2833
|
providedIn: 'root'
|
|
@@ -2142,7 +2849,9 @@ class TabSdk {
|
|
|
2142
2849
|
static crud;
|
|
2143
2850
|
static http;
|
|
2144
2851
|
static store;
|
|
2852
|
+
static workflow;
|
|
2145
2853
|
static util;
|
|
2854
|
+
static state;
|
|
2146
2855
|
/**
|
|
2147
2856
|
* Initialize the SDK with necessary services
|
|
2148
2857
|
*/
|
|
@@ -2164,9 +2873,15 @@ class TabSdk {
|
|
|
2164
2873
|
this.crud = injector.get(CrudService);
|
|
2165
2874
|
this.http = injector.get(HttpService);
|
|
2166
2875
|
this.store = injector.get(StoreService);
|
|
2167
|
-
|
|
2876
|
+
this.workflow = injector.get(WorkflowService);
|
|
2877
|
+
// Extract StateService from context before passing to util
|
|
2878
|
+
const { StateService: stateService, ...utilContext } = context || {};
|
|
2879
|
+
// Initialize util service with context (excluding StateService)
|
|
2168
2880
|
const utilService = injector.get(UtilService);
|
|
2169
|
-
this.util = utilService.init(
|
|
2881
|
+
this.util = utilService.init(utilContext);
|
|
2882
|
+
// Initialize state service with StateService from context
|
|
2883
|
+
this.state = injector.get(StateSdkService);
|
|
2884
|
+
this.state.init(stateService);
|
|
2170
2885
|
// Freeze the global object to prevent modifications
|
|
2171
2886
|
Object.freeze(this);
|
|
2172
2887
|
Object.freeze(this.app);
|
|
@@ -2181,19 +2896,26 @@ class TabSdk {
|
|
|
2181
2896
|
Object.freeze(this.translator);
|
|
2182
2897
|
Object.freeze(this.crud);
|
|
2183
2898
|
Object.freeze(this.http);
|
|
2899
|
+
Object.freeze(this.workflow);
|
|
2184
2900
|
Object.freeze(this.store);
|
|
2185
2901
|
Object.freeze(this.util);
|
|
2902
|
+
Object.freeze(this.state);
|
|
2186
2903
|
}
|
|
2187
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
2188
|
-
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "
|
|
2904
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TabSdk, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
2905
|
+
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TabSdk, providedIn: 'root' });
|
|
2189
2906
|
}
|
|
2190
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
2907
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.16", ngImport: i0, type: TabSdk, decorators: [{
|
|
2191
2908
|
type: Injectable,
|
|
2192
2909
|
args: [{
|
|
2193
2910
|
providedIn: 'root'
|
|
2194
2911
|
}]
|
|
2195
2912
|
}] });
|
|
2196
2913
|
|
|
2914
|
+
/**
|
|
2915
|
+
* State SDK Interfaces
|
|
2916
|
+
* Provides type definitions for accessing application state through TabSdk.state
|
|
2917
|
+
*/
|
|
2918
|
+
|
|
2197
2919
|
// SDK
|
|
2198
2920
|
|
|
2199
2921
|
/**
|