Go to file
Eugene 41bae423c3 add config 2023-11-10 17:48:19 +03:00
dist Added excel formula support 2023-07-28 19:30:59 +03:00
public Init commit 2023-07-19 17:34:15 +03:00
repo_assets Updated styles 2023-07-27 12:22:15 +03:00
src Added excel formula support 2023-07-28 19:30:59 +03:00
.eslintrc.cjs Linted code 2023-07-25 23:57:19 +03:00
.gitignore Builded first version of package 2023-07-24 19:12:21 +03:00
.prettierignore Added eslint & prettier config 2023-07-25 16:59:49 +03:00
.prettierrc.json Added eslint & prettier config 2023-07-25 16:59:49 +03:00
LICENCE Added 'destroy' method 2023-07-25 13:20:25 +03:00
README.md Update README.md 2023-07-27 12:24:46 +03:00
index.html Little styles fixes for columns and rows bars 2023-07-26 11:05:43 +03:00
package.json Added multiply config for component DEMO and lib mode. 2023-11-10 17:48:15 +03:00
pnpm-lock.yaml add config 2023-11-10 17:48:19 +03:00
tsconfig.json Added excel formula support 2023-07-28 19:30:59 +03:00
vite.config.ts add config 2023-11-10 17:48:19 +03:00

README.md

Modern Spreadsheet

spreadsheet_preview

Features:

  • High performance spreadsheet based on CanvasAPI.
  • TypeScript supported
  • Native scrolling
  • Customizable
  • Copy & Paste support

Basic usage

import Spreadsheet from "modern_spreadsheet";
import "modern_spreadsheet/style.css"; // <= this is required

const target = document.getElementById("spreadsheet");
const sheet = new Spreadsheet(target);
//...

Save and load data

function saveData() {
  const serialized = sheet.serializeData();
  localStorage.setItem("sheet_data", JSON.stringify(serialized));
}

function loadData() {
  const data = localStorage.getItem("sheet_data");
  const json = JSON.parse(data);
  if (!json) return;
  sheet.loadData(json);
}

Supported events

  • onCellClick
  • onSelectionChange
  • onCellChange
  • onCopy

Using events examples

import Spreadsheet, { SpreadsheetConstructorProperties } from "./main";

const options: SpreadsheetConstructorProperties = {
  onCellClick: (event, cell) => {
    console.log("Cell click", event, cell);
  },
  onSelectionChange: (selection) => {
    console.log("Changed selection: ", selection);
  },
  onCellChange = (cell) => {
    console.log("Cell changed: ", cell);
  },
  onCopy: (range, data, dataAsString) => {
    console.log("Copy event: ", range, data, dataAsString)
  }
};

const sheet = new Spreadsheet("#spreadsheet", options);

Roadmap

  • Rows number and columns heading render
  • Custom event functions (ex.: onSelectionChange, onCellEdit...). Full list of supported events will available on this page
  • Copy & Paste support
  • Rows and columns resizing
  • Toolbar
  • Context menu
  • Formulas support
  • Selected cell depends cells highlight
  • Async formulas support
  • Mutlisheets (?)