A drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets
Go to file
2022-04-15 17:28:05 +08:00
.storybook chore: refine Collabration story 2022-04-12 09:02:16 +08:00
backend-demo feat: special op for sheet add / delete 2022-04-14 10:50:41 +08:00
docs chore: refines 2022-04-15 09:38:13 +08:00
packages v0.2.2 2022-04-15 15:44:39 +08:00
patches chore: rename formula-parser 2022-03-29 11:05:02 +08:00
stories chore: refines 2022-04-15 09:38:13 +08:00
tests test: init testing 2022-04-05 13:30:07 +08:00
.drone.yml ci: init 2022-04-05 14:02:39 +08:00
.eslintignore fix: lint 2022-04-05 13:30:57 +08:00
.eslintrc.js fix: lint 2022-04-05 13:30:57 +08:00
.fatherrc.js chore: refine building 2022-03-29 23:54:00 +08:00
.gitignore chore: refine storybook 2022-03-30 14:50:30 +08:00
.prettierignore chore: format with prettier 2022-03-07 13:13:09 +08:00
jest.config.js test: init testing 2022-04-05 13:30:07 +08:00
lerna.json v0.2.2 2022-04-15 15:44:39 +08:00
LICENSE chore: create LICENSE 2022-04-15 17:28:05 +08:00
lint-staged.config.js initial commit 2022-03-05 09:44:18 +08:00
logo.png chore: refine README 2022-04-07 21:48:49 +08:00
package.json test: test thoroughly on patch.ts 2022-04-12 09:02:16 +08:00
README-zh.md doc: update docs 2022-04-14 15:37:43 +08:00
README.md chore: refines 2022-04-15 09:38:13 +08:00
screenshot.png chore: refines 2022-04-15 09:38:13 +08:00
tsconfig.json chore: use produceWithPatches universally for op extracting and history recording 2022-04-04 21:35:26 +08:00
yarn.lock feat: collabrative editing with backend demo (incompleted) 2022-04-12 09:00:59 +08:00

FortuneSheet

FortuneSheet is an online spreadsheet component library that provides out-of-the-box features just like Excel

Build Status FOSSA Status Known Vulnerabilities Build with father xiemala

English | 简体中文

Purpose

The goal of FortuneSheet is to make a feature-rich, easy-to-configure online spreadsheet that you can use out-of-the-box.

This project is originated from Luckysheet and has inherited many code from it. Lots of efforts have done to translate the whole project to typescript (still in progress), and solved problems in project level.

We aim to make FortuneSheet powerful yet easy to maintain.

Online demo

Take a look at the online demo at fortune-sheet-demo

Attention

This project is in the state of early development, APIs may have significant change in the future, use with caution in production.

Improvements to Luckysheet

  • Written fully in typescript.
  • You can now use import / require to use the library.
    import { Workbook } from '@fortune-sheet/react'
    
  • Multiple instance on the same page is supported.
  • Dropped jQuery dependency, uses native React / Vue + immer to manage the dom and state.
  • Changed to a forked handsontable/formula-parser to handle formula calculations.
  • Optimized the dom structure.
  • Replaced icons from iconfont with SVGs, as iconfont icons are inconvenient to update for other maintainers.
  • No visible elements is created outside container.
  • Never stores data in the window object.

Features

  • Data structure is compatible with Luckysheet.
  • Formatting: style, text alignment and rotation, text truncation, overflow, automatic line wrapping, multiple data types, cell segmentation style
  • Cells: multiple selection, merge cells
  • Row & column: insert, delete rows or columns
  • Operation: copy, paste, cut, hot key
  • Formulas & Functions: Built-in formulas

Roadmap

  • Support cooperative editing with backend storage.
  • Support undo/redo.
  • Mobile adaption.
  • Expose APIs.
  • Add tests.
  • More basic features:
    • fill handle
    • fonts
    • format painter
    • comments
    • insert images
    • more toolbar buttons
  • Excel import and export.
  • Support Vue.
  • More features:
    • filter, sort
    • conditional formatting
    • drag and drop
    • find and replace
    • location
    • data verification
    • hide, freeze, and split text
  • More advanced features:
    • pivot tables
    • charts
    • screenshots

Documentation

See detailed documentation at fortune-sheet-doc

Get started (react)

Download and install the library

yarn add @fortune-sheet/react

or using npm:

npm install @fortune-sheet/react

Create an HTML placeholder

<style>
  html, body, #root {
    width: 100%;
    height: 100%;
  }
</style>
<div id="root"></div>

NOTE: width and height doesn't have to be 100%, but should at least have a value. If set to auto, table area may not show.

Render the sheet

import React from 'react';
import ReactDOM from 'react-dom';
import { Workbook } from "@fortune-sheet/react";
import "@fortune-sheet/react/dist/index.css"

ReactDOM.render(
  <Workbook data={[{ name: "Sheet1" }]} />,
  document.getElementById('root')
);

Backend storage and collabration

Each time a user operates on the sheet, an array of Op will be emiited through onOp callback. An op describes how to modify the current data to reach the new data after the user's operation. For example, here is an op when user sets the cell font to be bold on cell A2.

[
    {
        "op": "replace",
        "index": "0",
        "path": ["data", 1, 0, "bl"],
        "value": 1
    }
]

The op is useful for database modification and syncing state in online collabration.

A working example with Express (backend server) and MongoDB (data persistence) is avaiable in backend-demo folder.

Run it with node index.js and visit Collabration example

For detailed doc about Op, refer to fortune-sheet-doc

Contributing

Expected workflow is: Fork -> Patch -> Push -> Pull Request

Please make sure to read the Contributing Guide before making a pull request.

Development

Installation

yarn

Development

yarn dev

Packaging

yarn build

License

This project is licensed under the MIT License. See MIT for the full license text.

FOSSA Status