1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 | "use strict";
|
8 | var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
9 | var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
10 | if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
11 | 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;
|
12 | return c > 3 && r && Object.defineProperty(target, key, r), r;
|
13 | };
|
14 | var __metadata = (this && this.__metadata) || function (k, v) {
|
15 | if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
16 | };
|
17 | Object.defineProperty(exports, "__esModule", { value: true });
|
18 | var context_1 = require("./context/context");
|
19 | var themeNames = ['fresh', 'dark', 'blue', 'bootstrap', 'material', 'balham-dark', 'balham'];
|
20 | var themes = themeNames.concat(themeNames.map(function (name) { return "theme-" + name; }));
|
21 | var themeClass = new RegExp("ag-(" + themes.join('|') + ")");
|
22 | var matGridSize = 8;
|
23 | var freshGridSize = 4;
|
24 | var balhamGridSize = 4;
|
25 | var HARD_CODED_SIZES = {
|
26 | 'ag-theme-material': {
|
27 | headerHeight: matGridSize * 7,
|
28 | virtualItemHeight: matGridSize * 5,
|
29 | rowHeight: matGridSize * 6
|
30 | },
|
31 | 'ag-theme-classic': {
|
32 | headerHeight: 25,
|
33 | virtualItemHeight: freshGridSize * 5,
|
34 | rowHeight: 25
|
35 | },
|
36 | 'ag-theme-balham': {
|
37 | headerHeight: balhamGridSize * 8,
|
38 | virtualItemHeight: balhamGridSize * 7,
|
39 | rowHeight: balhamGridSize * 7
|
40 | }
|
41 | };
|
42 | var Environment = (function () {
|
43 | function Environment() {
|
44 | this.sassVariables = {};
|
45 | }
|
46 |
|
47 |
|
48 | Environment.prototype.loadSassVariables = function () {
|
49 | |
50 |
|
51 |
|
52 |
|
53 |
|
54 |
|
55 |
|
56 |
|
57 |
|
58 |
|
59 |
|
60 |
|
61 |
|
62 |
|
63 |
|
64 | };
|
65 | Environment.prototype.getSassVariable = function (theme, key) {
|
66 | if (theme == 'ag-theme-material') {
|
67 | return HARD_CODED_SIZES['ag-theme-material'][key];
|
68 | }
|
69 | else if (theme == 'ag-theme-balham' || theme == 'ag-theme-balham-dark') {
|
70 | return HARD_CODED_SIZES['ag-theme-balham'][key];
|
71 | }
|
72 | return HARD_CODED_SIZES['ag-theme-classic'][key];
|
73 | |
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 | };
|
81 | Environment.prototype.getTheme = function () {
|
82 | var themeMatch;
|
83 | var element = this.eGridDiv;
|
84 | while (element != document.documentElement && themeMatch == null) {
|
85 | themeMatch = element.className.match(themeClass);
|
86 | element = element.parentElement;
|
87 | if (element == null) {
|
88 | break;
|
89 | }
|
90 | }
|
91 | if (themeMatch) {
|
92 | return themeMatch[0];
|
93 | }
|
94 | else {
|
95 | return 'ag-fresh';
|
96 | }
|
97 | };
|
98 | __decorate([
|
99 | context_1.Autowired('eGridDiv'),
|
100 | __metadata("design:type", HTMLElement)
|
101 | ], Environment.prototype, "eGridDiv", void 0);
|
102 | Environment = __decorate([
|
103 | context_1.Bean('environment')
|
104 | ], Environment);
|
105 | return Environment;
|
106 | }());
|
107 | exports.Environment = Environment;
|