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