How to use the rc-tree/lib/util.convertTreeToEntities function in rc-tree

To help you get started, we’ve selected a few rc-tree examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ant-design / ant-design / components / tree / DirectoryTree.tsx View on Github external
constructor(props: DirectoryTreeProps) {
    super(props);

    const {
      defaultExpandAll,
      defaultExpandParent,
      expandedKeys,
      defaultExpandedKeys,
      children,
    } = props;
    const { keyEntities } = convertTreeToEntities(children);

    // Selected keys
    this.state = {
      selectedKeys: props.selectedKeys || props.defaultSelectedKeys || [],
    };

    // Expanded keys
    if (defaultExpandAll) {
      this.state.expandedKeys = getFullKeyList(props.children);
    } else if (defaultExpandParent) {
      this.state.expandedKeys = conductExpandParent(
        expandedKeys || defaultExpandedKeys,
        keyEntities,
      );
    } else {
      this.state.expandedKeys = expandedKeys || defaultExpandedKeys;
github ant-design / ant-design / components / tree / util.ts View on Github external
export function getFullKeyList(children: React.ReactNode | React.ReactNode[]) {
  const { keyEntities } = convertTreeToEntities(children);
  return Object.keys(keyEntities);
}