npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

hc-mind

v1.0.12

Published

基于jsmind二次开发的可视化插件

Readme

hc-mind

一个 Vue 组件 ( 基于 jsmind )二次开发新增异步加载子节点、动态节点样式、 动态节点提示框、动态菜单、拖拽回调、整图拖拽等常用功能 节点基础操作增删改查api请参考jsmind文档

效果

example

安装

yarn add hc-mind # or npm install hc-mind

快速开始

import jm from 'hc-mind';
Vue.use(jm);

if (window.jsMind) {
  console.log('hc-mind start...');
  Vue.prototype.jsMind = window.jsMind;
}

使用

<js-mind :values="mind" :options="options" ref="jsMind" height="500px"></js-mind>

参数

  • 是否异步加载子节点
asyncNext:true // false
/**
 * 请求下一层节点数据
 * node 当前节点
 * return 当前及子节点
 * nextLevelFn 返回promise模拟接口返回效果
 * 返回结构为
    {
        nodeid:node.id,
        topic:node.topic,
        child:[]
    }
    child为当前节点子节点 hasNextNode【是否有子节点】
 */
nextLevelFn: function (node) {
  return new Promise(function(resolve, reject) {
    setTimeout(() => {
      let newNode={
        nodeid:node.id,
        topic:node.topic,
        child:[]
      }
      for (let index = 0; index < 2; index++) {
          var nodeid = jsMind.util.uuid.newid();
          var topic = "new Node";
          var data={
              hasNextNode:false
          }
          if (index%2 ==0) {
              data.hasNextNode=true
          }else{
              data.hasNextNode=false
          }
          newNode.child.push(
            {
              nodeid:nodeid,
              topic:topic+nodeid,
              data:data
            }
          )
      }
      resolve(newNode);
    }, 1000);
  });
},
  • 动态设置节点样式
/**
 * 根据节点某字段设置类名
 * node 当前节点
 * classRes 处理类名
 */
classFn: function(node) {
  let { quote, bindData, bindProduct } = node.data;
  let classRes = "";
  /**
   * quote        0 非引用    1 引用
   */
  if (quote) {
      classRes += " quote";
  } else {
      classRes += " node";
  }
  return classRes;
}
  • 动态设置节点提示框

/**
 * tooltip
 * node 当前节点
 * 返回提示框信息数组
 */
 
tooltipFn: function(node) {
  if (node.isroot) {
    return [
      {
        label: "根节点名称",
        value: node.topic
      }
    ];
  } else {
    return [
      {
        label: "节点名称",
        value: node.topic
      },
      {
        label: "节点ID",
        value: node.id
      }
    ];
  }
}
  • 拖拽节点回调
/**
 * 拖拽回调函数
 * src 操作节点
 * target 拖拽至目标节点
 */
dragFn: function(src, target) {
  return new Promise(function(resolve, reject) {
    setTimeout(() => {
      resolve(1); // 返回为true即放行 反之失败
    }, 1000);
  });
}
  • 菜单
  /**
   * 重新初始化菜单
   * node 操作节点
   */
  initMenu: function(node) {
    if (!node) {
      return [];
    }
    if (node.isroot) {
      _this.options.menuOpts.injectionList = [ {
          target: "indexDetail",
          text: "查看信息",
          callback: function(node) {
            console.log("查看信息:", node);
            alert(`查看信息:${node.topic}`)
          }
        }]
    }else{
      _this.options.menuOpts.injectionList = [{
          target: "indexDetail",
          text: "查看信息",
          callback: function(node) {
            console.log("查看信息:", node);
          }
        },
        {
          target: "addChild",
          text: "新增子级",
          callback: function(node) {
            console.log("新增子级:", node);
          }
        }]
    }
  }

使用例子

https://github.com/zhenzp/hc-mind
yarn #or npm install
yarn run dev #or npm run dev