Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataGrid - In the Fluent theme, a padding is set when Toolbar is not visible (T1261773) #28551

Draft
wants to merge 3 commits into
base: 24_2
Choose a base branch
from
Draft
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
30 changes: 30 additions & 0 deletions e2e/testcafe-devextreme/tests/dataGrid/headerPanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,33 @@ test('Toolbar should not reset its widget values when changing the disabled prop
}],
},
}));

[
Themes.genericLight,
Themes.materialBlue,
Themes.fluentBlue,
].forEach((theme) => {
test(`Invisible toolbar doesn't have additional paddings (T1261773) in ${theme}`, async (t) => {
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
const dataGrid = new DataGrid('#container');

await t
.expect(await takeScreenshot(`disabled-toolbar-buttons-${theme}.png`, dataGrid.element))
.ok()
.expect(compareResults.isValid())
.ok(compareResults.errorMessages());
}).before(async () => {
await changeTheme(theme);

return createWidget('dxDataGrid', {
dataSource: getData(5, 3),
keyExpr: 'field_0',
toolbar: {
items: ['columnChooserButton'],
visible: false,
},
});
}).after(async () => {
await changeTheme(Themes.genericLight);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,6 @@ const headerPanel = (Base: ModuleType<HeaderPanel>) => class ExportHeaderPanelEx
this.setToolbarItemDisabled('exportButton', disabled);
});
}

public isVisible() {
return super.isVisible() || this._isExportButtonVisible();
}
};

dataGridCore.registerModule('export', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -584,10 +584,6 @@ export const GroupingHeaderPanelExtender = (Base: ModuleType<HeaderPanel>) => cl
return items;
}

public isVisible() {
return super.isVisible() || this._isGroupPanelVisible();
}

public hasGroupedColumns(): boolean {
return this._isGroupPanelVisible() && !!this.getColumns().length;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -579,13 +579,6 @@ const headerPanel = (Base: ModuleType<HeaderPanel>) => class ColumnChooserHeader
super.optionChanged(args);
}
}

public isVisible() {
const that = this;
const columnChooserEnabled = that.option('columnChooser.enabled')!;

return super.isVisible() || columnChooserEnabled;
}
};

const columns = (Base: ModuleType<ColumnsController>) => class ColumnsChooserColumnsControllerExtender extends Base {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2873,13 +2873,6 @@ const headerPanel = (Base: ModuleType<HeaderPanel>) => class HeaderPanelEditingE

return editButtonItems.concat(items);
}

public isVisible() {
const editingOptions = this._editingController.option('editing');

// @ts-expect-error
return super.isVisible() || editingOptions?.allowAdding;
}
};

export const editingModule = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import type { DeferredObj } from '@js/core/utils/deferred';
import { Deferred, when } from '@js/core/utils/deferred';
import { isElementInDom } from '@js/core/utils/dom';
import { isDefined, isString } from '@js/core/utils/type';
import type { HeaderPanel } from '@ts/grids/grid_core/header_panel/m_header_panel';
import type { RowsView } from '@ts/grids/grid_core/views/m_rows_view';

import type { ModuleType } from '../m_types';
Expand Down Expand Up @@ -721,23 +720,13 @@ const rowsView = (Base: ModuleType<RowsView>) => class RowsViewEditingCellBasedE
}
};

const headerPanel = (Base: ModuleType<HeaderPanel>) => class HeaderPanelEditingCellBasedExtender extends Base {
public isVisible() {
const editingOptions = this._editingController.option('editing');

// @ts-expect-error
return super.isVisible() || editingOptions && (editingOptions.allowUpdating || editingOptions.allowDeleting) && editingOptions.mode === EDIT_MODE_BATCH;
}
};

export const editingCellBasedModule = {
extenders: {
controllers: {
editing: editingControllerExtender,
},
views: {
rowsView,
headerPanel,
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -1013,10 +1013,6 @@ const headerPanel = (Base: ModuleType<HeaderPanel>) => class FilterRowHeaderPane
private enableApplyButton(value) {
this.setToolbarItemDisabled('applyFilterButton', !value);
}

public isVisible() {
return super.isVisible() || this._isShowApplyFilterButton();
}
};

export const filterRowModule = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,8 +214,7 @@ export class HeaderPanel extends ColumnsView {
} else if (parts[1] === 'items') {
if (parts.length === 2) {
// `toolbar.items` case
const toolbarOptions = this._getToolbarOptions();
this._toolbar?.option('items', toolbarOptions.items);
this._invalidate();
} else if (parts.length === 3) {
// `toolbar.items[i]` case
const normalizedItem = this._normalizeToolbarItems(this._getToolbarItems(), args.value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,11 +193,6 @@ const headerPanel = (
}
return null;
}

public isVisible() {
const searchPanelOptions = this.option('searchPanel');
return super.isVisible() || !!searchPanelOptions?.visible;
}
};

const rowsView = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2879,7 +2879,7 @@ QUnit.module('Assign options', baseModuleConfig, () => {
dataGrid.option('toolbar.visible', false);

// assert
assert.ok($toolbar.hasClass('dx-state-invisible'), 'toolbar is hidden');
assert.ok($toolbar.parent().hasClass('dx-hidden'), 'toolbar is hidden');

// act
dataGrid.option('toolbar.disabled', true);
Expand Down
Loading