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

luckytool

v1.0.12

Published

Tool for luckysheet

Downloads

7

Readme

Luckytool

基于luckysheet开发的 表格模板替换(packtable)、excel文件导出(exportExcel,xlsx格式)。

一个 Luckysheet 表格插件。

安装

npm install luckytool

注:

由于luckysheet的insertImage方法个人改动,使用insertEChart的时候,务必引入修改后的文件: github地址:https://github.com/Bingle2020/luckysheet-dist.git

<link rel='stylesheet' href='./luckysheet-dist/plugins/css/pluginsCss.css' />
<link rel='stylesheet' href='./luckysheet-dist/plugins/plugins.css' />
<link rel='stylesheet' href='./luckysheet-dist/css/luckysheet.css' />
<link rel='stylesheet' href='./luckysheet-dist/assets/iconfont/iconfont.css' />
<script src="./luckysheet-dist/plugins/js/plugin.js"></script>
<script src="./luckysheet-dist/luckysheet.umd.js"></script>

目录

引入

import { packtable,insertEChart,exportExcel } from 'luckytool';
  • 当前第三方包都是通过方法参数传入方式,如$、luckysheet、echarts.

表格模板替换

import { packtable } from 'luckytool';
const apiData = await httpApiData();
const optionData = packtable(apiData, initOptionData); // apiData为接口请求数据,initOptionData是luckysheet的option里的一个data数组元素,在packtable方法内部将表格变量替换为接口真是数据返回
this.option.data = [optionData];
luckysheet.create(this.option);

插入echarts

import { insertEChart } from 'luckytool';
luckysheet.create(option);
const sheetData = luckysheet.getSheet();
setTimeout(() => {
  insertEChart({
    selector: "#container", /** 当前luckysheet容器选择器(带前缀) */
    info,
    /** 
      {
        id: 1, // 唯一id
        pos: [1, 1], // eCharts插入的单元格横、纵坐标
        className: "chart", // 给定eCharts容器的className,自定义
        chart: null, // 创建的eCharts实例
        option // eCharts图形配置选项
      }
    */
    sheet, /** luckysheet最新位置信息,通过luckysheet.getSheet()获得 */
    optionData, /** luckysheet最新的option.data数组元素 */
    echarts, /** echarts类 */
    luckysheet, /** luckysheet */
    $ /** jQuery */
  });
}, 200);

excel文件导出

import { exportExcel } from 'luckytool';
exportExcel(luckysheet /** 表格实例 */, luckysheet.getAllSheets()[0].name /** 导出excel名字 */, ExcelJS /** exceljs类 */).then((res) => {
    console.log("result==>", res);
}).catch((err) => {});

更新说明

  • 2022.12.16 更新dist静态资源地址,从github上拉取下来引入(v1.0.11)