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

@beisen-phoenix/group-single-select

v3.3.55

Published

## 注意:该组件即将废弃,我们将不再新增特性。如需使用新特性请替换为该组件:@beisen-phoenix/select-list

Downloads

692

Readme

分组弹层

注意:该组件即将废弃,我们将不再新增特性。如需使用新特性请替换为该组件:@beisen-phoenix/select-list

API属性如下:

成员|说明|类型|默认值 ---|:--:|:--:|--- value|弹层的选中值 |string|- size|分组弹层的尺寸 small(170px) large(340px) auto(与父级自适应) 若与非模态弹层一块使用, 则使用弹层的size属性即可 |string|- font|字体大小 small(12px) large(14px) |Function|- loading|加载状态|Boolean|false options|选项值|optionsType |- isSearch|是否显示输入框|Boolean |false searchWord|搜索的初始值|string|- onChange|弹层的改变选项时的回调函数|Function({label, value})|- validateSearch|自定义搜索验证规则函数|(searchValue:string) => {value:string,info:value}| hasShadow| 是否有阴影|Boolean| false userDefinedComponent|自定义元素|--|-- isShowTitle|是否显示没有选项的分类的标题|boolean|true extraCls | 自定义组件容器class,一般用于覆盖组件默认样式使用| string | 无 autoFocus | 首次挂载时是否自动获取焦点(2019-10-15新增) | boolean | false

2019-07-12新增api | extraCls | 自定义组件容器class,一般用于覆盖组件默认样式使用| string | 无| No |

代码示例

<GroupSingleSelect
value={value}
singleOptions=[{
  label: '增加',
  value: 'add'
}] 
options=[{
  label: "分类一",
  children:[{label: "员工1", value: "staff1"}]
}]
font="small" 
onChange={this.onChange} 
/>

optionsType类型

为了实现一些业务场景,联合显示普通单选和分组单组的情况,且为了不改变数据结构,将普通的单选值放在children中且label为空,即:

const options = [{
  children: [{
    label: '增加',
    value: add
  }]
}, {
  label: '分类一',
  children: [{
    label: '员工',
    value: 'staff'
  }]
}]

validateSearch函数说明

该函数为搜索框的自定义验证函数,一般用来验证搜索内容的长度。通过该函数,你可以自定义验证规则,并且当搜索字符串不满足你的验证规则的时候,你可以改变搜索字符串并在组件中给出你的自定义提示内容

/**
	@param val 搜索的字符串
	@return {value: '你自定义的字符串',info:'你自定义的提示信息'}
*/

const validateSearch = (val) => {
  let res = {value:val,info:''}
  if(val.length > 3) {
    return {value: val.slice(0,3),info: '搜索字符不能大于3个'}
  }
  return res
}

多语言

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | translation | 语言包 用于翻译组件内置常量 | {noData: string} | {noData: '这里什么都没有...'} |