디자이너 컴포넌트 - 보고서 구성요소(Parts)

이 샘플은 보고서 구성요소(Parts) 기능이 실제로 작동하는 모습을 보여줍니다. 라이브러리 패널의 회사 로고, 매출액 카드, 판매 차트 및 데이터 슬라이서 항목을 보고서 레이아웃으로 끌어다 놓아 구성할 수 있습니다. 이 기능은 Designer Component를 사용하여 보고서 내에서 사전 정의된 보고서 항목을 쉽게 통합하고 사용자 정의할 수 있음을 보여줍니다.

app.component.ts
app.component.css
app.module.ts
index.html
import { AfterViewInit, Component, ViewChild } from "@angular/core"; import { ViewerComponent, DesignerComponent, AR_EXPORTS, PdfExportService, HtmlExportService, TabularDataExportService, } from "@mescius/activereportsjs-angular"; @Component({ selector: "app-root", templateUrl: "src/app.component.html", styleUrls: ["src/app.component.css"], providers: [ { provide: AR_EXPORTS, useClass: PdfExportService, multi: true, }, { provide: AR_EXPORTS, useClass: HtmlExportService, multi: true, }, { provide: AR_EXPORTS, useClass: TabularDataExportService, multi: true, }, ], }) export class AppComponent implements AfterViewInit { designerHidden = false; initialReport = { id: "reports/init-template.rdlx-json" }; @ViewChild(ViewerComponent, { static: false }) reportViewer: ViewerComponent; @ViewChild(DesignerComponent, { static: false }) reportDesigner: DesignerComponent; ngAfterViewInit() { if(this.reportDesigner){ this.reportDesigner.getPanelsAPI().then(function(panelsApi:any){ panelsApi.menu.open("libraries-list"); }) } } onDesignerOpen() { this.designerHidden = false; } onReportPreview = (report: any) => { this.designerHidden = true; this.reportViewer.open(report.definition); return Promise.resolve(); }; onDesignerInit = function onDesignerInit() { const appBarSettings = { visible: true, // Show the app bar homeTab: { visible: true, // Show the home tab }, contextActionsTab: { visible: false, // Hide the context actions tab }, parametersTab: { visible: false, // Hide the parameters tab }, }; const toolBarSettings = { visible: true, // Show the toolbar }; const menuSettings = { visible: true, // Show the main menu toolBox: { visible: false, // Hide the Tool Box }, documentExplorer: { visible: true, // Show the Document Explorer }, groupEditor: { visible: false, // Hide the Group Editor }, layerEditor: { visible: false, // Hide the Layer Editor }, logo: { visible: false, // Hide the logo }, }; const dataTabSettings = { dataTab: { visible: false, // Hide the Data tab }, }; const propertyGridSettings = { propertiesTab: { visible: true, // Show the Properties tab }, mode: "Basic", // Set the Property Grid mode to "Advanced" or "Basic" }; const statusBarSettings = { visible: false, // Hide the status bar }; const themeConfig = { initialTheme: "ActiveReports", themeSelector: { isEnabled: false, } }; const libraries = [ { id: 'reports/ReportLib.rdlx-json', name: 'ReportLib', displayName: "Sales Data Visualizers" } ]; return { appBar: appBarSettings, toolBar: toolBarSettings, menu: menuSettings, data: dataTabSettings, propertyGrid: propertyGridSettings, statusBar: statusBarSettings, themeConfig: themeConfig, reportPartsLibraries: libraries, }; }; }
import { AfterViewInit, Component, ViewChild } from "@angular/core"; import { ViewerComponent, DesignerComponent, AR_EXPORTS, PdfExportService, HtmlExportService, TabularDataExportService, } from "@mescius/activereportsjs-angular"; @Component({ selector: "app-root", templateUrl: "src/app.component.html", styleUrls: ["src/app.component.css"], providers: [ { provide: AR_EXPORTS, useClass: PdfExportService, multi: true, }, { provide: AR_EXPORTS, useClass: HtmlExportService, multi: true, }, { provide: AR_EXPORTS, useClass: TabularDataExportService, multi: true, }, ], }) export class AppComponent implements AfterViewInit { designerHidden = false; initialReport = { id: "reports/init-template.rdlx-json" }; @ViewChild(ViewerComponent, { static: false }) reportViewer: ViewerComponent; @ViewChild(DesignerComponent, { static: false }) reportDesigner: DesignerComponent; ngAfterViewInit() { if(this.reportDesigner){ this.reportDesigner.getPanelsAPI().then(function(panelsApi:any){ panelsApi.menu.open("libraries-list"); }) } } onDesignerOpen() { this.designerHidden = false; } onReportPreview = (report: any) => { this.designerHidden = true; this.reportViewer.open(report.definition); return Promise.resolve(); }; onDesignerInit = function onDesignerInit() { const appBarSettings = { visible: true, // Show the app bar homeTab: { visible: true, // Show the home tab }, contextActionsTab: { visible: false, // Hide the context actions tab }, parametersTab: { visible: false, // Hide the parameters tab }, }; const toolBarSettings = { visible: true, // Show the toolbar }; const menuSettings = { visible: true, // Show the main menu toolBox: { visible: false, // Hide the Tool Box }, documentExplorer: { visible: true, // Show the Document Explorer }, groupEditor: { visible: false, // Hide the Group Editor }, layerEditor: { visible: false, // Hide the Layer Editor }, logo: { visible: false, // Hide the logo }, }; const dataTabSettings = { dataTab: { visible: false, // Hide the Data tab }, }; const propertyGridSettings = { propertiesTab: { visible: true, // Show the Properties tab }, mode: "Basic", // Set the Property Grid mode to "Advanced" or "Basic" }; const statusBarSettings = { visible: false, // Hide the status bar }; const themeConfig = { initialTheme: "ActiveReports", themeSelector: { isEnabled: false, } }; const libraries = [ { id: 'reports/ReportLib.rdlx-json', name: 'ReportLib', displayName: "Sales Data Visualizers" } ]; return { appBar: appBarSettings, toolBar: toolBarSettings, menu: menuSettings, data: dataTabSettings, propertyGrid: propertyGridSettings, statusBar: statusBarSettings, themeConfig: themeConfig, reportPartsLibraries: libraries, }; }; }
@import url("/activereportsjs/demos/arjs/styles/ar-js-ui.css"); @import url("/activereportsjs/demos/arjs/styles/ar-js-viewer.css"); @import url("/activereportsjs/demos/arjs/styles/ar-js-designer.css"); #designer-host, #viewer-host { width: 100%; height: 500px; }
import { BrowserModule } from "@angular/platform-browser"; import { NgModule } from "@angular/core"; import { AppComponent } from "./app.component"; import { ActiveReportsModule } from "@mescius/activereportsjs-angular"; import { ReactiveFormsModule } from "@angular/forms"; @NgModule({ declarations: [AppComponent], imports: [ActiveReportsModule, BrowserModule, ReactiveFormsModule], providers: [], bootstrap: [AppComponent], }) export class AppModule {}
(function (global) { System.config({ transpiler: "./plugin-typescript.js", typescriptOptions: { "target": "ES2022", "module": "system", "emitDecoratorMetadata": true, "experimentalDecorators": true, }, baseURL: "./node_modules/", meta: { typescript: { exports: "ts", }, "*.css": { loader: "systemjs-plugin-css" }, }, packageConfigPaths: [ "./node_modules/*/package.json", "./node_modules/@angular/*/package.json", "./node_modules/@mescius/*/package.json", ], map: { 'typescript': "typescript/lib/typescript.js", 'rxjs': "rxjs/dist/bundles/rxjs.umd.js", "rxjs/operators": "rxjs/dist/bundles/rxjs.umd.js", "@angular/core/primitives/signals": "@angular/core/fesm2022/primitives/signals.mjs", "@angular/common/http": "@angular/common/fesm2022/http.mjs", "@mescius/activereportsjs/core": "@mescius/activereportsjs/dist/ar-js-core.js", "@mescius/activereportsjs": "./activereports.js", "@mescius/ar-js-pagereport": "@mescius/activereportsjs/dist/ar-js-core.js", "@mescius/activereportsjs-i18n-ja": "@mescius/activereportsjs-i18n/dist/designer/ja-locale.js", "@mescius/activereportsjs-i18n-zh": "@mescius/activereportsjs-i18n/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: "fesm2022/core.mjs", }, "@angular/platform-browser": { defaultExtension: "mjs", main: "fesm2022/platform-browser.mjs", }, "@angular/common": { defaultExtension: "mjs", main: "fesm2022/common.mjs", }, "@angular/compiler": { defaultExtension: "mjs", main: "fesm2022/compiler.mjs", }, "@angular/forms": { defaultExtension: "mjs", main: "fesm2022/forms.mjs", }, "@angular/localize": { defaultExtension: "mjs", main: "fesm2022/localize.mjs", }, "@angular/platform-browser-dynamic": { defaultExtension: "mjs", main: "fesm2022/platform-browser-dynamic.mjs", }, "@mescius/activereportsjs-angular": { defaultExtension: "mjs", main: "fesm2022/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>ActiveReportsJS Report Designer Report Parts Sample</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <!-- Polyfills --> <script src="node_modules/zone.js/fesm2015/zone.min.js"></script> <!-- SystemJS --> <script src="node_modules/systemjs/dist/system.src.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("./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>