Skip to content

Commit 4e5f8cc

Browse files
committed
add 2 more gridTypes : verticalFixed and horizontalFixed tiberiuzuld#81
1 parent a33679d commit 4e5f8cc

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

src/app/app.component.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
<md-option value="scrollVertical">Scroll Vertical</md-option>
1010
<md-option value="scrollHorizontal">Scroll Horizontal</md-option>
1111
<md-option value="fixed">Fixed</md-option>
12+
<md-option value="verticalFixed">Vertical Fixed</md-option>
13+
<md-option value="horizontalFixed">Horizontal Fixed</md-option>
1214
</md-select>
1315
<md-select aria-label="Compact type" [(ngModel)]="options.compactType" (ngModelChange)="changedOptions()"
1416
placeholder="Compact Type">

src/lib/gridster.component.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,18 @@ export class GridsterComponent implements OnInit, OnDestroy {
200200
removeClass1 = 'fit';
201201
removeClass2 = 'scrollVertical';
202202
removeClass3 = 'scrollHorizontal';
203+
} else if (this.$options.gridType === 'verticalFixed') {
204+
this.curRowHeight = this.$options.fixedRowHeight;
205+
addClass = 'scrollVertical';
206+
removeClass1 = 'fit';
207+
removeClass2 = 'scrollHorizontal';
208+
removeClass3 = 'fixed';
209+
} else if (this.$options.gridType === 'horizontalFixed') {
210+
this.curColWidth = this.$options.fixedColWidth;
211+
addClass = 'scrollHorizontal';
212+
removeClass1 = 'fit';
213+
removeClass2 = 'scrollVertical';
214+
removeClass3 = 'fixed';
203215
}
204216

205217
this.renderer.addClass(this.el, addClass);

src/lib/gridsterConfig.constant.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ export const GridsterConfigService: GridsterConfig = {
55
// 'scrollVertical' will fit on width and height of the items will be the same as the width
66
// 'scrollHorizontal' will fit on height and width of the items will be the same as the height
77
// 'fixed' will set the rows and columns dimensions based on fixedColWidth and fixedRowHeight options
8+
// 'verticalFixed' will set the rows to fixedRowHeight and columns width will fit the space available
9+
// 'horizontalFixed' will set the columns to fixedColWidth and rows height will fit the space available
810
fixedColWidth: 250, // fixed col width for gridType: 'fixed'
911
fixedRowHeight: 250, // fixed row height for gridType: 'fixed'
1012
keepFixedHeightInMobile: false, // keep the height from fixed gridType in mobile layout

src/lib/gridsterConfig.interface.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export type GridType = 'fit' | 'scrollVertical' | 'scrollHorizontal' | 'fixed';
1+
export type GridType = 'fit' | 'scrollVertical' | 'scrollHorizontal' | 'fixed' | 'verticalFixed' | 'horizontalFixed';
22
export type displayGrid = 'always' | 'onDrag&Resize' | 'none';
33
export type compactType = 'none' | 'compactUp' | 'compactLeft' | 'compactUp&Left' | 'compactLeft&Up';
44

@@ -37,6 +37,7 @@ export interface GridsterConfig {
3737
optionsChanged?: Function,
3838
getNextPossiblePosition?: Function,
3939
};
40+
4041
[propName: string]: any;
4142
}
4243

0 commit comments

Comments
 (0)