|
9 | 9 | <button (click)="onShow(5)" [class.active]="show===5">Component Dynamic</button> |
10 | 10 | <button (click)="onShow(6)" [class.active]="show===6">Nested Grid</button> |
11 | 11 | <button (click)="onShow(7)" [class.active]="show===7">Two Grids + sidebar</button> |
12 | | - <button (click)="onShow(8)" [class.active]="show===8">Leak Test</button> |
| 12 | + <button (click)="onShow(8)" [class.active]="show===8">Lazy Load</button> |
| 13 | + <button (click)="onShow(9)" [class.active]="show===9">Leak Test</button> |
13 | 14 | </div> |
14 | 15 |
|
15 | 16 | <div class="test-container"> |
16 | | -<angular-simple-test *ngIf="show===0"></angular-simple-test> |
17 | | -<angular-ng-for-test *ngIf="show===1"></angular-ng-for-test> |
18 | | -<angular-ng-for-cmd-test *ngIf="show===2"></angular-ng-for-cmd-test> |
19 | | - |
20 | | -<div *ngIf="show===3"> |
21 | | - <p><b>COMPONENT template</b>: using DOM template to use components statically</p> |
22 | | - <button (click)="add()">add item</button> |
23 | | - <button (click)="delete()">remove item</button> |
24 | | - <button (click)="modify()">modify item</button> |
25 | | - <button (click)="newLayout()">new layout</button> |
26 | | - <gridstack [options]="gridOptions" (changeCB)="onChange($event)" (resizeStopCB)="onResizeStop($event)"> |
27 | | - <gridstack-item gs-x="1" gs-y="0">item 1</gridstack-item> |
28 | | - <gridstack-item gs-x="3" gs-y="0" gs-w="2">item 2 wide</gridstack-item> |
29 | | - </gridstack> |
30 | | -</div> |
31 | | - |
32 | | -<div *ngIf="show===4"> |
33 | | - <p><b>COMPONENT ngFor</b>: Most complete example that uses Component wrapper for grid and gridItem</p> |
34 | | - <button (click)="addNgFor()">add item</button> |
35 | | - <button (click)="deleteNgFor()">remove item</button> |
36 | | - <button (click)="modifyNgFor()">modify item</button> |
37 | | - <button (click)="newLayoutNgFor()">new layout</button> |
38 | | - <gridstack [options]="gridOptions" (changeCB)="onChange($event)" (resizeStopCB)="onResizeStop($event)"> |
39 | | - <gridstack-item *ngFor="let n of items; trackBy: identify" [options]="n"> |
40 | | - </gridstack-item> |
41 | | - </gridstack> |
42 | | -</div> |
43 | | - |
44 | | -<div *ngIf="show===5"> |
45 | | - <p><b>COMPONENT dynamic</b>: Best example that uses Component wrapper and dynamic grid creation (drag between grids, from toolbar, etc...)</p> |
46 | | - <button (click)="add()">add item</button> |
47 | | - <button (click)="delete()">remove item</button> |
48 | | - <button (click)="modify()">modify item</button> |
49 | | - <button (click)="newLayout()">new layout</button> |
50 | | - <button (click)="saveGrid()">Save</button> |
51 | | - <button (click)="clearGrid()">Clear</button> |
52 | | - <button (click)="loadGrid()">Load</button> |
53 | | - <gridstack [options]="gridOptionsFull" (changeCB)="onChange($event)" (resizeStopCB)="onResizeStop($event)"> |
54 | | - </gridstack> |
55 | | -</div> |
56 | | - |
57 | | - |
58 | | -<div *ngIf="show===6"> |
59 | | - <p><b>Nested Grid</b>: shows nested component grids, like nested.html demo but with Ng Components</p> |
60 | | - <button (click)="add()">add item</button> |
61 | | - <button (click)="delete()">remove item</button> |
62 | | - <button (click)="modify()">modify item</button> |
63 | | - <button (click)="newLayout()">new layout</button> |
64 | | - <button (click)="saveGrid()">Save</button> |
65 | | - <button (click)="clearGrid()">Clear</button> |
66 | | - <button (click)="loadGrid()">Load</button> |
67 | | - <!-- TODO: addGrid() in code for testing instead ? --> |
68 | | - <gridstack [options]="nestedGridOptions" (changeCB)="onChange($event)" (resizeStopCB)="onResizeStop($event)"> |
69 | | - <div empty-content>Add items here or reload the grid</div> |
70 | | - </gridstack> |
71 | | -</div> |
| 17 | + @if (show===0) { |
| 18 | + <angular-simple-test></angular-simple-test> |
| 19 | + } @else if (show===1) { |
| 20 | + <angular-ng-for-test></angular-ng-for-test> |
| 21 | + } @else if (show===2) { |
| 22 | + <angular-ng-for-cmd-test></angular-ng-for-cmd-test> |
| 23 | + } @else if (show===3) { |
| 24 | + <div> |
| 25 | + <p><b>COMPONENT template</b>: using DOM template to use components statically</p> |
| 26 | + <button (click)="add()">add item</button> |
| 27 | + <button (click)="delete()">remove item</button> |
| 28 | + <button (click)="modify()">modify item</button> |
| 29 | + <button (click)="newLayout()">new layout</button> |
| 30 | + <gridstack [options]="gridOptions" (changeCB)="onChange($event)" (resizeStopCB)="onResizeStop($event)"> |
| 31 | + <gridstack-item gs-x="1" gs-y="0">item 1</gridstack-item> |
| 32 | + <gridstack-item gs-x="3" gs-y="0" gs-w="2">item 2 wide</gridstack-item> |
| 33 | + </gridstack> |
| 34 | + </div> |
| 35 | + } @else if (show===4) { |
| 36 | + <div> |
| 37 | + <p><b>COMPONENT ngFor</b>: Most complete example that uses Component wrapper for grid and gridItem</p> |
| 38 | + <button (click)="addNgFor()">add item</button> |
| 39 | + <button (click)="deleteNgFor()">remove item</button> |
| 40 | + <button (click)="modifyNgFor()">modify item</button> |
| 41 | + <button (click)="newLayoutNgFor()">new layout</button> |
| 42 | + <gridstack [options]="gridOptions" (changeCB)="onChange($event)" (resizeStopCB)="onResizeStop($event)"> |
| 43 | + @for (n of items; track n.id) { |
| 44 | + <gridstack-item [options]="n"></gridstack-item> |
| 45 | + } |
| 46 | + </gridstack> |
| 47 | + </div> |
| 48 | + } @else if (show===5) { |
| 49 | + <div> |
| 50 | + <p><b>COMPONENT dynamic</b>: Best example that uses Component wrapper and dynamic grid creation (drag between grids, from toolbar, etc...)</p> |
| 51 | + <button (click)="add()">add item</button> |
| 52 | + <button (click)="delete()">remove item</button> |
| 53 | + <button (click)="modify()">modify item</button> |
| 54 | + <button (click)="newLayout()">new layout</button> |
| 55 | + <button (click)="saveGrid()">Save</button> |
| 56 | + <button (click)="clearGrid()">Clear</button> |
| 57 | + <button (click)="loadGrid()">Load</button> |
| 58 | + <gridstack [options]="gridOptionsFull" (changeCB)="onChange($event)" (resizeStopCB)="onResizeStop($event)"> |
| 59 | + </gridstack> |
| 60 | + </div> |
| 61 | + } @else if (show===6) { |
| 62 | + <div> |
| 63 | + <p><b>Nested Grid</b>: shows nested component grids, like nested.html demo but with Ng Components</p> |
| 64 | + <button (click)="add()">add item</button> |
| 65 | + <button (click)="delete()">remove item</button> |
| 66 | + <button (click)="modify()">modify item</button> |
| 67 | + <button (click)="newLayout()">new layout</button> |
| 68 | + <button (click)="saveGrid()">Save</button> |
| 69 | + <button (click)="clearGrid()">Clear</button> |
| 70 | + <button (click)="loadGrid()">Load</button> |
| 71 | + <!-- add .grid-stack-item for acceptWidgets:true --> |
| 72 | + <div class="sidebar-item grid-stack-item">Drag nested</div> |
| 73 | + <div class="sidebar-item grid-stack-item">Comp N nested</div> |
72 | 74 |
|
73 | | -<div *ngIf="show===7"> |
74 | | - <p><b>two.html</b>: shows multiple grids and outside drag&drop</p> |
75 | | - <div class="row"> |
76 | | - <div class="col-md-3"> |
77 | | - <div class="sidebar"> |
78 | | - <!-- will size to match content --> |
79 | | - <div class="grid-stack-item"> |
80 | | - <div class="grid-stack-item-content">Drag me</div> |
| 75 | + <!-- TODO: addGrid() in code for testing instead ? --> |
| 76 | + <gridstack [options]="nestedGridOptions" (changeCB)="onChange($event)" (resizeStopCB)="onResizeStop($event)"> |
| 77 | + <div empty-content>Add items here or reload the grid</div> |
| 78 | + </gridstack> |
| 79 | + </div> |
| 80 | + } @else if (show===7) { |
| 81 | + <div> |
| 82 | + <p><b>two.html</b>: shows multiple grids, sidebar creating Components</p> |
| 83 | + <div class="row"> |
| 84 | + <div class="col-md-6"> |
| 85 | + <div class="sidebar"> |
| 86 | + <div class="sidebar-item grid-stack-item">will be A</div> |
| 87 | + <div class="sidebar-item grid-stack-item">will be B max=3</div> |
| 88 | + </div> |
81 | 89 | </div> |
82 | | - <!-- manually force a drop size of 2x1 --> |
83 | | - <div class="grid-stack-item" gs-w="2" gs-h="1" gs-max-w="3"> |
84 | | - <div class="grid-stack-item-content">2x1, max=3</div> |
| 90 | + <div class="col-md-6"> |
| 91 | + <div class="trash" id="trash"> |
| 92 | + </div> |
85 | 93 | </div> |
86 | 94 | </div> |
87 | | - </div> |
88 | | - <div class="col-md-9"> |
89 | | - <div class="trash" id="trash"> |
| 95 | + <div class="row" style="margin-top: 20px"> |
| 96 | + <div class="col-md-6"> |
| 97 | + <gridstack [options]="twoGridOpt1"></gridstack> |
| 98 | + </div> |
| 99 | + <div class="col-md-6"> |
| 100 | + <gridstack [options]="twoGridOpt2"></gridstack> |
| 101 | + </div> |
90 | 102 | </div> |
91 | 103 | </div> |
92 | | - </div> |
93 | | - <div class="row" style="margin-top: 20px"> |
94 | | - <div class="col-md-6"> |
95 | | - <gridstack [options]="twoGridOpt1"></gridstack> |
| 104 | + } @else if (show===8) { |
| 105 | + <div> |
| 106 | + <p>delay loading of components</p> |
| 107 | + <div style="height: 120px; overflow-y: auto"> |
| 108 | + <gridstack [options]="gridOptionsDelay"></gridstack> |
| 109 | + </div> |
96 | 110 | </div> |
97 | | - <div class="col-md-6"> |
98 | | - <gridstack [options]="twoGridOpt2"></gridstack> |
| 111 | + } @else if (show===9) { |
| 112 | + <div> |
| 113 | + <p>load() + clear() to memory leak test between the two</p> |
| 114 | + <button (click)="clearGrid()">Clear</button> |
| 115 | + <button (click)="load(sub0)">load</button> |
| 116 | + <button (click)="load(sub2)">load 2</button> |
| 117 | + <gridstack [options]="gridOptions"></gridstack> |
99 | 118 | </div> |
100 | | - </div> |
101 | | -</div> |
102 | | - |
103 | | -<div *ngIf="show===8"> |
104 | | - <p>load() + clear() to memory leak test between the two</p> |
105 | | - <button (click)="clearGrid()">Clear</button> |
106 | | - <button (click)="load(sub0)">load</button> |
107 | | - <button (click)="load(sub2)">load 2</button> |
108 | | - <gridstack [options]="gridOptions"></gridstack> |
109 | | -</div> |
110 | 119 |
|
111 | | -<div class="grid-container"></div> |
| 120 | + <div class="grid-container"></div> |
112 | 121 |
|
113 | | -<div class="text-container" *ngIf="show!=8"> |
114 | | - <textarea #origTextArea cols="50" rows="50" readonly="readonly"></textarea> |
115 | | - <textarea #textArea cols="50" rows="50" readonly="readonly"></textarea> |
116 | | -</div> |
| 122 | +} @else if (show!=8) { |
| 123 | + <div class="text-container"> |
| 124 | + <textarea #origTextArea cols="50" rows="50" readonly="readonly"></textarea> |
| 125 | + <textarea #textArea cols="50" rows="50" readonly="readonly"></textarea> |
| 126 | + </div> |
| 127 | +} |
117 | 128 |
|
118 | 129 | </div> |
0 commit comments