Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export const groupingCommand = defineGridCommand({
schema: groupingCommandSchema,
execute: (component, { success, failure }) => (args): Promise<CommandResult> => {
const columnsController = component.getController('columns');
const column: Column | undefined = columnsController.columnOption(args.dataField);
const column = columnsController.columnOption(args.dataField);
// @ts-expect-error GridCore and DataGrid column types are not aligned
const defaultMessage = getGroupingDefaultMessage(args, column);

if (!column || column.allowGrouping === false) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const SUMMARY_TYPE_LABELS: Record<SummaryItem['summaryType'], string> = {
const buildItemLabel = (
item: SummaryItem,
location: 'total' | 'group',
columnsController: { columnOption: (id: string) => Column | undefined },
columnsController: { columnOption: (id: string) => Pick<Column, 'caption'> | undefined },
): string => {
const column = columnsController.columnOption(item.column);
const caption = column?.caption ?? item.column;
Expand All @@ -57,7 +57,7 @@ const buildItemLabel = (
const buildDefaultMessage = (
totalItems: SummaryItem[],
groupItems: SummaryItem[],
columnsController: { columnOption: (id: string) => Column | undefined },
columnsController: { columnOption: (id: string) => Pick<Column, 'caption'> | undefined },
): string => {
if (totalItems.length === 0 && groupItems.length === 0) {
return 'Display data summaries.';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const data = (Base: DataControllerBase) => class FocusDataControllerExtender ext

if (focusedRow) {
for (let i = 0; i < path.length; ++i) {
// @ts-expect-error compileGetter also accepts function selectors at runtime
const getter = compileGetter(groups[i] && groups[i].selector);

// @ts-expect-error
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ export const groupingColumnsControllerExtender = (
public _getExpandColumnOptions() {
const options = super._getExpandColumnOptions();

// @ts-expect-error
options.cellTemplate = gridCore.getExpandCellTemplate();

return options;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { CLASSES as GROUPING_CLASSES } from '../grouping/const';
import { ColumnKeyboardNavigationMixin } from './m_column_keyboard_navigation_mixin';

export class GroupPanelKeyboardNavigationController extends ColumnKeyboardNavigationMixin(ColumnKeyboardNavigationController) {
private isNeedToHiddenFocusAfterClick = false;
private isNeedToHiddenFocusAfterClick: boolean | undefined = false;

private groupItemClickHandlerContext!: (event: any) => void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ export const summaryDataControllerExtender = (
const columnName = groupItem.showInColumn ?? groupItem.column;
const column = this._columnsController.columnOption(columnName);

// @ts-expect-error GridCore and DataGrid column types are not aligned
if (groupItem.showInGroupFooter && isDataColumn(column)) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ export class AdaptiveColumnsController extends modules.ViewController {
containerWidth,
});
} else {
return parseFloat(widthOption);
return parseFloat(String(widthOption));
}
} else {
const columnAutoWidth = this.option('columnAutoWidth');
Expand All @@ -356,11 +356,12 @@ export class AdaptiveColumnsController extends modules.ViewController {
const bestFitWidth = this._columnsController.columnOption(columnId, 'bestFitWidth');

if (widthOption && widthOption !== 'auto' && !this._isPercentWidth(widthOption)) {
return parseFloat(widthOption);
return parseFloat(String(widthOption));
}

const colWidth = this._calculateColumnWidth(column, containerWidth, contentColumns, columnsCanFit);

// @ts-expect-error bestFitWidth can be absent; the comparison then returns false
return colWidth < bestFitWidth ? null : colWidth;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const sortingCommand = defineGridCommand({
const column: Column | undefined = columnsController.columnOption(args.dataField);
const defaultMessage = getSortingDefaultMessage(args, column);

if (!column || !columnsController.allowColumnSorting(column)) {
if (!column || !columnsController.allowColumnSorting(column) || column.index === undefined) {
return Promise.resolve(failure(defaultMessage));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ export class AIColumnController extends Controller {
...getAICommandColumnDefaultOptions(),
calculateCellValue(data: RawItemData) {
const key = dataSourceController.keyOf(data);
// @ts-expect-error the column name is initialized before calculateCellValue is called
const cellValue = aiColumnIntegrationController.getAIColumnText(this.name, key);
const defaultValue = getDefaultCellValue(this, cellValue);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,30 @@ describe('getFilteringColumns', () => {
});
});

describe('column fixing enablement', () => {
beforeEach(beforeTest);
afterEach(afterTest);

it.each([
{ enabled: undefined, fixed: false, expected: undefined },
{ enabled: undefined, fixed: true, expected: true },
{ enabled: false, fixed: false, expected: false },
{ enabled: false, fixed: true, expected: true },
{ enabled: true, fixed: false, expected: true },
{ enabled: true, fixed: true, expected: true },
])('preserves enabled=$enabled when fixed=$fixed', async ({ enabled, fixed, expected }) => {
const { instance } = await createDataGrid({
dataSource: [{ id: 1 }],
columns: [{ dataField: 'id', fixed }],
});
instance.option('columnFixing.enabled', enabled);

const result = instance.getController('columns')._isColumnFixing();

expect(result).toBe(expected);
});
});

describe('Bugs', () => {
beforeEach(() => {
beforeTest();
Expand Down
Loading
Loading