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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157 | 1×
1×
1×
1×
1×
73×
73×
1×
1847×
1×
74×
74×
74×
2×
2×
2×
2×
72×
74×
74×
74×
74×
1×
278×
34×
278×
278×
278×
377×
32×
278×
278×
278×
278×
211×
211×
67×
67×
67×
1×
66×
278×
278×
1×
201×
201×
23×
178×
201×
200×
200×
200×
3×
197×
1×
73×
73×
73×
1×
72×
66×
6×
6×
1×
72×
72×
6×
6×
6×
6×
66×
1×
1×
| define(["require", "exports", "../../common/base/constant", "../base/css-constant", "../../pivotfieldlist/base/field-list", "@syncfusion/ej2-base", "../../common/calculatedfield/calculated-field"], function (require, exports, events, cls, field_list_1, ej2_base_1, calculated_field_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
field_list_1.PivotFieldList.Inject(calculated_field_1.CalculatedField);
var FieldList = (function () {
function FieldList(parent) {
this.parent = parent;
this.addEventListener();
}
FieldList.prototype.getModuleName = function () {
return 'fieldList';
};
FieldList.prototype.initiateModule = function () {
Eif (!ej2_base_1.select('#' + this.parent.element.id + '_PivotFieldList', this.parent.element)) {
this.element = ej2_base_1.createElement('div', {
id: this.parent.element.id + '_PivotFieldList',
styles: 'position:' + (this.parent.enableRtl ? 'static' : 'absolute') + ';height:0;width:' + this.parent.element.style.width +
';display:none'
});
if (ej2_base_1.select('#' + this.parent.element.id + 'containerwrapper', document) === null) {
var containerWrapper = ej2_base_1.createElement('div', {
id: this.parent.element.id + 'containerwrapper',
styles: 'height:' + (isNaN(this.parent.height) ? this.parent.height : (this.parent.height + 'px'))
});
this.parent.element.parentElement.appendChild(containerWrapper);
containerWrapper.appendChild(this.element);
containerWrapper.appendChild(this.parent.element);
}
else {
ej2_base_1.select('#' + this.parent.element.id + 'containerwrapper', document).appendChild(this.element);
}
this.parent.pivotFieldListModule = new field_list_1.PivotFieldList({
dataSourceSettings: {
providerType: this.parent.dataSourceSettings.providerType,
rows: [],
columns: [],
values: [],
filters: []
},
spinnerTemplate: this.parent.spinnerTemplate,
allowDeferLayoutUpdate: this.parent.allowDeferLayoutUpdate,
renderMode: 'Popup',
allowCalculatedField: this.parent.allowCalculatedField,
showValuesButton: this.parent.showValuesButton,
enableRtl: this.parent.enableRtl,
locale: this.parent.locale,
target: this.parent.element.parentElement,
aggregateTypes: this.parent.aggregateTypes,
maxNodeLimitInMemberEditor: this.parent.maxNodeLimitInMemberEditor,
aggregateCellInfo: this.parent.bindTriggerEvents.bind(this.parent),
onHeadersSort: this.parent.bindTriggerEvents.bind(this.parent),
cssClass: this.parent.cssClass,
enableFieldSearching: this.parent.enableFieldSearching,
enableHtmlSanitizer: this.parent.enableHtmlSanitizer
});
this.parent.pivotFieldListModule.isPopupView = true;
this.parent.pivotFieldListModule.pivotGridModule = this.parent;
this.parent.pivotFieldListModule.appendTo(this.element);
}
};
FieldList.prototype.updateControl = function () {
if (this.parent.allowDeferLayoutUpdate) {
this.parent.actionObj.actionName = 'Field list refreshed';
}
Eif (this.element) {
var hasFieldList = void 0;
for (var i = 0; i < this.parent.toolbar.length; i++) {
if (this.parent.toolbar[i] === 'FieldList') {
hasFieldList = true;
}
}
Iif (hasFieldList && this.parent.dataSourceSettings.mode === 'Server') {
this.element.style.display = 'none';
}
else {
this.element.style.display = 'block';
}
ej2_base_1.prepend([this.element], this.parent.element);
if (this.parent.showGroupingBar && this.parent.groupingBarModule) {
clearTimeout(this.timeOutObj);
this.timeOutObj = setTimeout(this.update.bind(this));
}
else Eif (!ej2_base_1.isNullOrUndefined((this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS)))) {
ej2_base_1.setStyleAttribute(this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS), {
left: 'auto'
});
if (this.parent.enableRtl) {
ej2_base_1.removeClass([this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS)], 'e-fieldlist-left');
}
else {
ej2_base_1.addClass([this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS)], 'e-fieldlist-left');
}
}
ej2_base_1.setStyleAttribute(this.element, {
width: ej2_base_1.formatUnit(this.parent.element.offsetWidth)
});
}
this.parent.pivotFieldListModule.update(this.parent);
};
FieldList.prototype.update = function () {
var currentWidth;
if (this.parent.currentView !== 'Table') {
currentWidth = this.parent.chart ? this.parent.pivotChartModule.getCalulatedWidth() : currentWidth;
}
else {
currentWidth = this.parent.grid ? this.parent.grid.element.offsetWidth : currentWidth;
}
if (currentWidth && (!ej2_base_1.isNullOrUndefined((this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS))))) {
var actualWidth = currentWidth < 400 ? 400 : currentWidth;
ej2_base_1.setStyleAttribute(this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS), {
left: ej2_base_1.formatUnit(this.parent.enableRtl ?
-Math.abs((actualWidth) -
this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS).offsetWidth) :
(actualWidth) -
this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS).offsetWidth),
top: this.parent.element.querySelector('.' + cls.FIELD_PANEL_SCROLL_CLASS) ? this.parent.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS).offsetHeight.toString() + 'px' : ''
});
if (this.parent.enableRtl) {
ej2_base_1.addClass([this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS)], 'e-fieldlist-left');
}
else {
ej2_base_1.removeClass([this.element.querySelector('.' + cls.TOGGLE_FIELD_LIST_CLASS)], 'e-fieldlist-left');
}
}
};
FieldList.prototype.addEventListener = function () {
Iif (this.parent.isDestroyed) {
return;
}
this.parent.on(events.initSubComponent, this.initiateModule, this);
this.parent.on(events.uiUpdate, this.updateControl, this);
};
FieldList.prototype.removeEventListener = function () {
if (this.parent.isDestroyed) {
return;
}
this.parent.off(events.initSubComponent, this.initiateModule);
this.parent.off(events.uiUpdate, this.updateControl);
};
FieldList.prototype.destroy = function () {
this.removeEventListener();
if (this.parent.pivotFieldListModule && !this.parent.pivotFieldListModule.isDestroyed) {
this.parent.pivotFieldListModule.destroy();
this.parent.pivotFieldListModule = null;
Eif (!ej2_base_1.isNullOrUndefined(ej2_base_1.select('#' + this.parent.element.id + '_PivotFieldList', document))) {
ej2_base_1.remove(ej2_base_1.select('#' + this.parent.element.id + '_PivotFieldList', document));
}
}
else {
return;
}
};
return FieldList;
}());
exports.FieldList = FieldList;
});
|