Compare commits

..

11 Commits

Author SHA1 Message Date
263f7cad77 Update README.md
All checks were successful
Build / Build NPM Project (push) Successful in 29s
Build / Tag Version (push) Successful in 3s
2023-12-16 00:06:45 +00:00
eea71c930e Update .github/workflows/build.yaml
All checks were successful
Build / Tag Version (push) Successful in 7s
Build / Build NPM Project (push) Successful in 1m24s
2023-12-15 04:36:43 +00:00
f630fa677f Update package.json
All checks were successful
Build / Build NPM Project (push) Successful in 1m18s
Build / Tag Version (push) Successful in 5s
2023-12-15 04:31:44 +00:00
3dbb712260 Update package.json
Some checks failed
Build / Build NPM Project (push) Failing after 9s
Build / Tag Version (push) Has been skipped
2023-12-15 04:28:49 +00:00
7830d08332 Update .github/workflows/build.yaml
Some checks failed
Build / Tag Version (push) Successful in 9s
Build / Build NPM Project (push) Failing after 1m26s
2023-12-15 03:25:38 +00:00
acbaff4428 Update .github/workflows/build.yaml
Some checks failed
Build / Tag Version (push) Successful in 5s
Build / Build NPM Project (push) Failing after 1m18s
2023-12-15 03:22:01 +00:00
c983cd9ef6 Update .github/workflows/build.yaml
Some checks failed
Build / Build NPM Project (push) Failing after 27s
Build / Tag Version (push) Has been skipped
2023-12-15 03:18:19 +00:00
ca75517a53 Update .github/workflows/build.yaml
Some checks failed
Build / Build NPM Project (push) Failing after 26s
Build / Tag Version (push) Has been skipped
2023-12-15 03:16:26 +00:00
16f1cc996a Update package.json
Some checks failed
Build / Build NPM Project (push) Failing after 27s
Build / Tag Version (push) Has been skipped
2023-12-15 03:15:43 +00:00
6108cf9398 Update .github/workflows/build.yaml
Some checks failed
Build / Build NPM Project (push) Failing after 27s
Build / Tag Version (push) Has been skipped
2023-12-15 03:06:45 +00:00
1dd363ce37 Update .github/workflows/build.yaml
Some checks failed
Build / Build NPM Project (push) Failing after 27s
Build / Tag Version (push) Has been skipped
2023-12-15 03:04:23 +00:00
3 changed files with 283 additions and 291 deletions

View File

@ -19,20 +19,13 @@ jobs:
- name: Build Project
run: npm run build
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
retention-days: 7
- name: Push to registry
if: ${{github.ref_name}} == "production"
- name: Upload to Registry
uses: ztimson/actions/npm/publish@develop
tag:
name: Tag Version
needs: build
if: ${{github.ref_name}} == develop
runs-on: ubuntu-latest
container: node:8
steps:

464
README.md
View File

