eru-grid 0.0.20 → 0.0.22
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/fesm2022/eru-grid.mjs +22 -11
- package/fesm2022/eru-grid.mjs.map +1 -1
- package/package.json +1 -1
package/fesm2022/eru-grid.mjs
CHANGED
|
@@ -296,7 +296,7 @@ class PivotTransformService {
|
|
|
296
296
|
// Calculate aggregations for each pivot column (optimized)
|
|
297
297
|
pivotColumns.forEach(pivotColumn => {
|
|
298
298
|
configuration.aggregations.forEach(aggregation => {
|
|
299
|
-
const columnKey = `${pivotColumn}
|
|
299
|
+
const columnKey = `${pivotColumn}|${aggregation.name}`;
|
|
300
300
|
// Get filtered data from pre-calculated mapping
|
|
301
301
|
const columnData = configuration.cols.length > 0
|
|
302
302
|
? columnMapping.get(pivotColumn) || []
|
|
@@ -381,6 +381,7 @@ class PivotTransformService {
|
|
|
381
381
|
enableDrilldown: field?.enableDrilldown || false
|
|
382
382
|
});
|
|
383
383
|
});
|
|
384
|
+
console.log(columns);
|
|
384
385
|
// Check if column subtotals and grand totals are enabled
|
|
385
386
|
const enableColumnSubtotals = gridConfiguration?.config?.enableColumnSubtotals ?? false;
|
|
386
387
|
const enableColumnGrandTotal = gridConfiguration?.config?.enableColumnGrandTotal ?? false;
|
|
@@ -450,7 +451,7 @@ class PivotTransformService {
|
|
|
450
451
|
aggregations.forEach(aggregation => {
|
|
451
452
|
const aggregationColumn = fields.find(field => field.name === aggregation.name);
|
|
452
453
|
// CRITICAL FIX: Always use consistent naming pattern
|
|
453
|
-
const columnName = `${pivotColumn}
|
|
454
|
+
const columnName = `${pivotColumn}|${aggregation.name}`;
|
|
454
455
|
// For no column dimensions, just show the aggregation label
|
|
455
456
|
const columnLabel = pivotColumns.length > 1 || pivotColumns[0] !== '_default'
|
|
456
457
|
? `${this.formatColumnLabel(pivotColumn)} - ${aggregation.label || aggregation.name}`
|
|
@@ -806,7 +807,7 @@ class PivotTransformService {
|
|
|
806
807
|
if (columnDimensions.length === 0) {
|
|
807
808
|
aggregations.forEach(aggregation => {
|
|
808
809
|
const aggregationColumn = gridConfiguration?.fields.find((col) => col.name === aggregation.name);
|
|
809
|
-
const columnName = `
|
|
810
|
+
const columnName = `_default|${aggregation.name}`;
|
|
810
811
|
const columnLabel = aggregation.label || this.formatColumnLabel(aggregation.name);
|
|
811
812
|
columns.push({
|
|
812
813
|
name: columnName,
|
|
@@ -881,7 +882,7 @@ class PivotTransformService {
|
|
|
881
882
|
aggregations.forEach(aggregation => {
|
|
882
883
|
const aggregationColumn = gridConfiguration?.fields.find((col) => col.name === aggregation.name);
|
|
883
884
|
const columnKey = combination.join('|');
|
|
884
|
-
const columnName = `${columnKey}
|
|
885
|
+
const columnName = `${columnKey}|${aggregation.name}`;
|
|
885
886
|
const columnLabel = aggregations.length > 1
|
|
886
887
|
? `${combination.join(' - ')} (${aggregation.label})`
|
|
887
888
|
: combination.join(' - ');
|
|
@@ -1006,7 +1007,7 @@ class PivotTransformService {
|
|
|
1006
1007
|
if (columnDimensions.length === 0) {
|
|
1007
1008
|
aggregations.forEach(aggregation => {
|
|
1008
1009
|
const aggregationColumn = gridConfiguration?.fields.find((col) => col.name === aggregation.name);
|
|
1009
|
-
const columnName = `
|
|
1010
|
+
const columnName = `_default|${aggregation.name}`;
|
|
1010
1011
|
const columnLabel = aggregation.label || this.formatColumnLabel(aggregation.name);
|
|
1011
1012
|
columns.push({
|
|
1012
1013
|
name: columnName,
|
|
@@ -1069,6 +1070,7 @@ class PivotTransformService {
|
|
|
1069
1070
|
combinations.push([value, ...restCombo]);
|
|
1070
1071
|
});
|
|
1071
1072
|
});
|
|
1073
|
+
console.log(combinations);
|
|
1072
1074
|
return combinations;
|
|
1073
1075
|
}
|
|
1074
1076
|
/**
|
|
@@ -3788,7 +3790,7 @@ class DataCellComponent {
|
|
|
3788
3790
|
;
|
|
3789
3791
|
columnCellConfiguration = computed(() => {
|
|
3790
3792
|
const columns = this.eruGridStore().columns();
|
|
3791
|
-
return columns?.find((columnConfig) => columnConfig.name === this.getColumnValue()
|
|
3793
|
+
return columns?.find((columnConfig) => columnConfig.name === this.getColumnValue()?.replace('default|', '')) || null;
|
|
3792
3794
|
}, ...(ngDevMode ? [{ debugName: "columnCellConfiguration" }] : []));
|
|
3793
3795
|
renderer = inject(Renderer2);
|
|
3794
3796
|
datePipe = inject(DatePipe);
|
|
@@ -3846,6 +3848,9 @@ class DataCellComponent {
|
|
|
3846
3848
|
if (config?.datatype !== 'number' && config?.datatype !== 'currency') {
|
|
3847
3849
|
return value?.toString() || '';
|
|
3848
3850
|
}
|
|
3851
|
+
if (typeof value === 'string') {
|
|
3852
|
+
return value;
|
|
3853
|
+
}
|
|
3849
3854
|
if (value == 0 && this.replaceZeroValue !== undefined) {
|
|
3850
3855
|
return this.replaceZeroValue;
|
|
3851
3856
|
}
|
|
@@ -3917,20 +3922,22 @@ class DataCellComponent {
|
|
|
3917
3922
|
event.stopPropagation();
|
|
3918
3923
|
console.log('drillable click', this.id(), this.currentValue());
|
|
3919
3924
|
// Handle drillable click - you can emit an event or call a service here
|
|
3920
|
-
const idSplit = this.id().toString().replace('pivot_', '').replace('
|
|
3925
|
+
const idSplit = this.id().toString().replace('pivot_', '').replace('_default|', '');
|
|
3921
3926
|
// Split on first underscore to get first part and rest
|
|
3922
3927
|
const [rowId, ...columnName] = idSplit.split('_');
|
|
3923
3928
|
const columnValues = columnName.join('_');
|
|
3929
|
+
const columnValuesSplit = columnValues.split('|');
|
|
3930
|
+
const colName = columnValuesSplit[columnValuesSplit.length - 1];
|
|
3924
3931
|
console.log({
|
|
3925
3932
|
frozenGrandTotalCell: this.frozenGrandTotalCell(),
|
|
3926
|
-
columnName:
|
|
3933
|
+
columnName: colName,
|
|
3927
3934
|
rowId: rowId,
|
|
3928
3935
|
columnValue: this.currentValue()
|
|
3929
3936
|
});
|
|
3930
3937
|
console.log(columnValues);
|
|
3931
3938
|
this.eruGridStore().setDrilldown({
|
|
3932
3939
|
frozenGrandTotalCell: this.frozenGrandTotalCell(),
|
|
3933
|
-
columnName:
|
|
3940
|
+
columnName: colName,
|
|
3934
3941
|
rowId: rowId,
|
|
3935
3942
|
columnValue: this.currentValue()
|
|
3936
3943
|
}, columnValues);
|
|
@@ -4520,7 +4527,7 @@ class DataCellComponent {
|
|
|
4520
4527
|
return firstInitial + secondInitial;
|
|
4521
4528
|
}
|
|
4522
4529
|
getColumnValue() {
|
|
4523
|
-
return this.columnName().includes('
|
|
4530
|
+
return this.columnName().includes('|') ? this.columnName().split('|').pop() : this.columnName();
|
|
4524
4531
|
}
|
|
4525
4532
|
/**
|
|
4526
4533
|
* Set column-specific CSS custom properties for text alignment
|
|
@@ -4552,7 +4559,11 @@ class DataCellComponent {
|
|
|
4552
4559
|
}
|
|
4553
4560
|
}
|
|
4554
4561
|
getColumnName() {
|
|
4555
|
-
|
|
4562
|
+
//console.log(this.getColumnValue())
|
|
4563
|
+
//const columnValue = this.getColumnValue().replace('default|', '');
|
|
4564
|
+
//const columnValues = columnValue.split('|')
|
|
4565
|
+
//const colName = columnValues[columnValues.length - 1]
|
|
4566
|
+
return this.getColumnValue()?.replace('default|', '') || '';
|
|
4556
4567
|
}
|
|
4557
4568
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.3", ngImport: i0, type: DataCellComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
4558
4569
|
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "20.1.3", type: DataCellComponent, isStandalone: true, selector: "data-cell", inputs: { eruGridStore: { classPropertyName: "eruGridStore", publicName: "eruGridStore", isSignal: true, isRequired: true, transformFunction: null }, fieldSize: { classPropertyName: "fieldSize", publicName: "fieldSize", isSignal: true, isRequired: true, transformFunction: null }, columnDatatype: { classPropertyName: "columnDatatype", publicName: "columnDatatype", isSignal: true, isRequired: true, transformFunction: null }, columnName: { classPropertyName: "columnName", publicName: "columnName", isSignal: true, isRequired: true, transformFunction: null }, column: { classPropertyName: "column", publicName: "column", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: true, transformFunction: null }, frozenGrandTotalCell: { classPropertyName: "frozenGrandTotalCell", publicName: "frozenGrandTotalCell", isSignal: true, isRequired: false, transformFunction: null }, td: { classPropertyName: "td", publicName: "td", isSignal: true, isRequired: false, transformFunction: null }, drillable: { classPropertyName: "drillable", publicName: "drillable", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, isEditable: { classPropertyName: "isEditable", publicName: "isEditable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { td: "tdChange" }, host: { listeners: { "document:click": "onDocumentClick($event)" }, classAttribute: "data-cell-component" }, providers: [MatDatepickerModule,
|