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

@rax-ui/filter-combo-container

v1.0.0-beta.15

Published

--- display: @rax-ui/filter-combo-container family: other ---

Downloads

1

Readme


display: @rax-ui/filter-combo-container family: other

@rax-ui/filter-combo-container

用作 Filter 场景的业务组件组合容器,它只是一个滚动容器,包含 重置确认选择按钮 和一些方法,内部渲染由 config 数组传递 子组件和 子组件props 来决定,详见 Demo

Feature

  • 1、内部组件可动态扩展
  • 2、容器统一封装,开发者无需关心容器实现,按照规范抛出结果即可
  • 3、统一封装,必然有一些规范,规范如下

接入容器中的组件:规范约定

  • 组件必须暴露 reset 重置选中值方法供容器调用:Function() => filterParam
  • 组件必须暴露 getFilterParam 获取选中值方法供容器调用:Function() => filterParam
  • 组件 onChange(filterParam) 回调函数返回形参 filterParam
// filterParam 格式
interface FilterParam {
  filterKey: string | number;
  filterText?: string;
  filterValue: any;
  // 和默认筛选值比较,筛选值是否变更
  filterValueChanged?: boolean;
}

预览图

预览图

API

Props

|名称 | 说明 | 类型 | 默认值 | |:---------------|:--------|:----|:----------| | styles | 自定义样式 | { [key:string]: CSSProperties} | {} | | config| 组合的组件配置数组(Component 属性必传,此处用 多选组件) | Array | [] | | filterKey| filterKey | String | 'more'| | resetButtonText| 重置按钮文字 | String | '重置'| | confirmButtonText| 确认按钮文字 | String | '确定选择'| | enableScroll| 开启滚动 | Boolean | true | | iphonexCompatible| iPhoneX 兼容性处理 | Boolean | true |

这里的 MultiSelect写法规范就是 Filter.Panel 子组件书写规范,详见 @rax-ui/filter 组件文档

config = [
  {
    Component: MultiSelect, // Component必传,此处用 多选组件
    {...compProps} // 如下都是多选组件的 Props
  },
  {
    Component: MultiSelect, // Component必传,此处用 多选组件
    {...compProps} // 如下都是多选组件的 Props
  },
]

方法

|名称 | 说明 | 类型 | 默认值 | |:---------------|:--------|:----|:----------| | reset | 重置内部选中状态 | Function | | | rootRef | 根节点 ref | Object | |

CSS API

| 名称 | 说明 | |:---------------|:--------| |container| 外层容器样式(可通过此来设置 width, height) | |body| 中间内容样式 | |footer| 底部样式 | |reset__button| 重置按钮样式 | |reset__button__text| 重置按钮文字样式 | |confirm__button| 确认按钮 | |confirm__button__text| 确认按钮文字样式 | |separator| 分隔符样式 |