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

webkf-core-base-grid

v2.2.6

Published

base-grid

Downloads

4

Readme

介绍

webkf-core-base-grid 基本表格组件,基础开发框架为Vue2.X

安装教程

# 指定npm服务器
npm set registry http://www.xhzq.com:4873
# 安装依赖包
npm i webkf-core-base-grid -S
# 查看更新版本
npm view webkf-core-base-grid versions
# 更新到指定版本
npm install [email protected]

更新日志

增加表格配置参数

      表格配置参数可以和表格属性混用
      表格配置参数不包括 'rowData' 属性
      如果表格配置参数属性与表格属性相同时表格配置属性生效

      :allowGridConfig="true"   //是否启用表格配置参数
      :gridConfig="gridConfig"  //表格配置参数

      DEMO
       this.gridConfig = {
            'showToolbar': true,
            'defaultColDef': this.defaultColDef,
            'columnDefs': this.columnDefs,
            'rowSelection': this.rowSelection,
            'frameworkComponents': this.frameworkComponents,
            'treeData': true,
            'getDataPath': this.getDataPath,
            'animateRows': true,
            'autoGroupColumnDef': this.autoGroupColumnDef,
            'gridOptions': this.gridOptions
          }

增加行样式

#表格绑定数据
 :rowClassRules="rowClassRules"

#在beforeMount中增加行class回调
this.rowClassRules = {
      'test1': params => {
        var numSickDays = params.data.gold
        return numSickDays > 2 && numSickDays <= 5
      },
      'test2': 'data.gold > 5'
    }

# css
<style>
  .ag-theme-balham .test1 {
    background-color: sandybrown !important;
  }
  .ag-theme-balham .test2 {
    background-color: lightcoral !important;
  }
</style>

增加单元格样式

 # 先定义好过滤器方法(可以自己手写方法,可以调用全局的,可以把过滤器通过Vue实例出来)
  const DateFormat = baseGrid.Format.DateFormat
  const toThousands = baseGrid.Format.toThousands
 # 列配置中使用
 # 时间格式化 默认格式(yyyy-MM-dd hh:mm:ss)
   {
     headerName: 'Country',
     field: 'country',
     width: 120,
     valueGetter: (params) => {
       return DateFormat(params.data.country)
     }
   },
  # 千分符
   {
     headerName: 'Year',
     field: 'year',
     width: 90,
     valueGetter: (params) => {
       return toThousands(params.data.year)
     }
   },

增加单元格样式

   {
     headerName: 'Athlete',
     field: 'athlete',
     width: 150,
     cellStyle: {color: 'red'}
   },

新增树形表格

      :treeData=true
      :getDataPath="getDataPath"
      rowData: [
        {
          id: 'A',
          parentId: null,
          make: 'Toyota1',
          model: 'Celica',
          price: 35000,
          date: new Date().Format('yyyy-MM-dd hh:mm:ss')
        },
        {
          id: 'B',
          parentId: 'A',
          make: 'Ford',
          model: 'Mondeo',
          price: 32000,
          date: new Date().Format('yyyy-MM-dd hh:mm:ss')
        },
        {
          id: 'C',
          parentId: 'B',
          make: 'Porsche',
          model: 'Boxter',
          price: 72000,
          date: new Date().Format('yyyy-MM-dd hh:mm:ss')
        }
      ],
  beforeMount () {
    this.rowData.toTree('id', 'parentId', 'dataPath')
    this.getDataPath = data => {
      return data.dataPath
    }
  }
import 'webkf-core-base-grid/src/utils/prototype.js'

表格组件测试版

1. 属性

| 参数 | 说明 | 类型 |可选值 | 默认值 | | :---- | :---- | :---- |:---- | :---- | | showGrid | 是否显示表格 | Boolean | - | true | | showQuickFilter | 是否显示快速过滤 | Boolean | - | true | | baseGridDebug | 表格调试模式 | Boolean | - | true | | showToolbar | 是否显示工具栏 | Boolean | - | false | | groupUseEntireRow | 使用整行分组 | Boolean | - | false | | rowGroupPanelShow | 显示分组面板 | String | always/ | - | | suppressMakeColumnVisibleAfterUnGroup | 未知 | Boolean | - | false | | columnDefs | 列定义 | Array | - | - | | rowData | 行数据 | Array | - | - | | rowSelection | 行选择模式 | String | single/multiple | single | | sideBar | 右侧控制面板 | Boolean | - | false | | defaultColDef | 列默认设置 | Object | - | { sortable: true, // 是否允许排序  resizable: true, // 是否允许调整大小 filter: true, // 是否允许过滤  editable: true // 是否允许编辑} | | rowBuffer | - | - | - | - | | rowModelType | - | String | clientSide/infinite/viewport/serverSide | clientSide | | pagination | 是否分页 | Boolean | - | false | | paginationPageSize | 分页页面大小 | - | - | - | | cacheOverflowSize | - | - | - | - | | maxConcurrentDatasourceRequests | - | - | - | - | | infiniteInitialRowCount | - | - | - | - | | maxBlocksInCache | - | - | - | - | | autoGroupColumnDef | 自动分组列定义 | Object | - | - | | groupDefaultExpanded | 分组默认展开 | Number | - | - |

2. 事件

| 方法名 | 说明 | :---- | :---- | gridReady | 表格准备就绪 | ready | 准备就绪 | rowclick | 行点击 | rowDoubleClicked | 行双击 | rowSelected | 行选择 | selectionChanged | 行选择改变 | cellValueChanged | 单元格值改变 | cellClicked | 单元格点击 | cellDoubleClicked | 单元格双击 | cellContextMenu | 单元格右键菜单 | cellFocused | 单元格获取焦点 | modelUpdated | model更新 | cellEditingStarted | 单元格开始编辑 | cellEditingStopped | 单元格停止编辑 | rowEditingStarted | 行开始编辑 | rowEditingStopped | 行停止编辑 | rowDragEnter | 行拖住进入 | rowDragEnd | 行拖住结束 | rowDragMove | 行拖住移动 | rowDragLeave | 行拖住离开

3. 方法

| 方法名 | 说明 | 返回类型 |参数 | 默认值 | | :---- | :---- | :---- |:---- | :---- | | getSelectedDatas | 获取所有选择的数据 | Array | - | - | | getSelectedNodes | 获取所有选择的节点 | Array | - | - | | setAllColumnsWidth | 设置全列宽 | Void | - | - |

// 组件使用
  this.frameworkComponents = {  // wl: 表格框架组件
    'cellKeyValue': baseGrid.cellKeyValue,
    'cellSwitch': cellSwitch
  }
  
  // 渲染部门名称   
  Deptapi.GetAllList().then(res => {
        this.DeptIdList = res.toTree('deptId', 'parentId', 'path') // wl: 转换树形数据
        const deptCol = this.gridOptions.columnApi.getColumn('defaultDeptId');  //得到列
        // 设置单元格渲染
        deptCol.colDef.cellRenderer = 'cellKeyValue'
        deptCol.colDef.cellRendererParams = {
              list: this.DeptIdList,
              id: 'deptId',
              name: 'deptName',
        }
        this.gridOptions.columnApi.resetColumnState()
      })