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 🙏

© 2024 – Pkg Stats / Ryan Hefner

lay-excel

v1.8.3

Published

简单快捷的导出插件,导出仅需一句话

Downloads

347

Readme

LAY-EXCEL 简单快捷的导出插件

现有导出前端库中,XLSX.JS功能强大但是操作颇为不便,于是封装了此插件,无额外依赖,支持 npm 引入,支持 Layui插件形式加载,导出仅需一句话

导出excel功能基于 XLSX.js,下载功能基于 FileSaver,读取文件基于 H5的 FileReader。

功能演示地址: http://excel.wj2015.com

文档地址: http://excel.wj2015.com/_book/

1570418356365

兼容性

支持IE10+、Firefox、Chrome 等

!!! 兼容性警告: v1.7.2+ 不再支持 IE9 ,如需必须在 IE9 环境使用,请使用 v1.6.6 版本!!!

快速入门

一句话导出,快速上手请查看 『快速上手』,更多便捷函数请查看『函数列表』,样式设置请查看『样式设置专区』

使用本项目的几种方式

npm安装

$ npm i lay-excel

然后使用 import 引入并调用导出函数

import LAY_EXCEL from 'lay-excel';
LAY_EXCEL.exportExcel([[1, 2, 3]], '表格导出.xlsx', 'xlsx')

script引入

<script src="layui_exts/excel.js"></script>
<script>
    LAY_EXCEL.exportExcel([[1, 2, 3]], '表格导出.xlsx', 'xlsx')
</script>

Layui插件引入

layui.config({
	base: 'layui_exts/', // 配置一个可访问地址
}).extend({
    excel: 'excel',
});
layui.use(['excel'], function (){
    layui.excel.exportExcel([[1, 2, 3]], '表格导出.xlsx', 'xlsx')
})

依赖的开源项目

| 开源项目名称 | 地址 | 用于 | | -------------------------------------------------------- | ------------------------------------------------------------ | ------------------------------ | | SheetJS / js-xlsx | https://github.com/SheetJS/js-xlsx | 导出的基础逻辑 | | protobi / js-xlsx | https://github.com/protobi/js-xlsx | 可以设置样式,用于补全样式功能 | | FileSaver.js | https://github.com/eligrey/FileSaver.js/ | 前端用于保存文件的JS功能组件 | | Blob.js | https://github.com/eligrey/Blob.js/ | Blob在IE10中的hack实现 | | polyfill.js | https://github.com/philipwalton/polyfill/ | 有名的IE兼容插件 | | shim.js | https://github.com/es-shims/es5-shim | xlsx.js内置的兼容组件,支持ES5 |

注:魔改 js-xlsx 支持样式的具体细节请见博客:JeffreyWang的个人博客:令最新JS-XLSX支持样式的改造方法

待完成需求

  • [x] 【文档】制作 Gitbook 方便查阅
  • [x] 【文档】新增『参与开发』页,以便其他开发者上手此插件
  • [x] 【文档】新增『常见问题整理』,整理群内高频问题,提高处理效率
  • [x] 【兼容】移除 jQuery 依赖
  • [x] 【兼容】兼容 npm 的方式加载,vue demo:lay-excel-vue
  • [x] 【导出】导出图片
  • [ ] 【兼容】导入支持IE11(卡住)
  • [ ] 【测试】单元测试覆盖
  • [ ] 【测试】建立CI/CD机制(做了一半)
  • [ ] 【导出】分段递归获取数据函数封装
  • [ ] 【导出】分段压缩打包
  • [ ] 【导出】样式设置函数更友好
  • [ ] 【导入】导入图片(卡住)
  • [ ] 【导入】优化导入处理函数
  • [ ] 【兼容】vite 打包及加载
  • [ ] 【兼容】时间上firefox比chrome慢43s(有说是浏览器底层兼容问题,未能再次复现)

参与开发

如果有好的想法,或者想实现 『待完成需求』中的部分功能,请邮 [email protected],或者提 GitHub Issue,或者加群 555056599 讨论。

如果有意贡献代码,那么在开始之前,请先阅读 『参与开发』 文档。

特别感谢

感谢 Layui 社区的小伙伴们的使用及建议,还有交流群中反馈各种问题和积极回复问题的群友们,以及 Github 上提 ISSUE、PR 的小伙伴们~

也非常感谢大方的 Jetbrains 提供的免费 IDE License,很好用很强大,https://www.jetbrains.com/?from=LAY-EXCEL

友情链接

Authtree插件JeffreyWang的个人博客

开源协议

LAY-EXCEL is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.