7.5.2 • Published 3 years ago

@ang-kit/component v7.5.2

Weekly downloads
243
License
-
Repository
-
Last release
3 years ago

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

3 years ago

7.5.1

4 years ago

7.5.0-beta.1

5 years ago

7.5.0-beta.0

5 years ago

7.5.0

5 years ago

7.4.5

5 years ago

7.4.4

5 years ago

7.4.3

5 years ago

7.4.2

5 years ago

7.4.1

5 years ago

7.4.1-beta.1

5 years ago

7.4.1--beta.1

5 years ago

7.4.0

5 years ago

7.3.2

5 years ago

7.3.1

5 years ago

7.3.0

5 years ago

7.2.9

5 years ago

7.2.9-beta.1

5 years ago

7.2.9-beta.0

5 years ago

7.2.7

5 years ago

7.2.6

5 years ago

7.2.5

5 years ago

7.2.4

5 years ago

7.2.3

5 years ago

7.2.2

5 years ago

7.2.1

5 years ago

7.2.1-beta.1

5 years ago

7.2.1-beta.0

5 years ago

7.2.0

5 years ago

7.1.2

5 years ago

7.1.1

5 years ago

7.1.0

5 years ago

7.0.0

5 years ago

7.0.0-beta.0

5 years ago

0.6.0

5 years ago

0.5.6-rc.1

5 years ago

0.5.5

5 years ago

0.5.4

5 years ago

0.5.3

5 years ago

0.5.2

5 years ago

0.5.1

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.4

5 years ago

0.3.3

5 years ago

0.3.2

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.4

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago