@fileverse-dev/dsheet

中文文档
4.1.27发布于 2026/11/10TypeScriptESM + CJS近 30 天下载 4185

DSheet

原始使用文档
文档目录21 节
  1. 𓆣 Features include:
  2. Installation
  3. Setup
  4. 1. Import
  5. 2. Configure Tailwind
  6. 3. Basic Usage
  7. Props Reference
  8. Required Props
  9. Optional Props
  10. Advanced Props
  11. UI State Props
  12. Examples
  13. Read-Only Viewer
  14. Collaborative Editor
  15. Custom Navbar
  16. With Templates
  17. Development
  18. Run Demo
  19. Build Package
  20. TypeScript
  21. License

Fileverse dSheets

NPM TypeScript

dsheets.new is your end-to-end encrypted alternative to Google Sheets & Excel. Use it to read, manipulate, and even write financial data, in real-time. Built on the same middleware as ddocs.new, the app is privacy-focused, sovereign, and gives you full control over your data.

𓆣 Features include:

  • End-to-end encryption
  • Local & peer-to-peer storage
  • Query live data from APIs & even smart contracts
  • Enable dark mode and other color themes
  • Use a familiar spreadsheets interface & functions (VLOOKUP, INDEX, MATCH…)
  • Granular access permissions (e.g., give view, comment, edit, suggest access to specific email addresses)
dsheetsnew

Installation

Install via npm to get started:

npm install @fileverse-dev/dsheet

Setup

1. Import

Add the following imports

import DsheetEditor from '@fileverse-dev/dsheet';
import '@fileverse-dev/dsheet/styles';

2. Configure Tailwind

Add to your tailwind.config.js:

module.exports = {
  content: [
    "./src/**/*.{js,jsx,ts,tsx}",
    "./node_modules/@fileverse-dev/dsheet/dist/index.es.js"
  ]
}

3. Basic Usage

function App() {
  const [data, setData] = useState({});

  return (
    <DsheetEditor
      isAuthorized={true}
      dsheetId="my-sheet-id"
      onChange={(updateData) => setData(updateData)}
    />
  );
}

Props Reference

Required Props

PropTypeDescription
isAuthorizedbooleanAuthorization status for the user
dsheetIdstringUnique identifier for collaboration room

Optional Props

PropTypeDefaultDescription
onChange(data: SheetUpdateData, encodedUpdate?: string) => void-Callback when sheet data changes
onContentUpdate() => void-Cheap throttled callback that does not encode or reconstruct the sheet
portalContentstring-Encoded initial sheet data
isReadOnlybooleanfalseEnable read-only mode
allowCommentsbooleanfalseEnable comments (requires isReadOnly=true)
usernamestring-Username for collaboration
isCollaborativebooleanfalseEnable collaborative features
enableWebrtcbooleantrueEnable WebRTC for P2P collaboration
enableIndexeddbSyncbooleantrueEnable local IndexedDB persistence
isTemplateOpenboolean-Template sidebar state
selectedTemplatestring-Selected template identifier
onboardingCompleteboolean-Onboarding completion status
sheetEditorRefRefObject<WorkbookInstance>-External ref to editor instance

Advanced Props

PropTypeDescription
renderNavbar(editorValues?: EditorValues) => JSX.ElementCustom navbar renderer
onboardingHandlerOnboardingHandlerTypeCustom onboarding logic
dataBlockApiKeyHandlerDataBlockApiKeyHandlerTypeAPI key handler for data blocks
getCommentCellUI(row: number, column: number, dragHandler: CommentUIDragFn) => voidCustom comment UI handler
commentDataObjectComment data for cells
toggleTemplateSidebar() => voidTemplate sidebar toggle handler
storeApiKey(apiKeyName: string) => voidAPI key storage handler
onDataBlockApiResponse(dataBlockName: string) => voidData block API response handler
onDuneChartEmbed() => voidDune chart embed handler
onSheetCountChange(sheetCount: number) => voidSheet count change handler

