Skip to content

Commit eee7918

Browse files
authored
DataGrid/TreeList AI Column: Add new column type (#31079)
Co-authored-by: Alyar <>
1 parent a2c96e9 commit eee7918

File tree

7 files changed

+98
-3
lines changed

7 files changed

+98
-3
lines changed
8.46 KB
Loading
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
2+
import DataGrid from 'devextreme-testcafe-models/dataGrid';
3+
import url from '../../../../helpers/getPageUrl';
4+
import { createWidget } from '../../../../helpers/createWidget';
5+
6+
fixture`Ai Column.Visual`
7+
.page(url(__dirname, '../../../container.html'));
8+
9+
const DATA_GRID_SELECTOR = '#container';
10+
11+
test('Default render', async (t) => {
12+
// arrange, act
13+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
14+
const dataGrid = new DataGrid(DATA_GRID_SELECTOR);
15+
16+
await t.expect(dataGrid.isReady()).ok();
17+
18+
await takeScreenshot('datagrid__ai-column__default.png', dataGrid.element);
19+
20+
// assert
21+
await t
22+
.expect(compareResults.isValid())
23+
.ok(compareResults.errorMessages());
24+
}).before(async () => createWidget('dxDataGrid', {
25+
dataSource: [
26+
{ id: 1, name: 'Name 1', value: 10 },
27+
{ id: 2, name: 'Name 2', value: 20 },
28+
{ id: 3, name: 'Name 3', value: 30 },
29+
],
30+
columns: [
31+
{ dataField: 'id', caption: 'ID' },
32+
{ dataField: 'name', caption: 'Name' },
33+
{ dataField: 'value', caption: 'Value' },
34+
{
35+
type: 'ai',
36+
caption: 'AI Column',
37+
},
38+
],
39+
}));
8.5 KB
Loading
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { createScreenshotsComparer } from 'devextreme-screenshot-comparer';
2+
import TreeList from 'devextreme-testcafe-models/treeList';
3+
import url from '../../../helpers/getPageUrl';
4+
import { createWidget } from '../../../helpers/createWidget';
5+
6+
fixture`Ai Column.Visual`
7+
.page(url(__dirname, '../../container.html'));
8+
9+
const TREE_LIST_SELECTOR = '#container';
10+
11+
test('Default render', async (t) => {
12+
// arrange, act
13+
const { takeScreenshot, compareResults } = createScreenshotsComparer(t);
14+
const treeList = new TreeList(TREE_LIST_SELECTOR);
15+
16+
await t.expect(treeList.isReady()).ok();
17+
18+
await takeScreenshot('treelist__ai-column__default.png', treeList.element);
19+
20+
// assert
21+
await t
22+
.expect(compareResults.isValid())
23+
.ok(compareResults.errorMessages());
24+
}).before(async () => createWidget('dxTreeList', {
25+
dataSource: [
26+
{
27+
id: 1, parentId: 0, name: 'Name 1', value: 10,
28+
},
29+
{
30+
id: 2, parentId: 1, name: 'Name 2', value: 20,
31+
},
32+
{
33+
id: 3, parentId: 0, name: 'Name 3', value: 30,
34+
},
35+
{
36+
id: 4, parentId: 3, name: 'Name 4', value: 40,
37+
},
38+
],
39+
keyExpr: 'id',
40+
parentIdExpr: 'parentId',
41+
expandedRowKeys: [3],
42+
columns: [
43+
{ dataField: 'id', caption: 'ID' },
44+
{ dataField: 'name', caption: 'Name' },
45+
{ dataField: 'value', caption: 'Value' },
46+
{
47+
type: 'ai',
48+
caption: 'AI Column',
49+
},
50+
],
51+
}));

packages/devextreme/js/ui/data_grid.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export type ScrollingBase = ComponentScrollingBase;
183183
export type SelectionBase = ComponentSelectionBase;
184184

185185
/** @public */
186-
export type DataGridCommandColumnType = 'adaptive' | 'buttons' | 'detailExpand' | 'groupExpand' | 'selection' | 'drag';
186+
export type DataGridCommandColumnType = 'adaptive' | 'ai' | 'buttons' | 'detailExpand' | 'groupExpand' | 'selection' | 'drag';
187187
/** @public */
188188
export type DataGridExportFormat = 'pdf' | 'xlsx';
189189
/** @public */

packages/devextreme/js/ui/tree_list.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ export type TreeListPredefinedColumnButton = 'add' | 'cancel' | 'delete' | 'edit
172172
/** @public */
173173
export type TreeListPredefinedToolbarItem = 'addRowButton' | 'applyFilterButton' | 'columnChooserButton' | 'revertButton' | 'saveButton' | 'searchPanel';
174174
/** @public */
175-
export type TreeListCommandColumnType = 'adaptive' | 'buttons' | 'drag';
175+
export type TreeListCommandColumnType = 'adaptive' | 'ai' | 'buttons' | 'drag';
176176
/** @public */
177177
export type TreeListFilterMode = 'fullBranch' | 'withAncestors' | 'matchOnly';
178178

packages/devextreme/ts/dx.all.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12349,6 +12349,7 @@ declare module DevExpress.ui {
1234912349
DevExpress.common.grids.DataErrorOccurredInfo;
1235012350
export type DataGridCommandColumnType =
1235112351
| 'adaptive'
12352+
| 'ai'
1235212353
| 'buttons'
1235312354
| 'detailExpand'
1235412355
| 'groupExpand'
@@ -31401,7 +31402,11 @@ declare module DevExpress.ui {
3140131402
TKey = any
3140231403
> = DevExpress.common.core.events.EventInfo<dxTreeList<TRowData, TKey>> &
3140331404
DevExpress.common.grids.ToolbarPreparingInfo;
31404-
export type TreeListCommandColumnType = 'adaptive' | 'buttons' | 'drag';
31405+
export type TreeListCommandColumnType =
31406+
| 'adaptive'
31407+
| 'ai'
31408+
| 'buttons'
31409+
| 'drag';
3140531410
export type TreeListFilterMode =
3140631411
| 'fullBranch'
3140731412
| 'withAncestors'

0 commit comments

Comments
 (0)