1.0.7 • Published 1 year ago

@illa-design/tree-select v1.0.7

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
1 year ago

TreeSelect

It is a selector which displays options in a tree.

Installation

yarn add @illa-design/treeselect

Import component

import { TreeSelect } from "@illa-dedign/treeselect"

API

TreeSelect Basic Properties

PropsDescTypeDefault
multipleWhether to allow selecting multiple treeNodesboolean-
defaultValueSet defalut value in inputstring | string[] | { label: ReactNode; value: string; disabled?: boolean } | { label: ReactNode; value: string; disabled?: boolean }[]-
valueSet valuestring | string[] | { label: ReactNode; value: string; disabled?: boolean } | { label: ReactNode; value: string; disabled?: boolean }[]-
treeDataGenerate tree structure by structured dataTreeSelectDataType[]-
labelInValueSet value's formatboolean-
treeCheckableWhether to add a Checkbox before the treeNodesboolean-
treeCheckStrictlyWhether associate parent treeNode and children treeNode when they are checkableboolean-
treePropsSet tree's propertiesPartial<TreeProps>-
triggerPropsSet trigger's propertiesPartial<TriggerProps>-
notFoundContentSet the content when treeData is emptyReactNode-
placeholderSet placeholderstring-
showSearchWhether allow searchboolean | { retainInputValue?: boolean; retainInputValueWhileSelect?: boolean }-
sizeSet selector's size"small" | "medium" | "large""medium"
disabledwhether the selector is disabledboolean-
errorwhether the selector is errorboolean-
loadingwhether the selector is loading statusboolean-
allowClearWhether allow clear valuesboolean-
allowCreateWhether allow create new valuesboolean-
maxTagCountSet maxmium number of tags which is selectednumber-

Steps Events

PropsDescTypeDefault
filterTreeNodeFilter data based on entered value(inputText, treeNode: any) => boolean | void-
onChangeCallback when value is changed(value: any) => void-
loadMoreCallback when dynamic load tree node(treeNode: NodeProps, dataRef) => void-
onSearchCallback when search value is changed(inputValue: string) => void-
onClearCallback when clicked clear(visible: boolean) => void-
onVisibleChangeCallback when the visibility of the popup is changed(visible: boolean) => void-
onClickclicks on the drop-down box(e) => void-

Example

Basic usage

const TreeData = [
  {
    title: 'Trunk 0-0',
    key: '0-0',
    children: [
      {
        title: 'Leaf',
        key: '0-0-1',
      },
      {
        title: 'Branch 0-0-2',
        key: '0-0-2',
        disableCheckbox: true,
        children: [
          {
            title: 'Leaf',
            key: '0-0-2-1'
          }
        ]
      },
    ],
  },
  {
    title: 'Trunk 0-1',
    key: '0-1',
    children: [
      {
        title: 'Branch 0-1-1',
        key: '0-1-1',
        checkable: false,
        children: [
          {
            title: 'Leaf',
            key: '0-1-1-1',
          },
          {
            title: 'Leaf',
            key: '0-1-1-2',
          },
        ]
      },
      {
        title: 'Leaf',
        key: '0-1-2',
      },
    ],
  },
];
<TreeSelect
  multiple
  showSearch
  allowClear
  treeData={TreeData}
/>
1.0.7

1 year ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.10

2 years ago

0.0.11

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.9

2 years ago

0.0.16

2 years ago

0.0.17

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago