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 🙏

© 2024 – Pkg Stats / Ryan Hefner

zxr-ui

v0.0.2

Published

okr align map, many-to-many relationship

Downloads

25

Readme

Getting Started

This is a demo, which is under development. Please look forward to it

Install dependencies,

$ npm i zxr-ui

联系/contact

 [email protected]

TodoList

 1.Documentation will be improved in the future /补充文档
 2.Optimize code to improve performance /优化代码,处理bug
 3.Add animation /增加动画

介绍/Introduction Alt

Demo:

import React from 'react';
import { DagreMap, Rank } from 'zxr-ui';
import ''

interface ICard {
  id: number | string;
  up?: ICard[];
  down?: ICard[];
  upLength: number;
  downLength: number;
  [propName: string]: any;
}

interface INode extends ICard {
  uuid: number;
  rank: number;
  rootUUID: number;
  parentID: number | null;
  visible?: boolean;
  hideUp?: boolean;
  hideDown?: boolean;
  [propName: string]: any;
}

// 样式参数设置
enum DEFAULT_STYLE {
  OFFSET_L = 40, // 整体距离页面左边的初始间距。
  OFFSET_R = 40, // 整体距离页面右边的初始间距。
  OFFSET_TOP = 20, // 图层组元素的初始纵向间距
  NODE_OFFSET_Y = 30, // 每个图层组元素的纵向间距
  NODE_OFFSET_X = 100, // 元素左右之间间距 100,
  CR = 8, // 收缩展开按钮圆形半径,是元素之外的位置 ,同时距离元素margin也是一个半径.
  NODE_WIDTH = 340, // 元素本身宽度,
  NODE_HEIGHT = 124, // 元素本身高度,
}

// 节点朝向, root 根节点 up上节点 down下节点
enum ARROW_DIR {
  UP = -1,
  DOWN = 1,
  ROOT = 0,
}

type TArrow = ARROW_DIR.UP | ARROW_DIR.DOWN | ARROW_DIR.ROOT;

interface IFieldNames {
  id: string;
  up: string;
  down: string;
  upLength: string;
  downLength: string;
}

export default () => {
  let dataList: ICard[] = [
    {
        id:1,
        name:'i am root one',
        upLength:2,
        up:[
            {
                id:3,
                name:'i am his up children one',
                upLength: 2,
                up:[], //when up.length !== upLength,show +,can use fetchMoreData
                downLength: 0,
            },
            {
                id:4,
                name:'i am his up children two',
                upLength:0,
                downLength: 0,
                up:[]
            }
        ],
        downLength:1,
        down:[
            {
                id:5,
                name:'i am his down children one',
                upLength:0,
                downLength:0,
            },
        ]
    },
    {
        id:2,
        name:'i am root two',
        upLength:0,
        downLength:0,
    },
  ]

  return (
    <DagreMap
      renderChild={(info: INode) => {
        return <div style={{width:'100%',height:'100%',border:"1px solid #aaa",borderRadius:'8px'}}>{info.uuid}我是自己diy的节点样式</div>;
      }}
      data={dataList}
      fetchMoreData={(info: INode, direction: TArrow): Promise<{data: ICard[]}> => {
        // 异步返回下一级节点 {data:[],code:200,msg}
        return new Promise((res, rej) => {
          res({ data: [] });
        });
      }}
      offset={{
        left: DEFAULT_STYLE.OFFSET_L,
        top: DEFAULT_STYLE.OFFSET_TOP,
        right: DEFAULT_STYLE.OFFSET_R,
      }}
      nodeStyle={{
        offsetY: DEFAULT_STYLE.NODE_OFFSET_Y,
        offsetX: DEFAULT_STYLE.NODE_OFFSET_X,
        width: DEFAULT_STYLE.NODE_WIDTH,
        height: DEFAULT_STYLE.NODE_HEIGHT,
        circleWidth: DEFAULT_STYLE.CR,
      }}
      fieldNames={{
        id: 'id', // id,用来request,
        up: 'up', // root节点的up子节点 === left
        down: 'down', // root节点的down子节点 === right
        upLength: 'upLength', // 上子节点个数,控制是否可以新增
        downLength: 'downLength', //下子节点个数,控制是否可以新增
      }}
    ></DagreMap>
  );
};