import { Component, ViewChild } from "@angular/core";
import { CPLReport, FPLReport } from "./reportTemplates";
import { DesignerComponent } from "@grapecity/activereports-angular";
import { Observable, Subject } from "rxjs";
@Component({
selector: "app-root",
templateUrl: "src/app.component.html",
styleUrls: ["src/app.component.css"],
})
export class AppComponent {
@ViewChild(DesignerComponent, { static: false })
reportDesigner: DesignerComponent;
openReportSubj = new Subject<string>();
openReportObs = this.openReportSubj as Observable<string>;
designer: any;
initialReport = { id: "reports/company-template.rdlx-json" };
showDialog = false;
onLoadBlank(fpl: boolean) {
this.reportDesigner.setReport({
definition: fpl ? FPLReport : CPLReport,
});
}
onSelectReport(report: string) {
this.openReportSubj.next(report);
}
onCreateReport() {
return Promise.resolve({ id: "reports/company-template.rdlx-json" });
}
onOpenReport = () => {
return new Promise<any>((resolve) => {
const subscription = this.openReportObs.subscribe((report: string) => {
subscription.unsubscribe();
if(report)
resolve({ id: report });
else
resolve(null);
this.showDialog = false;
});
this.showDialog = true;
});
};
onCloseDialog = ()=>{
this.openReportSubj.next(null);
}
}
@import url("/activereportsjs/demos/arjs/styles/ar-js-ui.css");
@import url("/activereportsjs/demos/arjs/styles/ar-js-designer.css");
#designer-host {
width: 100%;
height: 500px;
}
.modal {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
}
.modal-content {
background: white;
padding: 20px;
border-radius: 4px;
width: 50%;
max-width: 500px;
max-height: 80%;
overflow-y: auto;
}
import { BrowserModule } from "@angular/platform-browser";
import { NgModule } from "@angular/core";
import { AppComponent } from "./app.component";
import { ActiveReportsModule } from "@grapecity/activereports-angular";
@NgModule({
declarations: [AppComponent],
imports: [BrowserModule, ActiveReportsModule],
providers: [],
bootstrap: [AppComponent],
})
export class AppModule {}
export var CPLReport = {
Name: "Report",
Body: {
Width: "8.5in",
Height: "11in",
},
};
export var FPLReport = {
Name: "Report",
Page: {
PageWidth: "8.5in",
PageHeight: "11in",
},
FixedPage: { Pages: [{}] },
};
<div id="designer-toolbar" class="container-fluid">
<div class="row mt-3 mb-3">
<button
type="button"
class="btn btn-outline-primary btn-sm col-sm-2 ml-1"
(click)="onLoadBlank(false)"
>
Load Blank Report
</button>
</div>
</div>
<div id="designer-host">
<gc-activereports-designer
[report]="initialReport"
[onCreate]="onCreateReport"
[onOpen]="onOpenReport"
>
</gc-activereports-designer>
</div>
<div *ngIf="showDialog" class="modal">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Open Report</h5>
<button type="button" class="close" (click)="onCloseDialog()">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<strong>Select Report:</strong>
<div class="list-group">
<button
type="button"
class="list-group-item list-group-item-action"
(click)="onSelectReport('reports/CustomersTable.rdlx-json')"
>
Customers Report
</button>
<button
type="button"
class="list-group-item list-group-item-action"
(click)="onSelectReport('reports/TaxiDrives.rdlx-json')"
>
Taxi Drives Report
</button>
</div>
</div>
<div class="modal-footer">
<button
type="button"
class="btn btn-outline-secondary"
(click)="onCloseDialog()"
>
Close
</button>
</div>
</div>
</div>
(function (global) {
System.config({
transpiler: './plugin-typescript.js',
typescriptOptions: {
"target": "es2022",
"module": "system",
},
baseURL: './node_modules/',
meta: {
'typescript': {
"exports": "ts"
},
'*.css': { loader: 'systemjs-plugin-css' }
},
packageConfigPaths: [
'./node_modules/*/package.json',
"./node_modules/@angular/*/package.json",
"./node_modules/@grapecity/*/package.json"],
map: {
'typescript': 'typescript/lib/typescript.js',
"rxjs": "rxjs/dist/bundles/rxjs.umd.js",
"rxjs/operators": "rxjs/dist/bundles/rxjs.umd.js",
"@grapecity/activereports/core": "@grapecity/activereports/dist/ar-js-core.js",
"@grapecity/activereports": "./activereports.js",
"@grapecity/ar-js-pagereport": "@grapecity/activereports/dist/ar-js-core.js",
"@grapecity/activereports-localization-ja": "@grapecity/activereports-localization/dist/designer/ja-locale.js",
"@grapecity/activereports-localization-zh": "@grapecity/activereports-localization/dist/designer/zh-locale.js",
},
// packages tells the System loader how to load when no filename and/or no extension
packages: {
"./src": {
defaultExtension: 'ts'
},
rxjs: {
defaultExtension: 'js',
// "main": "bundles/rxjs.umd.min.js"
},
"node_modules": {
defaultExtension: 'js'
},
"@angular/core": {
defaultExtension: 'mjs',
"main": "fesm2015/core.mjs"
},
"@angular/platform-browser": {
defaultExtension: 'mjs',
"main": "fesm2015/platform-browser.mjs"
},
"@angular/common": {
defaultExtension: 'mjs',
"main": "fesm2015/common.mjs"
},
"@angular/compiler": {
defaultExtension: 'mjs',
"main": "fesm2015/compiler.mjs"
},
"@angular/forms": {
defaultExtension: 'mjs',
"main": "fesm2015/forms.mjs"
},
"@angular/localize": {
defaultExtension: 'mjs',
"main": "fesm2015/localize.mjs"
},
"@angular/platform-browser-dynamic": {
defaultExtension: 'mjs',
"main": "fesm2015/platform-browser-dynamic.mjs"
},
"@grapecity/activereports-angular": {
defaultExtension: 'mjs',
"main": "fesm2015/grapecity-activereports-angular.mjs"
}
}
});
})(this);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>MESCIUS ActiveReports for Javascript sample</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<!-- Polyfills -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.min.js"></script>
<!-- SystemJS -->
<script src="node_modules/systemjs/dist/system.js"></script>
<script src="systemjs.config.js"></script>
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap"
rel="stylesheet"
/>
<link
rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"
integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z"
crossorigin="anonymous"
/>
<script>
System.import('$DEMOROOT$/en/lib/angular/license.ts');
System.import("./src/app.main");
</script>
</head>
<body>
<app-root></app-root>
<script
src="https://code.jquery.com/jquery-3.5.1.slim.min.js"
integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj"
crossorigin="anonymous"
></script>
<script
src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
crossorigin="anonymous"
></script>
<script
src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"
integrity="sha384-B4gt1jrGC7Jh4AgTPSdUtOBvfO8shuf57BaghqFfPlYxofvL8/KUEfYiJOMMV+rV"
crossorigin="anonymous"
></script>
</body>
</html>