-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReportDisplayStat.js
129 lines (104 loc) · 3.08 KB
/
ReportDisplayStat.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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/* jshint camelcase:false, unused:false, laxbreak:true, expr:true, boss:true */
/* globals debugger, BEMHTML, DEBUG, DBG, app, project */
/**
*
* @module ReportDisplayStat
* @overview __INFO__
*
* @author lilliputten <lilliputten@yandex.ru>
* @since 2017.06.05 17:19:20
* @version 2017.06.05 17:19:20
*
* $Date: 2017-06-06 15:15:36 +0300 (Вт, 06 июн 2017) $
* $Id: ReportDisplayStat.js 8547 2017-06-06 12:15:36Z miheev $
*
*/
modules.define('ReportDisplayStat', [
'i-bem-dom',
'vow',
'objects',
'project',
'jquery',
],
function(provide,
BEMDOM,
vow,
objects,
project,
$,
__BASE) {
/**
*
* @exports
* @class ReportDisplayStat
* @bem
* @classdesc __INFO__
*
* TODO
* ====
*
* ОПИСАНИЕ
* ========
*
*/
// Ссылка на описание модуля
var __module = this;
var ReportDisplayStat = /** @lends ReportDisplayStat.prototype */ {
/** exportableItems ** {{{ */
exportableItems : function (conditions) {
return this.findChildElems('Item')
.filter(function(Item){
return ( !Item.params.conditions || objects.isComprised(conditions, Item.params.conditions) );
})
;
},/*}}}*/
/** exportData ** {{{ */
exportData : function (conditions) {
return this.exportableItems(conditions)
.map(function(Item){
var ItemContent = Item._elem('ItemContent');
return {
elem : 'Item',
id : Item.params.id,
title : Item.params.title,
val : ItemContent.domElem.html(),
};
})
;
},/*}}}*/
/** isVisibleItem ** {{{ */
isVisibleItem : function (Item) {
return Item && !Item.getMod('print') && !Item.getMod('export') && !Item.getMod('hidden');
},/*}}}*/
/** visibleItems ** {{{ Количество видимых элементов */
visibleItems : function () {
return this.findChildElems('Item')
.filter(this.isVisibleItem, this)
;
},/*}}}*/
/** visibleItemsCount ** {{{ Количество видимых элементов */
visibleItemsCount : function () {
return this.visibleItems().size();
},/*}}}*/
/** _onInited() ** {{{ Инициализируем блок */
_onInited : function () {
var ReportDisplayStat = this;
this.visibleItemsCount() || this.setMod('hidden');
},/*}}}*/
/** onSetMod... ** {{{ События на установку модификаторов... */
onSetMod : {
/** (js:inited) ** {{{ Инициализация bem блока */
js : {
inited : function () {
var ReportDisplayStat = this,
that = this,
params = this.params,
undef
;
this._onInited();
},
},/*}}}*/
},/*}}}*/
};
provide(BEMDOM.declBlock(this.name, ReportDisplayStat)); // provide
}); // module