Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions angular/projects/demo/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<button (click)="onShow(4)" [class.active]="show===4">Component ngFor</button>
<button (click)="onShow(5)" [class.active]="show===5">Component Dynamic</button>
<button (click)="onShow(6)" [class.active]="show===6">Nested Grid</button>
<button (click)="onShow(7)" [class.active]="show===7">Two Grids + sidebar</button>
</div>

<div class="test-container">
Expand Down Expand Up @@ -68,6 +69,37 @@
</gridstack>
</div>

<div *ngIf="show===7">
<p><b>two.html</b>: shows multiple grids and outside drag&drop</p>
<div class="row">
<div class="col-md-3">
<div class="sidebar">
<!-- will size to match content -->
<div class="grid-stack-item">
<div class="grid-stack-item-content">Drag me</div>
</div>
<!-- manually force a drop size of 2x1 -->
<div class="grid-stack-item" gs-w="2" gs-h="1" gs-max-w="3">
<div class="grid-stack-item-content">2x1, max=3</div>
</div>
</div>
</div>
<div class="col-md-9">
<div class="trash" id="trash">
</div>
</div>
</div>
<div class="row" style="margin-top: 20px">
<div class="col-md-6">
<gridstack [options]="twoGridOpt1"></gridstack>
</div>
<div class="col-md-6">
<gridstack [options]="twoGridOpt2"></gridstack>
</div>
</div>
</div>


<div class="grid-container"></div>

<div class="text-container">
Expand Down
25 changes: 20 additions & 5 deletions angular/projects/demo/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,23 @@ export class AppComponent implements OnInit {
acceptWidgets: true,
children: this.subChildren
};
public twoGridOpt1: NgGridStackOptions = {
column: 6,
cellHeight: 50,
margin: 5,
minRow: 1, // don't collapse when empty
disableOneColumnMode: true,
removable: '.trash',
acceptWidgets: true,
float: true,
children: [
{x: 0, y: 0, w: 2, h: 2},
{x: 3, y: 1, h: 2},
{x: 4, y: 1},
{x: 2, y: 3, w: 3, maxW: 3, id: 'special', content: 'has maxW=3'},
]
};
public twoGridOpt2: NgGridStackOptions = { ...this.twoGridOpt1, float: false }
private serializedData?: NgGridStackOptions;

constructor() {
Expand Down Expand Up @@ -110,15 +127,13 @@ export class AppComponent implements OnInit {
case 4: data = this.items; break;
case 5: data = this.gridOptionsFull; break;
case 6: data = this.nestedGridOptions; break;
case 7: data = this.twoGridOpt1;
GridStack.setupDragIn('.sidebar .grid-stack-item', { appendTo: 'body', helper: 'clone' });
break;
}
if (this.origTextEl) this.origTextEl.nativeElement.value = JSON.stringify(data, null, ' ');
});
if (this.textEl) this.textEl.nativeElement.value = '';

// if (val === 6 && !this.gridComp) {
// const cont: HTMLElement | null = document.querySelector('.grid-container');
// if (cont) GridStack.addGrid(cont, this.serializedData);
// }
}

/** called whenever items change size/position/etc.. */
Expand Down
37 changes: 37 additions & 0 deletions angular/projects/demo/src/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,40 @@
@import "../../../../demo/demo.css";
/* required file for gridstack 2-11 column */
@import "../../../../dist/gridstack-extra.css";

/* for two.html example from bootstrap.min.css */
.row {
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;
box-sizing: border-box;
}
.col-md-3 {
-ms-flex: 0 0 25%;
flex: 0 0 25%;
max-width: 25%;
box-sizing: border-box;
}
.col-md-9 {
-ms-flex: 0 0 75%;
flex: 0 0 75%;
max-width: 75%;
box-sizing: border-box;
}
.col-md-6 {
-ms-flex: 0 0 50%;
flex: 0 0 50%;
max-width: 50%;
box-sizing: border-box;
}
.col, .col-1, .col-10, .col-11, .col-12, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-auto, .col-lg, .col-lg-1, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-auto, .col-md, .col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-auto, .col-sm, .col-sm-1, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-auto, .col-xl, .col-xl-1, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-auto {
position: relative;
width: 100%;
padding-right: 15px;
padding-left: 15px;
box-sizing: border-box;
}