项目作者: buoyad

项目描述 :
Excel-esque datasheet for Angular 2
高级语言: TypeScript
项目地址: git://github.com/buoyad/ngDatasheet.git
创建时间: 2017-04-05T01:16:44Z
项目社区:https://github.com/buoyad/ngDatasheet

开源协议:MIT License

下载


NgDatasheet

Datasheet component for Angular 2 that allows user interaction and prettified display alike.

Notice

This component is still under development. Breaking changes are subject to release with no notice.

Installation

npm install --save ngdatasheet

Usage

Import NgDatasheetModule into your NgModule:

  1. ...
  2. import { NgModule } from '@angular/core';
  3. import { NgDatasheetModule } from 'ngdatasheet/ngdatasheet';
  4. ...
  5. ...
  6. @NgModule({
  7. imports: [ NgDatasheetModule ]
  8. ...

In your component define a 2-D data array:

  1. public data: any[][] = [
  2. ['Item', 'Unit price', 'Quantity', 'Price'],
  3. ['Joy Division shirt', 25, 4, 100],
  4. ['Cutoff jeans', 30, 24, 720],
  5. ['Peeps', 1.25, 100, 125],
  6. ['Subtotal', , , 945],
  7. ['Tax', , '3.0%', .03*945],
  8. ['Total', , , 945 + .03*945]
  9. ]

And bind to it in your template:

  1. <ng-datasheet [(data)]="data"></ng-datasheet>

Output:

Planned Features

  • Inline expression evaluation
  • data property:
    • Support for relative expressioning via property
    • Support for defining cells as read-only
    • Support for inline templating with the following API:
      • Defining templates within the <ng-datasheet></ng-datasheet> using a directive
      • Injecting <ng-template> with selector as supplied in the appropriate spot in the data array