|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +This is an Angular 19 dynamic dashboard framework (ngx-dd-ui) that enables JSON-driven creation of customizable dashboards with drag/drop functionality. The project is based on the open source NGX Dynamic Dashboard Framework and focuses on production line management interfaces. |
| 8 | + |
| 9 | +## Common Commands |
| 10 | + |
| 11 | +- **Development server**: `npm start` or `ng serve` - serves on http://localhost:4200/ |
| 12 | +- **Build**: `npm run build` or `ng build` - creates production build in `dist/` directory |
| 13 | +- **Test**: `npm test` or `ng test` - runs unit tests via Karma/Jasmine |
| 14 | +- **Watch build**: `npm run watch` or `ng build --watch --configuration development` - builds with file watching |
| 15 | + |
| 16 | +## Architecture |
| 17 | + |
| 18 | +### Core Concepts |
| 19 | + |
| 20 | +1. **JSON-Driven Configuration**: Dashboard layouts and gadget definitions are driven by JSON configuration files in `src/assets/api/` |
| 21 | +2. **Dynamic Component Loading**: Uses Angular's dynamic component loader to create gadgets at runtime |
| 22 | +3. **Dynamic Forms**: Property configuration forms are generated dynamically based on JSON schemas |
| 23 | + |
| 24 | +### Key Components |
| 25 | + |
| 26 | +**Gadget System**: |
| 27 | +- `GadgetGridCellHostComponent` (`src/app/gadgets/gadget-grid-cell-host/gadget-grid-cell-host.component.ts:49-82`) - Factory component that dynamically creates gadget instances via switch statement |
| 28 | +- `GadgetBase` (`src/app/gadgets/common/gadget-common/gadget-base/gadget.base.ts`) - Abstract base class all gadgets extend |
| 29 | +- Gadget library defined in `src/assets/api/library.json` - JSON configuration for all available gadgets |
| 30 | + |
| 31 | +**Available Gadgets**: |
| 32 | +- BarChartComponent, AreaChartComponent (NGX Charts integration) |
| 33 | +- ProductComponent, ScoreCardComponent, PckLineComponent |
| 34 | +- ImageComponent, DateComponent, NotificationComponent |
| 35 | +- UsergroupComponent, EventsComponent |
| 36 | + |
| 37 | +**Dynamic Forms**: |
| 38 | +- `DynamicFormComponent` - Renders property configuration forms |
| 39 | +- Form controls: textbox, dropdown, dropdown-ms, number, date, textarea, upload, hidden |
| 40 | +- Property definitions in gadget JSON include validation rules |
| 41 | + |
| 42 | +**Layout & Navigation**: |
| 43 | +- Multi-board support with dynamic navigation |
| 44 | +- Drag/drop layout management |
| 45 | +- Board persistence and configuration |
| 46 | + |
| 47 | +### Key Files |
| 48 | + |
| 49 | +- `src/app/gadgets/gadget-grid-cell-host/gadget-grid-cell-host.component.ts` - Gadget factory (add new gadgets here) |
| 50 | +- `src/assets/api/library.json` - Gadget definitions and property schemas |
| 51 | +- `src/app/dynamic-form/` - Dynamic form generation system |
| 52 | +- `src/app/board/` - Dashboard board management |
| 53 | +- `src/app/layout/` - Layout and grid system |
| 54 | + |
| 55 | +### Adding New Gadgets |
| 56 | + |
| 57 | +1. Create component in `src/app/gadgets/[gadget-name]/` |
| 58 | +2. Add component import and case to `GadgetGridCellHostComponent` switch statement |
| 59 | +3. Add gadget definition to `src/assets/api/library.json` |
| 60 | +4. Create icon image in `src/assets/images/` |
| 61 | + |
| 62 | +### Dependencies |
| 63 | + |
| 64 | +- Angular 19 with Angular Material |
| 65 | +- NGX Charts (@swimlane/ngx-charts) for data visualization |
| 66 | +- RxJS for reactive programming |
| 67 | +- TypeScript 5.6.3 |
0 commit comments