npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@startdt/spreadsheet

v1.1.8

Published

轻量级 Excel 开发库

Readme

@startdt/spreadsheet dependencies

open source npm version node version npm download npm license

快速使用

npm install @startdt/spreadsheet --save
<div id="container"></div>
import Spreadsheet from "@startdt/spreadsheet";
// If you need to override the default options, you can set the override
// const options = {};
// new Spreadsheet('#container', options);
const s = new Spreadsheet("#container")
  .loadData({}) // load data
  .change(data => {
    // save data to db
  });

// data validation
s.validate()

参数说明

只读/编辑

首次加载时将配置中的 mode 设置为 read 或者 edit

mode: 'read'    // 'edit'

工具栏

工具栏的显示状态 showToolbar: boolean,默认为 true

底部工具栏 showBottomBar: boolean,默认为 true

showToolbar: true     // false
showBottomBar: true   // false

网格

内容区域网格显示状态 showGrid: boolean

showGrid: true    // false

右键菜单

切换右键菜单显示状态 showContextmenu: boolean

showContextmenu: true   // false

表格宽高

这包含工具栏高度,可以调整表格固定的宽高 view 属性的 heightwidth

// 可以是固定值
view: {
    height: () => document.documentElement.clientHeight,
    width: () => document.documentElement.clientWidth
}

调整行的高度和默认展示数量,分别通过 height 属性和 len 调整

row: {
    height: 25,
    len: 100
}

可以调整默认显示的列数 len,A-Z,默认每个列的宽度 width,左边序列栏默认宽度 indexWidth,以及每个列默认最小宽度 minWidth

col: {
    len: 26,
    width: 100,
    indexWidth: 60,
    minWidth: 60,
}

样式

可以调整表格渲染的样式

style: {
    // 背景颜色
    bgcolor: '#ffffff',
    // 水平对齐方式
    align: 'left',
    // 垂直对齐方式
    valign: 'middle',
    // 是否需要换行
    textwrap: false,
    // 虚线边框
    strike: false,
    // 下画线
    underline: false,
    // 文字颜色
    color: '#0a0a0a',
    // 字体设置
    font: {
        // 字体
        name: 'Helvetica',
        // 字号大小
        size: 10,
        // 是否加粗
        bold: false,
        // 斜体
        italic: false,
    },
}

默认配置

{
    mode: 'edit',
    showToolbar: true,
    showGrid: true,
    showContextmenu: true,
    view: {
        height: () => document.documentElement.clientHeight,
        width: () => document.documentElement.clientWidth,
    },
    row: {
        len: 100,
        height: 25,
    },
    col: {
        len: 26,
        width: 100,
        indexWidth: 60,
        minWidth: 60,
    },
    style: {
        bgcolor: '#ffffff',
        align: 'left',
        valign: 'middle',
        textwrap: false,
        strike: false,
        underline: false,
        color: '#0a0a0a',
        font: {
            name: 'Helvetica',
            size: 10,
            bold: false,
            italic: false,
        },
    },
}

绑定单元格事件

const s = new Spreadsheet("#container")
// event of click on cell
s.on('cell-selected', (cell, ri, ci) => {});
s.on('cells-selected', (cell, { sri, sci, eri, eci }) => {});
// edited on cell
s.on('cell-edited', (text, ri, ci) => {});

设置单元格内容

const s = new Spreadsheet("#container")
// cellText(ri, ci, text, sheetIndex = 0)
s.cellText(5, 5, 'xxxx').cellText(6, 5, 'yyy').reRender();

获取单元格信息

const s = new Spreadsheet("#container")
// cell(ri, ci, sheetIndex = 0)
s.cell(ri, ci);
// cellStyle(ri, ci, sheetIndex = 0)
s.cellStyle(ri, ci);

本地开发

npm install
npm run dev

浏览器打开:http://localhost:8080

基础功能

  • 撤销
  • 恢复
  • 格式刷
  • 清除格式
  • 字体
  • 字号
  • 粗体
  • 斜体
  • 边框
  • 下划线
  • 删除线
  • 字体颜色
  • 填充颜色
  • 对齐方式
  • 自动换行
  • 自动填充
  • 合并单元格
  • 复制/剪切/粘贴
  • 行高/列宽
  • 冻结行列
  • 插入行列
  • 删除行列
  • 隐藏行列
  • 多表支持
  • 数据格式
  • 格式校验
  • 打印
  • 公式

浏览器支持

现代浏览器(Chrome、Firefox、Safari)