# gdtshi

> create npm package with typescript

Latest version **1.9.2** (published 2021-05-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install gdtshi
pnpm add gdtshi
yarn add gdtshi
bun add gdtshi
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.9.2 |
| Published | 2021-05-12 |
| First published | 2021-04-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 36.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | pangxiaochen |
| Maintainers | dangou |
| Keywords | typescript |

## Links

- npm: https://www.npmjs.com/package/gdtshi
- Repository: https://github.com/pangxiaochen/tshi
- Homepage: https://github.com/pangxiaochen/tshi#readme
- Issues: https://github.com/pangxiaochen/tshi/issues
- npm.io page: https://npm.io/package/gdtshi

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.9.2 (latest) — 2021-05-12
- 1.9.1 — 2021-04-30
- 1.8.9 — 2021-04-30
- 1.8.8 — 2021-04-30
- 1.8.7 — 2021-04-30
- 1.8.6 — 2021-04-26
- 1.8.5 — 2021-04-26
- 1.8.4 — 2021-04-26
- 1.8.3 — 2021-04-26
- 1.8.2 — 2021-04-26
- 1.8.1 — 2021-04-26
- 1.7.1 — 2021-04-25
- 1.4.0 — 2021-04-24
- 1.3.0 — 2021-04-24
- 1.0.2 — 2021-04-06
- … 1 more at https://npm.io/package/gdtshi/versions

## README

# Install
```
npm install gdtshi
```
# Import
```
import {TreeTable, TreeTableNode, TreeTableOptions} from "gdtshi";
```
# TreeTabel usage
## tree.component.ts
```
import {Component,OnInit} from '@angular/core';
import {TreeTable, TreeTableNode, TreeTableOptions} from "gdtshi";
@Component({
  selector: 'tree',
  templateUrl: './tree.component.html',
  styleUrls: ['./tree.component.scss']
})
export class TelemetryTreeComponent extends TreeTable<TreeTableNode> implements OnInit {

  constructor() { super();}

  ngOnInit(): void {
    this.reload();
  
  }
  reload(){
    this.getInfo();
  }
  getInfo(id:string){
    this.telCtl.getSubscriptionInfosByGroupId(id).subscribe(
      res => {
        this.setTreeData(res)
      },
      failed => {
        // TODO
      }
    );
  }
  setTreeData(data){
    this.treeData=this.setTreeDataCommon(data);
    this.goSetTree();
  }
  goSetTree(){
    let options: TreeTableOptions<TreeTableNode> = {
      compare: this.compare,
      nodes: this.treeData
    };
    this.setOptions(options);
  }
  compare(nodeA:any, nodeB:any): number {
    return 1;
  }
 treeOd(id:string){
   this.deleteNodeGroup(this.getNodeById(id))
 }
  getNodeById(id) {
    return this.getNode((n) => {
      return n.id === id ? 0 : -1;
    });
  }
  treeAvc(id:string,values:Object){
    let node=this.getNodeById(id);
    for(let [k,v] of Object.entries(values)){
        node.eq[k]=v
    }
  }
  setTreeDataCommon(data):TreeTableNode[]{
    let treeData=[];
    data.forEach((sItem,index)=>{
      let item={
        id:sItem.id,
        eq:sItem,
        children:[]
      };
    });
    return  treeData
  }
 }
 ```
 ## tree.component.html (The UI framework of ng-zorro is used)
 
 ```
 <nz-table  class="table table-hover mt-3" #basicTable [nzData]="shownNodes()">
  <thead>
  <tr>
    <th>{{'i18n_neName'|i18n}}</th>
    <th>{{'i18n_subscriptions.state'|i18n}}</th>
    <th>{{'i18n_startTime'|i18n}}</th>
    <th>{{'i18n_endTime'|i18n}}</th>
  </tr>
  </thead>
    <tbody  *ngIf="getTableModel().length> 0; else emptyTreeTable">
     <tr  *ngFor="let node of basicTable.data">
      <td >
        <div [ngStyle]="{'padding-left':node._node.padding}">
          <div *ngIf="node.children && node.children.length>0; else treeTableNoChild">
            <div *ngIf="node._node.collapsed == true ; else uncollapsedSign">
              <div>
                <i class="fas fa-angle-right" style="font-size:18px" (click)="uncollapse(node)" *ngIf="node.children.length>0"></i>
                <ng-container *ngIf="node['eq'].subscriptionState !=undefined">
                     {{node['eq'].entityId.userLabel}}
                </ng-container>
                <ng-container *ngIf="node['eq'].subscriptionState==undefined &&node['eq'].entityId !=undefined">
                  <span (click)="uncollapse(node)" style="padding-left: 1rem">{{node['eq'].entityId.userLabel}}</span>
                </ng-container>
              </div>
            </div>
            <ng-template #uncollapsedSign>
              <div>
                <i class="fas fas fa-angle-down" style="font-size:18px" (click)="collapse(node)" *ngIf="node.children.length>0"></i>
                <ng-container *ngIf="node['eq'].subscriptionState !=undefined">
                  {{node['eq'].entityId.userLabel}}
                </ng-container>
                <ng-container *ngIf="node['eq'].subscriptionState==undefined && node['eq'].entityId !=undefined">
                  <span (click)="uncollapse(node)" style="padding-left: 1rem">{{node['eq'].entityId.userLabel}}</span>
                </ng-container>
              </div>
            </ng-template>
          </div>
          <ng-template #treeTableNoChild>
            <ng-container *ngIf="node['eq'].name !=undefined">
            {{node['eq'].name}}
          </ng-container>
          </ng-template>
        </div>
      </td>
       <td>
         <ng-container *ngIf="node['eq'].entityId !=undefined && node['eq']?.subscriptionState">
          {{node['eq'].subscriptionState}}
         </ng-container>
       </td>
       <td>{{node['eq'].startTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
       <td>{{node['eq'].endTime | date:'yyyy-MM-dd HH:mm:ss'}}</td>
    </tr>
    </tbody>
</nz-table>
```
# tshi
[![Build Status](https://travis-ci.com/pangxiaochen/tshi.svg?branch=main)](https://travis-ci.com/pangxiaochen/tshi)

---
_Source: https://npm.io/package/gdtshi · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
