photon-grid-angular 1.0.0 → 1.0.2
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.
- package/README.md +237 -14
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,27 +1,250 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Photon Grid for Angular
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="https://raw.githubusercontent.com/abdulwahid-csit/photon-grid/main/assets/logo.svg" alt="Photon Grid — Angular Data Grid" width="180"/>
|
|
5
|
+
</p>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>A high-performance, enterprise-grade Angular data grid built on the zero-dependency Photon Grid engine.</strong>
|
|
9
|
+
</p>
|
|
6
10
|
|
|
7
|
-
|
|
11
|
+
<p align="center">
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+

|
|
14
|
+

|
|
15
|
+

|
|
16
|
+

|
|
10
17
|
|
|
11
|
-
|
|
18
|
+
</p>
|
|
12
19
|
|
|
13
|
-
|
|
20
|
+
---
|
|
14
21
|
|
|
15
|
-
|
|
22
|
+
## Overview
|
|
16
23
|
|
|
17
|
-
|
|
24
|
+
**Photon Grid for Angular** (`photon-grid-angular`) is the official Angular wrapper for [Photon Grid Core](https://www.npmjs.com/package/photon-grid-core) — an extremely fast, framework-agnostic TypeScript data grid.
|
|
18
25
|
|
|
19
|
-
|
|
26
|
+
It exposes a single standalone `<photon-grid>` component that binds Angular inputs and outputs to the core engine, giving you virtual scrolling, sorting, filtering, grouping, editing, and custom Angular component/template cell renderers with **zero framework lock-in**.
|
|
20
27
|
|
|
21
|
-
|
|
28
|
+
A modern, lightweight alternative to AG Grid, Handsontable, and PrimeNG Table for Angular applications.
|
|
22
29
|
|
|
23
|
-
|
|
30
|
+
---
|
|
24
31
|
|
|
25
|
-
##
|
|
32
|
+
## Features
|
|
26
33
|
|
|
27
|
-
|
|
34
|
+
- Standalone Angular component (`<photon-grid>`) and optional `PhotonGridModule`
|
|
35
|
+
- Angular component and `TemplateRef` cell renderers
|
|
36
|
+
- Strongly-typed `@Input` / `@Output` bindings
|
|
37
|
+
- Zero runtime dependencies in the core engine
|
|
38
|
+
- Virtual scrolling and virtual columns
|
|
39
|
+
- Millions of rows support
|
|
40
|
+
- Column pinning, resizing, moving, and auto-size
|
|
41
|
+
- Cell selection and range selection
|
|
42
|
+
- Clipboard support (copy / paste)
|
|
43
|
+
- Keyboard and mouse navigation
|
|
44
|
+
- Tree data and row grouping
|
|
45
|
+
- Sorting and multi-column sorting
|
|
46
|
+
- Filtering and quick filtering
|
|
47
|
+
- Custom cell and header renderers
|
|
48
|
+
- Context menu and custom context menus
|
|
49
|
+
- Pagination, status bar, and tool panels
|
|
50
|
+
- Theme support (light, dark, custom)
|
|
51
|
+
- Event-driven, API-driven architecture
|
|
52
|
+
- High-FPS, memory-efficient rendering
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Installation
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
npm install photon-grid-angular photon-grid-core
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
or
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
yarn add photon-grid-angular photon-grid-core
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
or
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pnpm add photon-grid-angular photon-grid-core
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`@angular/core`, `@angular/common`, and `photon-grid-core` are peer dependencies.
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## Basic Usage
|
|
79
|
+
|
|
80
|
+
`PhotonGridComponent` is standalone — import it directly into any standalone component or NgModule.
|
|
81
|
+
|
|
82
|
+
```ts
|
|
83
|
+
import { Component } from '@angular/core';
|
|
84
|
+
import { PhotonGridComponent } from 'photon-grid-angular';
|
|
85
|
+
import type { ColumnDef } from 'photon-grid-angular';
|
|
86
|
+
import type { GridApi } from 'photon-grid-core';
|
|
87
|
+
|
|
88
|
+
@Component({
|
|
89
|
+
selector: 'app-root',
|
|
90
|
+
standalone: true,
|
|
91
|
+
imports: [PhotonGridComponent],
|
|
92
|
+
template: `
|
|
93
|
+
<photon-grid
|
|
94
|
+
[columns]="columns"
|
|
95
|
+
[dataSet]="rows"
|
|
96
|
+
[options]="{ theme: 'light' }"
|
|
97
|
+
(gridReady)="onReady($event)"
|
|
98
|
+
(rowClicked)="onRowClicked($event)">
|
|
99
|
+
</photon-grid>
|
|
100
|
+
`,
|
|
101
|
+
})
|
|
102
|
+
export class AppComponent {
|
|
103
|
+
columns: ColumnDef[] = [
|
|
104
|
+
{ colId: 'name', field: 'name', header: 'Name', type: 'string' },
|
|
105
|
+
{ colId: 'age', field: 'age', header: 'Age', type: 'number' },
|
|
106
|
+
];
|
|
107
|
+
|
|
108
|
+
rows = [
|
|
109
|
+
{ name: 'Ada', age: 36 },
|
|
110
|
+
{ name: 'Alan', age: 41 },
|
|
111
|
+
];
|
|
112
|
+
|
|
113
|
+
onReady(api: GridApi): void {
|
|
114
|
+
console.log('visible rows:', api.getVisibleRows().length);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
onRowClicked(event: unknown): void {
|
|
118
|
+
console.log(event);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
> **Styling** is injected automatically by the core engine — no CSS import is required.
|
|
124
|
+
|
|
125
|
+
### NgModule consumers
|
|
126
|
+
|
|
127
|
+
Not on standalone APIs yet? Import `PhotonGridModule`, which re-exports the standalone component:
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { PhotonGridModule } from 'photon-grid-angular';
|
|
131
|
+
|
|
132
|
+
@NgModule({
|
|
133
|
+
imports: [PhotonGridModule],
|
|
134
|
+
})
|
|
135
|
+
export class AppModule {}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Inputs
|
|
141
|
+
|
|
142
|
+
| Input | Type | Description |
|
|
143
|
+
| --------- | --------------------------- | ------------------------------------------------------ |
|
|
144
|
+
| `columns` | `ColumnDef[]` | Column definitions. Renderer slots accept Angular components/templates in addition to plain functions. |
|
|
145
|
+
| `dataSet` | `Record<string, unknown>[]` | Row data. |
|
|
146
|
+
| `options` | `Partial<GridOptions>` | Theme, selection, editing, pagination, and feature flags. |
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## Outputs
|
|
151
|
+
|
|
152
|
+
`gridReady`, `dataChanged`, `rowClicked`, `rowDoubleClicked`, `rowSelected`,
|
|
153
|
+
`cellClicked`, `cellDoubleClicked`, `cellValueChanged`, `cellSelectionChanged`,
|
|
154
|
+
`columnResized`, `columnMoved`, `sortChanged`, `filterChanged`, `pageChanged`,
|
|
155
|
+
`columnsStateChanged`, `themeChanged`, `exportComplete`.
|
|
156
|
+
|
|
157
|
+
`gridReady` emits the `GridApi`, giving you full programmatic control over the grid.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Angular Component & Template Renderers
|
|
162
|
+
|
|
163
|
+
Cell, header, and editor renderers may be plain functions (identical to the core API), or declarative Angular specs:
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
// Component-based renderer
|
|
167
|
+
columns: ColumnDef[] = [{
|
|
168
|
+
colId: 'status', field: 'status', header: 'Status', type: 'string',
|
|
169
|
+
renderer: {
|
|
170
|
+
display: {
|
|
171
|
+
kind: 'component',
|
|
172
|
+
component: StatusBadgeComponent,
|
|
173
|
+
inputs: (params) => ({ value: params.value }),
|
|
174
|
+
},
|
|
175
|
+
},
|
|
176
|
+
}];
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
```html
|
|
180
|
+
<!-- Template-based renderer -->
|
|
181
|
+
<ng-template #statusTpl let-params>
|
|
182
|
+
<span class="badge">{{ params.value }}</span>
|
|
183
|
+
</ng-template>
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The wrapper mounts and disposes these views automatically as rows are virtualized and recycled, so nothing leaks.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Why Photon Grid?
|
|
191
|
+
|
|
192
|
+
- Modern, standalone Angular API
|
|
193
|
+
- Fast, virtualized rendering for millions of rows
|
|
194
|
+
- Framework-independent core — share grid logic across Angular, React, and Vue
|
|
195
|
+
- Modular, extensible, plugin-friendly architecture
|
|
196
|
+
- Enterprise capabilities with a simple, predictable API
|
|
197
|
+
- Fully typed with built-in declaration files
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Browser Support
|
|
202
|
+
|
|
203
|
+
Supports all modern browsers: Chrome, Edge, Firefox, and Safari.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## TypeScript
|
|
208
|
+
|
|
209
|
+
`photon-grid-angular` is written in TypeScript and ships with built-in declaration files. No additional typings are required.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Ecosystem
|
|
214
|
+
|
|
215
|
+
| Package | Description |
|
|
216
|
+
| ------- | ----------- |
|
|
217
|
+
| [`photon-grid-core`](https://www.npmjs.com/package/photon-grid-core) | Framework-agnostic engine |
|
|
218
|
+
| [`photon-grid-angular`](https://www.npmjs.com/package/photon-grid-angular) | Angular wrapper (this package) |
|
|
219
|
+
| [`photon-grid-react`](https://www.npmjs.com/package/photon-grid-react) | React wrapper |
|
|
220
|
+
| [`photon-grid-vue`](https://www.npmjs.com/package/photon-grid-vue) | Vue 3 wrapper |
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
## Contributing
|
|
225
|
+
|
|
226
|
+
Contributions are welcome. Please submit issues, feature requests, or pull requests through GitHub.
|
|
227
|
+
|
|
228
|
+
---
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
MIT License
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## Author
|
|
237
|
+
|
|
238
|
+
**Abdul Wahid**
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## Links
|
|
243
|
+
|
|
244
|
+
- **GitHub** — https://github.com/abdulwahid-csit/photon-grid
|
|
245
|
+
- **Issues** — https://github.com/abdulwahid-csit/photon-grid/issues
|
|
246
|
+
- **NPM** — https://www.npmjs.com/package/photon-grid-angular
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
⭐ If you find Photon Grid useful, consider starring the repository.
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "photon-grid-angular",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Angular wrapper for Photon Grid — an enterprise-grade, framework-agnostic TypeScript data grid.",
|
|
5
5
|
"author": "Abdul Wahid",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@angular/common": "^18.2.0",
|
|
9
9
|
"@angular/core": "^18.2.0",
|
|
10
|
-
"photon-grid-core": "^1.0.
|
|
10
|
+
"photon-grid-core": "^1.0.2"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"tslib": "^2.3.0"
|