ankareport

0.1.0-beta.15 • Public • Published

Anka Report

Docs | Playground

designer

Anka Report

Purpose

Free & Open Source Web Reporting Tool

Features

  • [x] Add/Remove Item
  • [x] Bindings
  • [x] Styles
  • [x] Color Picker
  • [x] Move & Size
  • [x] Bulk Move & Resize
  • [x] Add Sub Group
  • [x] Remove Sub Group
  • [x] Style By Group
  • [x] Undo/Redo
  • [x] Elements List
  • [x] Report Viewer
  • [x] Export To PDF
  • [ ] Custom PDF Converter

Contributing

yarn install
yarn dev
# open localhost:8080

Setup

<html>
  <head>
    ...

    <link
      rel="stylesheet"
      href="https://unpkg.com/ankareport/dist/ankareport.css"
    />
  </head>
  <body>
    ...

    <script src="https://unpkg.com/ankareport/dist/ankareport.js"></script>
  </body>
</html>

Quick Start

<div id="designer"></div>

<script>
  const designerDiv = document.getElementById("designer");
  const designer = AnkaReport.designer({
    element: designerDiv,
    dataSource: dataSource,
    layout: layout,
    onSaveButtonClick: (layout) => {
      console.log(layout);
    },
  });
</script>
<div id="report"></div>

<script>
  const reportDiv = document.getElementById("report");
  const report = AnkaReport.render({
    element: reportDiv,
    layout: layout,
    data: data,
  });
</script>
Example Data Source
const dataSource = [
  { label: "Header 1", field: "header1" },
  { label: "Header 2", field: "header2" },
  {
    label: "Content",
    children: [
      { label: "Name", field: "name" },
      { label: "Surname", field: "surname" },
    ],
  },
  { label: "Footer 1", field: "footer1" },
  { label: "Footer 2", field: "footer2" },
];
Example Layout
const layout = {
  width: 500,
  headerSection: {
    height: 50,
    items: [
      {
        text: "Header 1",
        binding: "header1",
        x: 5,
        y: 4,
        width: 100,
        height: 20,
      },
      {
        text: "Header 2",
        binding: "header2",
        x: 5,
        y: 28,
        width: 200,
        height: 20,
      },
    ],
  },
  contentSection: {
    height: 75,
    binding: "content",
    items: [
      {
        text: "Label1",
        binding: "name",
        x: 9,
        y: 6,
        width: 100,
        height: 20,
      },
      {
        text: "Label2",
        binding: "surname",
        x: 9,
        y: 26,
        width: 200,
        height: 40,
      },
    ],
  },
  footerSection: {
    height: 40,
    items: [
      {
        text: "Copyright",
        x: 150,
        y: 8,
        width: 100,
        height: 20,
      },
      {
        text: "Desc",
        binding: "footer2",
        x: 250,
        y: 8,
        width: 100,
        height: 20,
      },
    ],
  },
};
Example Data
const data = {
  header1: "Header 1",
  header2: "Header 2",
  content: [
    {
      name: "John1",
      surname: "Doe1",
    },
    {
      name: "John2",
      surname: "Doe2",
    },
    {
      name: "John3",
      surname: "Doe3",
    },
  ],
  footer1: "Footer 1",
  footer2: "Footer 2",
};

Readme

Keywords

none

Package Sidebar

Install

npm i ankareport

Weekly Downloads

10

Version

0.1.0-beta.15

License

MIT

Unpacked Size

267 kB

Total Files

100

Last publish

Collaborators

  • metiftikci
  • ankareport