forked from khoanguyen123/aurelia-ui-framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui-grid.js
95 lines (95 loc) · 4.45 KB
/
ui-grid.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
define(["require", "exports", "aurelia-framework"], function (require, exports, aurelia_framework_1) {
"use strict";
var UIRow = (function () {
function UIRow(element) {
this.element = element;
}
UIRow.prototype.bind = function () {
if (this.element.hasAttribute('column')) {
this.element.classList.add('ui-column-row');
}
else {
this.element.classList.add('ui-row');
}
if (this.element.hasAttribute('start'))
this.element.classList.add('ui-align-start');
if (this.element.hasAttribute('end'))
this.element.classList.add('ui-align-end');
if (this.element.hasAttribute('center'))
this.element.classList.add('ui-align-center');
if (this.element.hasAttribute('spaced'))
this.element.classList.add('ui-align-spaced');
if (this.element.hasAttribute('top'))
this.element.classList.add('ui-align-top');
if (this.element.hasAttribute('bottom'))
this.element.classList.add('ui-align-bottom');
if (this.element.hasAttribute('middle'))
this.element.classList.add('ui-align-middle');
if (this.element.hasAttribute('stretch'))
this.element.classList.add('ui-align-stretch');
};
UIRow = __decorate([
aurelia_framework_1.customElement('ui-row'),
aurelia_framework_1.inlineView('<template><content></content></template>'),
__metadata('design:paramtypes', [Element])
], UIRow);
return UIRow;
}());
exports.UIRow = UIRow;
var UIColumn = (function () {
function UIColumn(element) {
this.element = element;
this.size = '';
this.width = 'none';
}
UIColumn.prototype.bind = function () {
if (this.element.hasAttribute('fill')) {
this.element.classList.add('ui-col-fill');
}
else if (this.element.hasAttribute('full')) {
this.element.classList.add('ui-col-full');
}
else if (isEmpty(this.size)) {
this.element.classList.add('ui-col-auto');
}
if (this.element.hasAttribute('padded'))
this.element.classList.add('ui-pad-all');
for (var _i = 0, _a = this.size.split(' '); _i < _a.length; _i++) {
var size = _a[_i];
this.element.classList.add("ui-col-" + size);
}
if (this.element.hasAttribute('top'))
this.element.classList.add('ui-align-top');
if (this.element.hasAttribute('bottom'))
this.element.classList.add('ui-align-bottom');
if (this.element.hasAttribute('middle'))
this.element.classList.add('ui-align-middle');
if (this.element.hasAttribute('stretch'))
this.element.classList.add('ui-align-stretch');
};
__decorate([
aurelia_framework_1.bindable(),
__metadata('design:type', String)
], UIColumn.prototype, "size", void 0);
__decorate([
aurelia_framework_1.bindable(),
__metadata('design:type', String)
], UIColumn.prototype, "width", void 0);
UIColumn = __decorate([
aurelia_framework_1.customElement('ui-column'),
aurelia_framework_1.inlineView("<template class=\"ui-column\" css.bind=\"{'flex-basis': width}\"><content></content></template>"),
__metadata('design:paramtypes', [Element])
], UIColumn);
return UIColumn;
}());
exports.UIColumn = UIColumn;
});