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

pro-table-ant-design-vue

v0.0.9

Published

Ant Design Pro table of Vue, easy to use pro scaffolding.

Downloads

2

Readme

NPM version Vue Support Vue Grammar Level NPM downloads License

ProTable - Advanced Tables

ProTable was created to solve the problem of having to write a lot of sample code for tables in a project, so a lot of common logic was encapsulated in it. These wrappers can be simply categorized as pre-defined behaviors and pre-defined logic.

Thanks to ProForm's capabilities, ProForm can take many forms, switch between query form types, set up deformations to become a simple Form form, perform new creation, etc.

layout

When to Use

When your forms need to interact with the server or need multiple cell styles, ProTable is the right choice.

API

ProTable puts a layer of wrapping on top of antd's Table, supports some presets, and encapsulates some behaviors. Only api's that differ from antd Table are listed here.

request

request is the most important API of ProTable, request takes an object. The object must have data and success in it, and total is also required if manual paging is needed. request takes over the loading settings and re-executes them when the query form is queried and the params parameters are modified. Also the query form values and params parameters are brought in. The following is an example.

<ProTable
  // params is a parameter that needs to be self-contained
  // This parameter has higher priority and will override the parameters of the query form
  params={params}
  request={async (
    // The first parameter params is the combination of the query form and params parameters
    // The first parameter will always have pageSize and current, which are antd specifications
    { current, pageSize, ...params },
    sort,
    filter,
  ) => {
    // Here you need to return a Promise, and you can transform the data before returning it
    // If you need to transform the parameters you can change them here
    const {
      data: { result: data, total },
    } = await axios.get<{
      result: Record<string, unknown>[];
      total: number;
    }>('/api', {
      params: { page: current, pageSize, ...params },
    });
    return {
      data,
      // not passed will use the length of the data, if it is paged you must pass
      total,
      // Please return true for success.
      // otherwise the table will stop parsing the data, even if there is data
      success: true,
    };
  }}
/>

Attributes

| Name | Description | Type | Default Value | | --- | --- | --- | --- | | request | How to get dataSource | (params?: {pageSize,current},sort,filter) => {data,success,total} | - | | params | Additional parameters used for request query, once changed will trigger reloading | object | - | | cardBordered | Border of Card components around Table and Search | boolean \| {search?: boolean, table?: boolean} | false | | cardProps | Card's props which wrap the Table, not displayed when set to false | false | CardProps | - | | toolbar | Transparent transmission of ListToolBar configuration items, not displayed when set to false | false | ListToolBarProps | | | options | table toolbar, not displayed when set to false | {{ reload: boolean \| function, density?: boolean, setting: boolean, fullScreen: boolean \| function }} | { reload :true, density: true, setting: true } |

Slots

| Name | Description | Tag | | --- | --- | --- | | actions | Render toolbar actions area | v-slot:actions | | settings | Render toolbar settings area, will overwrite the options | v-slot:settings |

Events

| Name | Description | Arguments | | --- | --- | --- | | load | Triggered after the data is loaded, it will be triggered multiple times | (dataSource: T[]) => void | | requestError | Triggered when data loading fails | (error: Error) => void |

ListToolbar

Toolbar section for customizing forms.

ListToolBarProps

Toolbar configuration properties for lists and tables

| Parameters | Description | Type | Default | | --- | --- | --- | --- | | title | title | not implemented | - | | subTitle | subTitle | not implemented | - | | description | description | not implemented | - | | search | query area | not implemented | - | | actions | actions area | false \| VNode[] | - | | settings | settings area | false \| (VNode \| Setting)[] | - | | filter | The filter area, usually used with LightFilter | not implemented | - | | multipleLine | Whether to display multiple lines | not implemented | - | | menu | menu configuration | not implemented | - | | tabs | Tabs configuration, only valid if multipleLine is true | not implemented | - |

Setting

| Parameters | Description | Type | Default | | --- | --- | --- | --- | | icon | icon | ReactNode | - | | tooltip | tooltip Description | string | - | | key | operation unique identifier | string | - | | onClick | set to be triggered | (key: string)=>void | - |