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

@ang-kit/component

v7.5.2

Published

新的使用文档请访问内网:http://10.10.11.106:4500

Downloads

65

Readme

@ang-kit/component

新的使用文档请访问内网:http://10.10.11.106:4500

注册模块

import {AngKitComponentModule} from '@ang-kit/component';

@NgModule({
  imports: [
    AngKitComponentModule
  ]
})
export class AppModule { }

组件

ADSimpleTableComponent

功能

  • 简易表格,简化html的声明,基于配置的方式创建表格组件

使用示例

1.使用
.html
<app-ad-simple-table
  #table
  [dataSource]="data"
  [columns]="column"
>
</app-ad-simple-table>

.ts
data = [
    {name: '111'}
];
column = [
    {title: '姓名', index: 'name'},
    {title: '操作区', buttons: [
        {
          text: '按钮1',
          click: (item) => {
            console.log('111');
          }
        }
    ]}
];

2.基本的接口类说明

/**
 * 单个数据源(静态数据)
 */
export interface ADSimpleTableData {
  /**
   * 选择框或单选框状态值
   */
  checked?: boolean;
  /**
   * 选择框或单选框 `disabled` 值
   */
  disabled?: boolean;
  /**
   * 其他字段
   */
  [key: string]: any;
}

/**
 * 列描述
 */
export interface ADSimpleTableColumn {
  /**
   * 表格标题
   */
  title: string;
  /**
   * 列数据在数据项中对应的key
   */
  index?: string;
  /**
   * 类型
   */
  type?: 'checkbox' | 'img' | 'date' | 'yuan' | 'input-number';
  /**
   * 是否可编辑
   */
  canEdit?: boolean;
  /**
   * 编辑状态类型
   */
  editType?: 'input-number';
  /**
   * 列宽,例如:`10%`、`100px`
   */
  width?: string;
  /**
   * 按钮组
   */
  buttons?: ADSimpleTableButton[];
  /**
   * 排序的默认受控属性
   * - 只支持同时对一列进行排序
   * - 保证只有一列的 `sort` 值,否则自动获取所有列的第一个值
   */
  sortValue: 'descend' | 'ascend' | null;
  /**
   * 格式化列值
   */
  format?: (record: any) => any;
  /**
   * 日期格式,`type=date` 有效,(默认:yyyy-MM-dd HH:mm:ss)
   */
  dateFormat?: string;
  /**
   * 头像类型,仅当 type=img 时有效;
   */
  avatarShape?: 'square' | 'circle' | null;
  /**
   * 默认提示,仅当呦输入框的时候有效
   */
  placeholder?: string;
  /**
   * 精度值,只有当 type = input-number 时候有效
   */
  precision?: number;
  /**
   * 最小值,只有 type = input-number 时候有效
   */
  min?: number;
  /**
   * 步数,只有 type = input-number 时候有效
   */
  step?: number;
  [key: string]: any;
}

/**
 * 按钮配置
 */
export interface ADSimpleTableButton {
  /**
   * 文本
   */
  text: string;
  /**
   * 格式化文本
   */
  format?: (record: any, btn: ADSimpleTableButton) => string;
  /**
   * 按钮类型 暂只支持 edit
   */
  type?: null | 'edit';
  /**
   * 是否显示的条件
   */
  isShow?: (record: any) => boolean;
  /**
   * 是否显示分割符,显示在该按钮的位置后面
   */
  isShowDivider?: boolean;
  /**
   * 点击回调
   */
  click?: (record: any) => void;
  /**
   * 下拉菜单,当存在时以 `dropdown` 形式渲染
   * - 只支持一级
   */
  children?: ADSimpleTableButton[];
  [key: string]: any;
}

Api

|参数|说明|类型|默认值| |------|------|------|------| | showNumber | 是否显示序号 | boolean | true | | tableSize | 大小,有default、middle、small三种 | string | middle | | tableTitle | 标题 | string | '' | | showBorder | 是否显示border | boolean | true | | isPagination | 是否显示分页 | boolean | true | | isPagination | 是否显示分页 | boolean | true | | isFrontPagination | 是否前端分页 | boolean | false | | showCheckBox | 是否显示checkbox | boolean | false | | dataSourceId | 数据源的ID,主要用于checkbox、快速编辑功能等判断是否是同一个数据 | number 或者 string | 'id' | | maxCheckCount | 当有checkBox,最大显示数量 | number | 500 | | url | 请求地址,如果用了该变量默认在内部做请求处理 | string | null | | dataSource | 表格数据,如果用了该变量默认在外部做请求处理 | ADSimpleTableData[] | [] | | extraParams | 请求的额外参数 | any | null | | reqHeader | 请求头信息 | any | null | | reqMethod | 请求方法,传入 GET、POST... | string | 'POST' | | reqReName | 重命名请求参数,支持重命名pageNo、pageSize两个参数 | any | {} | | sortReName | 重命名排序参数,支持重命名sortName、sortValue两个参数 | any | {} | | sortReNameValue | 重命名排序参数对应的值,支持重命名descend、ascend | any | {} | | resReName | 重命名返回参数,支持重命名total、list两个参数 | any | {} | | columns | 表格字段 | ADSimpleTableColumn[] | [] | | preDataChange | 数据处理前回调 | (data: ADSimpleTableData[]) => ADSimpleTableData[] | - | | preResponseDataChange | 如果需要从外部改变数据的时候调用 | (data: ADSimpleTableData) => any | - | | initLoadData | 初始化的时候是否加载数据 | boolean | true | | requestDataSourceEmitter | 通知外部处理请求事件 | EventEmitter<object> | - | | checkboxChangeEmitter | 多选框改变事件 | EventEmitter<ADSimpleTableData[]> | - | | saveRowEmitter | 快速保存数据的事件 | EventEmitter<ADSimpleTableData> | - |