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 | 1×
1×
1×
1×
67×
1×
825×
67×
825×
825×
825×
825×
825×
1506×
1506×
1506×
1×
825×
825×
825×
51×
825×
4571×
4571×
4571×
825×
797×
797×
2×
2×
2×
16×
16×
2×
797×
3190×
3190×
3190×
1×
1×
| define(["require", "exports", "../../common/base/constant", "../../common/base/css-constant", "@syncfusion/ej2-base", "../../base/util", "../actions/pivot-button", "@syncfusion/ej2-data"], function (require, exports, events, cls, ej2_base_1, util_1, pivot_button_1, ej2_data_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var AxisFields = (function () {
function AxisFields(parent) {
this.parent = parent;
}
AxisFields.prototype.render = function () {
if ((!this.parent.pivotButtonModule || (this.parent.pivotButtonModule && this.parent.pivotButtonModule.isDestroyed))) {
new pivot_button_1.PivotButton(this.parent);
}
this.createPivotButtons();
var pivotButtons = [];
pivotButtons = pivotButtons.concat([].slice.call(this.parent.groupingBarModule.rowPanel.querySelectorAll('.' + cls.PIVOT_BUTTON_WRAPPER_CLASS)));
var vlen = pivotButtons.length;
for (var j = 0; j < vlen; j++) {
var indentWidth = 24;
var indentDiv = ej2_base_1.createElement('span', {
className: 'e-indent-div',
styles: 'width:' + j * indentWidth + 'px'
});
ej2_base_1.prepend([indentDiv], pivotButtons[j]);
}
};
AxisFields.prototype.createPivotButtons = function () {
var fields = [this.parent.dataSourceSettings.rows, this.parent.dataSourceSettings.columns,
this.parent.dataSourceSettings.values, this.parent.dataSourceSettings.filters];
var elements = Array.prototype.slice.call(this.parent.element.querySelectorAll('.' + cls.GROUP_ALL_FIELDS_CLASS +
',.' + cls.GROUP_ROW_CLASS + ',.' + cls.GROUP_COLUMN_CLASS + ',.' + cls.GROUP_VALUE_CLASS + ',.' + cls.GROUP_FILTER_CLASS));
if (ej2_base_1.isNullOrUndefined(this.parent.element.querySelector('.' + cls.GROUP_PIVOT_ROW))) {
elements.push(this.parent.groupingBarModule.rowPanel);
}
for (var i = 0; i < elements.length; i++) {
var element = elements[i];
Eif ((this.parent.dataSourceSettings.values.length > 0 ? !element.classList.contains(cls.GROUP_CHART_VALUE) : true) ||
(this.parent.dataSourceSettings.columns.length > 0 ? !element.classList.contains(cls.GROUP_CHART_COLUMN) : true)) {
element.innerHTML = '';
}
}
if ((this.parent.dataType === 'pivot' && this.parent.dataSourceSettings.dataSource && ((!(this.parent.dataSourceSettings.dataSource instanceof ej2_data_1.DataManager) &&
(this.parent.dataSourceSettings.dataSource.length > 0)) ||
(this.parent.dataSourceSettings.dataSource instanceof ej2_data_1.DataManager && this.parent.engineModule.data &&
this.parent.engineModule.data.length > 0))) || (this.parent.dataType === 'olap' &&
this.parent.dataSourceSettings.url && this.parent.dataSourceSettings.url !== '') ||
(this.parent.dataSourceSettings.mode === 'Server' && this.parent.dataSourceSettings.url &&
this.parent.dataSourceSettings.url !== '')) {
var axis = ['rows', 'columns', 'values', 'filters'];
if (this.parent.dataType === 'pivot' && this.parent.groupingBarSettings.showFieldsPanel) {
axis.push('all-fields');
fields.push([]);
for (var _i = 0, _a = (this.parent.engineModule && this.parent.engineModule.fieldList ?
Object.keys(this.parent.engineModule.fieldList) : []); _i < _a.length; _i++) {
var key = _a[_i];
if (this.parent.engineModule.fieldList[key] &&
!this.parent.engineModule.fieldList[key].isSelected) {
fields[fields.length - 1].push(util_1.PivotUtil.getFieldInfo(key, this.parent, true).fieldItem);
}
}
}
for (var i = 0, lnt = fields.length; i < lnt; i++) {
Eif (fields[i]) {
var args = {
field: fields[i],
axis: axis[i].toString()
};
this.parent.notify(events.pivotButtonUpdate, args);
}
}
}
};
return AxisFields;
}());
exports.AxisFields = AxisFields;
});
|