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

@alicd/crui-address-field

v0.0.68

Published

--- category: Components type: UI Views component: Form chinese: 地址选择框 english: CNAddressField ---

Downloads

10

Readme


category: Components type: UI Views component: Form chinese: 地址选择框 english: CNAddressField

地址单选组件。

API

| 成员 | 说明 | 类型 | 默认值 | | ----- | ----- | ----- | ----- | | value | 当前组件中的地址值,以 JSON 对象的形式表示,其中包含 countryprovincecityareatown 等字段 | object | N/A | | onChange | 用户的选择、清空等交互使地址值变化时所调用的函数参数:value: object 改变后的地址值,可直接设置到 value 属性上nodeChain: [object]value 值对应的地址详细信息,可用来取地名等 | (value: object, nodeChain: [object], nodeChain: [object]) => void | N/A | | defaultValue | 默认选择的地址值,以 JSON 对象的形式表示 | object | { "country": "1" } (默认选择中国) | | className | 自定义类名 | string | N/A | | style | 自定义组件内联样式 | object | N/A | | size | 选择框大小 | "small""medium""large" | "medium" | | name | 可以配合表单Form 收集表单元素的数据,要求表单必须指定 field 属性 | String | "" | | label | label 标签的文本 | ReactNode | - | | rules | 配置表单规则,可以配置多个规则,可参考:async-validator,注意Form 表单必须配置field 属性才会生效 | Array | null | | labelCol | label 标签布局,通 <Col> 组件,设置 span offset 值,如 {span: 8, offset: 16},该项仅在垂直表单有效 | Object | - | | help | 提示信息,如不设置,则会根据校验规则自动生成. 如果设置会受控(ps: 可以利用这点自定义错误位置,详细看demo自定义错误) | ReactNode | - | | validateStatus | 校验状态,如不设置,则会根据校验规则自动生成可选值:'''success'(成功)'error'(失败)'loading'(校验中) | Enum | - | | hasFeedback | 配合 validateStatus 属性使用,是否展示校验状态图标, 目前只有Input支持 | Boolean | false | | wrapperCol | 需要为输入控件设置布局样式时,使用该属性,用法同 labelCol | Object | - | | extra | 额外的提示信息,和 help 类似,当需要错误信息和提示文案同时出现时,可以使用这个。 位于错误信息后面 | ReactNode | - | | inputStyle | 表单输入框自定义内联样式 | Object/String | null | | showValidateType | 应用于Field 类元素后,指定其展示错误的方式,可选值有 helptooltip 两种| String | help | | overseas | 是否显示国家选择列表 | boolean | false | | level | 选择到几级地址,1 为只选择省,4 为从省到街道全部选择(国家选择请使用 overseas 属性) | number | 4 (省、市、区、街道四级全部启用) | | hasClear | 是否显示清空按钮(包含国家和地区选择框上的清空“X”,以及选择器弹层上的“清空”按钮) | boolean | false | | addressSelectPlaceholder | 地址选择框没有值时显示的内容 | string | 请选择地址 | | countrySelectPlaceholder | 国家选择框没有值时显示的内容 | string | 请选择国家 | | disabled | 是否禁止用户编辑地址 | boolean | false | | provincePartition |是否对中国的省级行政区细分以方便用户定位特定省。设置为 "letter" 则会以拼音首字母 "A–G", "H–K", "L–S", "T–Z" 划分。|"letter"|N/A|, | showSearch |是否在省市区选择框中启用搜索,搜索仅限省市区三级地址数据|boolean|false|, | readOnly | 是否禁止用户编辑地址,该属性为 disabled 属性的别名 | boolean | false | | fixedWidth | 是否固定选择器弹层的宽度 | boolean | true | | animation | 是否启用组件的动效 | boolean | true | | container | 指定渲染地址选择弹层的容器,一般不需要设置该属性 | any | 默认为地址组件本身 | | popupProps | 地址选择弹层的属性,参见 SelectField 组件 | object | N/A | | popupClassName | 地址选择弹层的类名 | string | N/A | | countryPopupProps | 国家选择弹层的属性,参见 SelectField 组件 | object | N/A | | countryPopupClassName | 国家选择弹层的类名 | string | N/A | | requestAddressUrl | 国家、省、市、区四级数据的接口地址,默认拉取最新数据,其他数据源:"https://division-data.alicdn.com/simple/addr_4_1111_1.js""https://division-data.alicdn.com/simple/addr_4_1111.js""https://division-data.alicdn.com/simple/addr_4_0001.js""https://division-data.alicdn.com/simple/addr_4_0000.js" 还满足不了,请联系慧仙 新增数据源| string | "//division-data.alicdn.com/simple/addr_4_1111_1_0.js" | | requestTownUrl | 用于街道一级数据的接口地址 | string | "//lsp.wuliu.taobao.com/locationservice/addr/output_address_town.do" | | requestAddressLevelUrl | 用于街道一级数据的接口地址 | string | "//lsp.wuliu.taobao.com/locationservice/addr/outputParentDivisons.do" | | hasToSelectToLastLevel | 用户必须选择到指定的层级,如果为 true,则使用 level 所指定的最后一层,如果为数字则使用相应数字的层级 | boolean|number | false | | partialSelectionOverlayClosable | 如果启用了 hasToSelectToLastLevel,在尚未选择到指定的层级时,是否允许关闭选择弹层(如果为 true 则会关闭弹层,当前弹层内的选择状态由于不满足 hasToSelectToLastLevel 的条件会丢失) | boolean | true | | hiddenData |数据中不做展示的地址 ID 数组,用于去除部分数据。注意不要将该属性误写为 "hidden","hidden" 属性将会将组件隐藏|string[]|[]| | ignored |数据中忽略的地址 ID 数组,用于去除部分数据。注意 hiddenData 与本属性的区别,ignored 会将地址节点从数据中彻底剔除(用户无法选择,且使用被忽略掉的地址进行 setValue() 不被识别),hiddenData 仅仅在展示时隐藏地址节点(用户无法选择),且 ignoreddataOverridepreprocessor 等属性仅在地址数据加载时有效,之后对这些属性的更新均无效。一般推荐使用 hiddenData 属性|string[]|[]| | dataOverride |需要临时复写、增加新的地址数据时使用|{ [addressID: number]: string[] }||{}| | preprocessor |需要对地址数据定制更细致的预处理工作时使用的回调接口,一般优先使用 hiddenData, ignored, dataOverride 等属性,需求无法满足时再考虑使用本属性|(dataRaw: { [addressID: number]: string[] }) => { [addressID: number]: string[] }|默认直接返回第一个参数(不进行任何操作)| | language | 国际化语言可选值:'zh-cn', 'en-us', 'zh-tw' | Enum | 'zh-cn' | | locale | 自定义国际化文案对象 | Object | - |