UI State Props

PropTypeDescription
setShowFetchURLModalDispatch<SetStateAction<boolean>>URL fetch modal state setter
setFetchingURLData(fetching: boolean) => voidURL fetching state setter
setInputFetchURLDataBlockDispatch<SetStateAction<string>>URL input state setter
setForceSheetRenderDispatch<SetStateAction<number>>Force re-render trigger

Examples

Read-Only Viewer

<DsheetEditor
  isAuthorized={true}
  dsheetId="viewer-sheet"
  isReadOnly={true}
  allowComments={true}
  portalContent={encodedData}
  onChange={() => {}}
/>

Collaborative Editor

<DsheetEditor
  isAuthorized={true}
  dsheetId="collab-sheet"
  username="john-doe"
  isCollaborative={true}
  enableWebrtc={true}
  onChange={(data) => console.log('Sheet updated:', data)}
/>

Custom Navbar

<DsheetEditor
  isAuthorized={true}
  dsheetId="custom-sheet"
  renderNavbar={(editorValues) => (
    <div className="flex items-center gap-4">
      <h1>My Custom Sheet</h1>
      <button onClick={() => editorValues?.sheetEditorRef.current?.exportToExcel()}>
        Export
      </button>
    </div>
  )}
/>

With Templates

<DsheetEditor
  isAuthorized={true}
  dsheetId="template-sheet"
  selectedTemplate="financial-budget"
  isTemplateOpen={true}
  toggleTemplateSidebar={() => setTemplateOpen(!templateOpen)}
/>

Development

Run Demo

cd demo
npm install
npm run dev

Build Package

npm run build

TypeScript

All props are fully typed. Import types:

import { DsheetProps, SheetUpdateData, EditorValues } from '@fileverse-dev/dsheet/types';

License

AGPL-3.0

版本与发布记录

@fileverse-dev/dsheet 共发布 1,050 个版本,首次发布于 2025/04/21;过去 12 个月发布了 550 个版本。

版本发布日期距今
4.1.27latest2026/11/104 天前
4.1.11-opaque-sheets.22026/11/078 天前
4.1.262026/11/078 天前
4.1.252026/11/068 天前
4.1.24-stabilise-package-42026/11/0410 天前
4.1.24-stabilise-package-32026/11/0311 天前

其他发布通道:add-support-for-external-function-ui → 0.0.39-patch-1,update-suggestion-box → 0.0.42-patch-2,expose-workbook-context → 0.0.52-patch-1,patch-2 → 0.0.52-patch-2,patch-3 → 0.0.52-patch-3,rate-limit → 0.0.84-patch-1。

关于 @fileverse-dev/dsheet 的常见问题

@fileverse-dev/dsheet 是什么?

DSheet

如何安装 @fileverse-dev/dsheet?

在项目目录运行 npm install @fileverse-dev/dsheet,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:yjs(>=13.6.30 <14)、react(^18.2.0 || ^19.0.0)、react-dom(^18.2.0 || ^19.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@fileverse-dev/dsheet 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@fileverse-dev/dsheet 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@fileverse-dev/dsheet 可以商用吗?

@fileverse-dev/dsheet 使用 未声明 许可。package.json 没有声明许可证。没有许可证的代码默认保留全部权利,商用前请联系作者或查看仓库中的 LICENSE 文件。以上为概括,不构成法律意见,请以许可原文为准。

@fileverse-dev/dsheet 的下载量有多少?

根据 npm 官方下载统计,@fileverse-dev/dsheet 在 2026/10/15 – 2026/11/13 这 30 天内被下载 4,185 次,日均约 140 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@fileverse-dev/dsheet 还在维护吗?

最新版本 4.1.27 发布于 2026/11/10(4 天前);至今共发布 1050 个版本,其中过去 12 个月发布了 550 个;首次发布于 2025/04/21。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。