antd-utils

0.1.14 • Public • Published

Antd Utils

功能概览

名称 方法名 类型 demo 稳定版本
表格转置 transformTable Table 文档 0.1.5
复制 tags pasteTags Select 文档 0.1.5
TS 枚举转 select options enum2Options Select 文档 0.1.5
获取 url 参数 getQueryString Utils 文档 0.1.9
纵向合并相邻重复单元格 calcRowspanToMerge Table 文档 0.1.11

编译

npm run compile
npm run compile:w  // 可监听

测试

npm run test

打包

npm run build

自定义打包

// 打包umd格式,兼容浏览器和node环境
npm run dev
 
// 打包cjs格式
npm run dev:cjs
 
// 打包es6格式
npm run dev:esm

发布

npm publish

Getting Started 开始使用

  1. Using npm (Recomended)
 
import AntdUtils from '@antd-utils';
// or
import { transformTable } from '@antd-utils';
 
  1. Using <script>

Direct import using <script>, use antd-utils.js or compressed version antd-utils-min.js, call window.AntdUtils.xxx

浏览器直接引入,使用 antd-utils.js 或者压缩版 antd-utils-min.js,调用 window.AntdUtils.xxx

编写工具函数

  1. 在src下创建对应函数的文件 xx(工具类,如date)/xxx.ts

  2. 在入口文件entry-compiler.ts 导入

import xxx from './xx/xxx.ts'
export = {
    ...
    xxx
}
  1. 在index.d.ts中添加类型声明, 如
declare namespace AntdUtils {
    ...
    export function xxx():void
}

编写单元测试用例

  1. 在test下创建命名为xx.spec.ts文件,然后写单元测试用例使用mocha

  2. 执行 npm run test, 可在终端查看测试通过情况和代码覆盖率

编译、打包构建、发布

// 修改提交后,直接执行以下命令,即可完成编译、打包、发布
npm run publish:patch 
npm run publish:minor
npm run publish:major
npm run publish:premajor

鸣谢

打包构建基于 @ghfengye 的 https://github.com/ghfengye/mutils

Contact

Feel free to raise issues and contact me

github: https://github.com/xunge0613 weibo: @徐迅爱上大

Package Sidebar

Install

npm i antd-utils

Weekly Downloads

35

Version

0.1.14

License

MIT

Unpacked Size

92.1 kB

Total Files

24

Last publish

Collaborators

  • xunge0613