tangrid 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +124 -0
  3. package/config/index.d.ts +5 -0
  4. package/config/ngs-config.d.ts +16 -0
  5. package/config/public-api.d.ts +1 -0
  6. package/esm2022/config/ngs-config.mjs +24 -0
  7. package/esm2022/config/public-api.mjs +2 -0
  8. package/esm2022/config/tangrid-config.mjs +5 -0
  9. package/esm2022/index.mjs +17 -0
  10. package/esm2022/table/public-api.mjs +4 -0
  11. package/esm2022/table/table.component.mjs +1433 -0
  12. package/esm2022/table/table.module.mjs +19 -0
  13. package/esm2022/table/table.types.mjs +2 -0
  14. package/esm2022/table/tangrid-table.mjs +5 -0
  15. package/esm2022/table/virtual-provider.mjs +165 -0
  16. package/esm2022/tangrid.mjs +5 -0
  17. package/esm2022/theme/ngs-theme.service.mjs +83 -0
  18. package/esm2022/theme/public-api.mjs +2 -0
  19. package/esm2022/theme/tangrid-theme.mjs +5 -0
  20. package/fesm2022/tangrid-config.mjs +31 -0
  21. package/fesm2022/tangrid-config.mjs.map +1 -0
  22. package/fesm2022/tangrid-table.mjs +1618 -0
  23. package/fesm2022/tangrid-table.mjs.map +1 -0
  24. package/fesm2022/tangrid-theme.mjs +90 -0
  25. package/fesm2022/tangrid-theme.mjs.map +1 -0
  26. package/fesm2022/tangrid.mjs +1732 -0
  27. package/fesm2022/tangrid.mjs.map +1 -0
  28. package/index.d.ts +10 -0
  29. package/package.json +78 -0
  30. package/table/index.d.ts +5 -0
  31. package/table/public-api.d.ts +3 -0
  32. package/table/table.component.d.ts +542 -0
  33. package/table/table.module.d.ts +10 -0
  34. package/table/table.types.d.ts +202 -0
  35. package/table/virtual-provider.d.ts +9 -0
  36. package/theme/index.d.ts +5 -0
  37. package/theme/ngs-theme.service.d.ts +34 -0
  38. package/theme/public-api.d.ts +1 -0
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 infinity2zero
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md ADDED
@@ -0,0 +1,124 @@
1
+ <p align="center">
2
+ <a href="https://infinity2zero.github.io/tanGrid/">
3
+ <img src="demo/src/public/images/tanGrid-logo.png" alt="tanGrid Logo" width="250" />
4
+ </a>
5
+ </p>
6
+
7
+ <p align="center">
8
+ <a href="https://infinity2zero.github.io/tanGrid/">
9
+ <img src="https://img.shields.io/badge/Docs-Demo-blue?style=for-the-badge&logo=github" alt="Docs & Demo" />
10
+ </a>
11
+ </p>
12
+
13
+ # <span style="color:#0B2447">tan</span><span style="color:#20B2AA">Grid</span>
14
+
15
+ A powerful, feature-rich, and highly customizable data table component for Angular, built on top of the headless UI library [TanStack Table](https://tanstack.com/table/v8).
16
+
17
+ ## Introduction
18
+
19
+ `TanGrid` provides a production-grade data table solution that combines the power and flexibility of TanStack Table with the ease of use of a pre-built Angular component. It is designed to handle complex data scenarios with ease, offering features like virtual scrolling, column reordering, server-side operations, and extensive theming capabilities out of the box.
20
+
21
+ Key design principles:
22
+ - **Headless Core**: Leverages TanStack Table for logic, ensuring robustness and flexibility.
23
+ - **Performance**: Optimized for large datasets with virtual scrolling support via `@tanstack/angular-virtual`.
24
+ - **Developer Experience**: Extensive API with typed interfaces and intuitive configuration.
25
+ - **Modern Angular**: Built with Standalone Components and Signals for optimal performance.
26
+
27
+ ## Key Features
28
+
29
+ - **🚀 High Performance**: Virtual scrolling support for rendering thousands of rows efficiently.
30
+ - **🔄 Sorting & Filtering**: Multi-column sorting and global/column-specific filtering.
31
+ - **📄 Pagination**: Built-in pagination with customizable page sizes.
32
+ - **👆 Selection**: Single and multiple row selection modes.
33
+ - **↔️ Column Reordering**: Drag-and-drop column reordering using SortableJS.
34
+ - **📌 Column Pinning**: Pin columns to the left or right.
35
+ - **✏️ Inline Editing**: Edit cell values directly within the table.
36
+ - **📂 Row Expansion**: Expandable rows for showing detailed information.
37
+ - **📤 Exporting**: Built-in support for exporting data to CSV, Excel, and PDF.
38
+ - **🎨 Theming**: Multiple built-in themes (Material, Bootstrap, Ant Design) and SCSS customization.
39
+ - **🌐 Server-side Support**: Full support for server-side sorting, filtering, and pagination.
40
+
41
+ ## Installation
42
+
43
+ Install the package and its required peer dependencies:
44
+
45
+ ```bash
46
+ npm install tangrid @tanstack/angular-table @tanstack/angular-virtual sortablejs
47
+ ```
48
+
49
+ Ensure you also have `@angular/cdk` installed if you plan to use specific features that might rely on it (though the core virtual scroll now uses TanStack Virtual).
50
+
51
+ ```bash
52
+ npm install @angular/cdk
53
+ ```
54
+
55
+ ## Basic Usage
56
+
57
+ Import `TanGrid` in your component:
58
+
59
+ ```typescript
60
+ import { Component } from '@angular/core';
61
+ import { TanGrid, TanGridColumn } from 'tangrid';
62
+
63
+ interface User {
64
+ id: number;
65
+ name: string;
66
+ email: string;
67
+ role: string;
68
+ }
69
+
70
+ @Component({
71
+ selector: 'app-users-table',
72
+ standalone: true,
73
+ imports: [TanGrid],
74
+ template: `
75
+ <tan-grid
76
+ [data]="users"
77
+ [columns]="columns"
78
+ [pagination]="true"
79
+ [sorting]="true"
80
+ [filtering]="true"
81
+ globalFilterPlaceholder="Search users..."
82
+ ></tan-grid>
83
+ `,
84
+ })
85
+ export class UsersTableComponent {
86
+ users: User[] = [
87
+ { id: 1, name: 'John Doe', email: 'john@example.com', role: 'Admin' },
88
+ { id: 2, name: 'Jane Smith', email: 'jane@example.com', role: 'User' },
89
+ // ... more data
90
+ ];
91
+
92
+ columns: TanGridColumn<User>[] = [
93
+ { header: 'ID', accessorKey: 'id', width: '50px' },
94
+ { header: 'Name', accessorKey: 'name', sortable: true, filterable: true },
95
+ { header: 'Email', accessorKey: 'email' },
96
+ {
97
+ header: 'Role',
98
+ accessorKey: 'role',
99
+ cell: (ctx) => `<span class="badge">${ctx.row.role}</span>` // Or use a TemplateRef
100
+ },
101
+ ];
102
+ }
103
+ ```
104
+
105
+ ## API Reference
106
+
107
+ ### `<tan-grid>` Component
108
+
109
+ #### Inputs
110
+
111
+ | Input | Type | Default | Description |
112
+ |-------|------|---------|-------------|
113
+ | `data` | `T[]` | `[]` | Array of data objects to display. |
114
+ | `columns` | `TanGridColumn<T>[]` | `[]` | Column definitions. |
115
+ | `pagination` | `boolean` | `false` | Enable pagination. |
116
+ | `sorting` | `boolean` | `false` | Enable sorting. |
117
+ | `filtering` | `boolean` | `false` | Enable filtering. |
118
+
119
+ ## License
120
+
121
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
122
+
123
+ ## Author
124
+ Created by **infinity2zero**.
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ /// <amd-module name="tangrid/config" />
5
+ export * from './public-api';
@@ -0,0 +1,16 @@
1
+ import * as i0 from "@angular/core";
2
+ /**
3
+ * Configuration service for tanGrid components.
4
+ * Provides global configuration options.
5
+ */
6
+ export declare class NgsConfig {
7
+ /**
8
+ * If `true`, animations will be enabled globally for all components.
9
+ * Individual components can override this setting.
10
+ *
11
+ * @default true
12
+ */
13
+ animation: boolean;
14
+ static ɵfac: i0.ɵɵFactoryDeclaration<NgsConfig, never>;
15
+ static ɵprov: i0.ɵɵInjectableDeclaration<NgsConfig>;
16
+ }
@@ -0,0 +1 @@
1
+ export { NgsConfig } from './ngs-config';
@@ -0,0 +1,24 @@
1
+ import { Injectable } from '@angular/core';
2
+ import * as i0 from "@angular/core";
3
+ /**
4
+ * Configuration service for tanGrid components.
5
+ * Provides global configuration options.
6
+ */
7
+ export class NgsConfig {
8
+ constructor() {
9
+ /**
10
+ * If `true`, animations will be enabled globally for all components.
11
+ * Individual components can override this setting.
12
+ *
13
+ * @default true
14
+ */
15
+ this.animation = true;
16
+ }
17
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.7", ngImport: i0, type: NgsConfig, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
18
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.0.7", ngImport: i0, type: NgsConfig, providedIn: 'root' }); }
19
+ }
20
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.7", ngImport: i0, type: NgsConfig, decorators: [{
21
+ type: Injectable,
22
+ args: [{ providedIn: 'root' }]
23
+ }] });
24
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmdzLWNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9jb25maWcvbmdzLWNvbmZpZy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxDQUFDOztBQUUzQzs7O0dBR0c7QUFFSCxNQUFNLE9BQU8sU0FBUztJQUR0QjtRQUVDOzs7Ozt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uZmlnIH0gZnJvbSAnLi9uZ3MtY29uZmlnJztcblxuIl19
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generated bundle index. Do not edit.
3
+ */
4
+ export * from './public-api';
5
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGFuZ3JpZC1jb25maWcuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvY29uZmlnL3RhbmdyaWQtY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOztHQUVHO0FBRUgsY0FBYyxjQUFjLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyIvKipcbiAqIEdlbmVyYXRlZCBidW5kbGUgaW5kZXguIERvIG5vdCBlZGl0LlxuICovXG5cbmV4cG9ydCAqIGZyb20gJy4vcHVibGljLWFwaSc7XG4iXX0=
@@ -0,0 +1,17 @@
1
+ import { NgModule } from '@angular/core';
2
+ import { TanGridModule } from './table/public-api';
3
+ import * as i0 from "@angular/core";
4
+ export * from './table/public-api';
5
+ export { NgsConfig } from './config/public-api';
6
+ export { NgsThemeService } from './theme/public-api';
7
+ const NGS_MODULES = [TanGridModule];
8
+ export class NgsModule {
9
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.0.7", ngImport: i0, type: NgsModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
10
+ static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "18.0.7", ngImport: i0, type: NgsModule, imports: [TanGridModule], exports: [TanGridModule] }); }
11
+ static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "18.0.7", ngImport: i0, type: NgsModule, imports: [NGS_MODULES, TanGridModule] }); }
12
+ }
13
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.0.7", ngImport: i0, type: NgsModule, decorators: [{
14
+ type: NgModule,
15
+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wZSBOZ3NUaGVtZSB9IGZyb20gJy4vdGhlbWUvcHVibGljLWFwaSc7XG5cbmNvbnN0IE5HU19NT0RVTEVTID0gW1RhbkdyaWRNb2R1bGVdO1xuXG5ATmdNb2R1bGUoeyBpbXBvcnRzOiBOR1NfTU9EVUxFUywgZXhwb3J0czogTkdTX01PRFVMRVMgfSlcbmV4cG9ydCBjbGFzcyBOZ3NNb2R1bGUge31cblxuIl19
@@ -0,0 +1,4 @@
1
+ export * from './table.component';
2
+ export * from './table.types';
3
+ export * from './table.module';
4
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHVibGljLWFwaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy90YWJsZS9wdWJsaWMtYXBpLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLGNBQWMsbUJBQW1CLENBQUM7QUFDbEMsY0FBYyxlQUFlLENBQUM7QUFDOUIsY0FBYyxnQkFBZ0IsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gJy4vdGFibGUuY29tcG9uZW50JztcbmV4cG9ydCAqIGZyb20gJy4vdGFibGUudHlwZXMnO1xuZXhwb3J0ICogZnJvbSAnLi90YWJsZS5tb2R1bGUnO1xuXG4iXX0=