0.0.5 • Published 6 years ago

inferno-tree-select v0.0.5

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
6 years ago

Inferno Tree Select

pipeline status npm version

A select for tree using Inferno.

sample select

Repository

grauwoelfchen/inferno-tree-select (GitLab.com)

Usage

See example about detail of usage as Component.

import { render } from 'inferno';
import { h } from 'inferno-hyperscript';

import { TreeSelect } from 'inferno-tree-select';

class MyComponent extedns Component {
  ...

  render() {
     const { options } = this.state;
     return h(TreeSelect, {
       options
     , selected: '4'
     , onSelect: (node) => { console.log(node); }
     });
  }
}

Tree data

A node must have label, value and children.

[{
  "label": "foo",
  "value": "1",
  "children": [{
    "label": "bar",
    "value": "2",
    "children": [{
      "label": "qux",
      "value": "4",
      "children": []
    }, {
      "label": "quux",
      "value": "5",
      "children": []
    }]
  }]
}, {
  "label": "baz",
  "value": "3",
  "children": []
}]

Development

Build

% make build

Lint

% make vet:lint

Test

Unit Test

% make test:unit

Browser (EtoE) Test

% make test:etoe

: if you have `xvfb-run` (for Docker on CI etc.)
% xvfb-run make test:etoe

License

This program is free software: you can redistribute it and/or modify it under the terms of the MIT License.

See LICENSE.

Inferno Tree Select
Copyright (c) 2018 Yasuhiro Asaka
0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago