@trudb/tru-common-lib 0.2.384 → 0.2.388
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/fesm2022/trudb-tru-common-lib.mjs +276 -53
- package/fesm2022/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/components/iframe-view/classes/tru-iframe-view-config.d.ts +10 -0
- package/lib/components/iframe-view/tru-iframe-view.d.ts +33 -0
- package/lib/services/tru-action-invoke.d.ts +7 -2
- package/lib/services/tru-report-manager.d.ts +2 -1
- package/lib/services/tru-util.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +2 -1
- package/lib/components/report-view/tru-report-view.d.ts +0 -20
|
@@ -9,7 +9,7 @@ import { BehaviorSubject, defer, from, of, Subject, Observable, fromEvent, skip,
|
|
|
9
9
|
import * as _ from 'underscore';
|
|
10
10
|
import ___default from 'underscore';
|
|
11
11
|
import * as i2 from '@angular/common/http';
|
|
12
|
-
import { HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
12
|
+
import { HttpHeaders, HttpClient, HTTP_INTERCEPTORS } from '@angular/common/http';
|
|
13
13
|
import * as i1 from '@angular/material/dialog';
|
|
14
14
|
import { MatDialogModule, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|
15
15
|
import { A11yModule } from '@angular/cdk/a11y';
|
|
@@ -1238,6 +1238,11 @@ class TruUtil {
|
|
|
1238
1238
|
isValidDate = (value) => {
|
|
1239
1239
|
return !isNaN(Date.parse(value));
|
|
1240
1240
|
};
|
|
1241
|
+
adjustForTimezone = (date) => {
|
|
1242
|
+
var timeOffsetInMS = date.getTimezoneOffset() * 60000;
|
|
1243
|
+
date.setTime(date.getTime() + timeOffsetInMS);
|
|
1244
|
+
return date;
|
|
1245
|
+
};
|
|
1241
1246
|
rulesEval = (styles) => {
|
|
1242
1247
|
let defaultStyles = {
|
|
1243
1248
|
'backgroundColor': '#ffffff',
|
|
@@ -2677,70 +2682,226 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
2677
2682
|
type: Input
|
|
2678
2683
|
}] } });
|
|
2679
2684
|
|
|
2680
|
-
class
|
|
2685
|
+
class TruIframeViewConfig extends TruDesktopViewConfig {
|
|
2686
|
+
mode;
|
|
2687
|
+
requestMethod;
|
|
2688
|
+
requestHeaders;
|
|
2689
|
+
requestBody;
|
|
2690
|
+
clearOnDeactivate;
|
|
2691
|
+
errorTitle;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
class TruIframeView extends TruSearchViewBase {
|
|
2695
|
+
httpClient;
|
|
2681
2696
|
uiNotification;
|
|
2682
|
-
|
|
2683
|
-
view = {};
|
|
2697
|
+
view = new TruIframeViewConfig();
|
|
2684
2698
|
iframe;
|
|
2685
2699
|
isBusy = true;
|
|
2686
2700
|
subs = [];
|
|
2687
|
-
|
|
2701
|
+
objectUrl = null;
|
|
2702
|
+
clearedSrc = null;
|
|
2703
|
+
clearedOnDeactivate = false;
|
|
2704
|
+
hasStartedLoad = false;
|
|
2705
|
+
constructor(desktopManager, windowEventHandler, httpClient, uiNotification) {
|
|
2688
2706
|
super(desktopManager, windowEventHandler);
|
|
2707
|
+
this.httpClient = httpClient;
|
|
2689
2708
|
this.uiNotification = uiNotification;
|
|
2690
|
-
this.user = user;
|
|
2691
2709
|
}
|
|
2692
|
-
onLoad(
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2710
|
+
onLoad(_iframe) {
|
|
2711
|
+
if (!this.hasStartedLoad) {
|
|
2712
|
+
return;
|
|
2713
|
+
}
|
|
2714
|
+
const mode = this.getMode();
|
|
2715
|
+
if (mode === 'request' && !this.objectUrl) {
|
|
2716
|
+
return;
|
|
2697
2717
|
}
|
|
2698
2718
|
setTimeout(() => {
|
|
2699
2719
|
this.isBusy = false;
|
|
2700
2720
|
}, 0);
|
|
2701
2721
|
}
|
|
2702
2722
|
ngOnInit() {
|
|
2703
|
-
|
|
2704
|
-
|
|
2705
|
-
|
|
2706
|
-
|
|
2707
|
-
|
|
2708
|
-
if (
|
|
2709
|
-
if (
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2723
|
+
this.windowEventHandler.setWindowTitle(this.view.title);
|
|
2724
|
+
const activeSub = this.view?.onActive?.()?.subscribe((active) => {
|
|
2725
|
+
if (!Boolean(this.view?.clearOnDeactivate)) {
|
|
2726
|
+
return;
|
|
2727
|
+
}
|
|
2728
|
+
if (active) {
|
|
2729
|
+
if (this.clearedOnDeactivate) {
|
|
2730
|
+
this.clearedOnDeactivate = false;
|
|
2731
|
+
this.isBusy = true;
|
|
2732
|
+
const src = this.clearedSrc;
|
|
2733
|
+
this.clearedSrc = null;
|
|
2734
|
+
if (typeof src === 'string' && src.length && src !== 'about:blank') {
|
|
2735
|
+
this.iframe.nativeElement.src = src;
|
|
2736
|
+
}
|
|
2737
|
+
else {
|
|
2738
|
+
this.load();
|
|
2739
|
+
}
|
|
2717
2740
|
}
|
|
2741
|
+
return;
|
|
2718
2742
|
}
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2743
|
+
this.clearedOnDeactivate = true;
|
|
2744
|
+
try {
|
|
2745
|
+
const currentSrc = this.iframe.nativeElement.src;
|
|
2746
|
+
this.clearedSrc = currentSrc === 'about:blank' ? null : currentSrc;
|
|
2747
|
+
}
|
|
2748
|
+
catch {
|
|
2749
|
+
this.clearedSrc = null;
|
|
2750
|
+
}
|
|
2751
|
+
this.revokeObjectUrl();
|
|
2752
|
+
try {
|
|
2753
|
+
this.iframe.nativeElement.src = 'about:blank';
|
|
2754
|
+
}
|
|
2755
|
+
catch { }
|
|
2756
|
+
});
|
|
2757
|
+
if (activeSub) {
|
|
2758
|
+
this.subs.push(activeSub);
|
|
2759
|
+
}
|
|
2760
|
+
this.load();
|
|
2724
2761
|
}
|
|
2725
2762
|
ngOnDestroy() {
|
|
2726
|
-
this.subs.forEach(
|
|
2763
|
+
this.subs.forEach((sub) => sub.unsubscribe());
|
|
2764
|
+
this.revokeObjectUrl();
|
|
2765
|
+
try {
|
|
2766
|
+
this.iframe.nativeElement.src = 'about:blank';
|
|
2767
|
+
}
|
|
2768
|
+
catch { }
|
|
2727
2769
|
this.releaseWindowTitle();
|
|
2728
2770
|
}
|
|
2729
|
-
|
|
2730
|
-
|
|
2771
|
+
getMode() {
|
|
2772
|
+
return this.view?.mode ?? 'navigate';
|
|
2773
|
+
}
|
|
2774
|
+
getErrorTitle() {
|
|
2775
|
+
return this.view?.errorTitle ?? 'Error';
|
|
2776
|
+
}
|
|
2777
|
+
getRequestMethod() {
|
|
2778
|
+
const method = this.view?.requestMethod;
|
|
2779
|
+
if (typeof method === 'string' && method.length) {
|
|
2780
|
+
return method.toUpperCase();
|
|
2781
|
+
}
|
|
2782
|
+
return 'GET';
|
|
2783
|
+
}
|
|
2784
|
+
getRequestHeaders() {
|
|
2785
|
+
const headers = this.view?.requestHeaders;
|
|
2786
|
+
if (headers && typeof headers === 'object') {
|
|
2787
|
+
return new HttpHeaders(headers);
|
|
2788
|
+
}
|
|
2789
|
+
if (typeof this.view?.requestBody !== 'undefined') {
|
|
2790
|
+
return new HttpHeaders({ 'Content-Type': 'application/json' });
|
|
2791
|
+
}
|
|
2792
|
+
return new HttpHeaders();
|
|
2793
|
+
}
|
|
2794
|
+
getRequestBody() {
|
|
2795
|
+
return this.view?.requestBody;
|
|
2796
|
+
}
|
|
2797
|
+
revokeObjectUrl() {
|
|
2798
|
+
if (!this.objectUrl) {
|
|
2799
|
+
return;
|
|
2800
|
+
}
|
|
2801
|
+
try {
|
|
2802
|
+
URL.revokeObjectURL(this.objectUrl);
|
|
2803
|
+
}
|
|
2804
|
+
catch { }
|
|
2805
|
+
this.objectUrl = null;
|
|
2806
|
+
}
|
|
2807
|
+
load() {
|
|
2808
|
+
const url = this.view?.url;
|
|
2809
|
+
if (typeof url !== 'string' || !url.length) {
|
|
2810
|
+
this.uiNotification.error(this.getErrorTitle(), ['Missing URL']);
|
|
2811
|
+
this.isBusy = false;
|
|
2812
|
+
return;
|
|
2813
|
+
}
|
|
2814
|
+
this.isBusy = true;
|
|
2815
|
+
this.hasStartedLoad = true;
|
|
2816
|
+
const mode = this.getMode();
|
|
2817
|
+
if (mode === 'navigate') {
|
|
2818
|
+
try {
|
|
2819
|
+
this.iframe.nativeElement.src = url;
|
|
2820
|
+
}
|
|
2821
|
+
catch (error) {
|
|
2822
|
+
this.uiNotification.error(this.getErrorTitle(), [
|
|
2823
|
+
error?.message ?? 'Failed to load content',
|
|
2824
|
+
]);
|
|
2825
|
+
this.isBusy = false;
|
|
2826
|
+
}
|
|
2827
|
+
return;
|
|
2828
|
+
}
|
|
2829
|
+
const method = this.getRequestMethod();
|
|
2830
|
+
const headers = this.getRequestHeaders();
|
|
2831
|
+
const body = this.getRequestBody();
|
|
2832
|
+
const sub = this.httpClient
|
|
2833
|
+
.request(method, url, {
|
|
2834
|
+
body,
|
|
2835
|
+
headers,
|
|
2836
|
+
observe: 'response',
|
|
2837
|
+
responseType: 'arraybuffer',
|
|
2838
|
+
})
|
|
2839
|
+
.subscribe({
|
|
2840
|
+
next: (response) => {
|
|
2841
|
+
const contentType = (response.headers.get('content-type') ?? '').toLowerCase();
|
|
2842
|
+
const data = response.body;
|
|
2843
|
+
if (!data) {
|
|
2844
|
+
this.uiNotification.error(this.getErrorTitle(), ['No content returned']);
|
|
2845
|
+
this.isBusy = false;
|
|
2846
|
+
return;
|
|
2847
|
+
}
|
|
2848
|
+
if (contentType.includes('text/html') ||
|
|
2849
|
+
contentType.includes('application/xhtml') ||
|
|
2850
|
+
contentType.includes('text/plain')) {
|
|
2851
|
+
const html = new TextDecoder('utf-8').decode(data);
|
|
2852
|
+
try {
|
|
2853
|
+
const iframeDoc = this.iframe.nativeElement.contentWindow
|
|
2854
|
+
?.document;
|
|
2855
|
+
iframeDoc.open('text/html', 'replace');
|
|
2856
|
+
iframeDoc.write(html);
|
|
2857
|
+
iframeDoc.close();
|
|
2858
|
+
setTimeout(() => {
|
|
2859
|
+
this.isBusy = false;
|
|
2860
|
+
}, 0);
|
|
2861
|
+
}
|
|
2862
|
+
catch (error) {
|
|
2863
|
+
this.uiNotification.error(this.getErrorTitle(), [
|
|
2864
|
+
error?.message ?? 'Failed to render content',
|
|
2865
|
+
]);
|
|
2866
|
+
this.isBusy = false;
|
|
2867
|
+
}
|
|
2868
|
+
return;
|
|
2869
|
+
}
|
|
2870
|
+
this.revokeObjectUrl();
|
|
2871
|
+
const blob = new Blob([data], {
|
|
2872
|
+
type: contentType || 'application/octet-stream',
|
|
2873
|
+
});
|
|
2874
|
+
this.objectUrl = URL.createObjectURL(blob);
|
|
2875
|
+
try {
|
|
2876
|
+
this.iframe.nativeElement.src = this.objectUrl;
|
|
2877
|
+
}
|
|
2878
|
+
catch (error) {
|
|
2879
|
+
this.uiNotification.error(this.getErrorTitle(), [
|
|
2880
|
+
error?.message ?? 'Failed to render content',
|
|
2881
|
+
]);
|
|
2882
|
+
this.isBusy = false;
|
|
2883
|
+
}
|
|
2884
|
+
},
|
|
2885
|
+
error: (error) => {
|
|
2886
|
+
this.uiNotification.error(this.getErrorTitle(), [
|
|
2887
|
+
error?.statusText ?? error?.message ?? 'Server error',
|
|
2888
|
+
]);
|
|
2889
|
+
this.isBusy = false;
|
|
2890
|
+
},
|
|
2891
|
+
});
|
|
2892
|
+
this.subs.push(sub);
|
|
2893
|
+
}
|
|
2894
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TruIframeView, deps: [{ token: TruDesktopManager }, { token: TruWindowEventHandler }, { token: i2.HttpClient }, { token: TruUiNotification }], target: i0.ɵɵFactoryTarget.Component });
|
|
2895
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.17", type: TruIframeView, isStandalone: true, selector: "tru-iframe-view", inputs: { view: "view" }, viewQueries: [{ propertyName: "iframe", first: true, predicate: ["iframe"], descendants: true, static: true }], usesInheritance: true, ngImport: i0, template: "<div>\n <div class=\"view-busy-overlay\" *ngIf=\"isBusy\"></div>\n <iframe #iframe class=\"iframe-view-frame\" (load)=\"onLoad(iframe)\"></iframe>\n</div>\n\n", styles: [".iframe-view-frame{position:absolute;inset:0;border-style:none;height:100%;width:100%}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }] });
|
|
2731
2896
|
}
|
|
2732
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type:
|
|
2897
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TruIframeView, decorators: [{
|
|
2733
2898
|
type: Component,
|
|
2734
|
-
args: [{ selector: 'tru-
|
|
2735
|
-
|
|
2736
|
-
FormsModule,
|
|
2737
|
-
MatSidenav
|
|
2738
|
-
], template: "<div>\r\n <div class=\"view-busy-overlay\" *ngIf=\"isBusy\"></div>\r\n <iframe (load)=\"onLoad(iframe)\" class=\"report-view-frame\"></iframe>\r\n</div>\r\n", styles: [".report-view-frame{position:absolute;inset:0;border-style:none;height:100%;width:100%}\n"] }]
|
|
2739
|
-
}], ctorParameters: () => [{ type: TruDesktopManager }, { type: TruWindowEventHandler }, { type: TruUiNotification }, { type: TruUser }], propDecorators: { view: [{
|
|
2899
|
+
args: [{ selector: 'tru-iframe-view', imports: [CommonModule], template: "<div>\n <div class=\"view-busy-overlay\" *ngIf=\"isBusy\"></div>\n <iframe #iframe class=\"iframe-view-frame\" (load)=\"onLoad(iframe)\"></iframe>\n</div>\n\n", styles: [".iframe-view-frame{position:absolute;inset:0;border-style:none;height:100%;width:100%}\n"] }]
|
|
2900
|
+
}], ctorParameters: () => [{ type: TruDesktopManager }, { type: TruWindowEventHandler }, { type: i2.HttpClient }, { type: TruUiNotification }], propDecorators: { view: [{
|
|
2740
2901
|
type: Input
|
|
2741
2902
|
}], iframe: [{
|
|
2742
2903
|
type: ViewChild,
|
|
2743
|
-
args: ['iframe', { static:
|
|
2904
|
+
args: ['iframe', { static: true }]
|
|
2744
2905
|
}] } });
|
|
2745
2906
|
|
|
2746
2907
|
class TruViewBase {
|
|
@@ -3921,7 +4082,7 @@ class Node {
|
|
|
3921
4082
|
class TruComponentLookup {
|
|
3922
4083
|
truComponentLookupRegistry = new Map();
|
|
3923
4084
|
constructor() {
|
|
3924
|
-
this.set('
|
|
4085
|
+
this.set('TruIframeView', TruIframeView);
|
|
3925
4086
|
this.set('TruCloneView', TruCloneView);
|
|
3926
4087
|
}
|
|
3927
4088
|
set = (key, type) => {
|
|
@@ -8790,15 +8951,19 @@ class TruActionInvoke {
|
|
|
8790
8951
|
desktopManager;
|
|
8791
8952
|
windowEventHandler;
|
|
8792
8953
|
uiNotification;
|
|
8954
|
+
appEnvironment;
|
|
8955
|
+
httpClient;
|
|
8793
8956
|
modelTypeLookup;
|
|
8794
8957
|
globalDataContext;
|
|
8795
8958
|
user;
|
|
8796
|
-
constructor(dataContext, textManager, desktopManager, windowEventHandler, uiNotification, modelTypeLookup, globalDataContext, user) {
|
|
8959
|
+
constructor(dataContext, textManager, desktopManager, windowEventHandler, uiNotification, appEnvironment, httpClient, modelTypeLookup, globalDataContext, user) {
|
|
8797
8960
|
this.dataContext = dataContext;
|
|
8798
8961
|
this.textManager = textManager;
|
|
8799
8962
|
this.desktopManager = desktopManager;
|
|
8800
8963
|
this.windowEventHandler = windowEventHandler;
|
|
8801
8964
|
this.uiNotification = uiNotification;
|
|
8965
|
+
this.appEnvironment = appEnvironment;
|
|
8966
|
+
this.httpClient = httpClient;
|
|
8802
8967
|
this.modelTypeLookup = modelTypeLookup;
|
|
8803
8968
|
this.globalDataContext = globalDataContext;
|
|
8804
8969
|
this.user = user;
|
|
@@ -8897,18 +9062,57 @@ class TruActionInvoke {
|
|
|
8897
9062
|
windowAddViewEventArgs.componentName = 'TruReportView';
|
|
8898
9063
|
this.windowEventHandler.addView(windowAddViewEventArgs);
|
|
8899
9064
|
};
|
|
9065
|
+
openStimulsoftPreview = (reportRef, actionRefs, reportName) => {
|
|
9066
|
+
if (!reportRef) {
|
|
9067
|
+
this.uiNotification.error('Report Error', ['Missing report reference']);
|
|
9068
|
+
return;
|
|
9069
|
+
}
|
|
9070
|
+
this.httpClient
|
|
9071
|
+
.post(this.appEnvironment.appUri + '/api/report/previewSession', { reportRef, refs: actionRefs ?? '' }, { headers: { 'Content-Type': 'application/json' } })
|
|
9072
|
+
.subscribe({
|
|
9073
|
+
next: (response) => {
|
|
9074
|
+
const token = response?.token;
|
|
9075
|
+
if (!token) {
|
|
9076
|
+
this.uiNotification.error('Report Error', ['Invalid server response']);
|
|
9077
|
+
return;
|
|
9078
|
+
}
|
|
9079
|
+
const previewUrl = this.appEnvironment.appUri +
|
|
9080
|
+
'/api/report/preview?token=' +
|
|
9081
|
+
encodeURIComponent(token);
|
|
9082
|
+
const windowAddViewEventArgs = new TruIframeViewConfig();
|
|
9083
|
+
windowAddViewEventArgs.title = reportName;
|
|
9084
|
+
windowAddViewEventArgs.componentName = 'TruIframeView';
|
|
9085
|
+
windowAddViewEventArgs.url = previewUrl;
|
|
9086
|
+
windowAddViewEventArgs.mode = 'navigate';
|
|
9087
|
+
windowAddViewEventArgs.clearOnDeactivate = true;
|
|
9088
|
+
windowAddViewEventArgs.errorTitle = 'Report Error';
|
|
9089
|
+
this.windowEventHandler.addView(windowAddViewEventArgs);
|
|
9090
|
+
},
|
|
9091
|
+
error: (error) => {
|
|
9092
|
+
const status = error?.status;
|
|
9093
|
+
if (status === 404 || status === 405 || status === 501) {
|
|
9094
|
+
this.processCustomReport(reportRef, actionRefs ?? '');
|
|
9095
|
+
this.uiNotification.info('Report preview not available; downloading instead');
|
|
9096
|
+
return;
|
|
9097
|
+
}
|
|
9098
|
+
this.uiNotification.error('Report Error', [
|
|
9099
|
+
error?.error ?? error?.message ?? 'Server error',
|
|
9100
|
+
]);
|
|
9101
|
+
},
|
|
9102
|
+
});
|
|
9103
|
+
};
|
|
8900
9104
|
processCustomReport = (reportRef, actionRefs, mimeRef) => {
|
|
8901
9105
|
this.dataContext.entityAccess().downloadFromService('/api/report/execute', {
|
|
8902
9106
|
reportRef: reportRef,
|
|
8903
9107
|
refs: actionRefs,
|
|
8904
9108
|
});
|
|
8905
9109
|
};
|
|
8906
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TruActionInvoke, deps: [{ token: TruDataContext }, { token: TruTextManager }, { token: TruDesktopManager }, { token: TruWindowEventHandler }, { token: TruUiNotification }, { token: TruModelTypeLookup }, { token: TruGlobalDataContext }, { token: TruUser }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
9110
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TruActionInvoke, deps: [{ token: TruDataContext }, { token: TruTextManager }, { token: TruDesktopManager }, { token: TruWindowEventHandler }, { token: TruUiNotification }, { token: TruAppEnvironment }, { token: i2.HttpClient }, { token: TruModelTypeLookup }, { token: TruGlobalDataContext }, { token: TruUser }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
8907
9111
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TruActionInvoke });
|
|
8908
9112
|
}
|
|
8909
9113
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImport: i0, type: TruActionInvoke, decorators: [{
|
|
8910
9114
|
type: Injectable
|
|
8911
|
-
}], ctorParameters: () => [{ type: TruDataContext }, { type: TruTextManager }, { type: TruDesktopManager }, { type: TruWindowEventHandler }, { type: TruUiNotification }, { type: TruModelTypeLookup }, { type: TruGlobalDataContext }, { type: TruUser }] });
|
|
9115
|
+
}], ctorParameters: () => [{ type: TruDataContext }, { type: TruTextManager }, { type: TruDesktopManager }, { type: TruWindowEventHandler }, { type: TruUiNotification }, { type: TruAppEnvironment }, { type: i2.HttpClient }, { type: TruModelTypeLookup }, { type: TruGlobalDataContext }, { type: TruUser }] });
|
|
8912
9116
|
|
|
8913
9117
|
class TruReportManager {
|
|
8914
9118
|
dataContext;
|
|
@@ -8923,7 +9127,7 @@ class TruReportManager {
|
|
|
8923
9127
|
this.actionInvoke = actionInvoke;
|
|
8924
9128
|
this.user = user;
|
|
8925
9129
|
}
|
|
8926
|
-
|
|
9130
|
+
setupDownloadMenuImpl(report, menu, getActionRefs, enabled) {
|
|
8927
9131
|
var reportRef = report.Ref;
|
|
8928
9132
|
var mimeRef = report.ReportMimeTypeStdMimeTypeRef;
|
|
8929
9133
|
menu[0].choices.push({
|
|
@@ -8941,6 +9145,22 @@ class TruReportManager {
|
|
|
8941
9145
|
}
|
|
8942
9146
|
});
|
|
8943
9147
|
}
|
|
9148
|
+
setupMrtMenuImpl(report, menu, getActionRefs, enabled) {
|
|
9149
|
+
var reportRef = report.Ref;
|
|
9150
|
+
menu[0].choices.push({
|
|
9151
|
+
hasAccess: function () {
|
|
9152
|
+
return true;
|
|
9153
|
+
},
|
|
9154
|
+
label: report.ReportName,
|
|
9155
|
+
enabled: function () {
|
|
9156
|
+
return enabled();
|
|
9157
|
+
},
|
|
9158
|
+
reportRef: reportRef,
|
|
9159
|
+
fire: () => {
|
|
9160
|
+
this.actionInvoke.openStimulsoftPreview(reportRef, getActionRefs(), report.ReportName);
|
|
9161
|
+
}
|
|
9162
|
+
});
|
|
9163
|
+
}
|
|
8944
9164
|
get(url, method, callback, params = null) {
|
|
8945
9165
|
let obj = new XMLHttpRequest();
|
|
8946
9166
|
try {
|
|
@@ -8966,15 +9186,18 @@ class TruReportManager {
|
|
|
8966
9186
|
}, null, false).subscribe((cloudFiles) => {
|
|
8967
9187
|
if (cloudFiles.length) {
|
|
8968
9188
|
//there is a cloud file associated with this report
|
|
8969
|
-
|
|
9189
|
+
const filename = cloudFiles[0]?.Filename;
|
|
9190
|
+
const isMrt = typeof filename === 'string' && filename.toLowerCase().endsWith('.mrt');
|
|
9191
|
+
if (isMrt) {
|
|
8970
9192
|
//this is a stimulsoft report, check if license file exists
|
|
8971
9193
|
this.dataContext.entityAccess().search(this.modelTypeLookup.getType('TruDbConfig'), (query) => {
|
|
8972
9194
|
var predicate = new breeze.Predicate('Key', breeze.FilterQueryOp.Equals, 'StimulsoftLicensePath');
|
|
8973
9195
|
return query.where(predicate);
|
|
8974
9196
|
}, null, false).subscribe((config) => {
|
|
8975
9197
|
if (!config.length || !config[0].Value) {
|
|
8976
|
-
//
|
|
8977
|
-
//
|
|
9198
|
+
// Keep the report available even without a configured Stimulsoft license.
|
|
9199
|
+
// Preview may not work, but the existing download path can still be used.
|
|
9200
|
+
this.setupDownloadMenuImpl(report, menu, getActionRefs, enabled);
|
|
8978
9201
|
obs.next(menu);
|
|
8979
9202
|
obs.complete();
|
|
8980
9203
|
}
|
|
@@ -8984,7 +9207,7 @@ class TruReportManager {
|
|
|
8984
9207
|
// if (data.length) {
|
|
8985
9208
|
// }
|
|
8986
9209
|
//});
|
|
8987
|
-
this.
|
|
9210
|
+
this.setupMrtMenuImpl(report, menu, getActionRefs, enabled);
|
|
8988
9211
|
obs.next(menu);
|
|
8989
9212
|
obs.complete();
|
|
8990
9213
|
}
|
|
@@ -8993,7 +9216,7 @@ class TruReportManager {
|
|
|
8993
9216
|
else {
|
|
8994
9217
|
//there is a cloud file associated with this report, but it isn't an mrt report push menu option
|
|
8995
9218
|
//since this a different type of report (word, excel)
|
|
8996
|
-
this.
|
|
9219
|
+
this.setupDownloadMenuImpl(report, menu, getActionRefs, enabled);
|
|
8997
9220
|
obs.next(menu);
|
|
8998
9221
|
obs.complete();
|
|
8999
9222
|
}
|
|
@@ -9001,7 +9224,7 @@ class TruReportManager {
|
|
|
9001
9224
|
else {
|
|
9002
9225
|
//no cloud file, so no need to check for license, push menu option
|
|
9003
9226
|
//since this could be a non mrt report (word, excel)
|
|
9004
|
-
this.
|
|
9227
|
+
this.setupDownloadMenuImpl(report, menu, getActionRefs, enabled);
|
|
9005
9228
|
obs.next(menu);
|
|
9006
9229
|
obs.complete();
|
|
9007
9230
|
}
|
|
@@ -13292,5 +13515,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.17", ngImpo
|
|
|
13292
13515
|
* Generated bundle index. Do not edit.
|
|
13293
13516
|
*/
|
|
13294
13517
|
|
|
13295
|
-
export { TruAboutDialog, TruActionInvoke, TruAppEnvironment, TruAppSettingsDialog, TruAuth, TruAuthInterceptor, TruBreezeContext, TruBreezeContextFactory, TruBreezeMetadataProvider, TruBreezeValidator, TruCard, TruCardColumn, TruCardColumnData, TruCardColumnSearchResultsConfigBase, TruChoice, TruCloneView, TruCloudFileManager, TruColumn, TruCommonModule, TruComponentConfigBase, TruComponentLookup, TruConfirmDialog, TruConfirmDialogConfig, TruConnectionHub, TruContextFilter, TruContextFilterChoice, TruContextFilters, TruControlComponentConfigBase, TruCountries, TruDataChange, TruDataContext, TruDataGrid, TruDataGridCellRenderer, TruDataGridHeader, TruDataGridHeaderFilter, TruDataGridPkeyCellRenderer, TruDataGridRefHeader, TruDataGridTypes, TruDataGridUtil, TruDesktop, TruDesktopEventHandler, TruDesktopManager, TruDesktopViewConfig, TruDesktopViewEventNotifier, TruDetailViewBase, TruEditControlBase, TruEditControlConfigBase, TruEditParentControlConfigBase, TruEditPkeyControlConfigBase, TruEntityAccessor, TruEntityBase, TruErrorDialog, TruErrorInterceptor, TruExportDialog, TruExportDialogConfig, TruForm, TruFormatter, TruFormulaEval, TruGridValidationDialog, TruGridValidationDialogConfig, TruGroupBox, TruIconModule, TruListControlConfigBase, TruLogin, TruLoginModule, TruMatSelectPanel, TruModelNavigationPropertiesLookup, TruModelPropertyLookup, TruModelTableLookup, TruModelTypeLookup, TruNameValue, TruNavigationPropertiesConfig, TruNavigationPropertyConfig, TruPasswordDialog, TruPredicate, TruPredicateMap, TruPropertyConfigBase, TruPropertyConfigCloudFile, TruPropertyConfigDate, TruPropertyConfigDecimal, TruPropertyConfigFile, TruPropertyConfigForeignKey, TruPropertyConfigInteger, TruPropertyConfigPassword, TruPropertyConfigPercentage, TruPropertyConfigScientific, TruPropertyConfigText, TruPropertyConfigTextChoices, TruPropertyConfigUsaAddress, TruPropertyConfigZipCode, TruQueryPredicateManager, TruReportManager,
|
|
13518
|
+
export { TruAboutDialog, TruActionInvoke, TruAppEnvironment, TruAppSettingsDialog, TruAuth, TruAuthInterceptor, TruBreezeContext, TruBreezeContextFactory, TruBreezeMetadataProvider, TruBreezeValidator, TruCard, TruCardColumn, TruCardColumnData, TruCardColumnSearchResultsConfigBase, TruChoice, TruCloneView, TruCloudFileManager, TruColumn, TruCommonModule, TruComponentConfigBase, TruComponentLookup, TruConfirmDialog, TruConfirmDialogConfig, TruConnectionHub, TruContextFilter, TruContextFilterChoice, TruContextFilters, TruControlComponentConfigBase, TruCountries, TruDataChange, TruDataContext, TruDataGrid, TruDataGridCellRenderer, TruDataGridHeader, TruDataGridHeaderFilter, TruDataGridPkeyCellRenderer, TruDataGridRefHeader, TruDataGridTypes, TruDataGridUtil, TruDesktop, TruDesktopEventHandler, TruDesktopManager, TruDesktopViewConfig, TruDesktopViewEventNotifier, TruDetailViewBase, TruEditControlBase, TruEditControlConfigBase, TruEditParentControlConfigBase, TruEditPkeyControlConfigBase, TruEntityAccessor, TruEntityBase, TruErrorDialog, TruErrorInterceptor, TruExportDialog, TruExportDialogConfig, TruForm, TruFormatter, TruFormulaEval, TruGridValidationDialog, TruGridValidationDialogConfig, TruGroupBox, TruIconModule, TruIframeView, TruIframeViewConfig, TruListControlConfigBase, TruLogin, TruLoginModule, TruMatSelectPanel, TruModelNavigationPropertiesLookup, TruModelPropertyLookup, TruModelTableLookup, TruModelTypeLookup, TruNameValue, TruNavigationPropertiesConfig, TruNavigationPropertyConfig, TruPasswordDialog, TruPredicate, TruPredicateMap, TruPropertyConfigBase, TruPropertyConfigCloudFile, TruPropertyConfigDate, TruPropertyConfigDecimal, TruPropertyConfigFile, TruPropertyConfigForeignKey, TruPropertyConfigInteger, TruPropertyConfigPassword, TruPropertyConfigPercentage, TruPropertyConfigScientific, TruPropertyConfigText, TruPropertyConfigTextChoices, TruPropertyConfigUsaAddress, TruPropertyConfigZipCode, TruQueryPredicateManager, TruReportManager, TruRow, TruSearchConfigBase, TruSearchControlBase, TruSearchControlConfigBase, TruSearchControlParentBase, TruSearchControlRangeBase, TruSearchIconModule, TruSearchPanelPositionManager, TruSearchResultViewBase, TruSearchResultViewManager, TruSearchViewBase, TruSearchViewControlEventHandler, TruSearchViewEventHandler, TruSort, TruTab, TruTabGroup, TruTableConfigBase, TruTextManager, TruToolbar, TruToolbarAppCustomization, TruToolbarButton, TruToolbarContextFilter, TruToolbarDropdown, TruToolbarMenu, TruToolbarSeparator, TruToolbarText, TruToolbarTextbox, TruToolbarUserProfile, TruUiNotification, TruUser, TruUserPreferenceManager, TruUtil, TruValidationDialog, TruValidationDialogConfig, TruValidationDialogContext, TruValidatorFactory, TruViewBase, TruViewMenuConfig, TruWindowActionEventHandler, TruWindowCloseEventArgs, TruWindowEventArgs, TruWindowEventHandler, TruWindowManager };
|
|
13296
13519
|
//# sourceMappingURL=trudb-tru-common-lib.mjs.map
|