1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | "use strict";
|
8 | Object.defineProperty(exports, "__esModule", { value: true });
|
9 | var constants_1 = require("../constants");
|
10 | var utils_1 = require("../utils");
|
11 | var gridCell_1 = require("./gridCell");
|
12 | var GridRow = (function () {
|
13 | function GridRow(rowIndex, floating) {
|
14 | this.rowIndex = rowIndex;
|
15 | this.floating = utils_1.Utils.makeNull(floating);
|
16 | }
|
17 | GridRow.prototype.isFloatingTop = function () {
|
18 | return this.floating === constants_1.Constants.PINNED_TOP;
|
19 | };
|
20 | GridRow.prototype.isFloatingBottom = function () {
|
21 | return this.floating === constants_1.Constants.PINNED_BOTTOM;
|
22 | };
|
23 | GridRow.prototype.isNotFloating = function () {
|
24 | return !this.isFloatingBottom() && !this.isFloatingTop();
|
25 | };
|
26 | GridRow.prototype.equals = function (otherSelection) {
|
27 | return this.rowIndex === otherSelection.rowIndex
|
28 | && this.floating === otherSelection.floating;
|
29 | };
|
30 | GridRow.prototype.toString = function () {
|
31 | return "rowIndex = " + this.rowIndex + ", floating = " + this.floating;
|
32 | };
|
33 | GridRow.prototype.getGridCell = function (column) {
|
34 | var gridCellDef = { rowIndex: this.rowIndex, floating: this.floating, column: column };
|
35 | return new gridCell_1.GridCell(gridCellDef);
|
36 | };
|
37 |
|
38 | GridRow.prototype.before = function (otherSelection) {
|
39 | var otherFloating = otherSelection.floating;
|
40 | switch (this.floating) {
|
41 | case constants_1.Constants.PINNED_TOP:
|
42 |
|
43 | if (otherFloating !== constants_1.Constants.PINNED_TOP) {
|
44 | return true;
|
45 | }
|
46 | break;
|
47 | case constants_1.Constants.PINNED_BOTTOM:
|
48 |
|
49 | if (otherFloating !== constants_1.Constants.PINNED_BOTTOM) {
|
50 | return false;
|
51 | }
|
52 | break;
|
53 | default:
|
54 |
|
55 | if (utils_1.Utils.exists(otherFloating)) {
|
56 | if (otherFloating === constants_1.Constants.PINNED_TOP) {
|
57 |
|
58 | return false;
|
59 | }
|
60 | else {
|
61 |
|
62 | return true;
|
63 | }
|
64 | }
|
65 | break;
|
66 | }
|
67 | return this.rowIndex < otherSelection.rowIndex;
|
68 | };
|
69 | return GridRow;
|
70 | }());
|
71 | exports.GridRow = GridRow;
|