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

lc-vue-pro-table

v1.3.0

Published

vue3高级表格

Downloads

207

Readme

lc-vue-pro-table

高级表格组件

基于vue3 + element-plus el-table 开发

  • 新增跨页多选/跨页全选反选功能
  • 新增自定义列功能(新增/删除/排序)

安装

npm i lc-vue-pro-table

依赖

Demo

demo

基本使用

<template>
  <div>
    <el-checkbox v-model="showSelectionAlert">showSelectionAlert</el-checkbox>
  </div>
    <div>
      <CustomColumnPop ref="customColumnPopRef" @submit="onSubmit">
        <template #reference>
          <el-button :icon="Setting" @click="onSetting"/>
        </template>
      </CustomColumnPop>
    </div>
  <div style="height: 600px;" class="reset">
    <AutoPagination :fetch-data="fetchData" ref="pagination" auto-init>
      <template #default="{data, indexMethod}">
        <AutoHeightWrapper>
        <template #default="{size}">
          <ProTable :data="data" rowKey="id" :height="size.height" :showSelectionAlert="showSelectionAlert" ref="tableRef">
            <ProTableColumn type="selection" label="选择" prop="selection"> </ProTableColumn>
            <ProTableColumn type="reserveSelection" label="跨页选择" prop="reserveSelection"> </ProTableColumn>
            <ProTableColumn type="index" label="c" prop="c"></ProTableColumn>
            <ProTableColumn prop="id" label="id"></ProTableColumn>
            <ProTableColumn prop="b" label="bb" disabled>
              <template #default="{row}">{{ row }}</template>
            </ProTableColumn>
          </ProTable>
        </template>
      </AutoHeightWrapper>  
      </template>
    </AutoPagination>
  </div>
  <div>
    <el-button @click="getReserveSelection">获取选择记录</el-button>
  </div>
</template>

<script setup lang="ts">
import {ref} from 'vue';
import { AutoPagination } from 'lc-vue-auto-pagination';
import { AutoHeightWrapper } from 'lc-vue-auto-height-wrapper';
import { ProTable, ProTableColumn, CustomColumnPop } from 'lc-vue-pro-table';
import { Setting } from '@element-plus/icons';

const tableRef = ref<InstanceType<typeof ProTable>>()
const customColumnPopRef = ref<InstanceType<typeof CustomColumnPop>>()

const showSelectionAlert=ref(true)

const fetchData: InstanceType<typeof AutoPagination>['$props']['fetchData'] = async ({ pageNo, pageSize }) => {
  const list:any[] = [];

  for(let i=0; i<pageSize; i++){
    list.push({
      id: (pageNo-1)*pageSize + i,
      a: 10,
      b: 11
    })
  }

  return {
    list: list,
    total: 201
  }
}

const getReserveSelection = ()=>{
  console.log(tableRef.value.getReserveSelection())
}

const onSetting = ()=>{
  const columns = tableRef.value.getCustomColumns()
  customColumnPopRef.value.show(columns)
}

const onSubmit = (list)=>{
  tableRef.value.updateCustomColumns(list)
}

</script>

<style scoped>

</style>

较 el-table 变更的 Api

ProTable Props

| 属性名 | 说明 | 类型 | 默认值 | | ---- | ---- | ---- | ---- | | showSelectionAlert | 是否显示选项提示 | boolean | false | | renderTableType | table渲染类型 | string | 'el-table' | 'ag-grid' |

ProTable Exposes

| 名称 | 描述 | 类型 | | ---- | ---- | ---- | | getRowSelection | 获取选择信息,ProTableColumn.type='reserveSelection' | () => { rows: any[]; type: "reverse" | "positive"; } ;positive 为正选;reverse为反选 |

FormGrid Events

| 事件名 | 说明 | 类型 | | ---- | ---- | ---- | | row-selection-change | 多选变化(支持全选排除) | { rows: any[]; type: "reverse" | "positive"; } |

较 el-table-column 变更的 Api

ProTableColumn Props

| 属性名 | 说明 | 类型 | 默认值 | | ---- | ---- | ---- | ---- | | type | 新增跨页多选类型 | reserveSelection | - |

el-table 和 ag-grid 支持对比

| 功能 | el-table | ag-grid | | ---- | ---- | ---- | | 数据展示 | 有 | 有 | | 自定义单元格 | 有 | 无 | | 行多选 | 有 | 无 | | 自定义列调整 | 有 | 有 |

TODO

  • [ ] 支持 ag-grid 按需加载
  • [x] 支持 ag-grid 自定义单元格
  • [x] 支持 ag-grid 行多选
  • [ ] 支持 ag-grid 行反向多选
  • [ ] 支持 ag-grid 排序
  • [ ] 支持 ag-grid header渲染