logitude-dashboard-library 3.2.64 → 3.2.66
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/dist/assets/styles/dl-dashboard.scss +157 -7
- package/dist/features/Dashboard/ChartsComponents/CustomCharts/PivotAgGridSupport.d.ts +14 -0
- package/dist/index.js +985 -694
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +985 -694
- package/dist/index.modern.js.map +1 -1
- package/dist/styles/dl-dashboard.scss +157 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1972,7 +1972,8 @@ var TableChart = function TableChart(props) {
|
|
|
1972
1972
|
}
|
|
1973
1973
|
|
|
1974
1974
|
if (!rowData) return true;
|
|
1975
|
-
|
|
1975
|
+
var rowTenantId = rowData.lookUp_Tenant != null ? rowData.lookUp_Tenant : rowData.Tenant;
|
|
1976
|
+
return Number(rowTenantId) === Number(Session.Tenant);
|
|
1976
1977
|
};
|
|
1977
1978
|
|
|
1978
1979
|
var isClickableCell = function isClickableCell(fieldCode, rowData) {
|
|
@@ -1984,7 +1985,7 @@ var TableChart = function TableChart(props) {
|
|
|
1984
1985
|
return false;
|
|
1985
1986
|
}
|
|
1986
1987
|
|
|
1987
|
-
return fieldCode == "ShipmentNumber" && objectTableName == "Shipment" || IsShipmentMasterFieldClickable(fieldCode, rowData) || fieldCode == "InvoiceNumber" && objectTableName == "APInvoice" || fieldCode == "InvoiceNumber" && objectTableName == "ARInvoice" || fieldCode == "ContainerNumber" && objectTableName == "Container" || fieldCode == "QuoteNumber" && objectTableName == "Quote" || fieldCode == "Subject" && objectTableName == "Opportunity" || fieldCode == "EnglishName" && objectTableName == "Customer" || fieldCode == "TaskNumber" && objectTableName == "Task" || fieldCode == "Subject" && objectTableName == "Activity" || fieldCode == "TicketNumber" && objectTableName == "Ticket" || fieldCode == "ReleaseNumber" && objectTableName == "WarehouseRelease" || fieldCode == "EntryNumber" && objectTableName == "WarehouseEntry";
|
|
1988
|
+
return fieldCode == "ShipmentNumber" && objectTableName == "Shipment" || IsShipmentMasterFieldClickable(fieldCode, rowData) || fieldCode == "InvoiceNumber" && objectTableName == "APInvoice" || fieldCode == "InvoiceNumber" && objectTableName == "ARInvoice" || fieldCode == "ContainerNumber" && objectTableName == "Container" || fieldCode == "QuoteNumber" && objectTableName == "Quote" || fieldCode == "Subject" && objectTableName == "Opportunity" || fieldCode == "EnglishName" && objectTableName == "Customer" || fieldCode == "TaskNumber" && objectTableName == "Task" || fieldCode == "Subject" && objectTableName == "Activity" || fieldCode == "TicketNumber" && objectTableName == "Ticket" || fieldCode == "ReleaseNumber" && objectTableName == "WarehouseRelease" || fieldCode == "EntryNumber" && objectTableName == "WarehouseEntry" || fieldCode == "Subject" && objectTableName == "Conversation" || fieldCode == "ConversationSubject" && objectTableName == "ConversationMessage";
|
|
1988
1989
|
};
|
|
1989
1990
|
|
|
1990
1991
|
var IsShipmentMasterFieldClickable = function IsShipmentMasterFieldClickable(fieldCode, rowData) {
|
|
@@ -2150,847 +2151,1110 @@ var TableChart = function TableChart(props) {
|
|
|
2150
2151
|
}));
|
|
2151
2152
|
};
|
|
2152
2153
|
|
|
2153
|
-
var
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2154
|
+
var PIVOT_DATE_DATA_CELL_CLASS = 'dl-pivot-date-data-cell';
|
|
2155
|
+
var getPivotDataCellClassNames = function getPivotDataCellClassNames(measure) {
|
|
2156
|
+
if (isPivotDateMinMaxMeasure(measure)) {
|
|
2157
|
+
return "dl-ag-pivot-data-cell " + PIVOT_DATE_DATA_CELL_CLASS;
|
|
2158
|
+
}
|
|
2157
2159
|
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2160
|
+
return 'dl-ag-pivot-data-cell';
|
|
2161
|
+
};
|
|
2162
|
+
var isPivotDateMinMaxMeasure = function isPivotDateMinMaxMeasure(measure) {
|
|
2163
|
+
if (!measure) return false;
|
|
2164
|
+
if (measure.MeasureCode !== 'Min' && measure.MeasureCode !== 'Max') return false;
|
|
2165
|
+
return FieldDataType.isDateOrDateTimeType(measure.MeasureFieldDataType);
|
|
2166
|
+
};
|
|
2161
2167
|
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
var
|
|
2168
|
+
var toValidDate = function toValidDate(value) {
|
|
2169
|
+
if (isPivotMeasureValueEmpty(value)) return null;
|
|
2170
|
+
var date = moment(value);
|
|
2171
|
+
if (!date || !date.isValid()) return null;
|
|
2172
|
+
return date.toDate();
|
|
2173
|
+
};
|
|
2165
2174
|
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2175
|
+
var formatPivotDateMeasureValue = function formatPivotDateMeasureValue(value) {
|
|
2176
|
+
if (isPivotMeasureValueEmpty(value)) return '';
|
|
2177
|
+
var date = moment(value);
|
|
2178
|
+
if (!date || !date.isValid()) return '';
|
|
2179
|
+
return date.format('DD.MM.YYYY');
|
|
2180
|
+
};
|
|
2181
|
+
var isRowPivotField = function isRowPivotField(field) {
|
|
2182
|
+
return !!(field.PivotCode && field.PivotCode.indexOf('Row') !== -1);
|
|
2183
|
+
};
|
|
2184
|
+
var truncateToTwoDecimals = function truncateToTwoDecimals(value) {
|
|
2185
|
+
var numericValue = isNullOrUndefinedOrEmpty(value) ? 0 : Number(value);
|
|
2186
|
+
var safeValue = isNaN(numericValue) ? 0 : numericValue;
|
|
2187
|
+
var decimalParts = safeValue.toString().split('.');
|
|
2188
|
+
var firstPart = decimalParts[0] ? decimalParts[0] : '0';
|
|
2189
|
+
var secondPart = decimalParts[1] ? decimalParts[1].toString().substr(0, 2) : '0';
|
|
2190
|
+
return Number(firstPart + '.' + secondPart);
|
|
2191
|
+
};
|
|
2192
|
+
var isPivotMeasureValueEmpty = function isPivotMeasureValueEmpty(value) {
|
|
2193
|
+
return value === null || value === undefined || value === '';
|
|
2194
|
+
};
|
|
2195
|
+
var logitudeSumAgg = function logitudeSumAgg(params) {
|
|
2196
|
+
var values = params && params.values ? params.values : [];
|
|
2197
|
+
if (values.length === 0) return null;
|
|
2198
|
+
var total = 0;
|
|
2199
|
+
var hasValue = false;
|
|
2172
2200
|
|
|
2173
|
-
|
|
2174
|
-
|
|
2201
|
+
for (var i = 0; i < values.length; i++) {
|
|
2202
|
+
if (isPivotMeasureValueEmpty(values[i])) continue;
|
|
2203
|
+
hasValue = true;
|
|
2204
|
+
total += truncateToTwoDecimals(values[i]);
|
|
2205
|
+
}
|
|
2175
2206
|
|
|
2176
|
-
|
|
2177
|
-
|
|
2178
|
-
widgetRefData.current = props.customChartProps.widget;
|
|
2179
|
-
getPivotTableData();
|
|
2180
|
-
}
|
|
2207
|
+
return hasValue ? total : null;
|
|
2208
|
+
};
|
|
2181
2209
|
|
|
2182
|
-
|
|
2183
|
-
|
|
2210
|
+
var isAgGridDateMeasureTotalAggregation = function isAgGridDateMeasureTotalAggregation(params) {
|
|
2211
|
+
var aggParams = params;
|
|
2212
|
+
var rowNode = aggParams.rowNode;
|
|
2184
2213
|
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
document.addEventListener("resizeStop", handleResize);
|
|
2189
|
-
return function () {
|
|
2190
|
-
document.removeEventListener("resizeStop", handleResize);
|
|
2191
|
-
};
|
|
2192
|
-
}, []);
|
|
2193
|
-
React.useEffect(function () {
|
|
2194
|
-
if (props.customChartProps.isInEditMode) {
|
|
2195
|
-
var _pivotGridRef$current;
|
|
2214
|
+
if (rowNode && rowNode.footer) {
|
|
2215
|
+
return true;
|
|
2216
|
+
}
|
|
2196
2217
|
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2218
|
+
if (rowNode && rowNode.group && rowNode.leafGroup === false) {
|
|
2219
|
+
return true;
|
|
2220
|
+
}
|
|
2200
2221
|
|
|
2201
|
-
|
|
2202
|
-
var _pivotGridRef$current2;
|
|
2222
|
+
var colDef = aggParams.colDef || aggParams.column && aggParams.column.getColDef && aggParams.column.getColDef();
|
|
2203
2223
|
|
|
2204
|
-
|
|
2224
|
+
if (!colDef) {
|
|
2225
|
+
return false;
|
|
2226
|
+
}
|
|
2205
2227
|
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
}, 5);
|
|
2210
|
-
}
|
|
2211
|
-
}, [props.customChartProps.isInEditMode]);
|
|
2228
|
+
if (colDef.pivotTotalColumnIds !== undefined && colDef.pivotTotalColumnIds !== null) {
|
|
2229
|
+
return true;
|
|
2230
|
+
}
|
|
2212
2231
|
|
|
2213
|
-
var
|
|
2214
|
-
|
|
2232
|
+
var colId = colDef.colId || aggParams.column && aggParams.column.getColId && aggParams.column.getColId();
|
|
2233
|
+
return !!(colId && String(colId).indexOf('PivotRowTotal_') === 0);
|
|
2234
|
+
};
|
|
2215
2235
|
|
|
2216
|
-
|
|
2217
|
-
|
|
2236
|
+
var isDevExtremePivotDataCellTotalOrGrandTotal = function isDevExtremePivotDataCellTotalOrGrandTotal(cell, hasRowFields, hasColumnFields) {
|
|
2237
|
+
if (!cell) {
|
|
2238
|
+
return false;
|
|
2239
|
+
}
|
|
2218
2240
|
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
}
|
|
2241
|
+
if (hasRowFields && (cell.rowType === 'T' || cell.rowType === 'GT')) {
|
|
2242
|
+
return true;
|
|
2243
|
+
}
|
|
2222
2244
|
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
setIsLoading(false);
|
|
2227
|
-
return;
|
|
2228
|
-
}
|
|
2245
|
+
if (hasColumnFields && (cell.columnType === 'T' || cell.columnType === 'GT')) {
|
|
2246
|
+
return true;
|
|
2247
|
+
}
|
|
2229
2248
|
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
widgetLoadLogger.log(res);
|
|
2237
|
-
})["catch"](function (err) {
|
|
2238
|
-
console.log("Error while Getting Pivot Table Data: ", err);
|
|
2239
|
-
tabledata.current = null;
|
|
2240
|
-
setPivotDataSourceFields();
|
|
2241
|
-
setIsLoading(false);
|
|
2242
|
-
});
|
|
2243
|
-
};
|
|
2249
|
+
return false;
|
|
2250
|
+
};
|
|
2251
|
+
var isDevExtremeSummaryCellTotalOrGrandTotal = function isDevExtremeSummaryCellTotalOrGrandTotal(cell, hasRowFields, hasColumnFields) {
|
|
2252
|
+
if (!cell) {
|
|
2253
|
+
return false;
|
|
2254
|
+
}
|
|
2244
2255
|
|
|
2245
|
-
var
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
e.cellElement.children[0].style.backgroundColor = "#f4433673";
|
|
2250
|
-
}
|
|
2256
|
+
var rowPath = cell._rowPath;
|
|
2257
|
+
var columnPath = cell._columnPath;
|
|
2258
|
+
var rowType = rowPath && rowPath[0] ? rowPath[0].type : null;
|
|
2259
|
+
var columnType = columnPath && columnPath[0] ? columnPath[0].type : null;
|
|
2251
2260
|
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
e.cellElement.children[0].style.backgroundColor = "#03a9f4ad";
|
|
2256
|
-
}
|
|
2257
|
-
}, []);
|
|
2258
|
-
var onCellClick = React.useCallback(function (e) {
|
|
2259
|
-
if (e.area === 'data') {
|
|
2260
|
-
var pivotFields = [];
|
|
2261
|
-
e.columnFields.forEach(function (c, index) {
|
|
2262
|
-
var fieldValue = e.cell.columnPath[index];
|
|
2261
|
+
if (hasRowFields && (rowType === 'T' || rowType === 'GT')) {
|
|
2262
|
+
return true;
|
|
2263
|
+
}
|
|
2263
2264
|
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
}));
|
|
2268
|
-
}
|
|
2269
|
-
});
|
|
2270
|
-
e.rowFields.forEach(function (r, index) {
|
|
2271
|
-
var fieldValue = e.cell.rowPath[index];
|
|
2265
|
+
if (hasColumnFields && (columnType === 'T' || columnType === 'GT')) {
|
|
2266
|
+
return true;
|
|
2267
|
+
}
|
|
2272
2268
|
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
});
|
|
2279
|
-
props.customChartProps.onSelectDataPoint({
|
|
2280
|
-
MeasureFieldId: '',
|
|
2281
|
-
Widget: props.customChartProps.widget,
|
|
2282
|
-
MeasureCode: '',
|
|
2283
|
-
Formula: '',
|
|
2284
|
-
GroupById: '',
|
|
2285
|
-
PivotFields: pivotFields
|
|
2286
|
-
});
|
|
2287
|
-
}
|
|
2288
|
-
}, []);
|
|
2269
|
+
return false;
|
|
2270
|
+
};
|
|
2271
|
+
var isAgGridPivotDateMeasureTotalDisplayCell = function isAgGridPivotDateMeasureTotalDisplayCell(params) {
|
|
2272
|
+
var node = params && params.node;
|
|
2273
|
+
var colDef = params && params.colDef;
|
|
2289
2274
|
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
});
|
|
2294
|
-
return data ? ConvertStringToPascalCaseHelper(data[fieldName]) : '';
|
|
2295
|
-
};
|
|
2275
|
+
if (node && node.footer) {
|
|
2276
|
+
return true;
|
|
2277
|
+
}
|
|
2296
2278
|
|
|
2297
|
-
|
|
2298
|
-
|
|
2299
|
-
|
|
2300
|
-
var bValue = b.value == null ? -1 : Number(b.value);
|
|
2279
|
+
if (node && node.group && node.leafGroup === false) {
|
|
2280
|
+
return true;
|
|
2281
|
+
}
|
|
2301
2282
|
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2283
|
+
if (!colDef) {
|
|
2284
|
+
return false;
|
|
2285
|
+
}
|
|
2305
2286
|
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2287
|
+
if (colDef.pivotTotalColumnIds !== undefined && colDef.pivotTotalColumnIds !== null) {
|
|
2288
|
+
return true;
|
|
2289
|
+
}
|
|
2309
2290
|
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2291
|
+
return isPivotRowGrandTotalColumnDef(colDef);
|
|
2292
|
+
};
|
|
2293
|
+
var logitudeMinAgg = function logitudeMinAgg(params) {
|
|
2294
|
+
if (isAgGridDateMeasureTotalAggregation(params)) {
|
|
2295
|
+
return null;
|
|
2296
|
+
}
|
|
2313
2297
|
|
|
2314
|
-
|
|
2298
|
+
var values = params && params.values ? params.values : [];
|
|
2299
|
+
var minDate = null;
|
|
2300
|
+
var minValue = null;
|
|
2315
2301
|
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2302
|
+
for (var i = 0; i < values.length; i++) {
|
|
2303
|
+
var currentDate = toValidDate(values[i]);
|
|
2304
|
+
if (!currentDate) continue;
|
|
2319
2305
|
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2306
|
+
if (!minDate || currentDate.getTime() < minDate.getTime()) {
|
|
2307
|
+
minDate = currentDate;
|
|
2308
|
+
minValue = values[i];
|
|
2309
|
+
}
|
|
2310
|
+
}
|
|
2323
2311
|
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2312
|
+
return minValue;
|
|
2313
|
+
};
|
|
2314
|
+
var logitudeMaxAgg = function logitudeMaxAgg(params) {
|
|
2315
|
+
if (isAgGridDateMeasureTotalAggregation(params)) {
|
|
2316
|
+
return null;
|
|
2317
|
+
}
|
|
2328
2318
|
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2319
|
+
var values = params && params.values ? params.values : [];
|
|
2320
|
+
var maxDate = null;
|
|
2321
|
+
var maxValue = null;
|
|
2332
2322
|
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
|
|
2323
|
+
for (var i = 0; i < values.length; i++) {
|
|
2324
|
+
var currentDate = toValidDate(values[i]);
|
|
2325
|
+
if (!currentDate) continue;
|
|
2336
2326
|
|
|
2337
|
-
|
|
2327
|
+
if (!maxDate || currentDate.getTime() > maxDate.getTime()) {
|
|
2328
|
+
maxDate = currentDate;
|
|
2329
|
+
maxValue = values[i];
|
|
2338
2330
|
}
|
|
2339
|
-
}
|
|
2331
|
+
}
|
|
2340
2332
|
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
dataField: field.PivotCode,
|
|
2346
|
-
caption: field.DisplayName,
|
|
2347
|
-
name: field.PivotName,
|
|
2348
|
-
width: 100,
|
|
2349
|
-
allowSorting: false,
|
|
2350
|
-
allowFiltering: false,
|
|
2351
|
-
area: field.PivotCode && field.PivotCode.includes('Row') ? 'row' : 'column',
|
|
2352
|
-
sortingMethod: function sortingMethod(a, b) {
|
|
2353
|
-
return SortRowAndColumnHeaders(a, b, field);
|
|
2354
|
-
},
|
|
2355
|
-
expanded: true,
|
|
2356
|
-
wordWrapEnabled: true,
|
|
2357
|
-
fieldData: {
|
|
2358
|
-
FieldId: field.FieldId,
|
|
2359
|
-
FieldType: field.FieldType ? field.FieldType : "Field",
|
|
2360
|
-
FieldValue: '',
|
|
2361
|
-
DateCode: field.DateCode
|
|
2362
|
-
},
|
|
2363
|
-
customizeText: function customizeText(cellInfo) {
|
|
2364
|
-
return getColumnNameByColumnId(field.PivotName, field.PivotCode, cellInfo.value);
|
|
2365
|
-
}
|
|
2366
|
-
};
|
|
2367
|
-
});
|
|
2368
|
-
var pivotDataCellsFields = tabledata.current.PivotMeasures.map(function (measure) {
|
|
2369
|
-
return {
|
|
2370
|
-
dataField: measure.PivotMeasureCode,
|
|
2371
|
-
area: 'data',
|
|
2372
|
-
dataType: 'number',
|
|
2373
|
-
wordWrapEnabled: true,
|
|
2374
|
-
caption: measure.MeasureCode == 'Sum' && typeof measure.DisplayName == 'string' ? ConvertStringToPascalCaseHelper(measure.DisplayName.replace("Sum of ", "")) : ConvertStringToPascalCaseHelper(measure.DisplayName),
|
|
2375
|
-
summaryType: 'custom',
|
|
2376
|
-
calculateCustomSummary: function calculateCustomSummary(options) {
|
|
2377
|
-
if (options.summaryProcess == 'calculate') {
|
|
2378
|
-
var _value = !isNullOrUndefinedOrEmpty(options.value) ? options.value : 0;
|
|
2333
|
+
return maxValue;
|
|
2334
|
+
};
|
|
2335
|
+
var formatPivotMeasureValue = function formatPivotMeasureValue(value, measure) {
|
|
2336
|
+
if (isPivotMeasureValueEmpty(value)) return '';
|
|
2379
2337
|
|
|
2380
|
-
|
|
2338
|
+
if (isPivotDateMinMaxMeasure(measure)) {
|
|
2339
|
+
return formatPivotDateMeasureValue(value);
|
|
2340
|
+
}
|
|
2381
2341
|
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2342
|
+
var isInteger = isValueInteger(measure.MeasureCode, measure.MeasureFieldDataType);
|
|
2343
|
+
var minimumFraction = isInteger ? 0 : 2;
|
|
2344
|
+
return getNumberInSystemLocalFormat(value, 2, minimumFraction);
|
|
2345
|
+
};
|
|
2346
|
+
var getPivotGroupFooterLabel = function getPivotGroupFooterLabel(node, fieldCode, rawValue, lookupDisplayName) {
|
|
2347
|
+
if (!node || !node.footer) return '';
|
|
2385
2348
|
|
|
2386
|
-
|
|
2349
|
+
if (node.level === -1) {
|
|
2350
|
+
return 'Grand Total';
|
|
2351
|
+
}
|
|
2387
2352
|
|
|
2388
|
-
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2353
|
+
if (!fieldCode) return '';
|
|
2354
|
+
var displayName = lookupDisplayName(fieldCode, rawValue);
|
|
2355
|
+
return displayName ? displayName + " Total" : '';
|
|
2356
|
+
};
|
|
2357
|
+
var compareDimensionValues = function compareDimensionValues(aValue, bValue, dateCode, aText, bText) {
|
|
2358
|
+
if (dateCode === 'Month') {
|
|
2359
|
+
var aNumber = aValue == null ? -1 : Number(aValue);
|
|
2360
|
+
var bNumber = bValue == null ? -1 : Number(bValue);
|
|
2361
|
+
if (aNumber < bNumber) return -1;
|
|
2362
|
+
if (aNumber > bNumber) return 1;
|
|
2363
|
+
return 0;
|
|
2364
|
+
}
|
|
2395
2365
|
|
|
2396
|
-
|
|
2366
|
+
if (dateCode != null) {
|
|
2367
|
+
var aCompare = aValue == null ? '' : aValue;
|
|
2368
|
+
var bCompare = bValue == null ? '' : bValue;
|
|
2369
|
+
if (aCompare < bCompare) return -1;
|
|
2370
|
+
if (aCompare > bCompare) return 1;
|
|
2371
|
+
return 0;
|
|
2372
|
+
}
|
|
2397
2373
|
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2404
|
-
|
|
2405
|
-
|
|
2406
|
-
|
|
2374
|
+
var aDisplay = aText == null || aText === '' ? aValue == null ? '' : aValue : aText;
|
|
2375
|
+
var bDisplay = bText == null || bText === '' ? bValue == null ? '' : bValue : bText;
|
|
2376
|
+
if (aDisplay < bDisplay) return -1;
|
|
2377
|
+
if (aDisplay > bDisplay) return 1;
|
|
2378
|
+
return 0;
|
|
2379
|
+
};
|
|
2380
|
+
var getPivotDisplayName = function getPivotDisplayName(pivotData, fieldName, dataField, dataFieldValue) {
|
|
2381
|
+
if (!pivotData || pivotData.length === 0) return '';
|
|
2382
|
+
var data = pivotData.find(function (el) {
|
|
2383
|
+
return el[dataField] == dataFieldValue;
|
|
2384
|
+
});
|
|
2385
|
+
return data ? ConvertStringToPascalCaseHelper(data[fieldName]) : '';
|
|
2386
|
+
};
|
|
2387
|
+
var isPivotRowGrandTotalColumnDef = function isPivotRowGrandTotalColumnDef(colDef) {
|
|
2388
|
+
if (!colDef || !colDef.colId) {
|
|
2389
|
+
return false;
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
return String(colDef.colId).indexOf('PivotRowTotal_') === 0;
|
|
2393
|
+
};
|
|
2394
|
+
var isPivotRowGrandTotalGroupDef = function isPivotRowGrandTotalGroupDef(colGroupDef) {
|
|
2395
|
+
if (!colGroupDef) {
|
|
2396
|
+
return false;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
var groupId = colGroupDef.groupId || colGroupDef.colId || '';
|
|
2400
|
+
|
|
2401
|
+
if (String(groupId).indexOf('PivotRowTotal') >= 0) {
|
|
2402
|
+
return true;
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
var children = colGroupDef.children;
|
|
2406
|
+
|
|
2407
|
+
if (!children || children.length === 0) {
|
|
2408
|
+
return false;
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
return children.every(function (child) {
|
|
2412
|
+
if (child && child.children) {
|
|
2413
|
+
return isPivotRowGrandTotalGroupDef(child);
|
|
2407
2414
|
}
|
|
2408
|
-
};
|
|
2409
2415
|
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2416
|
+
return isPivotRowGrandTotalColumnDef(child);
|
|
2417
|
+
});
|
|
2418
|
+
};
|
|
2419
|
+
var resolvePivotGroupHeaderName = function resolvePivotGroupHeaderName(colGroupDef, columnFields, lookupDisplayName) {
|
|
2420
|
+
if (isPivotRowGrandTotalGroupDef(colGroupDef)) {
|
|
2421
|
+
return 'Grand Total';
|
|
2422
|
+
}
|
|
2415
2423
|
|
|
2416
|
-
var
|
|
2417
|
-
|
|
2418
|
-
|
|
2424
|
+
var pivotKeys = colGroupDef && colGroupDef.pivotKeys ? colGroupDef.pivotKeys : [];
|
|
2425
|
+
|
|
2426
|
+
if (pivotKeys.length === 0) {
|
|
2427
|
+
return null;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
var field = columnFields[pivotKeys.length - 1];
|
|
2431
|
+
|
|
2432
|
+
if (!field) {
|
|
2433
|
+
return null;
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
return lookupDisplayName(field, pivotKeys[pivotKeys.length - 1]);
|
|
2437
|
+
};
|
|
2438
|
+
var getPivotValueColumnId = function getPivotValueColumnId(pivotValueColumn) {
|
|
2439
|
+
if (!pivotValueColumn) {
|
|
2440
|
+
return null;
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
if (typeof pivotValueColumn.getId === 'function') {
|
|
2444
|
+
return pivotValueColumn.getId();
|
|
2445
|
+
}
|
|
2446
|
+
|
|
2447
|
+
if (typeof pivotValueColumn.getColId === 'function') {
|
|
2448
|
+
return pivotValueColumn.getColId();
|
|
2449
|
+
}
|
|
2450
|
+
|
|
2451
|
+
if (pivotValueColumn.colId) {
|
|
2452
|
+
return String(pivotValueColumn.colId);
|
|
2453
|
+
}
|
|
2454
|
+
|
|
2455
|
+
if (pivotValueColumn.field) {
|
|
2456
|
+
return String(pivotValueColumn.field);
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
return null;
|
|
2460
|
+
};
|
|
2461
|
+
var resolveMeasureFromPivotValueColumn = function resolveMeasureFromPivotValueColumn(colDef, measures) {
|
|
2462
|
+
if (!colDef || measures.length === 0) {
|
|
2463
|
+
return undefined;
|
|
2464
|
+
}
|
|
2465
|
+
|
|
2466
|
+
if (measures.length === 1) {
|
|
2467
|
+
return measures[0];
|
|
2468
|
+
}
|
|
2469
|
+
|
|
2470
|
+
var valueColumnId = getPivotValueColumnId(colDef.pivotValueColumn);
|
|
2471
|
+
|
|
2472
|
+
if (valueColumnId) {
|
|
2473
|
+
var measureByValueColumn = measures.find(function (measure) {
|
|
2474
|
+
return measure.PivotMeasureCode === valueColumnId;
|
|
2475
|
+
});
|
|
2476
|
+
|
|
2477
|
+
if (measureByValueColumn) {
|
|
2478
|
+
return measureByValueColumn;
|
|
2419
2479
|
}
|
|
2480
|
+
}
|
|
2420
2481
|
|
|
2421
|
-
|
|
2422
|
-
return !isNullOrUndefinedOrEmpty(pivotTotalsSettings.ShowRowsGrandTotal) ? pivotTotalsSettings.ShowRowsGrandTotal : false;
|
|
2423
|
-
};
|
|
2482
|
+
var colId = colDef.colId ? String(colDef.colId) : '';
|
|
2424
2483
|
|
|
2425
|
-
|
|
2426
|
-
var
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
};
|
|
2484
|
+
if (colId) {
|
|
2485
|
+
var sortedMeasures = [].concat(measures).sort(function (left, right) {
|
|
2486
|
+
return right.PivotMeasureCode.length - left.PivotMeasureCode.length;
|
|
2487
|
+
});
|
|
2430
2488
|
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2489
|
+
for (var index = 0; index < sortedMeasures.length; index++) {
|
|
2490
|
+
var measureCode = sortedMeasures[index].PivotMeasureCode;
|
|
2491
|
+
|
|
2492
|
+
if (colId.endsWith('_' + measureCode)) {
|
|
2493
|
+
return sortedMeasures[index];
|
|
2494
|
+
}
|
|
2434
2495
|
}
|
|
2496
|
+
}
|
|
2435
2497
|
|
|
2436
|
-
|
|
2437
|
-
|
|
2438
|
-
|
|
2498
|
+
return undefined;
|
|
2499
|
+
};
|
|
2500
|
+
var resolvePivotLeafHeaderName = function resolvePivotLeafHeaderName(colDef, columnFields, lookupDisplayName, measureCount, measures) {
|
|
2501
|
+
if (isPivotRowGrandTotalColumnDef(colDef)) {
|
|
2502
|
+
return null;
|
|
2503
|
+
}
|
|
2439
2504
|
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2443
|
-
};
|
|
2505
|
+
if (measureCount > 1 && colDef.pivotValueColumn) {
|
|
2506
|
+
return null;
|
|
2507
|
+
}
|
|
2444
2508
|
|
|
2445
|
-
var
|
|
2446
|
-
var pivotTotalsSettings = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) : {};
|
|
2447
|
-
return !isNullOrUndefinedOrEmpty(pivotTotalsSettings.ShowColumnsTotal) ? pivotTotalsSettings.ShowColumnsTotal : false;
|
|
2448
|
-
};
|
|
2509
|
+
var pivotKeys = colDef && colDef.pivotKeys ? colDef.pivotKeys : [];
|
|
2449
2510
|
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
}
|
|
2453
|
-
style: {
|
|
2454
|
-
width: '40px',
|
|
2455
|
-
height: '40px'
|
|
2456
|
-
},
|
|
2457
|
-
strokeWidth: "4",
|
|
2458
|
-
animationDuration: "2s"
|
|
2459
|
-
})) : React__default.createElement(PivotGrid__default, {
|
|
2460
|
-
id: "pivotGridId",
|
|
2461
|
-
ref: pivotGridRef,
|
|
2462
|
-
dataSource: dataSource,
|
|
2463
|
-
allowExpandAll: true,
|
|
2464
|
-
showBorders: true,
|
|
2465
|
-
className: 'pivot-grid-element',
|
|
2466
|
-
onCellClick: onCellClick,
|
|
2467
|
-
showRowGrandTotals: canShowRowsGrandTotal(),
|
|
2468
|
-
showColumnGrandTotals: canShowColumnsGrandTotal(),
|
|
2469
|
-
showRowTotals: canShowRowsTotal(),
|
|
2470
|
-
showColumnTotals: canShowColumnsTotal(),
|
|
2471
|
-
showTotalsPrior: 'none',
|
|
2472
|
-
wordWrapEnabled: true
|
|
2473
|
-
}, React__default.createElement(PivotGrid.FieldPanel, {
|
|
2474
|
-
showColumnFields: false,
|
|
2475
|
-
showDataFields: false,
|
|
2476
|
-
showFilterFields: false,
|
|
2477
|
-
showRowFields: false,
|
|
2478
|
-
texts: {
|
|
2479
|
-
rowFieldArea: ""
|
|
2480
|
-
},
|
|
2481
|
-
allowFieldDragging: false,
|
|
2482
|
-
visible: true
|
|
2483
|
-
}), React__default.createElement(PivotGrid.FieldChooser, {
|
|
2484
|
-
enabled: false
|
|
2485
|
-
}), React__default.createElement(PivotGrid.Scrolling, {
|
|
2486
|
-
mode: "virtual"
|
|
2487
|
-
})));
|
|
2488
|
-
});
|
|
2511
|
+
if (pivotKeys.length === 0) {
|
|
2512
|
+
return null;
|
|
2513
|
+
}
|
|
2489
2514
|
|
|
2490
|
-
var
|
|
2491
|
-
|
|
2515
|
+
var field = columnFields[pivotKeys.length - 1];
|
|
2516
|
+
|
|
2517
|
+
if (!field) {
|
|
2518
|
+
return null;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
return lookupDisplayName(field, pivotKeys[pivotKeys.length - 1]);
|
|
2492
2522
|
};
|
|
2493
|
-
var
|
|
2494
|
-
|
|
2495
|
-
var safeValue = isNaN(numericValue) ? 0 : numericValue;
|
|
2496
|
-
var decimalParts = safeValue.toString().split('.');
|
|
2497
|
-
var firstPart = decimalParts[0] ? decimalParts[0] : '0';
|
|
2498
|
-
var secondPart = decimalParts[1] ? decimalParts[1].toString().substr(0, 2) : '0';
|
|
2499
|
-
return Number(firstPart + '.' + secondPart);
|
|
2523
|
+
var resolveMeasureForSecondaryColDef = function resolveMeasureForSecondaryColDef(colDef, measures) {
|
|
2524
|
+
return resolveMeasureFromPivotValueColumn(colDef, measures);
|
|
2500
2525
|
};
|
|
2501
|
-
|
|
2502
|
-
|
|
2526
|
+
|
|
2527
|
+
var getColumnGroupAtHeaderLevel = function getColumnGroupAtHeaderLevel(column, targetLevel) {
|
|
2528
|
+
if (!column || typeof column.getParent !== 'function') {
|
|
2529
|
+
return null;
|
|
2530
|
+
}
|
|
2531
|
+
|
|
2532
|
+
var groupPointer = column.getParent();
|
|
2533
|
+
|
|
2534
|
+
while (groupPointer) {
|
|
2535
|
+
var providedColumnGroup = typeof groupPointer.getProvidedColumnGroup === 'function' ? groupPointer.getProvidedColumnGroup() : null;
|
|
2536
|
+
|
|
2537
|
+
if (!providedColumnGroup) {
|
|
2538
|
+
groupPointer = typeof groupPointer.getParent === 'function' ? groupPointer.getParent() : null;
|
|
2539
|
+
continue;
|
|
2540
|
+
}
|
|
2541
|
+
|
|
2542
|
+
var originalGroupLevel = typeof providedColumnGroup.getLevel === 'function' ? providedColumnGroup.getLevel() : 0;
|
|
2543
|
+
var groupPointerLevel = typeof groupPointer.getPaddingLevel === 'function' ? groupPointer.getPaddingLevel() : 0;
|
|
2544
|
+
|
|
2545
|
+
if (originalGroupLevel + groupPointerLevel <= targetLevel) {
|
|
2546
|
+
return groupPointer;
|
|
2547
|
+
}
|
|
2548
|
+
|
|
2549
|
+
groupPointer = typeof groupPointer.getParent === 'function' ? groupPointer.getParent() : null;
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
return null;
|
|
2503
2553
|
};
|
|
2504
|
-
var logitudeSumAgg = function logitudeSumAgg(params) {
|
|
2505
|
-
var values = params && params.values ? params.values : [];
|
|
2506
|
-
if (values.length === 0) return null;
|
|
2507
|
-
var total = 0;
|
|
2508
|
-
var hasValue = false;
|
|
2509
2554
|
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
total += truncateToTwoDecimals(values[i]);
|
|
2555
|
+
var escapeColumnIdSelector = function escapeColumnIdSelector(columnId) {
|
|
2556
|
+
if (typeof CSS !== 'undefined' && typeof CSS.escape === 'function') {
|
|
2557
|
+
return CSS.escape(columnId);
|
|
2514
2558
|
}
|
|
2515
2559
|
|
|
2516
|
-
return
|
|
2560
|
+
return columnId.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
2517
2561
|
};
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2562
|
+
|
|
2563
|
+
var findHeaderGroupCellByColumnGroup = function findHeaderGroupCellByColumnGroup(headerContainer, groupRows, targetGroupLevel, columnGroup) {
|
|
2564
|
+
if (!columnGroup || typeof columnGroup.getUniqueId !== 'function') {
|
|
2565
|
+
return null;
|
|
2566
|
+
}
|
|
2567
|
+
|
|
2568
|
+
var groupId = columnGroup.getUniqueId();
|
|
2569
|
+
var groupRowIndex = Math.min(Math.max(targetGroupLevel, 0), groupRows.length - 1);
|
|
2570
|
+
var targetGroupRow = groupRows[groupRowIndex];
|
|
2571
|
+
|
|
2572
|
+
if (!targetGroupRow) {
|
|
2573
|
+
return null;
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
return targetGroupRow.querySelector("[col-id=\"" + escapeColumnIdSelector(groupId) + "\"]");
|
|
2523
2577
|
};
|
|
2524
|
-
var getPivotGroupFooterLabel = function getPivotGroupFooterLabel(node, fieldCode, rawValue, lookupDisplayName) {
|
|
2525
|
-
if (!node || !node.footer) return '';
|
|
2526
2578
|
|
|
2527
|
-
|
|
2528
|
-
|
|
2579
|
+
var applyPivotRowGrandTotalGroupHeaderLabel = function applyPivotRowGrandTotalGroupHeaderLabel(gridRootElement, columnApi, measureCount, columnPivotFieldCount) {
|
|
2580
|
+
if (!gridRootElement || !columnApi || measureCount <= 1) {
|
|
2581
|
+
return;
|
|
2529
2582
|
}
|
|
2530
2583
|
|
|
2531
|
-
|
|
2532
|
-
var
|
|
2533
|
-
|
|
2584
|
+
clearPivotRowGrandTotalGroupHeaderMarkup(gridRootElement);
|
|
2585
|
+
var displayedColumns = typeof columnApi.getAllDisplayedColumns === 'function' ? columnApi.getAllDisplayedColumns() : [];
|
|
2586
|
+
var rowGrandTotalColumns = displayedColumns.filter(function (column) {
|
|
2587
|
+
return String(column.getColId()).indexOf('PivotRowTotal_') === 0;
|
|
2588
|
+
});
|
|
2589
|
+
|
|
2590
|
+
if (rowGrandTotalColumns.length <= 1) {
|
|
2591
|
+
return;
|
|
2592
|
+
}
|
|
2593
|
+
|
|
2594
|
+
var centerHeaderContainer = gridRootElement.querySelector('.ag-header-viewport .ag-header-container');
|
|
2595
|
+
|
|
2596
|
+
if (!centerHeaderContainer) {
|
|
2597
|
+
return;
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
var groupRows = Array.from(centerHeaderContainer.querySelectorAll('.ag-header-row-column-group'));
|
|
2601
|
+
|
|
2602
|
+
if (groupRows.length === 0) {
|
|
2603
|
+
return;
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2606
|
+
var targetGroupLevel = columnPivotFieldCount > 0 ? columnPivotFieldCount - 1 : 0;
|
|
2607
|
+
var rowGrandTotalGroupCells = findRowGrandTotalGroupHeaderCells(centerHeaderContainer, groupRows, targetGroupLevel, rowGrandTotalColumns);
|
|
2608
|
+
|
|
2609
|
+
if (rowGrandTotalGroupCells.length === 0) {
|
|
2610
|
+
return;
|
|
2611
|
+
}
|
|
2612
|
+
|
|
2613
|
+
applyGrandTotalLabelToGroupHeaderCells(rowGrandTotalGroupCells);
|
|
2534
2614
|
};
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2615
|
+
|
|
2616
|
+
var clearPivotRowGrandTotalGroupHeaderMarkup = function clearPivotRowGrandTotalGroupHeaderMarkup(gridRootElement) {
|
|
2617
|
+
gridRootElement.querySelectorAll('.dl-pivot-row-grand-total-group-header, .dl-pivot-row-grand-total-group-header-sibling').forEach(function (element) {
|
|
2618
|
+
element.classList.remove('dl-pivot-row-grand-total-group-header', 'dl-pivot-row-grand-total-group-header-sibling');
|
|
2619
|
+
});
|
|
2620
|
+
gridRootElement.querySelectorAll('.dl-pivot-row-grand-total-group-header-label').forEach(function (label) {
|
|
2621
|
+
label.classList.remove('dl-pivot-row-grand-total-group-header-label');
|
|
2622
|
+
var labelElement = label;
|
|
2623
|
+
labelElement.textContent = '';
|
|
2624
|
+
labelElement.style.width = '';
|
|
2625
|
+
labelElement.style.display = '';
|
|
2626
|
+
labelElement.style.textAlign = '';
|
|
2627
|
+
});
|
|
2628
|
+
};
|
|
2629
|
+
|
|
2630
|
+
var findRowGrandTotalGroupHeaderCells = function findRowGrandTotalGroupHeaderCells(centerHeaderContainer, groupRows, targetGroupLevel, rowGrandTotalColumns) {
|
|
2631
|
+
var cellsByColumnGroup = [];
|
|
2632
|
+
rowGrandTotalColumns.forEach(function (column) {
|
|
2633
|
+
var columnGroup = getColumnGroupAtHeaderLevel(column, targetGroupLevel);
|
|
2634
|
+
var matchingCell = findHeaderGroupCellByColumnGroup(centerHeaderContainer, groupRows, targetGroupLevel, columnGroup);
|
|
2635
|
+
|
|
2636
|
+
if (matchingCell) {
|
|
2637
|
+
cellsByColumnGroup.push(matchingCell);
|
|
2638
|
+
}
|
|
2639
|
+
});
|
|
2640
|
+
|
|
2641
|
+
if (cellsByColumnGroup.length === rowGrandTotalColumns.length) {
|
|
2642
|
+
return cellsByColumnGroup;
|
|
2643
|
+
}
|
|
2644
|
+
|
|
2645
|
+
var groupRowIndex = Math.min(Math.max(targetGroupLevel, 0), groupRows.length - 1);
|
|
2646
|
+
var targetGroupRow = groupRows[groupRowIndex];
|
|
2647
|
+
|
|
2648
|
+
if (!targetGroupRow) {
|
|
2649
|
+
return cellsByColumnGroup;
|
|
2542
2650
|
}
|
|
2543
2651
|
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
var bCompare = bValue == null ? '' : bValue;
|
|
2547
|
-
if (aCompare < bCompare) return -1;
|
|
2548
|
-
if (aCompare > bCompare) return 1;
|
|
2549
|
-
return 0;
|
|
2550
|
-
}
|
|
2652
|
+
var paddingCells = Array.from(targetGroupRow.querySelectorAll('.ag-header-group-cell-no-group'));
|
|
2653
|
+
var trailingPaddingCells = paddingCells.slice(-rowGrandTotalColumns.length);
|
|
2551
2654
|
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
if (aDisplay < bDisplay) return -1;
|
|
2555
|
-
if (aDisplay > bDisplay) return 1;
|
|
2556
|
-
return 0;
|
|
2557
|
-
};
|
|
2558
|
-
var getPivotDisplayName = function getPivotDisplayName(pivotData, fieldName, dataField, dataFieldValue) {
|
|
2559
|
-
if (!pivotData || pivotData.length === 0) return '';
|
|
2560
|
-
var data = pivotData.find(function (el) {
|
|
2561
|
-
return el[dataField] == dataFieldValue;
|
|
2562
|
-
});
|
|
2563
|
-
return data ? ConvertStringToPascalCaseHelper(data[fieldName]) : '';
|
|
2564
|
-
};
|
|
2565
|
-
var isPivotRowGrandTotalColumnDef = function isPivotRowGrandTotalColumnDef(colDef) {
|
|
2566
|
-
if (!colDef || !colDef.colId) {
|
|
2567
|
-
return false;
|
|
2655
|
+
if (trailingPaddingCells.length === rowGrandTotalColumns.length) {
|
|
2656
|
+
return trailingPaddingCells;
|
|
2568
2657
|
}
|
|
2569
2658
|
|
|
2570
|
-
return
|
|
2659
|
+
return cellsByColumnGroup;
|
|
2571
2660
|
};
|
|
2572
|
-
var isPivotRowGrandTotalGroupDef = function isPivotRowGrandTotalGroupDef(colGroupDef) {
|
|
2573
|
-
if (!colGroupDef) {
|
|
2574
|
-
return false;
|
|
2575
|
-
}
|
|
2576
2661
|
|
|
2577
|
-
|
|
2662
|
+
var applyGrandTotalLabelToGroupHeaderCells = function applyGrandTotalLabelToGroupHeaderCells(rowGrandTotalGroupCells) {
|
|
2663
|
+
var firstCell = rowGrandTotalGroupCells[0];
|
|
2664
|
+
var firstLabel = firstCell.querySelector('.ag-header-group-text, .ag-header-cell-text');
|
|
2578
2665
|
|
|
2579
|
-
if (
|
|
2580
|
-
return
|
|
2666
|
+
if (!firstLabel) {
|
|
2667
|
+
return;
|
|
2581
2668
|
}
|
|
2582
2669
|
|
|
2583
|
-
var
|
|
2670
|
+
var combinedWidth = rowGrandTotalGroupCells.reduce(function (totalWidth, cell) {
|
|
2671
|
+
return totalWidth + cell.offsetWidth;
|
|
2672
|
+
}, 0);
|
|
2673
|
+
firstLabel.textContent = 'Grand Total';
|
|
2674
|
+
firstLabel.style.width = combinedWidth + "px";
|
|
2675
|
+
firstLabel.style.display = 'inline-block';
|
|
2676
|
+
firstLabel.style.textAlign = 'center';
|
|
2677
|
+
firstLabel.classList.add('dl-pivot-row-grand-total-group-header-label');
|
|
2678
|
+
firstCell.classList.add('dl-pivot-row-grand-total-group-header');
|
|
2584
2679
|
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2680
|
+
for (var index = 1; index < rowGrandTotalGroupCells.length; index++) {
|
|
2681
|
+
rowGrandTotalGroupCells[index].classList.add('dl-pivot-row-grand-total-group-header-sibling');
|
|
2682
|
+
var siblingLabel = rowGrandTotalGroupCells[index].querySelector('.ag-header-group-text, .ag-header-cell-text');
|
|
2588
2683
|
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
return isPivotRowGrandTotalGroupDef(child);
|
|
2684
|
+
if (siblingLabel) {
|
|
2685
|
+
siblingLabel.textContent = '';
|
|
2592
2686
|
}
|
|
2593
|
-
|
|
2594
|
-
return isPivotRowGrandTotalColumnDef(child);
|
|
2595
|
-
});
|
|
2596
|
-
};
|
|
2597
|
-
var resolvePivotGroupHeaderName = function resolvePivotGroupHeaderName(colGroupDef, columnFields, lookupDisplayName) {
|
|
2598
|
-
if (isPivotRowGrandTotalGroupDef(colGroupDef)) {
|
|
2599
|
-
return 'Grand Total';
|
|
2600
2687
|
}
|
|
2688
|
+
};
|
|
2601
2689
|
|
|
2602
|
-
|
|
2690
|
+
var applyPivotRowGrandTotalHeader = function applyPivotRowGrandTotalHeader(colDef, measureCount, measures) {
|
|
2691
|
+
if (!isPivotRowGrandTotalColumnDef(colDef)) {
|
|
2692
|
+
return;
|
|
2693
|
+
}
|
|
2603
2694
|
|
|
2604
|
-
if (
|
|
2605
|
-
|
|
2695
|
+
if (measureCount <= 1) {
|
|
2696
|
+
colDef.headerName = 'Grand Total';
|
|
2697
|
+
return;
|
|
2606
2698
|
}
|
|
2607
2699
|
|
|
2608
|
-
var
|
|
2700
|
+
var measure = resolveMeasureFromPivotValueColumn(colDef, measures);
|
|
2609
2701
|
|
|
2610
|
-
if (
|
|
2611
|
-
|
|
2702
|
+
if (measure) {
|
|
2703
|
+
colDef.headerName = getMeasureCaption(measure);
|
|
2612
2704
|
}
|
|
2613
2705
|
|
|
2614
|
-
|
|
2706
|
+
delete colDef.headerValueGetter;
|
|
2615
2707
|
};
|
|
2616
|
-
var
|
|
2617
|
-
|
|
2618
|
-
return null;
|
|
2619
|
-
}
|
|
2708
|
+
var collectPivotRowPath = function collectPivotRowPath(startNode) {
|
|
2709
|
+
var path = [];
|
|
2620
2710
|
|
|
2621
|
-
if (
|
|
2622
|
-
return
|
|
2711
|
+
if (!startNode) {
|
|
2712
|
+
return path;
|
|
2623
2713
|
}
|
|
2624
2714
|
|
|
2625
|
-
if (
|
|
2626
|
-
return
|
|
2715
|
+
if (startNode.footer && startNode.level === -1) {
|
|
2716
|
+
return path;
|
|
2627
2717
|
}
|
|
2628
2718
|
|
|
2629
|
-
if (
|
|
2630
|
-
|
|
2719
|
+
if (startNode.field != null && startNode.key !== undefined) {
|
|
2720
|
+
path.unshift({
|
|
2721
|
+
field: startNode.field,
|
|
2722
|
+
key: startNode.key
|
|
2723
|
+
});
|
|
2631
2724
|
}
|
|
2632
2725
|
|
|
2633
|
-
|
|
2634
|
-
|
|
2726
|
+
var node = startNode.parent;
|
|
2727
|
+
|
|
2728
|
+
while (node && node.level >= 0) {
|
|
2729
|
+
if (!node.footer && node.field != null && node.key !== undefined) {
|
|
2730
|
+
path.unshift({
|
|
2731
|
+
field: node.field,
|
|
2732
|
+
key: node.key
|
|
2733
|
+
});
|
|
2734
|
+
}
|
|
2735
|
+
|
|
2736
|
+
node = node.parent;
|
|
2635
2737
|
}
|
|
2636
2738
|
|
|
2637
|
-
return
|
|
2739
|
+
return path;
|
|
2638
2740
|
};
|
|
2639
|
-
var
|
|
2640
|
-
if (!colDef || measures.length === 0) {
|
|
2641
|
-
return
|
|
2741
|
+
var isAgGridPivotDrillDownMeasureColumn = function isAgGridPivotDrillDownMeasureColumn(colDef, measures) {
|
|
2742
|
+
if (!colDef || !measures || measures.length === 0) {
|
|
2743
|
+
return false;
|
|
2642
2744
|
}
|
|
2643
2745
|
|
|
2644
|
-
if (
|
|
2645
|
-
return
|
|
2746
|
+
if (colDef.pivotValueColumn) {
|
|
2747
|
+
return true;
|
|
2646
2748
|
}
|
|
2647
2749
|
|
|
2648
|
-
|
|
2750
|
+
if (colDef.rowGroup || colDef.pivot) {
|
|
2751
|
+
return false;
|
|
2752
|
+
}
|
|
2649
2753
|
|
|
2650
|
-
|
|
2651
|
-
var measureByValueColumn = measures.find(function (measure) {
|
|
2652
|
-
return measure.PivotMeasureCode === valueColumnId;
|
|
2653
|
-
});
|
|
2754
|
+
var colId = colDef.colId ? String(colDef.colId) : '';
|
|
2654
2755
|
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
}
|
|
2756
|
+
if (colId.indexOf('ag-Grid-AutoColumn') === 0) {
|
|
2757
|
+
return false;
|
|
2658
2758
|
}
|
|
2659
2759
|
|
|
2660
|
-
|
|
2760
|
+
return measures.some(function (measure) {
|
|
2761
|
+
return measure.PivotMeasureCode === colDef.field || measure.PivotMeasureCode === colId;
|
|
2762
|
+
});
|
|
2763
|
+
};
|
|
2764
|
+
var buildPivotDrillDownPivotFields = function buildPivotDrillDownPivotFields(colDef, startNode, apiFields) {
|
|
2765
|
+
var columnFields = apiFields.filter(function (field) {
|
|
2766
|
+
return !isRowPivotField(field);
|
|
2767
|
+
});
|
|
2768
|
+
var rowFields = apiFields.filter(isRowPivotField);
|
|
2769
|
+
var pivotFields = [];
|
|
2770
|
+
var columnKeys = colDef && colDef.pivotKeys ? colDef.pivotKeys : [];
|
|
2771
|
+
columnKeys.forEach(function (key, index) {
|
|
2772
|
+
if (key === undefined) {
|
|
2773
|
+
return;
|
|
2774
|
+
}
|
|
2661
2775
|
|
|
2662
|
-
|
|
2663
|
-
var sortedMeasures = [].concat(measures).sort(function (left, right) {
|
|
2664
|
-
return right.PivotMeasureCode.length - left.PivotMeasureCode.length;
|
|
2665
|
-
});
|
|
2776
|
+
var field = columnFields[index];
|
|
2666
2777
|
|
|
2667
|
-
|
|
2668
|
-
|
|
2778
|
+
if (!field) {
|
|
2779
|
+
return;
|
|
2780
|
+
}
|
|
2669
2781
|
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2782
|
+
pivotFields.push({
|
|
2783
|
+
FieldId: field.FieldId,
|
|
2784
|
+
FieldType: field.FieldType ? field.FieldType : 'Field',
|
|
2785
|
+
FieldValue: key,
|
|
2786
|
+
DateCode: field.DateCode
|
|
2787
|
+
});
|
|
2788
|
+
});
|
|
2789
|
+
collectPivotRowPath(startNode).forEach(function (pathItem) {
|
|
2790
|
+
var field = rowFields.find(function (f) {
|
|
2791
|
+
return f.PivotCode === pathItem.field;
|
|
2792
|
+
}) || apiFields.find(function (f) {
|
|
2793
|
+
return f.PivotCode === pathItem.field;
|
|
2794
|
+
});
|
|
2795
|
+
|
|
2796
|
+
if (!field) {
|
|
2797
|
+
return;
|
|
2673
2798
|
}
|
|
2799
|
+
|
|
2800
|
+
pivotFields.push({
|
|
2801
|
+
FieldId: field.FieldId,
|
|
2802
|
+
FieldType: field.FieldType ? field.FieldType : 'Field',
|
|
2803
|
+
FieldValue: pathItem.key,
|
|
2804
|
+
DateCode: field.DateCode
|
|
2805
|
+
});
|
|
2806
|
+
});
|
|
2807
|
+
return pivotFields;
|
|
2808
|
+
};
|
|
2809
|
+
var getMeasureCaption = function getMeasureCaption(measure) {
|
|
2810
|
+
var displayName = typeof measure.DisplayName == 'string' ? measure.DisplayName : '';
|
|
2811
|
+
|
|
2812
|
+
if (measure.MeasureCode == 'Sum') {
|
|
2813
|
+
return ConvertStringToPascalCaseHelper(displayName.replace('Sum of ', ''));
|
|
2674
2814
|
}
|
|
2675
2815
|
|
|
2676
|
-
return
|
|
2816
|
+
return ConvertStringToPascalCaseHelper(displayName);
|
|
2677
2817
|
};
|
|
2678
|
-
var
|
|
2679
|
-
if (
|
|
2680
|
-
|
|
2818
|
+
var parseJsonArray = function parseJsonArray(json) {
|
|
2819
|
+
if (isNullOrUndefinedOrEmpty(json)) return [];
|
|
2820
|
+
|
|
2821
|
+
try {
|
|
2822
|
+
var parsed = JSON.parse(json);
|
|
2823
|
+
return parsed || [];
|
|
2824
|
+
} catch (error) {
|
|
2825
|
+
return [];
|
|
2681
2826
|
}
|
|
2827
|
+
};
|
|
2828
|
+
var parsePivotTotalsSettings = function parsePivotTotalsSettings(json) {
|
|
2829
|
+
if (isNullOrUndefinedOrEmpty(json)) return {};
|
|
2682
2830
|
|
|
2683
|
-
|
|
2684
|
-
return
|
|
2831
|
+
try {
|
|
2832
|
+
return JSON.parse(json) || {};
|
|
2833
|
+
} catch (error) {
|
|
2834
|
+
return {};
|
|
2685
2835
|
}
|
|
2836
|
+
};
|
|
2686
2837
|
|
|
2687
|
-
|
|
2838
|
+
var PivotTable = React.forwardRef(function (props, comRef) {
|
|
2839
|
+
var _useState = React.useState(),
|
|
2840
|
+
widget = _useState[0],
|
|
2841
|
+
setWidget = _useState[1];
|
|
2842
|
+
|
|
2843
|
+
var _useState2 = React.useState(true),
|
|
2844
|
+
isLoading = _useState2[0],
|
|
2845
|
+
setIsLoading = _useState2[1];
|
|
2846
|
+
|
|
2847
|
+
var widgetRefData = React.useRef(null);
|
|
2848
|
+
var tabledata = React.useRef();
|
|
2849
|
+
var pivotGridRef = React.useRef(null);
|
|
2850
|
+
var dateMeasureDataFieldsRef = React.useRef(new Set());
|
|
2851
|
+
var pivotHasRowFieldsRef = React.useRef(false);
|
|
2852
|
+
var pivotHasColumnFieldsRef = React.useRef(false);
|
|
2853
|
+
|
|
2854
|
+
var _useState3 = React.useState(new PivotGridDataSource({
|
|
2855
|
+
store: [],
|
|
2856
|
+
fields: []
|
|
2857
|
+
})),
|
|
2858
|
+
dataSource = _useState3[0],
|
|
2859
|
+
setDataSource = _useState3[1];
|
|
2860
|
+
|
|
2861
|
+
React.useEffect(function () {
|
|
2862
|
+
var _props$customChartPro;
|
|
2863
|
+
|
|
2864
|
+
if (props.customChartProps && props.customChartProps.widget) {
|
|
2865
|
+
setWidget(props.customChartProps.widget);
|
|
2866
|
+
widgetRefData.current = props.customChartProps.widget;
|
|
2867
|
+
getPivotTableData();
|
|
2868
|
+
}
|
|
2869
|
+
|
|
2870
|
+
(_props$customChartPro = props.customChartProps.dataBinding) === null || _props$customChartPro === void 0 ? void 0 : _props$customChartPro.widgetUpdated.subscribe(function (updatedWidget) {
|
|
2871
|
+
var _widgetRefData$curren;
|
|
2872
|
+
|
|
2873
|
+
if ((updatedWidget === null || updatedWidget === void 0 ? void 0 : updatedWidget.key) != ((_widgetRefData$curren = widgetRefData.current) === null || _widgetRefData$curren === void 0 ? void 0 : _widgetRefData$curren.key)) return;
|
|
2874
|
+
setWidget(_extends({}, updatedWidget));
|
|
2875
|
+
});
|
|
2876
|
+
document.addEventListener("resizeStop", handleResize);
|
|
2877
|
+
return function () {
|
|
2878
|
+
document.removeEventListener("resizeStop", handleResize);
|
|
2879
|
+
};
|
|
2880
|
+
}, []);
|
|
2881
|
+
React.useEffect(function () {
|
|
2882
|
+
if (props.customChartProps.isInEditMode) {
|
|
2883
|
+
var _pivotGridRef$current;
|
|
2688
2884
|
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2885
|
+
if (pivotGridRef.current && (_pivotGridRef$current = pivotGridRef.current) !== null && _pivotGridRef$current !== void 0 && _pivotGridRef$current.instance && pivotGridRef.current.instance.element && pivotGridRef.current.instance.element().classList) {
|
|
2886
|
+
pivotGridRef.current.instance.element().classList.add('force-overflow-hidden');
|
|
2887
|
+
}
|
|
2692
2888
|
|
|
2693
|
-
|
|
2889
|
+
setTimeout(function () {
|
|
2890
|
+
var _pivotGridRef$current2;
|
|
2694
2891
|
|
|
2695
|
-
|
|
2696
|
-
return null;
|
|
2697
|
-
}
|
|
2892
|
+
handleResize();
|
|
2698
2893
|
|
|
2699
|
-
|
|
2700
|
-
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
}
|
|
2894
|
+
if (pivotGridRef.current && (_pivotGridRef$current2 = pivotGridRef.current) !== null && _pivotGridRef$current2 !== void 0 && _pivotGridRef$current2.instance && pivotGridRef.current.instance.element && pivotGridRef.current.instance.element().classList) {
|
|
2895
|
+
pivotGridRef.current.instance.element().classList.remove('force-overflow-hidden');
|
|
2896
|
+
}
|
|
2897
|
+
}, 5);
|
|
2898
|
+
}
|
|
2899
|
+
}, [props.customChartProps.isInEditMode]);
|
|
2704
2900
|
|
|
2705
|
-
var
|
|
2706
|
-
|
|
2707
|
-
return null;
|
|
2708
|
-
}
|
|
2901
|
+
var handleResize = function handleResize() {
|
|
2902
|
+
var _pivotGridRef$current3, _pivotGridRef$current4;
|
|
2709
2903
|
|
|
2710
|
-
|
|
2904
|
+
if (pivotGridRef.current && (_pivotGridRef$current3 = pivotGridRef.current) !== null && _pivotGridRef$current3 !== void 0 && _pivotGridRef$current3.instance && (_pivotGridRef$current4 = pivotGridRef.current) !== null && _pivotGridRef$current4 !== void 0 && _pivotGridRef$current4.instance.repaint) {
|
|
2905
|
+
var _pivotGridRef$current5;
|
|
2711
2906
|
|
|
2712
|
-
|
|
2713
|
-
|
|
2907
|
+
(_pivotGridRef$current5 = pivotGridRef.current) === null || _pivotGridRef$current5 === void 0 ? void 0 : _pivotGridRef$current5.instance.repaint();
|
|
2908
|
+
}
|
|
2909
|
+
};
|
|
2714
2910
|
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2911
|
+
var getPivotTableData = function getPivotTableData(widget) {
|
|
2912
|
+
if (Session.Tenant == 0) {
|
|
2913
|
+
tabledata.current = [];
|
|
2914
|
+
setIsLoading(false);
|
|
2915
|
+
return;
|
|
2718
2916
|
}
|
|
2719
2917
|
|
|
2720
|
-
var
|
|
2721
|
-
var
|
|
2918
|
+
var dashboardAnalyticsService = new DashboardAnalyticsService();
|
|
2919
|
+
var widgetLoadLogger = new WidgetLoadLogger(props.customChartProps.widget, props.customChartProps.isPreviewModeActive, "PostGetPivotData");
|
|
2920
|
+
dashboardAnalyticsService.getPivotData(props.customChartProps.widget).then(function (res) {
|
|
2921
|
+
tabledata.current = res.data;
|
|
2922
|
+
setPivotDataSourceFields();
|
|
2923
|
+
setIsLoading(false);
|
|
2924
|
+
widgetLoadLogger.log(res);
|
|
2925
|
+
})["catch"](function (err) {
|
|
2926
|
+
console.log("Error while Getting Pivot Table Data: ", err);
|
|
2927
|
+
tabledata.current = null;
|
|
2928
|
+
setPivotDataSourceFields();
|
|
2929
|
+
setIsLoading(false);
|
|
2930
|
+
});
|
|
2931
|
+
};
|
|
2722
2932
|
|
|
2723
|
-
|
|
2724
|
-
|
|
2933
|
+
var customizeCells = React.useCallback(function (e) {
|
|
2934
|
+
if (e.cell.rowPath && e.cell.rowPath[0] === "Germany" && e.cell.columnPath && e.cell.columnPath[0] === "Export" && e.cell.columnPath[1] === "Air") {
|
|
2935
|
+
e.cellElement.children[0].style.padding = "6px";
|
|
2936
|
+
e.cellElement.children[0].style.borderRadius = "6px";
|
|
2937
|
+
e.cellElement.children[0].style.backgroundColor = "#f4433673";
|
|
2725
2938
|
}
|
|
2726
2939
|
|
|
2727
|
-
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
}
|
|
2940
|
+
if (e.cell.rowPath && e.cell.rowPath[0] === "USA" && e.cell.columnPath && e.cell.columnPath[0] === "Import" && e.cell.columnPath[1] === "Inland") {
|
|
2941
|
+
e.cellElement.children[0].style.padding = "6px";
|
|
2942
|
+
e.cellElement.children[0].style.borderRadius = "6px";
|
|
2943
|
+
e.cellElement.children[0].style.backgroundColor = "#03a9f4ad";
|
|
2944
|
+
}
|
|
2945
|
+
}, []);
|
|
2946
|
+
var onCellClick = React.useCallback(function (e) {
|
|
2947
|
+
if (e.area === 'data') {
|
|
2948
|
+
var pivotFields = [];
|
|
2949
|
+
e.columnFields.forEach(function (c, index) {
|
|
2950
|
+
var fieldValue = e.cell.columnPath[index];
|
|
2732
2951
|
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2952
|
+
if (fieldValue !== undefined) {
|
|
2953
|
+
pivotFields.push(_extends({}, c.fieldData, {
|
|
2954
|
+
FieldValue: fieldValue
|
|
2955
|
+
}));
|
|
2956
|
+
}
|
|
2957
|
+
});
|
|
2958
|
+
e.rowFields.forEach(function (r, index) {
|
|
2959
|
+
var fieldValue = e.cell.rowPath[index];
|
|
2737
2960
|
|
|
2738
|
-
|
|
2739
|
-
}
|
|
2961
|
+
if (fieldValue !== undefined) {
|
|
2962
|
+
pivotFields.push(_extends({}, r.fieldData, {
|
|
2963
|
+
FieldValue: fieldValue
|
|
2964
|
+
}));
|
|
2965
|
+
}
|
|
2966
|
+
});
|
|
2967
|
+
props.customChartProps.onSelectDataPoint({
|
|
2968
|
+
MeasureFieldId: '',
|
|
2969
|
+
Widget: props.customChartProps.widget,
|
|
2970
|
+
MeasureCode: '',
|
|
2971
|
+
Formula: '',
|
|
2972
|
+
GroupById: '',
|
|
2973
|
+
PivotFields: pivotFields
|
|
2974
|
+
});
|
|
2975
|
+
}
|
|
2976
|
+
}, []);
|
|
2977
|
+
var onCellPrepared = React.useCallback(function (e) {
|
|
2978
|
+
if (e.area !== 'data') {
|
|
2979
|
+
return;
|
|
2980
|
+
}
|
|
2740
2981
|
|
|
2741
|
-
var
|
|
2742
|
-
|
|
2743
|
-
return null;
|
|
2744
|
-
}
|
|
2982
|
+
var dataFields = e.component.getDataSource().getAreaFields('data');
|
|
2983
|
+
var dataField = dataFields && dataFields[e.cell.dataIndex];
|
|
2745
2984
|
|
|
2746
|
-
|
|
2747
|
-
|
|
2748
|
-
|
|
2985
|
+
if (!dataField || !dateMeasureDataFieldsRef.current.has(dataField.dataField)) {
|
|
2986
|
+
return;
|
|
2987
|
+
}
|
|
2749
2988
|
|
|
2750
|
-
|
|
2751
|
-
return null;
|
|
2752
|
-
}
|
|
2989
|
+
e.cellElement.classList.add(PIVOT_DATE_DATA_CELL_CLASS);
|
|
2753
2990
|
|
|
2754
|
-
|
|
2755
|
-
|
|
2991
|
+
if (isDevExtremePivotDataCellTotalOrGrandTotal(e.cell, pivotHasRowFieldsRef.current, pivotHasColumnFieldsRef.current)) {
|
|
2992
|
+
e.cell.text = '';
|
|
2993
|
+
var contentSpan = e.cellElement ? e.cellElement.querySelector('span') : null;
|
|
2756
2994
|
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2995
|
+
if (contentSpan) {
|
|
2996
|
+
contentSpan.textContent = '';
|
|
2997
|
+
}
|
|
2998
|
+
}
|
|
2999
|
+
}, []);
|
|
2761
3000
|
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
3001
|
+
var getColumnNameByColumnId = function getColumnNameByColumnId(fieldName, dataField, datafieldValue) {
|
|
3002
|
+
var data = tabledata.current.PivotData.find(function (el) {
|
|
3003
|
+
return el[dataField] == datafieldValue;
|
|
3004
|
+
});
|
|
3005
|
+
return data ? ConvertStringToPascalCaseHelper(data[fieldName]) : '';
|
|
3006
|
+
};
|
|
2767
3007
|
|
|
2768
|
-
|
|
2769
|
-
|
|
2770
|
-
|
|
3008
|
+
var SortRowAndColumnHeaders = function SortRowAndColumnHeaders(a, b, field) {
|
|
3009
|
+
if (field.DateCode == 'Month') {
|
|
3010
|
+
var aValue = a.value == null ? -1 : Number(a.value);
|
|
3011
|
+
var bValue = b.value == null ? -1 : Number(b.value);
|
|
2771
3012
|
|
|
2772
|
-
|
|
3013
|
+
if (aValue < bValue) {
|
|
3014
|
+
return -1;
|
|
3015
|
+
}
|
|
2773
3016
|
|
|
2774
|
-
|
|
2775
|
-
|
|
2776
|
-
|
|
3017
|
+
if (aValue > bValue) {
|
|
3018
|
+
return 1;
|
|
3019
|
+
}
|
|
2777
3020
|
|
|
2778
|
-
|
|
3021
|
+
return 0;
|
|
3022
|
+
} else if (field.DateCode != null) {
|
|
3023
|
+
var _aValue = a.value == null ? '' : a.value;
|
|
2779
3024
|
|
|
2780
|
-
|
|
2781
|
-
return;
|
|
2782
|
-
}
|
|
3025
|
+
var _bValue = b.value == null ? '' : b.value;
|
|
2783
3026
|
|
|
2784
|
-
|
|
2785
|
-
|
|
3027
|
+
if (_aValue < _bValue) {
|
|
3028
|
+
return -1;
|
|
3029
|
+
}
|
|
2786
3030
|
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
3031
|
+
if (_aValue > _bValue) {
|
|
3032
|
+
return 1;
|
|
3033
|
+
}
|
|
2790
3034
|
|
|
2791
|
-
|
|
2792
|
-
}
|
|
3035
|
+
return 0;
|
|
3036
|
+
} else {
|
|
3037
|
+
var aText = a.text == null ? '' : a.text;
|
|
3038
|
+
var bText = b.text == null ? '' : b.text;
|
|
2793
3039
|
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
});
|
|
2798
|
-
gridRootElement.querySelectorAll('.dl-pivot-row-grand-total-group-header-label').forEach(function (label) {
|
|
2799
|
-
label.classList.remove('dl-pivot-row-grand-total-group-header-label');
|
|
2800
|
-
var labelElement = label;
|
|
2801
|
-
labelElement.textContent = '';
|
|
2802
|
-
labelElement.style.width = '';
|
|
2803
|
-
labelElement.style.display = '';
|
|
2804
|
-
labelElement.style.textAlign = '';
|
|
2805
|
-
});
|
|
2806
|
-
};
|
|
3040
|
+
if (aText < bText) {
|
|
3041
|
+
return -1;
|
|
3042
|
+
}
|
|
2807
3043
|
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
var columnGroup = getColumnGroupAtHeaderLevel(column, targetGroupLevel);
|
|
2812
|
-
var matchingCell = findHeaderGroupCellByColumnGroup(centerHeaderContainer, groupRows, targetGroupLevel, columnGroup);
|
|
3044
|
+
if (aText > bText) {
|
|
3045
|
+
return 1;
|
|
3046
|
+
}
|
|
2813
3047
|
|
|
2814
|
-
|
|
2815
|
-
cellsByColumnGroup.push(matchingCell);
|
|
3048
|
+
return 0;
|
|
2816
3049
|
}
|
|
2817
|
-
}
|
|
2818
|
-
|
|
2819
|
-
if (cellsByColumnGroup.length === rowGrandTotalColumns.length) {
|
|
2820
|
-
return cellsByColumnGroup;
|
|
2821
|
-
}
|
|
2822
|
-
|
|
2823
|
-
var groupRowIndex = Math.min(Math.max(targetGroupLevel, 0), groupRows.length - 1);
|
|
2824
|
-
var targetGroupRow = groupRows[groupRowIndex];
|
|
2825
|
-
|
|
2826
|
-
if (!targetGroupRow) {
|
|
2827
|
-
return cellsByColumnGroup;
|
|
2828
|
-
}
|
|
3050
|
+
};
|
|
2829
3051
|
|
|
2830
|
-
var
|
|
2831
|
-
|
|
3052
|
+
var setPivotDataSourceFields = function setPivotDataSourceFields() {
|
|
3053
|
+
if (tabledata.current && tabledata.current.PivoFields && tabledata.current.PivotMeasures) {
|
|
3054
|
+
var pivotRowsAndColumnsFields = tabledata.current.PivoFields.map(function (field) {
|
|
3055
|
+
return {
|
|
3056
|
+
dataField: field.PivotCode,
|
|
3057
|
+
caption: field.DisplayName,
|
|
3058
|
+
name: field.PivotName,
|
|
3059
|
+
width: 100,
|
|
3060
|
+
allowSorting: false,
|
|
3061
|
+
allowFiltering: false,
|
|
3062
|
+
area: field.PivotCode && field.PivotCode.includes('Row') ? 'row' : 'column',
|
|
3063
|
+
sortingMethod: function sortingMethod(a, b) {
|
|
3064
|
+
return SortRowAndColumnHeaders(a, b, field);
|
|
3065
|
+
},
|
|
3066
|
+
expanded: true,
|
|
3067
|
+
wordWrapEnabled: true,
|
|
3068
|
+
fieldData: {
|
|
3069
|
+
FieldId: field.FieldId,
|
|
3070
|
+
FieldType: field.FieldType ? field.FieldType : "Field",
|
|
3071
|
+
FieldValue: '',
|
|
3072
|
+
DateCode: field.DateCode
|
|
3073
|
+
},
|
|
3074
|
+
customizeText: function customizeText(cellInfo) {
|
|
3075
|
+
return getColumnNameByColumnId(field.PivotName, field.PivotCode, cellInfo.value);
|
|
3076
|
+
}
|
|
3077
|
+
};
|
|
3078
|
+
});
|
|
3079
|
+
var hasRowFields = tabledata.current.PivoFields.some(function (field) {
|
|
3080
|
+
return field.PivotCode && field.PivotCode.includes('Row');
|
|
3081
|
+
});
|
|
3082
|
+
var hasColumnFields = tabledata.current.PivoFields.some(function (field) {
|
|
3083
|
+
return field.PivotCode && !field.PivotCode.includes('Row');
|
|
3084
|
+
});
|
|
3085
|
+
pivotHasRowFieldsRef.current = hasRowFields;
|
|
3086
|
+
pivotHasColumnFieldsRef.current = hasColumnFields;
|
|
3087
|
+
dateMeasureDataFieldsRef.current = new Set(tabledata.current.PivotMeasures.filter(function (measure) {
|
|
3088
|
+
return (measure.MeasureCode === 'Min' || measure.MeasureCode === 'Max') && FieldDataType.isDateOrDateTimeType(measure.MeasureFieldDataType);
|
|
3089
|
+
}).map(function (measure) {
|
|
3090
|
+
return measure.PivotMeasureCode;
|
|
3091
|
+
}));
|
|
3092
|
+
var pivotDataCellsFields = tabledata.current.PivotMeasures.map(function (measure) {
|
|
3093
|
+
var isDateMinMaxMeasure = (measure.MeasureCode === 'Min' || measure.MeasureCode === 'Max') && FieldDataType.isDateOrDateTimeType(measure.MeasureFieldDataType);
|
|
3094
|
+
return _extends({
|
|
3095
|
+
dataField: measure.PivotMeasureCode,
|
|
3096
|
+
area: 'data',
|
|
3097
|
+
dataType: isDateMinMaxMeasure ? 'string' : 'number',
|
|
3098
|
+
wordWrapEnabled: true,
|
|
3099
|
+
caption: measure.MeasureCode == 'Sum' && typeof measure.DisplayName == 'string' ? ConvertStringToPascalCaseHelper(measure.DisplayName.replace("Sum of ", "")) : ConvertStringToPascalCaseHelper(measure.DisplayName),
|
|
3100
|
+
summaryType: 'custom',
|
|
3101
|
+
calculateCustomSummary: function calculateCustomSummary(options) {
|
|
3102
|
+
if (options.summaryProcess == 'start') {
|
|
3103
|
+
options.totalValue = null;
|
|
3104
|
+
return;
|
|
3105
|
+
}
|
|
2832
3106
|
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
3107
|
+
if (options.summaryProcess != 'calculate') {
|
|
3108
|
+
return;
|
|
3109
|
+
}
|
|
2836
3110
|
|
|
2837
|
-
|
|
2838
|
-
|
|
3111
|
+
if (isDateMinMaxMeasure) {
|
|
3112
|
+
if (isNullOrUndefinedOrEmpty(options.value)) {
|
|
3113
|
+
return;
|
|
3114
|
+
}
|
|
2839
3115
|
|
|
2840
|
-
var
|
|
2841
|
-
var firstCell = rowGrandTotalGroupCells[0];
|
|
2842
|
-
var firstLabel = firstCell.querySelector('.ag-header-group-text, .ag-header-cell-text');
|
|
3116
|
+
var currentDate = moment(options.value);
|
|
2843
3117
|
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
3118
|
+
if (!currentDate || !currentDate.isValid()) {
|
|
3119
|
+
return;
|
|
3120
|
+
}
|
|
2847
3121
|
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
firstLabel.style.width = combinedWidth + "px";
|
|
2853
|
-
firstLabel.style.display = 'inline-block';
|
|
2854
|
-
firstLabel.style.textAlign = 'center';
|
|
2855
|
-
firstLabel.classList.add('dl-pivot-row-grand-total-group-header-label');
|
|
2856
|
-
firstCell.classList.add('dl-pivot-row-grand-total-group-header');
|
|
3122
|
+
if (isNullOrUndefinedOrEmpty(options.totalValue)) {
|
|
3123
|
+
options.totalValue = options.value;
|
|
3124
|
+
return;
|
|
3125
|
+
}
|
|
2857
3126
|
|
|
2858
|
-
|
|
2859
|
-
rowGrandTotalGroupCells[index].classList.add('dl-pivot-row-grand-total-group-header-sibling');
|
|
2860
|
-
var siblingLabel = rowGrandTotalGroupCells[index].querySelector('.ag-header-group-text, .ag-header-cell-text');
|
|
3127
|
+
var totalDate = moment(options.totalValue);
|
|
2861
3128
|
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
};
|
|
3129
|
+
if (!totalDate || !totalDate.isValid()) {
|
|
3130
|
+
options.totalValue = options.value;
|
|
3131
|
+
return;
|
|
3132
|
+
}
|
|
2867
3133
|
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
3134
|
+
if (measure.MeasureCode === 'Max') {
|
|
3135
|
+
if (currentDate.isAfter(totalDate)) {
|
|
3136
|
+
options.totalValue = options.value;
|
|
3137
|
+
}
|
|
3138
|
+
} else if (currentDate.isBefore(totalDate)) {
|
|
3139
|
+
options.totalValue = options.value;
|
|
3140
|
+
}
|
|
2872
3141
|
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
return;
|
|
2876
|
-
}
|
|
3142
|
+
return;
|
|
3143
|
+
}
|
|
2877
3144
|
|
|
2878
|
-
|
|
3145
|
+
var _value = !isNullOrUndefinedOrEmpty(options.value) ? options.value : 0;
|
|
2879
3146
|
|
|
2880
|
-
|
|
2881
|
-
colDef.headerName = getMeasureCaption(measure);
|
|
2882
|
-
}
|
|
3147
|
+
var decimalParts = _value.toString().split(".");
|
|
2883
3148
|
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
var path = [];
|
|
3149
|
+
var firstPart = decimalParts[0] ? decimalParts[0] : 0;
|
|
3150
|
+
var secondPart = decimalParts[1] ? decimalParts[1] : 0;
|
|
3151
|
+
secondPart = secondPart.toString().substr(0, 2);
|
|
2888
3152
|
|
|
2889
|
-
|
|
2890
|
-
return path;
|
|
2891
|
-
}
|
|
3153
|
+
var _finalVal = firstPart + "." + secondPart;
|
|
2892
3154
|
|
|
2893
|
-
|
|
2894
|
-
|
|
2895
|
-
|
|
2896
|
-
|
|
3155
|
+
options.value = Number(_finalVal);
|
|
3156
|
+
options.totalValue = (!isNullOrUndefinedOrEmpty(options.totalValue) ? options.totalValue : 0) + options.value;
|
|
3157
|
+
}
|
|
3158
|
+
}, isDateMinMaxMeasure ? {
|
|
3159
|
+
calculateSummaryValue: function calculateSummaryValue(cell) {
|
|
3160
|
+
if (isDevExtremeSummaryCellTotalOrGrandTotal(cell, hasRowFields, hasColumnFields)) {
|
|
3161
|
+
return null;
|
|
3162
|
+
}
|
|
2897
3163
|
|
|
2898
|
-
|
|
2899
|
-
|
|
2900
|
-
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
3164
|
+
return cell.value();
|
|
3165
|
+
},
|
|
3166
|
+
customizeText: function customizeText(cellInfo) {
|
|
3167
|
+
return formatPivotDateMeasureValue(cellInfo.value);
|
|
3168
|
+
}
|
|
3169
|
+
} : {
|
|
3170
|
+
format: function format(value) {
|
|
3171
|
+
var isInteger = isValueInteger(measure.MeasureCode, measure.MeasureFieldDataType);
|
|
3172
|
+
var minimumFraction = isInteger ? 0 : 2;
|
|
2905
3173
|
|
|
2906
|
-
|
|
3174
|
+
var _value = isNullOrUndefinedOrEmpty(value) ? 0 : value;
|
|
2907
3175
|
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
field: node.field,
|
|
2912
|
-
key: node.key
|
|
3176
|
+
return getNumberInSystemLocalFormat(_value, 2, minimumFraction);
|
|
3177
|
+
}
|
|
3178
|
+
});
|
|
2913
3179
|
});
|
|
3180
|
+
var AllfieldsData = [].concat(pivotRowsAndColumnsFields, pivotDataCellsFields);
|
|
3181
|
+
setDataSource(new PivotGridDataSource({
|
|
3182
|
+
store: tabledata.current.PivotData,
|
|
3183
|
+
fields: AllfieldsData
|
|
3184
|
+
}));
|
|
2914
3185
|
}
|
|
3186
|
+
};
|
|
2915
3187
|
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
};
|
|
2921
|
-
var buildPivotDrillDownPivotFields = function buildPivotDrillDownPivotFields(colDef, startNode, apiFields) {
|
|
2922
|
-
var columnFields = apiFields.filter(function (field) {
|
|
2923
|
-
return !isRowPivotField(field);
|
|
2924
|
-
});
|
|
2925
|
-
var rowFields = apiFields.filter(isRowPivotField);
|
|
2926
|
-
var pivotFields = [];
|
|
2927
|
-
var columnKeys = colDef && colDef.pivotKeys ? colDef.pivotKeys : [];
|
|
2928
|
-
columnKeys.forEach(function (key, index) {
|
|
2929
|
-
if (key === undefined) {
|
|
2930
|
-
return;
|
|
2931
|
-
}
|
|
2932
|
-
|
|
2933
|
-
var field = columnFields[index];
|
|
2934
|
-
|
|
2935
|
-
if (!field) {
|
|
2936
|
-
return;
|
|
2937
|
-
}
|
|
3188
|
+
var canShowRowsGrandTotal = function canShowRowsGrandTotal() {
|
|
3189
|
+
var pivotTotalsSettings = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) : {};
|
|
3190
|
+
return !isNullOrUndefinedOrEmpty(pivotTotalsSettings.ShowRowsGrandTotal) ? pivotTotalsSettings.ShowRowsGrandTotal : false;
|
|
3191
|
+
};
|
|
2938
3192
|
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
});
|
|
2945
|
-
});
|
|
2946
|
-
collectPivotRowPath(startNode).forEach(function (pathItem) {
|
|
2947
|
-
var field = rowFields.find(function (f) {
|
|
2948
|
-
return f.PivotCode === pathItem.field;
|
|
2949
|
-
}) || apiFields.find(function (f) {
|
|
2950
|
-
return f.PivotCode === pathItem.field;
|
|
2951
|
-
});
|
|
3193
|
+
var isRowsNotEmptyAndColumnsEmpty = function isRowsNotEmptyAndColumnsEmpty() {
|
|
3194
|
+
var pivotRows = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotRows) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotRows) : [];
|
|
3195
|
+
var pivotColumns = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotColumns) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotColumns) : [];
|
|
3196
|
+
return (pivotRows === null || pivotRows === void 0 ? void 0 : pivotRows.length) > 0 && (pivotColumns === null || pivotColumns === void 0 ? void 0 : pivotColumns.length) === 0;
|
|
3197
|
+
};
|
|
2952
3198
|
|
|
2953
|
-
|
|
2954
|
-
|
|
3199
|
+
var canShowColumnsGrandTotal = function canShowColumnsGrandTotal() {
|
|
3200
|
+
if (isRowsNotEmptyAndColumnsEmpty()) {
|
|
3201
|
+
return true;
|
|
2955
3202
|
}
|
|
2956
3203
|
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
FieldValue: pathItem.key,
|
|
2961
|
-
DateCode: field.DateCode
|
|
2962
|
-
});
|
|
2963
|
-
});
|
|
2964
|
-
return pivotFields;
|
|
2965
|
-
};
|
|
2966
|
-
var getMeasureCaption = function getMeasureCaption(measure) {
|
|
2967
|
-
var displayName = typeof measure.DisplayName == 'string' ? measure.DisplayName : '';
|
|
2968
|
-
|
|
2969
|
-
if (measure.MeasureCode == 'Sum') {
|
|
2970
|
-
return ConvertStringToPascalCaseHelper(displayName.replace('Sum of ', ''));
|
|
2971
|
-
}
|
|
3204
|
+
var pivotTotalsSettings = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) : {};
|
|
3205
|
+
return !isNullOrUndefinedOrEmpty(pivotTotalsSettings.ShowColumnsGrandTotal) ? pivotTotalsSettings.ShowColumnsGrandTotal : false;
|
|
3206
|
+
};
|
|
2972
3207
|
|
|
2973
|
-
|
|
2974
|
-
};
|
|
2975
|
-
|
|
2976
|
-
|
|
3208
|
+
var canShowRowsTotal = function canShowRowsTotal() {
|
|
3209
|
+
var pivotTotalsSettings = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) : {};
|
|
3210
|
+
return !isNullOrUndefinedOrEmpty(pivotTotalsSettings.ShowRowsTotal) ? pivotTotalsSettings.ShowRowsTotal : false;
|
|
3211
|
+
};
|
|
2977
3212
|
|
|
2978
|
-
|
|
2979
|
-
var
|
|
2980
|
-
return
|
|
2981
|
-
}
|
|
2982
|
-
return [];
|
|
2983
|
-
}
|
|
2984
|
-
};
|
|
2985
|
-
var parsePivotTotalsSettings = function parsePivotTotalsSettings(json) {
|
|
2986
|
-
if (isNullOrUndefinedOrEmpty(json)) return {};
|
|
3213
|
+
var canShowColumnsTotal = function canShowColumnsTotal() {
|
|
3214
|
+
var pivotTotalsSettings = widget && !isNullOrUndefinedOrEmpty(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) ? JSON.parse(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings) : {};
|
|
3215
|
+
return !isNullOrUndefinedOrEmpty(pivotTotalsSettings.ShowColumnsTotal) ? pivotTotalsSettings.ShowColumnsTotal : false;
|
|
3216
|
+
};
|
|
2987
3217
|
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
}
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
|
|
3218
|
+
return React__default.createElement(React__default.Fragment, null, isLoading ? React__default.createElement("div", {
|
|
3219
|
+
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
3220
|
+
}, React__default.createElement(progressspinner.ProgressSpinner, {
|
|
3221
|
+
style: {
|
|
3222
|
+
width: '40px',
|
|
3223
|
+
height: '40px'
|
|
3224
|
+
},
|
|
3225
|
+
strokeWidth: "4",
|
|
3226
|
+
animationDuration: "2s"
|
|
3227
|
+
})) : React__default.createElement(PivotGrid__default, {
|
|
3228
|
+
id: "pivotGridId",
|
|
3229
|
+
ref: pivotGridRef,
|
|
3230
|
+
dataSource: dataSource,
|
|
3231
|
+
allowExpandAll: true,
|
|
3232
|
+
showBorders: true,
|
|
3233
|
+
className: 'pivot-grid-element',
|
|
3234
|
+
onCellClick: onCellClick,
|
|
3235
|
+
onCellPrepared: onCellPrepared,
|
|
3236
|
+
showRowGrandTotals: canShowRowsGrandTotal(),
|
|
3237
|
+
showColumnGrandTotals: canShowColumnsGrandTotal(),
|
|
3238
|
+
showRowTotals: canShowRowsTotal(),
|
|
3239
|
+
showColumnTotals: canShowColumnsTotal(),
|
|
3240
|
+
showTotalsPrior: 'none',
|
|
3241
|
+
wordWrapEnabled: true
|
|
3242
|
+
}, React__default.createElement(PivotGrid.FieldPanel, {
|
|
3243
|
+
showColumnFields: false,
|
|
3244
|
+
showDataFields: false,
|
|
3245
|
+
showFilterFields: false,
|
|
3246
|
+
showRowFields: false,
|
|
3247
|
+
texts: {
|
|
3248
|
+
rowFieldArea: ""
|
|
3249
|
+
},
|
|
3250
|
+
allowFieldDragging: false,
|
|
3251
|
+
visible: true
|
|
3252
|
+
}), React__default.createElement(PivotGrid.FieldChooser, {
|
|
3253
|
+
enabled: false
|
|
3254
|
+
}), React__default.createElement(PivotGrid.Scrolling, {
|
|
3255
|
+
mode: "virtual"
|
|
3256
|
+
})));
|
|
3257
|
+
});
|
|
2994
3258
|
|
|
2995
3259
|
var ROW_GROUP_COLUMN_MIN_WIDTH = 100;
|
|
2996
3260
|
|
|
@@ -3107,11 +3371,14 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3107
3371
|
return lookupDisplayName(field, rawValue);
|
|
3108
3372
|
};
|
|
3109
3373
|
|
|
3110
|
-
var applyPivotDataCellFormatting = function applyPivotDataCellFormatting(colDef) {
|
|
3374
|
+
var applyPivotDataCellFormatting = function applyPivotDataCellFormatting(colDef, measure) {
|
|
3111
3375
|
colDef.sortable = false;
|
|
3112
3376
|
colDef.filter = false;
|
|
3113
|
-
colDef.cellClass = 'dl-ag-pivot-data-cell';
|
|
3114
|
-
|
|
3377
|
+
colDef.cellClass = measure ? getPivotDataCellClassNames(measure) : 'dl-ag-pivot-data-cell';
|
|
3378
|
+
|
|
3379
|
+
if (!measure || !isPivotDateMinMaxMeasure(measure)) {
|
|
3380
|
+
colDef.type = 'numericColumn';
|
|
3381
|
+
}
|
|
3115
3382
|
};
|
|
3116
3383
|
|
|
3117
3384
|
var buildGridFromPivotResponse = function buildGridFromPivotResponse() {
|
|
@@ -3181,28 +3448,36 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3181
3448
|
};
|
|
3182
3449
|
};
|
|
3183
3450
|
|
|
3451
|
+
var getMeasureAggFunc = function getMeasureAggFunc(measure) {
|
|
3452
|
+
if (!isPivotDateMinMaxMeasure(measure)) return 'logitudeSum';
|
|
3453
|
+
return measure.MeasureCode === 'Max' ? 'logitudeMax' : 'logitudeMin';
|
|
3454
|
+
};
|
|
3455
|
+
|
|
3184
3456
|
var createMeasureColDef = function createMeasureColDef(measure) {
|
|
3185
|
-
|
|
3457
|
+
var colDef = {
|
|
3186
3458
|
field: measure.PivotMeasureCode,
|
|
3187
3459
|
headerName: getMeasureCaption(measure),
|
|
3188
|
-
aggFunc:
|
|
3460
|
+
aggFunc: getMeasureAggFunc(measure),
|
|
3189
3461
|
enableValue: true,
|
|
3190
3462
|
wrapText: true,
|
|
3191
3463
|
autoHeight: true,
|
|
3192
3464
|
sortable: false,
|
|
3193
3465
|
filter: false,
|
|
3194
|
-
cellClass:
|
|
3195
|
-
type: 'numericColumn',
|
|
3466
|
+
cellClass: getPivotDataCellClassNames(measure),
|
|
3196
3467
|
valueFormatter: function valueFormatter(params) {
|
|
3468
|
+
if (isPivotDateMinMaxMeasure(measure) && isAgGridPivotDateMeasureTotalDisplayCell(params)) {
|
|
3469
|
+
return '';
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3197
3472
|
return formatPivotMeasureValue(params.value, measure);
|
|
3198
3473
|
}
|
|
3199
3474
|
};
|
|
3200
|
-
};
|
|
3201
3475
|
|
|
3202
|
-
|
|
3203
|
-
|
|
3204
|
-
|
|
3205
|
-
|
|
3476
|
+
if (!isPivotDateMinMaxMeasure(measure)) {
|
|
3477
|
+
colDef.type = 'numericColumn';
|
|
3478
|
+
}
|
|
3479
|
+
|
|
3480
|
+
return colDef;
|
|
3206
3481
|
};
|
|
3207
3482
|
|
|
3208
3483
|
var isRowsNotEmptyAndColumnsEmpty = function isRowsNotEmptyAndColumnsEmpty() {
|
|
@@ -3212,7 +3487,6 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3212
3487
|
};
|
|
3213
3488
|
|
|
3214
3489
|
var canShowRowsGrandTotal = function canShowRowsGrandTotal() {
|
|
3215
|
-
if (isRowsEmptyAndColumnsNotEmpty()) return true;
|
|
3216
3490
|
var settings = parsePivotTotalsSettings(widget === null || widget === void 0 ? void 0 : widget.PivotTotalsSettings);
|
|
3217
3491
|
return !isNullOrUndefinedOrEmpty(settings.ShowRowsGrandTotal) ? !!settings.ShowRowsGrandTotal : false;
|
|
3218
3492
|
};
|
|
@@ -3260,17 +3534,23 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3260
3534
|
}
|
|
3261
3535
|
}
|
|
3262
3536
|
|
|
3263
|
-
|
|
3537
|
+
var measure = resolveMeasureForSecondaryColDef(colDef, pivotMeasuresRef.current);
|
|
3538
|
+
applyPivotDataCellFormatting(colDef, measure);
|
|
3264
3539
|
|
|
3265
3540
|
colDef.valueFormatter = function (params) {
|
|
3266
|
-
var
|
|
3267
|
-
if (!
|
|
3268
|
-
|
|
3541
|
+
var resolvedMeasure = measure || resolveMeasureForSecondaryColDef(params.colDef, pivotMeasuresRef.current);
|
|
3542
|
+
if (!resolvedMeasure) return '';
|
|
3543
|
+
|
|
3544
|
+
if (isPivotDateMinMaxMeasure(resolvedMeasure) && isAgGridPivotDateMeasureTotalDisplayCell(params)) {
|
|
3545
|
+
return '';
|
|
3546
|
+
}
|
|
3547
|
+
|
|
3548
|
+
return formatPivotMeasureValue(params.value, resolvedMeasure);
|
|
3269
3549
|
};
|
|
3270
3550
|
}, []);
|
|
3271
3551
|
var onCellClicked = React.useCallback(function (event) {
|
|
3272
3552
|
var colDef = event.colDef;
|
|
3273
|
-
if (!colDef
|
|
3553
|
+
if (!isAgGridPivotDrillDownMeasureColumn(colDef, pivotMeasuresRef.current)) return;
|
|
3274
3554
|
if (isPivotMeasureValueEmpty(event.value)) return;
|
|
3275
3555
|
var pivotFields = buildPivotDrillDownPivotFields(colDef, event.node, pivotFieldsRef.current);
|
|
3276
3556
|
props.customChartProps.onSelectDataPoint({
|
|
@@ -3302,14 +3582,8 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3302
3582
|
wrapText: true,
|
|
3303
3583
|
autoHeight: true,
|
|
3304
3584
|
cellClass: 'dl-ag-pivot-row-label-cell',
|
|
3305
|
-
headerValueGetter: function headerValueGetter(
|
|
3306
|
-
|
|
3307
|
-
var showRowGroup = colDef && colDef.showRowGroup;
|
|
3308
|
-
if (!showRowGroup) return '';
|
|
3309
|
-
var field = pivotFieldsRef.current.find(function (f) {
|
|
3310
|
-
return f.PivotCode === showRowGroup;
|
|
3311
|
-
});
|
|
3312
|
-
return field ? field.DisplayName : '';
|
|
3585
|
+
headerValueGetter: function headerValueGetter() {
|
|
3586
|
+
return '';
|
|
3313
3587
|
},
|
|
3314
3588
|
valueFormatter: function valueFormatter(params) {
|
|
3315
3589
|
var colDef = params.colDef;
|
|
@@ -3331,7 +3605,9 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3331
3605
|
}, []);
|
|
3332
3606
|
var aggFuncs = React.useMemo(function () {
|
|
3333
3607
|
return {
|
|
3334
|
-
logitudeSum: logitudeSumAgg
|
|
3608
|
+
logitudeSum: logitudeSumAgg,
|
|
3609
|
+
logitudeMin: logitudeMinAgg,
|
|
3610
|
+
logitudeMax: logitudeMaxAgg
|
|
3335
3611
|
};
|
|
3336
3612
|
}, []);
|
|
3337
3613
|
var scheduleRowGrandTotalHeaderLabel = React.useCallback(function () {
|
|
@@ -3381,6 +3657,21 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3381
3657
|
scheduleRowGrandTotalHeaderLabel();
|
|
3382
3658
|
};
|
|
3383
3659
|
|
|
3660
|
+
var getContextMenuItems = React.useCallback(function (params) {
|
|
3661
|
+
var colId = params.column && params.column.getColId ? params.column.getColId() : '';
|
|
3662
|
+
if (!colId || colId.indexOf('ag-Grid-AutoColumn') !== 0) return [];
|
|
3663
|
+
return [{
|
|
3664
|
+
name: 'Expand All',
|
|
3665
|
+
action: function action() {
|
|
3666
|
+
if (params.api) params.api.expandAll();
|
|
3667
|
+
}
|
|
3668
|
+
}, {
|
|
3669
|
+
name: 'Collapse All',
|
|
3670
|
+
action: function action() {
|
|
3671
|
+
if (params.api) params.api.collapseAll();
|
|
3672
|
+
}
|
|
3673
|
+
}];
|
|
3674
|
+
}, []);
|
|
3384
3675
|
var gridWrapperClassName = 'ag-theme-balham pivot-grid-element dl-ag-pivot-grid';
|
|
3385
3676
|
return React__default.createElement(React__default.Fragment, null, isLoading ? React__default.createElement("div", {
|
|
3386
3677
|
className: 'dl-full-hight dl-flex-content-center spinner-custome'
|
|
@@ -3416,8 +3707,8 @@ var AgPivotGrid = React.forwardRef(function (props, _comRef) {
|
|
|
3416
3707
|
onFirstDataRendered: onFirstDataRendered,
|
|
3417
3708
|
onColumnPivotChanged: onColumnPivotChanged,
|
|
3418
3709
|
onColumnResized: onColumnResized,
|
|
3710
|
+
getContextMenuItems: getContextMenuItems,
|
|
3419
3711
|
animateRows: false,
|
|
3420
|
-
suppressContextMenu: true,
|
|
3421
3712
|
suppressMovableColumns: true,
|
|
3422
3713
|
headerHeight: 36,
|
|
3423
3714
|
rowHeight: 36
|