Socket
Book a DemoInstallSign in
Socket

@aligov/bops-site-select

Package Overview
Dependencies
Maintainers
16
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aligov/bops-site-select

站点选择

latest
npmnpm
Version
2.0.2
Version published
Weekly downloads
9
125%
Maintainers
16
Weekly downloads
 
Created
Source

站点选择

@aligov/bops-site-select

站点选择

返回所有选择的子节点的 value。

如果一个节点下的所有子节点都已选择,那么展示父节点,返回的 value 依然是所有选择的子节点的 value。

基础功能

import SiteSelect from '@aligov/bops-site-select';

<SiteSelect />

基于基础的功能又做了下面的定制。

单选

import { SingleSiteSelect } from '@aligov/bops-site-select';

<SingleSiteSelect />

服务范围

import { ServiceRange } from '@aligov/bops-site-select';

<ServiceRange />

当前站点

import { CurSiteSelect } from '@aligov/bops-site-select';

<CurSiteSelect />

其他相关导出

  • SiteContextProvider:站点 context provider
  • SiteContextConsumer: 站点 context consumer
  • useSiteContext:获取站点 context 的 hook
  • CurSiteSelectProvider: 当前站点 context provider,提供了 { site, changeSite } 的 value
  • CurSiteSelectWithCtx:内置了 CurSiteSelectProvider,不需要手动引入
  • CurSiteBox:包含了当前站点切换功能的组件,通过 children 来放置其他内容,适用于展台运营等场景
  • useCurSite:一般搭配 CurSiteBox 来使用,用于在 children 中获取当前站点信息

API

参数名说明必填类型默认值备注
rootId根结点 idstring
value选择的值array添加该属性表示受控
queryService数据加载服务(rootId) => Promise<K[]>bops 默认服务用来查询树数据
onChange选择变更后触发的函数(value) => void一般搭配 value 来做受控
multiple是否多选booleantrue
returnLeafValue多选时是否返回叶子结点的值而非使用父节点替代booleantrue
className扩展 treeSelect 的 classNamestringmod-bops-site-select
popupClassName扩展 treeSelect 下拉的 classNamestringmod-bops-site-select-poup

queryService 需要返回一个数组,数组元素类型是 K,其至少需要包括 key, valuelabelparentId (父结点的 vlaue,无则为 null)属性。

基于 TreeSelect 组件,具体参考该组件的文档。

Keywords

ice

FAQs

Package last updated on 11 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts