Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions eclipse-scout-chart/src/table/controls/ChartTableControl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
* Copyright (c) 2010, 2026 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -417,7 +417,7 @@ export class ChartTableControl extends TableControl implements ChartTableControl
}

protected _columns(): Column[] {
return new TableMatrix(this.table, this.session).columns();
return new TableMatrix(this.table).columns();
}

protected _axisCount(columnCount: (number | Column<any>)[][], column: Column<any>): number {
Expand Down Expand Up @@ -517,7 +517,7 @@ export class ChartTableControl extends TableControl implements ChartTableControl
this._chartGroup2Map = {};

// find best x- and y-axis: best is 9 different entries
let matrix = new TableMatrix(this.table, this.session),
let matrix = new TableMatrix(this.table),
columnCount = matrix.columnCount(false); // filterNumberColumns false: number columns will be filtered below
columnCount.sort((a, b) => {
return Math.abs(a[1] as number - 8) - Math.abs(b[1] as number - 8);
Expand Down Expand Up @@ -799,7 +799,7 @@ export class ChartTableControl extends TableControl implements ChartTableControl

protected _calculateValues(): TableMatrixResult {
// build matrix
let matrix = new TableMatrix(this.table, this.session);
let matrix = new TableMatrix(this.table);

// aggregation (data axis)
let tableData = this.chartAggregation.id ? this._aggregationMap[this.chartAggregation.id].data('column') : -1;
Expand Down
10 changes: 5 additions & 5 deletions eclipse-scout-chart/src/table/controls/ChartTableUserFilter.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2023 BSI Business Systems Integration AG
* Copyright (c) 2010, 2026 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -39,7 +39,7 @@ export class ChartTableUserFilter extends TableUserFilter implements ChartTableU
}

override createFilterAddedEventData(): ChartTableUserFilterAddedEventData {
let data: ChartTableUserFilterAddedEventData = super.createFilterAddedEventData();
let data = super.createFilterAddedEventData() as ChartTableUserFilterAddedEventData;
data.text = this.text;
data.filters = this.filters;
data.columnIdX = (this.xAxis && this.xAxis.column) ? this.xAxis.column.id : null;
Expand All @@ -48,7 +48,7 @@ export class ChartTableUserFilter extends TableUserFilter implements ChartTableU
}

calculate() {
let matrix = new TableMatrix(this.table, this.session);
let matrix = new TableMatrix(this.table);
let columnX = this.table.columnById(this.columnIdX);
let axisGroupX = columnX.createFilter().axisGroup();
this.xAxis = matrix.addAxis(columnX, axisGroupX);
Expand Down Expand Up @@ -77,8 +77,8 @@ export class ChartTableUserFilter extends TableUserFilter implements ChartTableU
}
}

export type ChartTableUserFilterAddedEventData = TableUserFilterAddedEventData & {
export interface ChartTableUserFilterAddedEventData extends TableUserFilterAddedEventData {
filters?: { deterministicKey: TableControlDeterministicKey }[];
columnIdX?: string;
columnIdY?: string;
};
}
14 changes: 14 additions & 0 deletions eclipse-scout-core/src/data-objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export class TableColumnClientUiPreferenceDo extends BaseDoEntity {
groupingActive: boolean;
aggregationFunctionId: string;
backgroundEffectId: string;
dateGroupType: DateGroupType;
}

export interface IUserFilterStateDo extends BaseDoEntity {
Expand All @@ -162,10 +163,23 @@ export class ColumnUserFilterStateDo extends BaseDoEntity implements IUserFilter
export class DateColumnUserFilterStateDo extends BaseDoEntity implements IUserFilterStateDo {
columnId: string;
selectedValues: Set<number>;
groupType: DateGroupType;
dateFrom: Date;
dateTo: Date;
}

/**
* @see "DateGroupType.java"
*/
export enum DateGroupType {
YEAR = 'year',
MONTH = 'month',
MONTH_AND_YEAR = 'month-and-year',
CALENDAR_WEEK = 'calendar-week',
WEEKDAY = 'weekday',
DATE = 'date'
}

@typeName('scout.NumberColumnUserFilterState')
export class NumberColumnUserFilterStateDo extends BaseDoEntity implements IUserFilterStateDo {
columnId: string;
Expand Down
1 change: 1 addition & 0 deletions eclipse-scout-core/src/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
@import "table/controls/TableControl";
@import "table/editor/CellEditorPopup";
@import "table/columns/CompactColumn";
@import "table/columns/DateColumnTableHeaderMenu";
@import "table/columns/LookupEditor";
@import "table/organizer/ShowInvisibleColumnsForm";
@import "table/organizer/TableOrganizerMenu";
Expand Down
1 change: 1 addition & 0 deletions eclipse-scout-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,7 @@ export * from './table/columns/CompactLineBlock';
export * from './table/columns/DateColumn';
export * from './table/columns/DateColumnModel';
export * from './table/columns/DateColumnEventMap';
export * from './table/columns/DateColumnTableHeaderMenu';
export * from './table/columns/IconColumn';
export * from './table/columns/NumberColumn';
export * from './table/columns/NumberColumnModel';
Expand Down
4 changes: 2 additions & 2 deletions eclipse-scout-core/src/menu/ContextMenuPopup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2025 BSI Business Systems Integration AG
* Copyright (c) 2010, 2026 BSI Business Systems Integration AG
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
Expand Down Expand Up @@ -43,7 +43,7 @@ export class ContextMenuPopup extends Popup implements ContextMenuPopupModel {
options.focusableContainer = true; // In order to allow keyboard navigation, the popup must gain focus. Because menu-items are not focusable, make the container focusable instead.

// If menu items are cloned, don't link the original menus with the popup, otherwise they would be removed when the context menu is removed
if (options.cloneMenuItems === false) {
if (scout.nvl(options.cloneMenuItems, this.cloneMenuItems) === false) {
this._addWidgetProperties('menuItems');
}

Expand Down
58 changes: 47 additions & 11 deletions eclipse-scout-core/src/prefs/TableUiPreferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
* SPDX-License-Identifier: EPL-2.0
*/
import {
arrays, Column, ErrorHandler, Event, ITableCustomizerDo, IUserFilterStateDo, NumberColumn, NumberColumnAggregationFunction, NumberColumnBackgroundEffect, objects, ObjectWithType, PropertyChangeEvent, scout, strings, Table,
arrays, Column, DateColumn, ErrorHandler, Event, ITableCustomizerDo, IUserFilterStateDo, NumberColumn, NumberColumnAggregationFunction, NumberColumnBackgroundEffect, objects, ObjectWithType, PropertyChangeEvent, scout, strings, Table,
TableClientUiPreferenceProfileDo, TableClientUiPreferencesDo, TableColumnClientUiPreferenceDo, TableUserFilter, UiPreferences, uiPreferences, UserFilterStateMappers
} from '../index';

Expand Down Expand Up @@ -123,15 +123,33 @@ export class TableUiPreferences implements ObjectWithType {
*/
protected _installTableListener(table: Table) {
this._uninstallTableListener(table);
table.on('columnMoved columnResized columnStructureChanged group sort aggregationFunctionChanged columnBackgroundEffectChanged', this._tableColumnListener);
table.on([
'columnMoved',
'columnResized',
'columnStructureChanged',
'group',
'sort',
'aggregationFunctionChanged',
'columnBackgroundEffectChanged',
'columnDateGroupTypeChanged'
].join(' '), this._tableColumnListener);
table.on('propertyChange:tileMode', this._tableTileModeListener);
}

/**
* Uninstalls the listener installed by {@link _installTableListener}.
*/
protected _uninstallTableListener(table: Table) {
table.off('columnMoved columnResized columnStructureChanged group sort aggregationFunctionChanged columnBackgroundEffectChanged', this._tableColumnListener);
table.off([
'columnMoved',
'columnResized',
'columnStructureChanged',
'group',
'sort',
'aggregationFunctionChanged',
'columnBackgroundEffectChanged',
'columnDateGroupTypeChanged'
].join(' '), this._tableColumnListener);
table.off('propertyChange:tileMode', this._tableTileModeListener);
}

Expand Down Expand Up @@ -265,6 +283,11 @@ export class TableUiPreferences implements ObjectWithType {
? column.backgroundEffect
: this.isColumnPreferencesColumn(column)
? column.getColumnPreferences()?.backgroundEffectId
: undefined,
dateGroupType: column instanceof DateColumn
? (column.grouped ? column.groupType : null) // only save group type if grouping is active
: this.isColumnPreferencesColumn(column)
? column.getColumnPreferences()?.dateGroupType
: undefined
});
});
Expand Down Expand Up @@ -500,24 +523,37 @@ export class TableUiPreferences implements ObjectWithType {
}

// Use setter for 'visible' property because it is a multidimensional property
column.setVisible(columnPreferences.visible, false); // parameter 'false' skips call of onColumnVisibilityChanged()
if (columnPreferences.visible !== undefined) {
column.setVisible(columnPreferences.visible, false); // parameter 'false' skips call of onColumnVisibilityChanged()
}

// Don't use setter for 'width' property to prevent unnecessarily redrawing the table (will be done again later in setColumns anyway)
if (!column.fixedWidth) {
if (columnPreferences.width !== undefined && !column.fixedWidth) {
column.width = columnPreferences.width;
}

// Properties without setter (changes will be applied later by _setColumns)
column.sortIndex = columnPreferences.sortOrder;
column.sortAscending = columnPreferences.sortAscending;
column.sortActive = column.sortIndex >= 0;
column.grouped = columnPreferences.groupingActive;
if (columnPreferences.sortOrder !== undefined) {
column.sortIndex = columnPreferences.sortOrder;
column.sortActive = column.sortIndex >= 0;
}
if (columnPreferences.sortAscending !== undefined) {
column.sortAscending = columnPreferences.sortAscending;
}
if (columnPreferences.groupingActive !== undefined) {
column.grouped = columnPreferences.groupingActive;
}

if (column instanceof NumberColumn) {
// Use setters to correctly update internal structures (e.g. aggrStart function)
// Use setters to correctly update internal structures (e.g. aggrStart function)
if (columnPreferences.aggregationFunctionId !== undefined && column instanceof NumberColumn) {
column.setAggregationFunction(columnPreferences.aggregationFunctionId as NumberColumnAggregationFunction);
}
if (columnPreferences.backgroundEffectId !== undefined && column instanceof NumberColumn) {
column.setBackgroundEffect(columnPreferences.backgroundEffectId as NumberColumnBackgroundEffect, false); // false = don't redraw
}
if (columnPreferences.dateGroupType !== undefined && column instanceof DateColumn) {
column.setGroupType(columnPreferences.dateGroupType, false); // false = don't apply grouping
}

if (this.isColumnPreferencesColumn(column)) {
column.setColumnPreferences(columnPreferences);
Expand Down
Loading
Loading