@datarailsshared/dr_renderer 1.5.36 → 1.5.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/highcharts_renderer.js +3 -5
- package/src/pivottable.js +0 -503
package/package.json
CHANGED
|
@@ -2131,8 +2131,7 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2131
2131
|
};
|
|
2132
2132
|
|
|
2133
2133
|
highchartsRenderer.addSecondYAxis = function (pivotData, chartOptions, additionOptions, opts) {
|
|
2134
|
-
|
|
2135
|
-
const forcePercentage = lodash.get(opts, 'comboOptions.secondaryAxisSettings.is_percentage', false) || lodash.get(additionOptions, 'delta_column.is_percentage', false);
|
|
2134
|
+
const forcePercentage = lodash.get(opts, 'comboOptions.secondaryAxisSettings.is_percentage', false) || lodash.get(additionOptions, 'delta_column.is_percentage', false);
|
|
2136
2135
|
|
|
2137
2136
|
chartOptions.yAxis = [chartOptions.yAxis];
|
|
2138
2137
|
chartOptions.yAxis[1] = {
|
|
@@ -2141,13 +2140,13 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
2141
2140
|
title: {
|
|
2142
2141
|
text: highchartsRenderer.encodeHTMLBrackets(opts.comboOptions.secondaryAxisSettings.name),
|
|
2143
2142
|
style: {
|
|
2144
|
-
color:
|
|
2143
|
+
color: CHART_COLORS.LABEL_SECOND
|
|
2145
2144
|
}
|
|
2146
2145
|
},
|
|
2147
2146
|
labels: {
|
|
2148
2147
|
formatter: highchartsRenderer.defaultValueLabelsFormatter(pivotData, opts, forcePercentage),
|
|
2149
2148
|
style: {
|
|
2150
|
-
color:
|
|
2149
|
+
color: CHART_COLORS.LABEL_SECOND
|
|
2151
2150
|
}
|
|
2152
2151
|
},
|
|
2153
2152
|
opposite: true,
|
|
@@ -4840,7 +4839,6 @@ let getHighchartsRenderer = function ($, document, Highcharts, default_colors, h
|
|
|
4840
4839
|
dateValuesDictionary: pivotOptions ? pivotOptions.dateValuesDictionary : null,
|
|
4841
4840
|
keysObject: pivotOptions ? pivotOptions.keysObject : null,
|
|
4842
4841
|
isDrillDownDisabled: pivotOptions ? pivotOptions.isDrillDownDisabled : false,
|
|
4843
|
-
pivotUiFnRemoved: pivotOptions ? pivotOptions.pivotUiFnRemoved : false,
|
|
4844
4842
|
};
|
|
4845
4843
|
|
|
4846
4844
|
if (!subopts.rendererOptions) {
|
package/src/pivottable.js
CHANGED
|
@@ -668,7 +668,6 @@ let initPivotTable = function($, window, document) {
|
|
|
668
668
|
this.getFormattedColKeys = (keys) => opts.getFormattedColKeys(this, keys);
|
|
669
669
|
this.getFormattedRowKeys = (keys) => opts.getFormattedRowKeys(this, keys);
|
|
670
670
|
this.isDrillDownDisabled = opts.isDrillDownDisabled;
|
|
671
|
-
this.pivotUiFnRemoved = opts.pivotUiFnRemoved;
|
|
672
671
|
|
|
673
672
|
PivotData.forEachRecord(this.input, this.derivedAttributes, (function(_this) {
|
|
674
673
|
return function(record) {
|
|
@@ -1214,508 +1213,6 @@ let initPivotTable = function($, window, document) {
|
|
|
1214
1213
|
return this.append(result);
|
|
1215
1214
|
};
|
|
1216
1215
|
|
|
1217
|
-
/*
|
|
1218
|
-
Pivot Table UI: calls Pivot Table core above with options set by user
|
|
1219
|
-
*/
|
|
1220
|
-
$.fn.pivotUI = function(input, inputOpts, overwrite, locale) {
|
|
1221
|
-
if (!this.pivotUiFnRemoved) {
|
|
1222
|
-
var a, aggregator, attr, attrLength, attrValues, c, colOrderArrow, defaults, e, existingOpts, fn1, i, initialRender, l, len1, len2, len3, localeDefaults, localeStrings, materializedInput, n, o, opts, ordering, pivotTable, recordsProcessed, ref, ref1, ref2, ref3, refresh, refreshDelayed, renderer, rendererControl, rowOrderArrow, shownAttributes, shownInAggregators, shownInDragDrop, tr1, tr2, uiTable, unused, unusedAttrsVerticalAutoCutoff, unusedAttrsVerticalAutoOverride, x;
|
|
1223
|
-
if (overwrite == null) {
|
|
1224
|
-
overwrite = false;
|
|
1225
|
-
}
|
|
1226
|
-
if (locale == null) {
|
|
1227
|
-
locale = "en";
|
|
1228
|
-
}
|
|
1229
|
-
if (locales[locale] == null) {
|
|
1230
|
-
locale = "en";
|
|
1231
|
-
}
|
|
1232
|
-
defaults = {
|
|
1233
|
-
derivedAttributes: {},
|
|
1234
|
-
aggregators: locales[locale].aggregators,
|
|
1235
|
-
renderers: locales[locale].renderers,
|
|
1236
|
-
hiddenAttributes: [],
|
|
1237
|
-
hiddenFromAggregators: [],
|
|
1238
|
-
hiddenFromDragDrop: [],
|
|
1239
|
-
menuLimit: 500,
|
|
1240
|
-
cols: [],
|
|
1241
|
-
rows: [],
|
|
1242
|
-
vals: [],
|
|
1243
|
-
rowOrder: "key_a_to_z",
|
|
1244
|
-
colOrder: "key_a_to_z",
|
|
1245
|
-
dataClass: PivotData,
|
|
1246
|
-
exclusions: {},
|
|
1247
|
-
inclusions: {},
|
|
1248
|
-
unusedAttrsVertical: 85,
|
|
1249
|
-
autoSortUnusedAttrs: false,
|
|
1250
|
-
onRefresh: null,
|
|
1251
|
-
showUI: true,
|
|
1252
|
-
filter: function() {
|
|
1253
|
-
return true;
|
|
1254
|
-
},
|
|
1255
|
-
sorters: {}
|
|
1256
|
-
};
|
|
1257
|
-
localeStrings = $.extend(true, {}, locales.en.localeStrings, locales[locale].localeStrings);
|
|
1258
|
-
localeDefaults = {
|
|
1259
|
-
rendererOptions: {
|
|
1260
|
-
localeStrings: localeStrings
|
|
1261
|
-
},
|
|
1262
|
-
localeStrings: localeStrings
|
|
1263
|
-
};
|
|
1264
|
-
existingOpts = this.data("pivotUIOptions");
|
|
1265
|
-
if ((existingOpts == null) || overwrite) {
|
|
1266
|
-
opts = $.extend(true, {}, localeDefaults, $.extend({}, defaults, inputOpts));
|
|
1267
|
-
} else {
|
|
1268
|
-
opts = existingOpts;
|
|
1269
|
-
}
|
|
1270
|
-
try {
|
|
1271
|
-
attrValues = {};
|
|
1272
|
-
materializedInput = [];
|
|
1273
|
-
recordsProcessed = 0;
|
|
1274
|
-
PivotData.forEachRecord(input, opts.derivedAttributes, function(record) {
|
|
1275
|
-
var attr, base, ref, value;
|
|
1276
|
-
if (!opts.filter(record)) {
|
|
1277
|
-
return;
|
|
1278
|
-
}
|
|
1279
|
-
materializedInput.push(record);
|
|
1280
|
-
for (attr in record) {
|
|
1281
|
-
if (!hasProp.call(record, attr)) continue;
|
|
1282
|
-
if (attrValues[attr] == null) {
|
|
1283
|
-
attrValues[attr] = {};
|
|
1284
|
-
if (recordsProcessed > 0) {
|
|
1285
|
-
attrValues[attr]["null"] = recordsProcessed;
|
|
1286
|
-
}
|
|
1287
|
-
}
|
|
1288
|
-
}
|
|
1289
|
-
for (attr in attrValues) {
|
|
1290
|
-
value = (ref = record[attr]) != null ? ref : "null";
|
|
1291
|
-
if ((base = attrValues[attr])[value] == null) {
|
|
1292
|
-
base[value] = 0;
|
|
1293
|
-
}
|
|
1294
|
-
attrValues[attr][value]++;
|
|
1295
|
-
}
|
|
1296
|
-
return recordsProcessed++;
|
|
1297
|
-
});
|
|
1298
|
-
uiTable = $("<table>", {
|
|
1299
|
-
"class": "pvtUi"
|
|
1300
|
-
}).attr("cellpadding", 5);
|
|
1301
|
-
rendererControl = $("<td>").addClass("pvtUiCell");
|
|
1302
|
-
renderer = $("<select>").addClass('pvtRenderer').appendTo(rendererControl).bind("change", function() {
|
|
1303
|
-
return refresh();
|
|
1304
|
-
});
|
|
1305
|
-
ref = opts.renderers;
|
|
1306
|
-
for (x in ref) {
|
|
1307
|
-
if (!hasProp.call(ref, x)) continue;
|
|
1308
|
-
$("<option>").val(x).html(x).appendTo(renderer);
|
|
1309
|
-
}
|
|
1310
|
-
unused = $("<td>").addClass('pvtAxisContainer pvtUnused pvtUiCell');
|
|
1311
|
-
shownAttributes = (function() {
|
|
1312
|
-
var results;
|
|
1313
|
-
results = [];
|
|
1314
|
-
for (a in attrValues) {
|
|
1315
|
-
if (indexOf.call(opts.hiddenAttributes, a) < 0) {
|
|
1316
|
-
results.push(a);
|
|
1317
|
-
}
|
|
1318
|
-
}
|
|
1319
|
-
return results;
|
|
1320
|
-
})();
|
|
1321
|
-
shownInAggregators = (function() {
|
|
1322
|
-
var l, len1, results;
|
|
1323
|
-
results = [];
|
|
1324
|
-
for (l = 0, len1 = shownAttributes.length; l < len1; l++) {
|
|
1325
|
-
c = shownAttributes[l];
|
|
1326
|
-
if (indexOf.call(opts.hiddenFromAggregators, c) < 0) {
|
|
1327
|
-
results.push(c);
|
|
1328
|
-
}
|
|
1329
|
-
}
|
|
1330
|
-
return results;
|
|
1331
|
-
})();
|
|
1332
|
-
shownInDragDrop = (function() {
|
|
1333
|
-
var l, len1, results;
|
|
1334
|
-
results = [];
|
|
1335
|
-
for (l = 0, len1 = shownAttributes.length; l < len1; l++) {
|
|
1336
|
-
c = shownAttributes[l];
|
|
1337
|
-
if (indexOf.call(opts.hiddenFromDragDrop, c) < 0) {
|
|
1338
|
-
results.push(c);
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
return results;
|
|
1342
|
-
})();
|
|
1343
|
-
unusedAttrsVerticalAutoOverride = false;
|
|
1344
|
-
if (opts.unusedAttrsVertical === "auto") {
|
|
1345
|
-
unusedAttrsVerticalAutoCutoff = 120;
|
|
1346
|
-
} else {
|
|
1347
|
-
unusedAttrsVerticalAutoCutoff = parseInt(opts.unusedAttrsVertical);
|
|
1348
|
-
}
|
|
1349
|
-
if (!isNaN(unusedAttrsVerticalAutoCutoff)) {
|
|
1350
|
-
attrLength = 0;
|
|
1351
|
-
for (l = 0, len1 = shownInDragDrop.length; l < len1; l++) {
|
|
1352
|
-
a = shownInDragDrop[l];
|
|
1353
|
-
attrLength += a.length;
|
|
1354
|
-
}
|
|
1355
|
-
unusedAttrsVerticalAutoOverride = attrLength > unusedAttrsVerticalAutoCutoff;
|
|
1356
|
-
}
|
|
1357
|
-
if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {
|
|
1358
|
-
unused.addClass('pvtVertList');
|
|
1359
|
-
} else {
|
|
1360
|
-
unused.addClass('pvtHorizList');
|
|
1361
|
-
}
|
|
1362
|
-
fn1 = function(attr) {
|
|
1363
|
-
var attrElem, checkContainer, closeFilterBox, controls, filterItem, filterItemExcluded, finalButtons, hasExcludedItem, len2, n, placeholder, ref1, sorter, triangleLink, v, value, valueCount, valueList, values;
|
|
1364
|
-
values = (function() {
|
|
1365
|
-
var results;
|
|
1366
|
-
results = [];
|
|
1367
|
-
for (v in attrValues[attr]) {
|
|
1368
|
-
results.push(v);
|
|
1369
|
-
}
|
|
1370
|
-
return results;
|
|
1371
|
-
})();
|
|
1372
|
-
hasExcludedItem = false;
|
|
1373
|
-
valueList = $("<div>").addClass('pvtFilterBox').hide();
|
|
1374
|
-
valueList.append($("<h4>").append($("<span>").text(attr), $("<span>").addClass("count").text("(" + values.length + ")")));
|
|
1375
|
-
if (values.length > opts.menuLimit) {
|
|
1376
|
-
valueList.append($("<p>").html(opts.localeStrings.tooMany));
|
|
1377
|
-
} else {
|
|
1378
|
-
if (values.length > 5) {
|
|
1379
|
-
controls = $("<p>").appendTo(valueList);
|
|
1380
|
-
sorter = getSort(opts.sorters, attr);
|
|
1381
|
-
placeholder = opts.localeStrings.filterResults;
|
|
1382
|
-
$("<input>", {
|
|
1383
|
-
type: "text"
|
|
1384
|
-
}).appendTo(controls).attr({
|
|
1385
|
-
placeholder: placeholder,
|
|
1386
|
-
"class": "pvtSearch"
|
|
1387
|
-
}).bind("keyup", function() {
|
|
1388
|
-
var accept, accept_gen, filter;
|
|
1389
|
-
filter = $(this).val().toLowerCase().trim();
|
|
1390
|
-
accept_gen = function(prefix, accepted) {
|
|
1391
|
-
return function(v) {
|
|
1392
|
-
var real_filter, ref1;
|
|
1393
|
-
real_filter = filter.substring(prefix.length).trim();
|
|
1394
|
-
if (real_filter.length === 0) {
|
|
1395
|
-
return true;
|
|
1396
|
-
}
|
|
1397
|
-
return ref1 = Math.sign(sorter(v.toLowerCase(), real_filter)), indexOf.call(accepted, ref1) >= 0;
|
|
1398
|
-
};
|
|
1399
|
-
};
|
|
1400
|
-
accept = filter.indexOf(">=") === 0 ? accept_gen(">=", [1, 0]) : filter.indexOf("<=") === 0 ? accept_gen("<=", [-1, 0]) : filter.indexOf(">") === 0 ? accept_gen(">", [1]) : filter.indexOf("<") === 0 ? accept_gen("<", [-1]) : filter.indexOf("~") === 0 ? function(v) {
|
|
1401
|
-
if (filter.substring(1).trim().length === 0) {
|
|
1402
|
-
return true;
|
|
1403
|
-
}
|
|
1404
|
-
return v.toLowerCase().match(filter.substring(1));
|
|
1405
|
-
} : function(v) {
|
|
1406
|
-
return v.toLowerCase().indexOf(filter) !== -1;
|
|
1407
|
-
};
|
|
1408
|
-
return valueList.find('.pvtCheckContainer p label span.value').each(function() {
|
|
1409
|
-
if (accept($(this).text())) {
|
|
1410
|
-
return $(this).parent().parent().show();
|
|
1411
|
-
} else {
|
|
1412
|
-
return $(this).parent().parent().hide();
|
|
1413
|
-
}
|
|
1414
|
-
});
|
|
1415
|
-
});
|
|
1416
|
-
controls.append($("<br>"));
|
|
1417
|
-
$("<button>", {
|
|
1418
|
-
type: "button"
|
|
1419
|
-
}).appendTo(controls).html(opts.localeStrings.selectAll).bind("click", function() {
|
|
1420
|
-
valueList.find("input:visible:not(:checked)").prop("checked", true).toggleClass("changed");
|
|
1421
|
-
return false;
|
|
1422
|
-
});
|
|
1423
|
-
$("<button>", {
|
|
1424
|
-
type: "button"
|
|
1425
|
-
}).appendTo(controls).html(opts.localeStrings.selectNone).bind("click", function() {
|
|
1426
|
-
valueList.find("input:visible:checked").prop("checked", false).toggleClass("changed");
|
|
1427
|
-
return false;
|
|
1428
|
-
});
|
|
1429
|
-
}
|
|
1430
|
-
checkContainer = $("<div>").addClass("pvtCheckContainer").appendTo(valueList);
|
|
1431
|
-
ref1 = values.sort(getSort(opts.sorters, attr));
|
|
1432
|
-
for (n = 0, len2 = ref1.length; n < len2; n++) {
|
|
1433
|
-
value = ref1[n];
|
|
1434
|
-
valueCount = attrValues[attr][value];
|
|
1435
|
-
filterItem = $("<label>");
|
|
1436
|
-
filterItemExcluded = false;
|
|
1437
|
-
if (opts.inclusions[attr]) {
|
|
1438
|
-
filterItemExcluded = (indexOf.call(opts.inclusions[attr], value) < 0);
|
|
1439
|
-
} else if (opts.exclusions[attr]) {
|
|
1440
|
-
filterItemExcluded = (indexOf.call(opts.exclusions[attr], value) >= 0);
|
|
1441
|
-
}
|
|
1442
|
-
hasExcludedItem || (hasExcludedItem = filterItemExcluded);
|
|
1443
|
-
$("<input>").attr("type", "checkbox").addClass('pvtFilter').attr("checked", !filterItemExcluded).data("filter", [attr, value]).appendTo(filterItem).bind("change", function() {
|
|
1444
|
-
return $(this).toggleClass("changed");
|
|
1445
|
-
});
|
|
1446
|
-
filterItem.append($("<span>").addClass("value").text(value));
|
|
1447
|
-
filterItem.append($("<span>").addClass("count").text("(" + valueCount + ")"));
|
|
1448
|
-
checkContainer.append($("<p>").append(filterItem));
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
closeFilterBox = function() {
|
|
1452
|
-
if (valueList.find("[type='checkbox']").length > valueList.find("[type='checkbox']:checked").length) {
|
|
1453
|
-
attrElem.addClass("pvtFilteredAttribute");
|
|
1454
|
-
} else {
|
|
1455
|
-
attrElem.removeClass("pvtFilteredAttribute");
|
|
1456
|
-
}
|
|
1457
|
-
valueList.find('.pvtSearch').val('');
|
|
1458
|
-
valueList.find('.pvtCheckContainer p').show();
|
|
1459
|
-
return valueList.hide();
|
|
1460
|
-
};
|
|
1461
|
-
finalButtons = $("<p>").appendTo(valueList);
|
|
1462
|
-
if (values.length <= opts.menuLimit) {
|
|
1463
|
-
$("<button>", {
|
|
1464
|
-
type: "button"
|
|
1465
|
-
}).text(opts.localeStrings.apply).appendTo(finalButtons).bind("click", function() {
|
|
1466
|
-
if (valueList.find(".changed").removeClass("changed").length) {
|
|
1467
|
-
refresh();
|
|
1468
|
-
}
|
|
1469
|
-
return closeFilterBox();
|
|
1470
|
-
});
|
|
1471
|
-
}
|
|
1472
|
-
$("<button>", {
|
|
1473
|
-
type: "button"
|
|
1474
|
-
}).text(opts.localeStrings.cancel).appendTo(finalButtons).bind("click", function() {
|
|
1475
|
-
valueList.find(".changed:checked").removeClass("changed").prop("checked", false);
|
|
1476
|
-
valueList.find(".changed:not(:checked)").removeClass("changed").prop("checked", true);
|
|
1477
|
-
return closeFilterBox();
|
|
1478
|
-
});
|
|
1479
|
-
triangleLink = $("<span>").addClass('pvtTriangle').html(" ▾").bind("click", function(e) {
|
|
1480
|
-
var left, ref2, top;
|
|
1481
|
-
ref2 = $(e.currentTarget).position(), left = ref2.left, top = ref2.top;
|
|
1482
|
-
return valueList.css({
|
|
1483
|
-
left: left + 10,
|
|
1484
|
-
top: top + 10
|
|
1485
|
-
}).show();
|
|
1486
|
-
});
|
|
1487
|
-
attrElem = $("<li>").addClass("axis_" + i).append($("<span>").addClass('pvtAttr').text(attr).data("attrName", attr).append(triangleLink));
|
|
1488
|
-
if (hasExcludedItem) {
|
|
1489
|
-
attrElem.addClass('pvtFilteredAttribute');
|
|
1490
|
-
}
|
|
1491
|
-
return unused.append(attrElem).append(valueList);
|
|
1492
|
-
};
|
|
1493
|
-
for (i in shownInDragDrop) {
|
|
1494
|
-
if (!hasProp.call(shownInDragDrop, i)) continue;
|
|
1495
|
-
attr = shownInDragDrop[i];
|
|
1496
|
-
fn1(attr);
|
|
1497
|
-
}
|
|
1498
|
-
tr1 = $("<tr>").appendTo(uiTable);
|
|
1499
|
-
aggregator = $("<select>").addClass('pvtAggregator').bind("change", function() {
|
|
1500
|
-
return refresh();
|
|
1501
|
-
});
|
|
1502
|
-
ref1 = opts.aggregators;
|
|
1503
|
-
for (x in ref1) {
|
|
1504
|
-
if (!hasProp.call(ref1, x)) continue;
|
|
1505
|
-
aggregator.append($("<option>").val(x).html(x));
|
|
1506
|
-
}
|
|
1507
|
-
ordering = {
|
|
1508
|
-
key_a_to_z: {
|
|
1509
|
-
rowSymbol: "↕",
|
|
1510
|
-
colSymbol: "↔",
|
|
1511
|
-
next: "value_a_to_z"
|
|
1512
|
-
},
|
|
1513
|
-
value_a_to_z: {
|
|
1514
|
-
rowSymbol: "↓",
|
|
1515
|
-
colSymbol: "→",
|
|
1516
|
-
next: "value_z_to_a"
|
|
1517
|
-
},
|
|
1518
|
-
value_z_to_a: {
|
|
1519
|
-
rowSymbol: "↑",
|
|
1520
|
-
colSymbol: "←",
|
|
1521
|
-
next: "key_a_to_z"
|
|
1522
|
-
}
|
|
1523
|
-
};
|
|
1524
|
-
rowOrderArrow = $("<a>", {
|
|
1525
|
-
role: "button"
|
|
1526
|
-
}).addClass("pvtRowOrder").data("order", opts.rowOrder).html(ordering[opts.rowOrder].rowSymbol).bind("click", function() {
|
|
1527
|
-
$(this).data("order", ordering[$(this).data("order")].next);
|
|
1528
|
-
$(this).html(ordering[$(this).data("order")].rowSymbol);
|
|
1529
|
-
return refresh();
|
|
1530
|
-
});
|
|
1531
|
-
colOrderArrow = $("<a>", {
|
|
1532
|
-
role: "button"
|
|
1533
|
-
}).addClass("pvtColOrder").data("order", opts.colOrder).html(ordering[opts.colOrder].colSymbol).bind("click", function() {
|
|
1534
|
-
$(this).data("order", ordering[$(this).data("order")].next);
|
|
1535
|
-
$(this).html(ordering[$(this).data("order")].colSymbol);
|
|
1536
|
-
return refresh();
|
|
1537
|
-
});
|
|
1538
|
-
$("<td>").addClass('pvtVals pvtUiCell').appendTo(tr1).append(aggregator).append(rowOrderArrow).append(colOrderArrow).append($("<br>"));
|
|
1539
|
-
$("<td>").addClass('pvtAxisContainer pvtHorizList pvtCols pvtUiCell').appendTo(tr1);
|
|
1540
|
-
tr2 = $("<tr>").appendTo(uiTable);
|
|
1541
|
-
tr2.append($("<td>").addClass('pvtAxisContainer pvtRows pvtUiCell').attr("valign", "top"));
|
|
1542
|
-
pivotTable = $("<td>").attr("valign", "top").addClass('pvtRendererArea').appendTo(tr2);
|
|
1543
|
-
if (opts.unusedAttrsVertical === true || unusedAttrsVerticalAutoOverride) {
|
|
1544
|
-
uiTable.find('tr:nth-child(1)').prepend(rendererControl);
|
|
1545
|
-
uiTable.find('tr:nth-child(2)').prepend(unused);
|
|
1546
|
-
} else {
|
|
1547
|
-
uiTable.prepend($("<tr>").append(rendererControl).append(unused));
|
|
1548
|
-
}
|
|
1549
|
-
this.html(uiTable);
|
|
1550
|
-
ref2 = opts.cols;
|
|
1551
|
-
for (n = 0, len2 = ref2.length; n < len2; n++) {
|
|
1552
|
-
x = ref2[n];
|
|
1553
|
-
this.find(".pvtCols").append(this.find(".axis_" + ($.inArray(x, shownInDragDrop))));
|
|
1554
|
-
}
|
|
1555
|
-
ref3 = opts.rows;
|
|
1556
|
-
for (o = 0, len3 = ref3.length; o < len3; o++) {
|
|
1557
|
-
x = ref3[o];
|
|
1558
|
-
this.find(".pvtRows").append(this.find(".axis_" + ($.inArray(x, shownInDragDrop))));
|
|
1559
|
-
}
|
|
1560
|
-
if (opts.aggregatorName != null) {
|
|
1561
|
-
this.find(".pvtAggregator").val(opts.aggregatorName);
|
|
1562
|
-
}
|
|
1563
|
-
if (opts.rendererName != null) {
|
|
1564
|
-
this.find(".pvtRenderer").val(opts.rendererName);
|
|
1565
|
-
}
|
|
1566
|
-
if (!opts.showUI) {
|
|
1567
|
-
this.find(".pvtUiCell").hide();
|
|
1568
|
-
}
|
|
1569
|
-
initialRender = true;
|
|
1570
|
-
refreshDelayed = (function(_this) {
|
|
1571
|
-
return function() {
|
|
1572
|
-
var exclusions, inclusions, len4, newDropdown, numInputsToProcess, pivotUIOptions, pvtVals, ref4, ref5, subopts, t, u, unusedAttrsContainer, vals;
|
|
1573
|
-
subopts = {
|
|
1574
|
-
derivedAttributes: opts.derivedAttributes,
|
|
1575
|
-
localeStrings: opts.localeStrings,
|
|
1576
|
-
rendererOptions: opts.rendererOptions,
|
|
1577
|
-
sorters: opts.sorters,
|
|
1578
|
-
cols: [],
|
|
1579
|
-
rows: [],
|
|
1580
|
-
dataClass: opts.dataClass
|
|
1581
|
-
};
|
|
1582
|
-
numInputsToProcess = (ref4 = opts.aggregators[aggregator.val()]([])().numInputs) != null ? ref4 : 0;
|
|
1583
|
-
vals = [];
|
|
1584
|
-
_this.find(".pvtRows li span.pvtAttr").each(function() {
|
|
1585
|
-
return subopts.rows.push($(this).data("attrName"));
|
|
1586
|
-
});
|
|
1587
|
-
_this.find(".pvtCols li span.pvtAttr").each(function() {
|
|
1588
|
-
return subopts.cols.push($(this).data("attrName"));
|
|
1589
|
-
});
|
|
1590
|
-
_this.find(".pvtVals select.pvtAttrDropdown").each(function() {
|
|
1591
|
-
if (numInputsToProcess === 0) {
|
|
1592
|
-
return $(this).remove();
|
|
1593
|
-
} else {
|
|
1594
|
-
numInputsToProcess--;
|
|
1595
|
-
if ($(this).val() !== "") {
|
|
1596
|
-
return vals.push($(this).val());
|
|
1597
|
-
}
|
|
1598
|
-
}
|
|
1599
|
-
});
|
|
1600
|
-
if (numInputsToProcess !== 0) {
|
|
1601
|
-
pvtVals = _this.find(".pvtVals");
|
|
1602
|
-
for (x = t = 0, ref5 = numInputsToProcess; 0 <= ref5 ? t < ref5 : t > ref5; x = 0 <= ref5 ? ++t : --t) {
|
|
1603
|
-
newDropdown = $("<select>").addClass('pvtAttrDropdown').append($("<option>")).bind("change", function() {
|
|
1604
|
-
return refresh();
|
|
1605
|
-
});
|
|
1606
|
-
for (u = 0, len4 = shownInAggregators.length; u < len4; u++) {
|
|
1607
|
-
attr = shownInAggregators[u];
|
|
1608
|
-
newDropdown.append($("<option>").val(attr).text(attr));
|
|
1609
|
-
}
|
|
1610
|
-
pvtVals.append(newDropdown);
|
|
1611
|
-
}
|
|
1612
|
-
}
|
|
1613
|
-
if (initialRender) {
|
|
1614
|
-
vals = opts.vals;
|
|
1615
|
-
i = 0;
|
|
1616
|
-
_this.find(".pvtVals select.pvtAttrDropdown").each(function() {
|
|
1617
|
-
$(this).val(vals[i]);
|
|
1618
|
-
return i++;
|
|
1619
|
-
});
|
|
1620
|
-
initialRender = false;
|
|
1621
|
-
}
|
|
1622
|
-
subopts.aggregatorName = aggregator.val();
|
|
1623
|
-
subopts.vals = vals;
|
|
1624
|
-
subopts.aggregator = opts.aggregators[aggregator.val()](vals);
|
|
1625
|
-
subopts.renderer = opts.renderers[renderer.val()];
|
|
1626
|
-
subopts.rowOrder = rowOrderArrow.data("order");
|
|
1627
|
-
subopts.colOrder = colOrderArrow.data("order");
|
|
1628
|
-
exclusions = {};
|
|
1629
|
-
_this.find('input.pvtFilter').not(':checked').each(function() {
|
|
1630
|
-
var filter;
|
|
1631
|
-
filter = $(this).data("filter");
|
|
1632
|
-
if (exclusions[filter[0]] != null) {
|
|
1633
|
-
return exclusions[filter[0]].push(filter[1]);
|
|
1634
|
-
} else {
|
|
1635
|
-
return exclusions[filter[0]] = [filter[1]];
|
|
1636
|
-
}
|
|
1637
|
-
});
|
|
1638
|
-
inclusions = {};
|
|
1639
|
-
_this.find('input.pvtFilter:checked').each(function() {
|
|
1640
|
-
var filter;
|
|
1641
|
-
filter = $(this).data("filter");
|
|
1642
|
-
if (exclusions[filter[0]] != null) {
|
|
1643
|
-
if (inclusions[filter[0]] != null) {
|
|
1644
|
-
return inclusions[filter[0]].push(filter[1]);
|
|
1645
|
-
} else {
|
|
1646
|
-
return inclusions[filter[0]] = [filter[1]];
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
});
|
|
1650
|
-
subopts.filter = function(record) {
|
|
1651
|
-
var excludedItems, k, ref6, ref7;
|
|
1652
|
-
if (!opts.filter(record)) {
|
|
1653
|
-
return false;
|
|
1654
|
-
}
|
|
1655
|
-
for (k in exclusions) {
|
|
1656
|
-
excludedItems = exclusions[k];
|
|
1657
|
-
if (ref6 = "" + ((ref7 = record[k]) != null ? ref7 : 'null'), indexOf.call(excludedItems, ref6) >= 0) {
|
|
1658
|
-
return false;
|
|
1659
|
-
}
|
|
1660
|
-
}
|
|
1661
|
-
return true;
|
|
1662
|
-
};
|
|
1663
|
-
pivotTable.pivot(materializedInput, subopts);
|
|
1664
|
-
pivotUIOptions = $.extend({}, opts, {
|
|
1665
|
-
cols: subopts.cols,
|
|
1666
|
-
rows: subopts.rows,
|
|
1667
|
-
colOrder: subopts.colOrder,
|
|
1668
|
-
rowOrder: subopts.rowOrder,
|
|
1669
|
-
vals: vals,
|
|
1670
|
-
exclusions: exclusions,
|
|
1671
|
-
inclusions: inclusions,
|
|
1672
|
-
inclusionsInfo: inclusions,
|
|
1673
|
-
aggregatorName: aggregator.val(),
|
|
1674
|
-
rendererName: renderer.val()
|
|
1675
|
-
});
|
|
1676
|
-
_this.data("pivotUIOptions", pivotUIOptions);
|
|
1677
|
-
if (opts.autoSortUnusedAttrs) {
|
|
1678
|
-
unusedAttrsContainer = _this.find("td.pvtUnused.pvtAxisContainer");
|
|
1679
|
-
$(unusedAttrsContainer).children("li").sort(function(a, b) {
|
|
1680
|
-
return naturalSort($(a).text(), $(b).text());
|
|
1681
|
-
}).appendTo(unusedAttrsContainer);
|
|
1682
|
-
}
|
|
1683
|
-
pivotTable.css("opacity", 1);
|
|
1684
|
-
if (opts.onRefresh != null) {
|
|
1685
|
-
return opts.onRefresh(pivotUIOptions);
|
|
1686
|
-
}
|
|
1687
|
-
};
|
|
1688
|
-
})(this);
|
|
1689
|
-
refresh = (function(_this) {
|
|
1690
|
-
return function() {
|
|
1691
|
-
pivotTable.css("opacity", 0.5);
|
|
1692
|
-
return setTimeout(refreshDelayed, 10);
|
|
1693
|
-
};
|
|
1694
|
-
})(this);
|
|
1695
|
-
refresh();
|
|
1696
|
-
this.find(".pvtAxisContainer").sortable({
|
|
1697
|
-
update: function(e, ui) {
|
|
1698
|
-
if (ui.sender == null) {
|
|
1699
|
-
return refresh();
|
|
1700
|
-
}
|
|
1701
|
-
},
|
|
1702
|
-
connectWith: this.find(".pvtAxisContainer"),
|
|
1703
|
-
items: 'li',
|
|
1704
|
-
placeholder: 'pvtPlaceholder'
|
|
1705
|
-
});
|
|
1706
|
-
} catch (error) {
|
|
1707
|
-
e = error;
|
|
1708
|
-
if (typeof console !== "undefined" && console !== null) {
|
|
1709
|
-
console.error(e.stack);
|
|
1710
|
-
}
|
|
1711
|
-
// This function is not used internally or in webclient_angular/export_widget_service
|
|
1712
|
-
// TODO if it not removed in DR-39041, upgrade the error propagation
|
|
1713
|
-
this.html("An error occurred rendering the PivotTable UI.");
|
|
1714
|
-
}
|
|
1715
|
-
return this;
|
|
1716
|
-
}
|
|
1717
|
-
};
|
|
1718
|
-
|
|
1719
1216
|
/*
|
|
1720
1217
|
Heatmap post-processing
|
|
1721
1218
|
*/
|