{"id":13406084,"url":"https://github.com/ruilisi/fortune-sheet","last_synced_at":"2025-05-12T13:19:30.411Z","repository":{"id":37366216,"uuid":"476099912","full_name":"ruilisi/fortune-sheet","owner":"ruilisi","description":"A drop-in javascript spreadsheet library that provides rich features like Excel and Google Sheets","archived":false,"fork":false,"pushed_at":"2025-04-14T13:46:26.000Z","size":7685,"stargazers_count":3178,"open_issues_count":68,"forks_count":267,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-05-12T13:19:13.130Z","etag":null,"topics":["collaborative","datagrid","excel","javascript","react","spreadsheet","typescript","xlsx"],"latest_commit_sha":null,"homepage":"https://ruilisi.github.io/fortune-sheet-docs/","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ruilisi.png","metadata":{"files":{"readme":"README-zh.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"patreon":"RuilisiTech"}},"created_at":"2022-03-31T00:51:06.000Z","updated_at":"2025-05-12T09:15:41.000Z","dependencies_parsed_at":"2024-01-31T09:39:35.300Z","dependency_job_id":"af188b90-dfda-4526-8562-c7fb3ad1e3c9","html_url":"https://github.com/ruilisi/fortune-sheet","commit_stats":{"total_commits":731,"total_committers":34,"mean_commits":21.5,"dds":0.6251709986320109,"last_synced_commit":"b441c81ab6a3aaa2eea55fd21e39d9d33eac492b"},"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruilisi%2Ffortune-sheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruilisi%2Ffortune-sheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruilisi%2Ffortune-sheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ruilisi%2Ffortune-sheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ruilisi","download_url":"https://codeload.github.com/ruilisi/fortune-sheet/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253745196,"owners_count":21957319,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collaborative","datagrid","excel","javascript","react","spreadsheet","typescript","xlsx"],"created_at":"2024-07-30T19:02:20.436Z","updated_at":"2025-05-12T13:19:30.372Z","avatar_url":"https://github.com/ruilisi.png","language":"TypeScript","funding_links":["https://patreon.com/RuilisiTech"],"categories":["TypeScript","UI Components"],"sub_categories":["Editable data grid / spreadsheet"],"readme":"\n\u003cp align=\"center\"\u003e\n  \u003cimg align=\"center\" src=\"logo.png\" width=\"150px\" height=\"150px\" /\u003e\n\u003c/p\u003e\n\u003ch1 align=\"center\"\u003eFortuneSheet\u003c/h1\u003e\n\u003cp align=\"center\"\u003eFortuneSheet是一款开箱即用的类似Excel和Google Sheets的javascript表格组件。\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n[![CircleCI Status](https://circleci.com/gh/ruilisi/fortune-sheet.svg?style=shield)](https://circleci.com/gh/ruilisi/fortune-sheet)\n[![Known Vulnerabilities](https://snyk.io/test/github/ruilisi/fortune-sheet/badge.svg)](https://snyk.io/test/github/ruilisi/fortune-sheet)\n[![Build with father](https://img.shields.io/badge/build%20with-father-028fe4.svg)](https://github.com/umijs/father/)\n[![xiemala](https://img.shields.io/badge/maintained%20by-xiemala-cc00ff.svg)](https://xiemala.com/)\n\n\u003c/div\u003e\n\n[English](./README.md) | 简体中文\n\n## 目的\n\n`FortuneSheet`的目标是制造一个功能丰富，配置简单的在线表格组件，开箱即用。\n\n本项目源于 [Luckysheet](https://github.com/mengshukeji/Luckysheet)，并继承了它的很多代码。我们为将其转换为typescript做了很多努力，并且解决了一些原项目设计层面的问题。\n\n我们的目标是让`FortuneSheet`越来越强大，同时易于维护。\n\n## 交流\n* [Discord](https://discord.gg/vHGwMB77w5) 英文社群\n* [QQ](https://jq.qq.com/?_wv=1027\u0026k=iHaSN47J) 中文社群\n* [Xiemala](https://xiemala.com/s/ctJmUn)\n\n## 在线样例\n\n项目的在线Demo：[fortune-sheet-demo](https://ruilisi.github.io/fortune-sheet-demo/)\n\n## 注意\n在稳定版1.0发布之前，输入的数据结构和API可能会发生变动。如果你在升级版本后遇到了错误，可以查看[Changelog](./CHANGELOG.md) 和 [迁移指南](#迁移luckysheet数据).\n\n## 对Luckysheet的改进\n\n- 完全使用typescript编写。\n- 可以用 `import` / `require` 导入本库了。\n  ```js\n  import { Workbook } from '@fortune-sheet/react'\n  ```\n- 同页面支持多个实例。\n- 去掉了 `jQuery` 的依赖, 用原生 `React` / `Vue` + `immer` 来管理Dom和状态。\n- 用一个forked [handsontable/formula-parser](https://github.com/handsontable/formula-parser) 来处理公式计算。\n- 优化dom结构。\n- 用SVG代替`iconfont`的图标，因为`iconfont`的图标对其他开发者而言很不方便改动。\n- 容器外面不创建可见的页面元素。\n- 避免在`window`对象上存储数据。\n\n## 特性\n\n- 数据结构总体兼容Luckysheet (见[迁移指南](#迁移luckysheet数据))。\n- **格式设置**：样式，文本对齐及旋转，文本截断、溢出、自动换行，多种数据类型，单元格内多样式\n- **单元格**：多选区，合并单元格\n- **行和列操作**：插入、删除行或列\n- **操作体验**：复制、粘贴、剪切，快捷键\n- **公式和函数**：内置公式\n\n## 开发路线\n- ✅ 支持协同编辑和后端存储.\n- ✅ 支持撤销/重做.\n- ✅ 手机端适配.\n- ✅ 开放API.\n- ✅ 增加测试代码.\n- 更多基础功能:\n  - ✅ 下拉填充\n  - ✅字体\n  - ✅ 格式刷\n  - ✅ 评论\n  - ✅ 插入图片\n  - ✅ 更多工具栏按钮\n- Excel 导入和导出.\n- 支持Vue.\n- 更多功能:\n  - ✅ 排序\n  - ✅ 筛选\n  - ✅ 事件钩子\n  - ✅ 条件格式\n  - ✅ 拖拽\n  - ✅ 查找和替换\n  - 定位\n  - ✅ 数据验证\n  - ✅ 冻结\n  - ✅ 隐藏、冻结，文本分列\n- 更多高级功能:\n  - 数据透视表\n  - 图表\n  - ✅ 截图\n\n\n## 文档\n\n请参考详细文档 [fortune-sheet-doc](https://ruilisi.github.io/fortune-sheet-docs/)\n\n## 快速开始 (react)\n\n### 安装库\n\n\u003cdetails open\u003e\n\u003csummary\u003e使用 npm\u003c/summary\u003e\n\n```shell\nnpm install @fortune-sheet/react\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e使用 pnpm\u003c/summary\u003e\n\n```shell\npnpm install @fortune-sheet/react\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e使用 yarn\u003c/summary\u003e\n\n```shell\nyarn add @fortune-sheet/react\n```\n\u003c/details\u003e\n\n### 创建一个HTML容器\n```html\n\u003cstyle\u003e\n  html, body, #root {\n    width: 100%;\n    height: 100%;\n  }\n\u003c/style\u003e\n\u003cdiv id=\"root\"\u003e\u003c/div\u003e\n```\n\n**注意**: `width` 和 `height` 不是一定要设为 100%, 但要有值. 如果设为 `auto`, 表格区域有可能不显示.\n\n### 渲染表格\n\n```js\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { Workbook } from \"@fortune-sheet/react\";\nimport \"@fortune-sheet/react/dist/index.css\"\n\nReactDOM.render(\n  \u003cWorkbook data={[{ name: \"Sheet1\" }]} /\u003e,\n  document.getElementById('root')\n);\n```\n\n### 后端存储和在线协同\n\n每当用户在表格上做操作，一个`Op`列表会通过`onOp`回调发出。op描述了如何从当前数据修改为用户操作后的新数据的步骤。例如，当用户在A2单元格上设置了加粗，生成的op如下：\n\n```json\n[\n    {\n        \"op\": \"replace\",\n        \"index\": \"0\",\n        \"path\": [\"data\", 1, 0, \"bl\"],\n        \"value\": 1\n    }\n]\n```\n\nop对后端数据修改和同步在线协同数据非常有用。\n\n我们在 `backend-demo` 目录中展示了一个例子，使用 `Express` (后端) and `MongoDB` (数据库) 实现。\n\n通过 `node index.js` 运行后端服务器，然后访问 [Collabration example](https://ruilisi.github.io/fortune-sheet-demo/?path=/story/collabration--example) 即可体验。(可通过 http://localhost:8081/init 初始化数据)\n\n详细的 `Op` 文档, 请参考 [fortune-sheet-doc](./docs/zh/guide/op.md)\n\n## 迁移Luckysheet数据\nFortuneSheet的总体数据结构与Luckysheet相同，只有几处命名的区别：\n\n1. sheet.index -\u003e sheet.id\n2. sheet.calcChain[].id -\u003e sheet.calcChain[].id\n\n## 贡献\n期望的工作流程为: Fork -\u003e Patch -\u003e Push -\u003e Pull Request\n\n请确保仔细阅读 [贡献指南](./docs/zh/guide/contribute.md)。\n\n\n## 开发\n### 安装\n```shell\nyarn\n```\n\n### 开发\n```shell\nyarn dev\n```\n\n### 打包\n```shell\nyarn build\n```\n\n## 许可\n本项目使用MIT许可. 在 [MIT](http://opensource.org/licenses/MIT) 查看完整文本。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruilisi%2Ffortune-sheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fruilisi%2Ffortune-sheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fruilisi%2Ffortune-sheet/lists"}