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

@monsterooo/list-content

v1.7.9

Published

列表查询页面

Downloads

1

Readme


title: ListContent 列表查询页 nav: title: 组件 path: /components order: 1 group: title: ' ' order: 125

ListContent 列表查询页

列表查询页。表单和表格数据联动。

使用

import ListContent from '@monsterooo/list-content';

<ListContent />;

代码演示

基本用法

如何使用 ListContent 的 action 方法

const actionRef = (React.useRef < TableQueryActions) | (null > null);

// onQuery 查询页面,重置分页参数,带上form参数
// onReset 查询页面,先调用form.resetFields,再带上form参数
// onLoad  查询页面,带上form参数。相当于本页刷新,不重置分页参数
const { onQuery, onReset, onLoad } = actionRef;

<ListContent ref={actionRef} />;

切记不要直接调用 fetchData 方法,应该使用上面三个语义化的方法执行查询。

API

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | formProps | 表单属性,同@monsterooo/form | object | - | | tableProps | 表格属性,同@monsterooo/table | object | - | | fetchData | 请求数据方法 ,params 包含表单数据(如果有)、分页参数 | (params) => Promise | - | | pageSizeKey | 设置 fetchData params 中返回的分页大小 key | string | pageSize | | currentKey | 设置 fetchData params 中返回的当前页面 key | string | current | | autoQuery | 是否进页面查询一次 | boolean | true | | action | 用于渲染查询按钮,内置了一组查询按钮,传此参数会覆盖默认行为 | ReactNode | - | | toolbar | 用于渲染操作栏 | ReactNode | - | | toolbarPosition | 操作拦内容渲染位置 | left|right | left | | allowInputIgnoreEmpty | 允许 input 输入框将空字符串转换成undefined,配置此属性后将强制给 fields 的 props 属性(当 props 为函数时需自行处理)追加ignoreEmptyString: true。 | boolean | false | | cachedQuery | 缓存搜索参数 | false | CachedQuery | false | | showCollapse | 是否开启展开收起功能 | - | false | | collapseProps | 受控的展开收起功能,配置展开收起初始化状态,并监听状态发生变化时回调 | CollapseProps | - |

CachedQuery

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | externalPaths | 额外路径,配置后从该路径返回也会缓存查询条件 | string[] | - | | onReady | 从二级页面返回后页面 ready 钩子 | (params: Record<string, any>, extraCache: Record<string, any>) => void | - | | extraCache | 额外需要保存的参数(比如页面勾选数据,动态数据需要使用函数,且键值需要 ref.currrent 传递) | Record<string, any> | () => Record<string, any> | - |

CollapseProps

| 参数 | 说明 | 类型 | 默认值 | | ---------- | ---------------------- | --------------------------- | ------ | | collapsed | 指定当前展开状态 | boolean | - | | onCollapse | 展开状态发生变化时回调 | (collapsed:boolean)=>void | - |