@@ -7,13 +7,34 @@ import { Component, ElementRef, Input, ViewChild, ViewContainerRef, OnDestroy, C
77import { GridItemHTMLElement , GridStackNode } from 'gridstack' ;
88import { BaseWidget } from './base-widget' ;
99
10- /** store element to Ng Class pointer back */
10+ /**
11+ * Extended HTMLElement interface for grid items.
12+ * Stores a back-reference to the Angular component for integration.
13+ */
1114export interface GridItemCompHTMLElement extends GridItemHTMLElement {
15+ /** Back-reference to the Angular GridStackItem component */
1216 _gridItemComp ?: GridstackItemComponent ;
1317}
1418
1519/**
16- * HTML Component Wrapper for gridstack items, in combination with GridstackComponent for parent grid
20+ * Angular component wrapper for individual GridStack items.
21+ *
22+ * This component represents a single grid item and handles:
23+ * - Dynamic content creation and management
24+ * - Integration with parent GridStack component
25+ * - Component lifecycle and cleanup
26+ * - Widget options and configuration
27+ *
28+ * Use in combination with GridstackComponent for the parent grid.
29+ *
30+ * @example
31+ * ```html
32+ * <gridstack>
33+ * <gridstack-item [options]="{x: 0, y: 0, w: 2, h: 1}">
34+ * <my-widget-component></my-widget-component>
35+ * </gridstack-item>
36+ * </gridstack>
37+ * ```
1738 */
1839@Component ( {
1940 selector : 'gridstack-item' ,
@@ -34,16 +55,37 @@ export interface GridItemCompHTMLElement extends GridItemHTMLElement {
3455} )
3556export class GridstackItemComponent implements OnDestroy {
3657
37- /** container to append items dynamically */
58+ /**
59+ * Container for dynamic component creation within this grid item.
60+ * Used to append child components programmatically.
61+ */
3862 @ViewChild ( 'container' , { read : ViewContainerRef , static : true } ) public container ?: ViewContainerRef ;
3963
40- /** ComponentRef of ourself - used by dynamic object to correctly get removed */
64+ /**
65+ * Component reference for dynamic component removal.
66+ * Used internally when this component is created dynamically.
67+ */
4168 public ref : ComponentRef < GridstackItemComponent > | undefined ;
4269
43- /** child component so we can save/restore additional data to be saved along */
70+ /**
71+ * Reference to child widget component for serialization.
72+ * Used to save/restore additional data along with grid position.
73+ */
4474 public childWidget : BaseWidget | undefined ;
4575
46- /** list of options for creating/updating this item */
76+ /**
77+ * Grid item configuration options.
78+ * Defines position, size, and behavior of this grid item.
79+ *
80+ * @example
81+ * ```typescript
82+ * itemOptions: GridStackNode = {
83+ * x: 0, y: 0, w: 2, h: 1,
84+ * noResize: true,
85+ * content: 'Item content'
86+ * };
87+ * ```
88+ */
4789 @Input ( ) public set options ( val : GridStackNode ) {
4890 const grid = this . el . gridstackNode ?. grid ;
4991 if ( grid ) {
0 commit comments