JSPM

  • Created
  • Published
  • Downloads 67313
  • Score
    100M100P100Q146870F
  • License MIT

Package Exports

  • treemate

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (treemate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

treemate · Coverage Status

Help people who want to write a tree component.

TODO

  • checked keys & indeterminate keys
  • basic test
  • lint
  • check action & uncheck action
    • full test
    • batch check & batch uncheck
      • feature
      • API cleaning
      • test
    • functional disabled prop
  • async patches support non-complete-data
    • support check & uncheck action on partial complete tree
      • implemented
      • well tested
    • throw error on non-complete tree

Usage

const { TreeMate } = require('treemate')

const tree = [
  {
    key: '0',
    children: [
      {
        key: '0-0'
      },
      {
        key: '0-1'
      }
    ]
  }
]

const treemate = TreeMate(tree)

let result = treemate.getCheckedKeys(['0'])
// {
//   checkedKeys: ['0', '0-0', '0-1'],
//   indeterminateKeys: []
// }
checkedKeys = treemate.uncheck('0-1', result)
// {
//   checkedKeys: ['0-0'],
//   indeterminateKeys: ['0']
// }
checkedKeys = treemate.check('0-1', result)
// {
//   checkedKeys: ['0', '0-0', '0-1'],
//   indeterminateKeys: []
// }