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

candy-data-matrix

v0.1.0

Published

数据矩阵

Downloads

11

Readme

CandyDataMatrix

适用于Angular项目,构建矩阵显示。

使用样例

安装方式

npm i candy-data-matrix

在对应module.ts中:

import {CandyDataMatrixModule} from "candy-data-matrix";

@NgModule({
  imports: [
    ...
    CandyDataMatrixModule
  ]
})

在html中:

    <candy-data-matrix #dataMatrix
        [rowData]="rowDataList" [columnData]="columnDataList"
        [matrixMapData]="matrixMappingData" 
        [buttonContentTemplate]="btnContent" [settingsContentTemplate]="dataSelectorBtn"
        (onMatrixDataSelected)="showRuleDetailModal($event)"
    ></candy-data-matrix>

example1

用户需要传入 rowDatacolumnData 对应的数据来定义第一类和第一行对应的数据,同时设定 matrixMapData 来定义行列两两相交时候的关系数据

buttonContentTemplate 对应每组数据相交的时候按钮显示的内容 settingsContentTemplate 对应左上角第一格的位置,可用于显示设置按钮之类的内容。

配置项

| 参数 | 说明 | 类型 | 默认值 | 例子 | | ---- | ---- | ---- | ---- | --- | | [rowData] | 行对应的数据 | MatrixData[] | [] | 详情请见注意项1 | | [columnData] | 列对应的数据 | MatrixData[] | [] | 详情请见注意项1 | | [matrixMapData] | 行列相交的对象对应的数据 | MatrixMapData[] | [] | 详情请见注意项2 | | [buttonContentTemplate] | 行列相交的对象按钮显示的内容 | TemplateRef<{ $implicit: data }> | null | | | [settingsContentTemplate] | 行列相交的对象按钮显示的内容 | TemplateRef<void> | null | | | (onMatrixDataSelected) | 行列相交的对象按钮点击的时候返回的数据 | EventEmitter<any> | null | 详情请见注意项3 |

注意事项

  1. MatrixData 类型:

    export class MatrixData {
      id: number;
      name: string;
      metaData: any;
      constructor(data: any, id: any, name: string) {
        this.id = id;
        this.name = name;
        this.metaData = data;
      }
    }

    其中id用于限定数据唯一性,name用于矩阵中的显示内容,metaData代表元数据。

  2. MatrixMapData 类型:

    export class MatrixMapData {
     rowId: number;
     columnId: number;
     metaData: any;
     constructor(data: any, rowId: any, columnId: number) {
       this.rowId = rowId;
       this.columnId = columnId;
       this.metaData = data;
     }
    }

    MatrixMapData 数据用于将行列数据关联起来,rowId对应行数据中的id, columnId对应列数据中的id;metaData用于表示两者相关的时候所需要的元数据

  3. 数据返回的格式为

    {
      row: rowData.metaData,
      column: columnData.metaData,
      mapData: matrixMapData.metaData : null
    }