レポートパーツ

このサンプルはレポートパーツ機能のサンプルです。ライブラリパネルにある「会社ロゴ」、「売上額カード」、「カテゴリ別売上チャート」、「データスライサー」の各アイテムをデザイナ面上にドラッグ&ドロップして配置することができます。この機能は、デザイナーコンポーネントを使用して、レポート内に定義済みのレポート項目を簡単に組み込み、カスタマイズできることを示すものです。

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>ActiveReportsJSデモ</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <script src="/activereportsjs/demos/arjs/dist/ar-js-core.js"></script> <script src="/activereportsjs/demos/arjs/dist/ar-js-designer.js"></script> <script src="/activereportsjs/demos/arjs/dist/ar-js-viewer.js"></script> <script src="/activereportsjs/demos/arjs-localization/dist/ar-js-locales.js"></script> <script src="/activereportsjs/demos/arjs-localization/dist/designer/ja-locale.js"></script> <script src="$DEMOROOT$/lib/purejs/license.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css" integrity="sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65" crossorigin="anonymous" /> <link rel="stylesheet" type="text/css" href="/activereportsjs/demos/arjs/styles/ar-js-ui.css" /> <link rel="stylesheet" type="text/css" href="/activereportsjs/demos/arjs/styles/ar-js-viewer.css" /> <link rel="stylesheet" type="text/css" href="/activereportsjs/demos/arjs/styles/ar-js-designer.css" /> <style> #designer-host, #viewer-host { margin: 0 auto; width: 100%; height: 500px; } .hide { display: none; } </style> </head> <body> <div id="designer-toolbar" class="container-fluid"> <button id="btnDesignerOpen" type="button" class="btn btn-outline-primary btn-sm col-sm-2 ml-1 hide" onclick="onOpenDesigner()" > デザイナを開く </button> </div> </div> <div id="designer-host"></div> <div id="viewer-host" class="hide"></div> <script> 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: "System", themeSelector: { isEnabled: true, availableThemes: ["System", "Default", "DefaultDark", "DarkOled", "HighContrast", "HighContrastDark", "ActiveReports", "ActiveReportsDark"] } }; const libraries = [ { id: 'reports/ReportLib.rdlx-json', name: 'ReportLib', displayName: "営業情報パーツ" } ]; const designerConfig = { language: "ja", appBar: appBarSettings, toolBar: toolBarSettings, menu: menuSettings, data: dataTabSettings, propertyGrid: propertyGridSettings, statusBar: statusBarSettings, themeConfig : themeConfig, reportPartsLibraries: libraries, }; function setVisibility(selector, isVisible) { document.querySelectorAll(selector).forEach(function (element) { isVisible ? element.classList.remove("hide") : element.classList.add("hide"); }); } var designer = null; function onOpenDesigner() { setVisibility("#viewer-host, #btnDesignerOpen", false); setVisibility("#designer-host, #btnPdfPreview", true); } MESCIUS.ActiveReportsJS.Core.FontStore.registerFonts( "/activereportsjs/demos/resource/fontsConfig.json" ); designer = new MESCIUS.ActiveReportsJS.ReportDesigner.Designer( "#designer-host", designerConfig ); designer.setActionHandlers({ onRender: (report) => { setVisibility("#viewer-host, #btnDesignerOpen", true); setVisibility("#designer-host, #btnPdfPreview", false); viewer.open(report.definition); return Promise.resolve(); }, }); designer.setReport({ id: "reports/init-template.rdlx-json" }); designer.getPanelsAPI().then(function(panelsApi){ panelsApi.menu.open("libraries-list"); }) var viewer = new MESCIUS.ActiveReportsJS.ReportViewer.Viewer( "#viewer-host", { language: "ja" } ); </script> </body> </html>