@ -1,232 +1,232 @@
<!-- Header -->
<div id="top" align="center">
<br />
<!-- Logo -->
<img src="https://git.zakscode.com/repo-avatars/066f56124662dc95ddacf70bdc8839b98462c885e106728b342abe8bfb5be36a" alt="Logo" width="200" height="200">
<!-- Title -->
### ng-datatable
<!-- Description -->
**Deprecated:** Angular Table Building Library
<!-- Repo badges -->
[![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/ng-datatable/tags&query=$[0].name)](https://git.zakscode.com/ztimson/ng-datatable/tags)
[![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/ng-datatable&query=open_pr_counter)](https://git.zakscode.com/ztimson/ng-datatable/pulls)
[![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/ng-datatable&query=open_issues_count)](https://git.zakscode.com/ztimson/ng-datatable/issues)
<!-- Links -->
---
<div>
<a href="https://git.zakscode.com/ztimson/ng-datatable/releases" target="_blank">Release Notes</a>
<a href="https://git.zakscode.com/ztimson/ng-datatable/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
<a href="https://git.zakscode.com/ztimson/ng-datatable/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
</div>
---
</div>
## Table of Contents
- [ng-datatable](#top)
- [About](#about)
- [Built With](#built-with)
- [Setup](#setup)
- [Production](#production)
- [Development](#development)
- [Documentation](#documentation)
- [NgDatatableComponent](#ngdatatablecomponent)
- [Column](#column)
- [License](#license)
## About
**Deprecated**
A lightweight, feature rich table to display data. It is built with twitter bootstrap in mind so it will be automatically styled if you have the css included but its simple table structure makes it easy to style.
Features:
- Templating columns
- Sorting
- Filtering
- Pagination
- Expanding/Master Detail
- Selection Modes
- Easy CSS
- Mobile column hiding
- Checkboxes
[View on NPM](https://www.npmjs.com/package/@ztimson/ng-datatable)
### Built With
[![Angular](https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular)](https://angular.io/)
[![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://typescriptlang.org/)
## Setup
<details>
<summary>
<h3 id="production" style="display: inline">
Production
</h3>
</summary>
#### Prerequisites
- [Node.js](https://nodejs.org/en/download)
#### Instructions
1. Install package `npm install @ztimson/ng-datatable --save`
2. Import into module
```Typescript
import {NgDatatableModule} from '@ztimsonm/ng-datatable'
@NgModule({
imports: [
NgDatatableModule,
...
],
...
})
export class AppModule { }
```
3. Add to template
```HTML
<ng-datatable [columns]="columns" [data]="data"></ng-datatable>
```
</details>
<details>
<summary>
<h3 id="development" style="display: inline">
Development
</h3>
</summary>
#### Prerequisites
- [Node.js](https://nodejs.org/en/download)
#### Instructions
1. Install the dependencies: `npm install`
2. Start the Angular server: `npm run start`
3. Open [http://localhost:4200](http://localhost:4200)
</details>
## Documentation
### NgDatatableComponent
Exported As: `NgDatatableComponent`
Selector: `ng-datatable`
#### Properties
| Name | Description |
| --------------------------------------------------------- | --------------------------------------------------------- |
| @Input() cssClass: string | Class added to the main table element |
| @Input() columns: Column[] | Columns to display on table |
| @Input() expandedTemplate: TemplateRef<any> | An Angular template to render expanded rows |
| @Input() mobileBreakpoint: number | Hide mobile columns past this point. Default: 768px |
| @Input() pageLength: number | Number of rows per page. Default 20 |
| @Input() page: number | Current page |
| @Input() paginate: boolean | Paginate rows or display all at once. Default true |
| @Input() paginateCssClass: string | Class added to the paginator |
| @Input() selectionMode: null/'single'/'multi' | Allow selecting none, single or multiple rows at once |
| @Input() showCheckbox: boolean | Show checkbox' for mass selecting |
| @Input() tableLayout: 'auto'/'fixed' | CSS table layout. Defaults to 'auto' |
| @Output() filterChanged: EventEmitter<(a, b) => 1/0/-1[]> | Applied filters |
| @Output() finished: EventEmitter<any[]> | Emits when finished processing data |
| @Output() pageChanged: EventEmitter<number> | New page |
| @Output() processing: EventEmitter<any[]> | Emits when processing begins |
| @Output() selectionChanged: EventEmitter<any[]> | Selected rows |
| pagedData: any[] | Array of rows on current page after sorting and filtering |
| processedData: any[] | Array of remaining rows after sorting and filtering |
| selectedRows: Set<number> | Index numbers of rows currently selected |
#### Methods
##### addFilter(...filters)
Add function to filter rows by.
| paramater | Description |
| ----------------------------------- | ------------------------- |
| ...filters: (el, i, arr) => boolean | Filters to add to dataset |
##### changePage(page)
Change the current selected page.
| paramater | Description |
| ------------ | ----------------- |
| page: number | Page to change to |
##### clearFilters(update)
Clear filters being applied to. Update can be set to false to prevent instant filtering in cases where you may be applying filters right after.
| paramater | Description |
| --------------- | ----------------------- |
| update: boolean | Clear filters imedietly |
##### clearSelected()
Clear all selected rows.
#### refresh()
Refreshes the grid
##### selectAll()
Select all rows. Ignores pagination but not filtering.
##### sort(columnIndex: number, desc?: boolean)
Sort the grid by column index
| paramater | Description |
| ------------------- | ---------------------------- |
| columnIndex: number | Column index to sort by |
| desc: boolean | Sort ascending or descending |
##### updateSelected(index)
Virtually click on row causing selection/expanding/collapsing
| paramater | Description |
| ------------- | ------------- |
| index: number | Row to select |
### Column
Exported As: `Column`
#### Properties
| Name | Description |
| -------------------------- | ----------------------------------- |
| cssClass: string | Style to add to column header |
| hide: boolean | Hide column |
| hideMobile: boolean | Hide column on mobile devices |
| initialSort: 'asc'/'desc' | Sort the column initially |
| label: string | Column header label |
| property: string | Property to display in dot notation |
| sort: boolean | Enable/Disable sorting |
| sortFn: (a, b) => 1/0/-1 | Custom function to sort rows by |
| template: TemplateRef<any> | Template to render row with |
| width: number/string | CSS width property |
## License
Copyright © 2023 Zakary Timson | Available under the Apache 2.0 License
See the [license](./LICENSE) for more information.
<!-- Header -->
<div id="top" align="center">
<br />
<!-- Logo -->
<img src="https://git.zakscode.com/repo-avatars/56e7adede041749f5df1d8b88b334e8c4cac38d7a4a574ccb42a624c52a35624" alt="Logo" width="200" height="200">
<!-- Title -->
### ng-datatable
<!-- Description -->
**Deprecated:** Angular Table Building Library
<!-- Repo badges -->
[![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/ng-datatable/tags&query=$[0].name)](https://git.zakscode.com/ztimson/ng-datatable/tags)
[![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/ng-datatable&query=open_pr_counter)](https://git.zakscode.com/ztimson/ng-datatable/pulls)
[![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/ng-datatable&query=open_issues_count)](https://git.zakscode.com/ztimson/ng-datatable/issues)
<!-- Links -->
---
<div>
<a href="https://git.zakscode.com/ztimson/ng-datatable/releases" target="_blank">Release Notes</a>
<a href="https://git.zakscode.com/ztimson/ng-datatable/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
<a href="https://git.zakscode.com/ztimson/ng-datatable/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
</div>
---
</div>
## Table of Contents
- [ng-datatable](#top)
- [About](#about)
- [Built With](#built-with)
- [Setup](#setup)
- [Production](#production)
- [Development](#development)
- [Documentation](#documentation)
- [NgDatatableComponent](#ngdatatablecomponent)
- [Column](#column)
- [License](#license)
## About
**Deprecated**
A lightweight, feature rich table to display data. It is built with twitter bootstrap in mind so it will be automatically styled if you have the css included but its simple table structure makes it easy to style.
Features:
- Templating columns
- Sorting
- Filtering
- Pagination
- Expanding/Master Detail
- Selection Modes
- Easy CSS
- Mobile column hiding
- Checkboxes
[View on NPM](https://www.npmjs.com/package/@ztimson/ng-datatable)
### Built With
[![Angular](https://img.shields.io/badge/Angular-DD0031?style=for-the-badge&logo=angular)](https://angular.io/)
[![TypeScript](https://img.shields.io/badge/TypeScript-3178C6?style=for-the-badge&logo=typescript&logoColor=white)](https://typescriptlang.org/)
## Setup
<details>
<summary>
<h3 id="production" style="display: inline">
Production
</h3>
</summary>
#### Prerequisites
- [Node.js](https://nodejs.org/en/download)
#### Instructions
1. Install package `npm install @ztimson/ng-datatable --save`
2. Import into module
```Typescript
import {NgDatatableModule} from '@ztimsonm/ng-datatable'
@NgModule({
imports: [
NgDatatableModule,
...
],
...
})
export class AppModule { }
```
3. Add to template
```HTML
<ng-datatable [columns]="columns" [data]="data"></ng-datatable>
```
</details>
<details>
<summary>
<h3 id="development" style="display: inline">
Development
</h3>
</summary>
#### Prerequisites
- [Node.js](https://nodejs.org/en/download)
#### Instructions
1. Install the dependencies: `npm install`
2. Start the Angular server: `npm run start`
3. Open [http://localhost:4200](http://localhost:4200)
</details>
## Documentation
### NgDatatableComponent
Exported As: `NgDatatableComponent`
Selector: `ng-datatable`
#### Properties
| Name | Description |
| --------------------------------------------------------- | --------------------------------------------------------- |
| @Input() cssClass: string | Class added to the main table element |
| @Input() columns: Column[] | Columns to display on table |
| @Input() expandedTemplate: TemplateRef<any> | An Angular template to render expanded rows |
| @Input() mobileBreakpoint: number | Hide mobile columns past this point. Default: 768px |
| @Input() pageLength: number | Number of rows per page. Default 20 |
| @Input() page: number | Current page |
| @Input() paginate: boolean | Paginate rows or display all at once. Default true |
| @Input() paginateCssClass: string | Class added to the paginator |
| @Input() selectionMode: null/'single'/'multi' | Allow selecting none, single or multiple rows at once |
| @Input() showCheckbox: boolean | Show checkbox' for mass selecting |
| @Input() tableLayout: 'auto'/'fixed' | CSS table layout. Defaults to 'auto' |
| @Output() filterChanged: EventEmitter<(a, b) => 1/0/-1[]> | Applied filters |
| @Output() finished: EventEmitter<any[]> | Emits when finished processing data |
| @Output() pageChanged: EventEmitter<number> | New page |
| @Output() processing: EventEmitter<any[]> | Emits when processing begins |
| @Output() selectionChanged: EventEmitter<any[]> | Selected rows |
| pagedData: any[] | Array of rows on current page after sorting and filtering |
| processedData: any[] | Array of remaining rows after sorting and filtering |
| selectedRows: Set<number> | Index numbers of rows currently selected |
#### Methods
##### addFilter(...filters)
Add function to filter rows by.
| paramater | Description |
| ----------------------------------- | ------------------------- |
| ...filters: (el, i, arr) => boolean | Filters to add to dataset |
##### changePage(page)
Change the current selected page.
| paramater | Description |
| ------------ | ----------------- |
| page: number | Page to change to |
##### clearFilters(update)
Clear filters being applied to. Update can be set to false to prevent instant filtering in cases where you may be applying filters right after.
| paramater | Description |
| --------------- | ----------------------- |
| update: boolean | Clear filters imedietly |
##### clearSelected()
Clear all selected rows.
#### refresh()
Refreshes the grid
##### selectAll()
Select all rows. Ignores pagination but not filtering.
##### sort(columnIndex: number, desc?: boolean)
Sort the grid by column index
| paramater | Description |
| ------------------- | ---------------------------- |
| columnIndex: number | Column index to sort by |
| desc: boolean | Sort ascending or descending |
##### updateSelected(index)
Virtually click on row causing selection/expanding/collapsing
| paramater | Description |
| ------------- | ------------- |
| index: number | Row to select |
### Column
Exported As: `Column`
#### Properties
| Name | Description |
| -------------------------- | ----------------------------------- |
| cssClass: string | Style to add to column header |
| hide: boolean | Hide column |
| hideMobile: boolean | Hide column on mobile devices |
| initialSort: 'asc'/'desc' | Sort the column initially |
| label: string | Column header label |
| property: string | Property to display in dot notation |
| sort: boolean | Enable/Disable sorting |
| sortFn: (a, b) => 1/0/-1 | Custom function to sort rows by |
| template: TemplateRef<any> | Template to render row with |
| width: number/string | CSS width property |
## License
Copyright © 2023 Zakary Timson | Available under the Apache 2.0 License
See the [license](./LICENSE) for more information.

View File

@ -1,50 +1,49 @@
{
"name": "sandbox",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build ng-datatable --prod"
},
"private": true,
"dependencies": {
"@angular/animations": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"ci-publish": "^1.3.1",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.0",
"@angular-devkit/build-ng-packagr": "~0.6.8",
"@angular/cli": "~6.0.0",
"@angular/compiler-cli": "^6.0.0",
"@angular/language-service": "^6.0.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ng-packagr": "^3.0.0-rc.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tsickle": ">=0.25.5",
"tslib": "^1.7.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
}
{
"name": "ng-datatable",
"version": "1.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build ng-datatable --prod"
},
"dependencies": {
"@angular/animations": "^6.0.0",
"@angular/common": "^6.0.0",
"@angular/compiler": "^6.0.0",
"@angular/core": "^6.0.0",
"@angular/forms": "^6.0.0",
"@angular/http": "^6.0.0",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.0",
"@angular/router": "^6.0.0",
"ci-publish": "^1.3.1",
"core-js": "^2.5.4",
"rxjs": "^6.0.0",
"zone.js": "^0.8.26"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.6.0",
"@angular-devkit/build-ng-packagr": "~0.6.8",
"@angular/cli": "~6.0.0",
"@angular/compiler-cli": "^6.0.0",
"@angular/language-service": "^6.0.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~8.9.4",
"codelyzer": "~4.2.1",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~1.7.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~1.4.2",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ng-packagr": "^3.0.0-rc.2",
"protractor": "~5.3.0",
"ts-node": "~5.0.1",
"tsickle": ">=0.25.5",
"tslib": "^1.7.1",
"tslint": "~5.9.1",
"typescript": "~2.7.2"
}
}