argent-grid 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 (53) hide show
  1. package/.github/workflows/pages.yml +68 -0
  2. package/AGENTS.md +179 -0
  3. package/README.md +222 -0
  4. package/demo-app/README.md +70 -0
  5. package/demo-app/angular.json +78 -0
  6. package/demo-app/e2e/benchmark.spec.ts +53 -0
  7. package/demo-app/e2e/demo-page.spec.ts +77 -0
  8. package/demo-app/e2e/grid-features.spec.ts +269 -0
  9. package/demo-app/package-lock.json +14023 -0
  10. package/demo-app/package.json +36 -0
  11. package/demo-app/playwright-test-menu.js +19 -0
  12. package/demo-app/playwright.config.ts +23 -0
  13. package/demo-app/src/app/app.component.ts +10 -0
  14. package/demo-app/src/app/app.config.ts +13 -0
  15. package/demo-app/src/app/app.routes.ts +7 -0
  16. package/demo-app/src/app/demo-page/demo-page.component.css +313 -0
  17. package/demo-app/src/app/demo-page/demo-page.component.html +124 -0
  18. package/demo-app/src/app/demo-page/demo-page.component.ts +366 -0
  19. package/demo-app/src/index.html +19 -0
  20. package/demo-app/src/main.ts +6 -0
  21. package/demo-app/tsconfig.json +31 -0
  22. package/ng-package.json +8 -0
  23. package/package.json +60 -0
  24. package/plan.md +131 -0
  25. package/setup-vitest.ts +18 -0
  26. package/src/lib/argent-grid.module.ts +21 -0
  27. package/src/lib/components/argent-grid.component.css +483 -0
  28. package/src/lib/components/argent-grid.component.html +320 -0
  29. package/src/lib/components/argent-grid.component.spec.ts +189 -0
  30. package/src/lib/components/argent-grid.component.ts +1188 -0
  31. package/src/lib/directives/ag-grid-compatibility.directive.ts +92 -0
  32. package/src/lib/rendering/canvas-renderer.ts +962 -0
  33. package/src/lib/rendering/render/blit.spec.ts +453 -0
  34. package/src/lib/rendering/render/blit.ts +393 -0
  35. package/src/lib/rendering/render/cells.ts +369 -0
  36. package/src/lib/rendering/render/index.ts +105 -0
  37. package/src/lib/rendering/render/lines.ts +363 -0
  38. package/src/lib/rendering/render/theme.spec.ts +282 -0
  39. package/src/lib/rendering/render/theme.ts +201 -0
  40. package/src/lib/rendering/render/types.ts +279 -0
  41. package/src/lib/rendering/render/walk.spec.ts +360 -0
  42. package/src/lib/rendering/render/walk.ts +360 -0
  43. package/src/lib/rendering/utils/damage-tracker.spec.ts +444 -0
  44. package/src/lib/rendering/utils/damage-tracker.ts +423 -0
  45. package/src/lib/rendering/utils/index.ts +7 -0
  46. package/src/lib/services/grid.service.spec.ts +1039 -0
  47. package/src/lib/services/grid.service.ts +1284 -0
  48. package/src/lib/types/ag-grid-types.ts +970 -0
  49. package/src/public-api.ts +22 -0
  50. package/tsconfig.json +32 -0
  51. package/tsconfig.lib.json +11 -0
  52. package/tsconfig.spec.json +8 -0
  53. package/vitest.config.ts +55 -0
@@ -0,0 +1,92 @@
1
+ import {
2
+ Directive,
3
+ Input,
4
+ OnInit,
5
+ OnDestroy,
6
+ ComponentRef,
7
+ ViewContainerRef,
8
+ ComponentFactoryResolver
9
+ } from '@angular/core';
10
+ import { GridOptions, ColDef, ColGroupDef } from '../types/ag-grid-types';
11
+ import { ArgentGridComponent } from '../components/argent-grid.component';
12
+
13
+ /**
14
+ * AgGridCompatibilityDirective - Drop-in replacement for AG Grid
15
+ *
16
+ * This directive allows users to migrate from AG Grid to ArgentGrid
17
+ * by simply changing their import statement. It maps AG Grid's
18
+ * [columnDefs] and [rowData] inputs to ArgentGrid's internal format.
19
+ */
20
+ @Directive({
21
+ selector: '[argentGrid], ag-grid-angular'
22
+ })
23
+ export class AgGridCompatibilityDirective<TData = any> implements OnInit, OnDestroy {
24
+ @Input('columnDefs') set columnDefs(value: (ColDef<TData> | ColGroupDef<TData>)[] | null) {
25
+ this._columnDefs = value;
26
+ this.updateGrid();
27
+ }
28
+ get columnDefs(): (ColDef<TData> | ColGroupDef<TData>)[] | null {
29
+ return this._columnDefs;
30
+ }
31
+ private _columnDefs: (ColDef<TData> | ColGroupDef<TData>)[] | null = null;
32
+
33
+ @Input('rowData') set rowData(value: TData[] | null) {
34
+ this._rowData = value;
35
+ this.updateGrid();
36
+ }
37
+ get rowData(): TData[] | null {
38
+ return this._rowData;
39
+ }
40
+ private _rowData: TData[] | null = null;
41
+
42
+ @Input('gridOptions') set gridOptions(value: GridOptions<TData>) {
43
+ this._gridOptions = value;
44
+ this.updateGrid();
45
+ }
46
+ get gridOptions(): GridOptions<TData> {
47
+ return this._gridOptions;
48
+ }
49
+ private _gridOptions: GridOptions<TData> | null = null;
50
+
51
+ private gridComponentRef: ComponentRef<ArgentGridComponent<TData>> | null = null;
52
+
53
+ constructor(
54
+ private viewContainerRef: ViewContainerRef
55
+ ) {}
56
+
57
+ ngOnInit(): void {
58
+ this.createGridComponent();
59
+ }
60
+
61
+ ngOnDestroy(): void {
62
+ if (this.gridComponentRef) {
63
+ this.gridComponentRef.destroy();
64
+ }
65
+ }
66
+
67
+ private createGridComponent(): void {
68
+ // Create ArgentGrid component
69
+ this.gridComponentRef = this.viewContainerRef.createComponent(ArgentGridComponent as any);
70
+
71
+ this.updateGrid();
72
+ }
73
+
74
+ private updateGrid(): void {
75
+ if (!this.gridComponentRef) {
76
+ return;
77
+ }
78
+
79
+ // Map AG Grid inputs to ArgentGrid component
80
+ this.gridComponentRef.instance.columnDefs = this.columnDefs;
81
+ this.gridComponentRef.instance.rowData = this.rowData;
82
+ this.gridComponentRef.instance.gridOptions = this.gridOptions || undefined;
83
+ this.gridComponentRef.instance.refresh();
84
+ }
85
+
86
+ /**
87
+ * Get the underlying GridApi for programmatic access
88
+ */
89
+ getApi(): any {
90
+ return this.gridComponentRef?.instance.getApi();
91
+ }
92
+ }