• Stars
    star
    2,384
  • Rank 19,287 (Top 0.4 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets

FortuneSheet

FortuneSheet is a drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets

CircleCI 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 the design of the original project.

We aim to make FortuneSheet powerful yet easy to maintain.

Communication

Live demo

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

Attention

Before stable release of 1.0, input data structure and APIs may change during development. If you encounter errors after upgrading a version, check Changelog and Migration Guide.

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 mostly compatible with Luckysheet (see Migration Guide).
  • 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:
    • โœ… sort
    • โœ… filter
    • โœ… hooks
    • โœ… conditional formatting
    • โœ… drag and drop
    • โœ… find and replace
    • location
    • โœ… data verification
    • โœ… freeze
    • โœ… hide, 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

Using npm
npm install @fortune-sheet/react
Using pnpm
pnpm install @fortune-sheet/react
Using yarn
yarn add @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 (initialize data by visiting http://localhost:8081/init)

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

Migrating data from Luckysheet

The overall data structure of FortuneSheet is the same as Luckysheet, with some naming differences:

  1. sheet.index -> sheet.id
  2. sheet.calcChain[].id -> sheet.calcChain[].id

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.

More Repositories

1

css-checker

Reduce Similar & Duplicated CSS Classes with Diff in Seconds!
Go
577
star
2

rails-pangu

Rails starter kit that every startup needs
Ruby
192
star
3

react-chessground

React wrapper of Chessground
JavaScript
131
star
4

go-pangu

rest api web server based on go(High availability, high security, high performance)
Go
45
star
5

react-media-previewer

A media previewer component for React
TypeScript
20
star
6

NSHoverableButton

NSButton with two images for hovering and not hovering separately
Swift
19
star
7

react-keycode-input

A cool component for inputing many kinds of code
JavaScript
17
star
8

macbit

Macbit aims to solve mac development issues in a bit level.
C
11
star
9

chart-pangu

Pangu-chart is a helm chart template which inherits from the default template, but brings many conveniences originated from our daily devops.
HTML
10
star
10

rails-influxdb-logger

Logger for Influxdb in Rails
Ruby
10
star
11

NSGradientView

NSView with Gradient Background Colour Settings for Mac OS
Swift
9
star
12

feishu-api

FeishuApi is an integration of commonly used feishu open platform's APIs, easy to call.
Ruby
7
star
13

dockery

JavaScript
7
star
14

CountryCodeNSTextField

CountryCodeNSTextField subclasses NSTextfield for International Phone Calling Code Input With Flags
Swift
6
star
15

weibo-crawler

Weibo-crawler is a crawler project based on golang colly framework to crawl weibo sites and get information. It crawls web content by regular expressions and Xpath selector, spatially transforms keywords using word vector model, and clusters text content by HDBSCAN clustering algorithm.
Go
6
star
16

pangu.js

JavaScript
5
star
17

golang-crawler-example

HTML
5
star
18

learn-webpack

JavaScript
5
star
19

goetc

Go
5
star
20

Rocket.Chat.Go.SDK

Go SDK for REST API and Realtime api(almost all api)
Go
5
star
21

NSScrollSideBar

Swift
4
star
22

react-pangu

JavaScript
4
star
23

nextjs-docker-base

docker image base for nextjs
Dockerfile
4
star
24

css-cookbook

https://ruilisi.github.io/css-cookbook/
4
star
25

govet

Go
4
star
26

actioncable-jwt

Actioncable with authentication by jwt token
Ruby
3
star
27

golang-examples

Go
3
star
28

IMChatSDK-Mac

Swift
2
star
29

fortune-sheet-demo

HTML
2
star
30

UICustomView

Swift
2
star
31

IMChatSDK

Swift
2
star
32

xcode-cookbook

2
star
33

actioncable-rails

JavaScript
1
star
34

esheep

1
star
35

react-chessground-demo

JavaScript
1
star
36

rails-6-api-template

Ruby
1
star
37

rollup-react-library

Another react library creator which follows latest js libraries
JavaScript
1
star
38

chatsdk

Sample DatoCMS website built with GatsbyJS
Sass
1
star
39

lingtihuyu

1
star
40

fortune-sheet-docs

HTML
1
star