Skip to content

Commit

Permalink
ensure new group instance
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Mar 13, 2019
1 parent ed03fa1 commit 8a38228
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/model/BooleanColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,6 @@ export default class BooleanColumn extends ValueColumn<boolean> implements ICate

group(row: IDataRow) {
const enabled = this.getValue(row);
return enabled ? BooleanColumn.GROUP_TRUE : BooleanColumn.GROUP_FALSE;
return Object.assign({}, enabled ? BooleanColumn.GROUP_TRUE : BooleanColumn.GROUP_FALSE);
}
}
2 changes: 1 addition & 1 deletion src/model/CategoricalColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ export default class CategoricalColumn extends ValueColumn<string> implements IC
group(row: IDataRow, valueCache?: any): IGroup {
const cat = valueCache !== undefined ? valueCache : this.getCategory(row);
if (!cat) {
return missingGroup;
return Object.assign({}, missingGroup);
}
return {name: cat.label, color: cat.color};
}
Expand Down
2 changes: 1 addition & 1 deletion src/model/Column.ts
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ export default class Column extends AEventDispatcher {
* @return {IGroup}
*/
group(_row: IDataRow, _valueCache?: any): IGroup {
return defaultGroup;
return Object.assign({}, defaultGroup);
}

toCompareGroupValue(_rows: ISequence<IDataRow>, group: IGroup, _valueCache?: ISequence<any>): ICompareValue | ICompareValue[] {
Expand Down
4 changes: 2 additions & 2 deletions src/model/DateColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,10 @@ export default class DateColumn extends ValueColumn<Date> implements IDateColumn
group(row: IDataRow, valueCache?: any): IGroup {
const v = valueCache !== undefined ? valueCache : this.getDate(row);
if (!v || !(v instanceof Date)) {
return missingGroup;
return Object.assign({}, missingGroup);
}
if (!this.currentGrouper) {
return defaultGroup;
return Object.assign({}, defaultGroup);
}
const g = toDateGroup(this.currentGrouper, v);
return {
Expand Down
2 changes: 1 addition & 1 deletion src/model/HierarchyColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ export default class HierarchyColumn extends ValueColumn<string> implements ICat
group(row: IDataRow): IGroup {
const base = this.getCategory(row);
if (!base) {
return missingGroup;
return Object.assign({}, missingGroup);
}
return {name: base.label, color: base.color};
}
Expand Down
2 changes: 1 addition & 1 deletion src/model/NumberColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ export default class NumberColumn extends ValueColumn<number> implements INumber
group(row: IDataRow): IGroup {
const value = this.getRawNumber(row);
if (isNaN(value)) {
return missingGroup;
return Object.assign({}, missingGroup);
}

let threshold = this.currentGroupThresholds;
Expand Down
2 changes: 1 addition & 1 deletion src/model/SelectionColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,6 @@ export default class SelectionColumn extends ValueColumn<boolean> {

group(row: IDataRow) {
const isSelected = this.getValue(row);
return isSelected ? SelectionColumn.SELECTED_GROUP : SelectionColumn.NOT_SELECTED_GROUP;
return Object.assign({}, isSelected ? SelectionColumn.SELECTED_GROUP : SelectionColumn.NOT_SELECTED_GROUP);
}
}
8 changes: 4 additions & 4 deletions src/model/StringColumn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,16 @@ export default class StringColumn extends ValueColumn<string> {

group(row: IDataRow): IGroup {
if (this.getValue(row) == null) {
return missingGroup;
return Object.assign({}, missingGroup);
}

if (this.currentGroupCriteria.length === 0) {
return othersGroup;
return Object.assign({}, othersGroup);
}
const value = this.getLabel(row);

if (!value) {
return missingGroup;
return Object.assign({}, missingGroup);
}

for (const criteria of this.currentGroupCriteria) {
Expand All @@ -205,7 +205,7 @@ export default class StringColumn extends ValueColumn<string> {
color: defaultGroup.color
};
}
return othersGroup;
return Object.assign({}, othersGroup);
}


Expand Down

0 comments on commit 8a38228

Please sign in to comment.