Skip to content

Commit bbf74a4

Browse files
pomahtriwdevfx
andauthored
CardView - runtime fixes related to .d.ts (#29700)
Co-authored-by: wdevfx <[email protected]>
1 parent cb7f84e commit bbf74a4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+907
-565
lines changed

apps/react-storybook/stories/card_view/CardView.stories.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ const columns = {
8686
{
8787
dataField: 'birthDate',
8888
dataType: 'date',
89-
calculateCellValue: (data) => {
89+
calculateFieldValue: (data) => {
9090
return new Date(data.birthDate);
9191
},
9292
calculateDisplayValue: (data) => {
@@ -103,7 +103,7 @@ const columns = {
103103
{
104104
dataField: "OrderDate",
105105
dataType: 'date',
106-
calculateCellValue: (data) => {
106+
calculateFieldValue: (data) => {
107107
return new Date(data.OrderDate);
108108
},
109109
calculateDisplayValue: (data) => {

e2e/testcafe-devextreme/tests/cardView/headerFilter/common.functional.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ test('should support custom translations', async (t) => {
4242
columns: [
4343
{
4444
dataField: 'A',
45-
calculateCellValue: () => undefined,
45+
calculateFieldValue: () => undefined,
4646
},
4747
'B',
4848
'C',

e2e/testcafe-devextreme/tests/cardView/headerFilter/local.functional.ts

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ test('list should contain all values from computed column', async (t) => {
110110
columns: [
111111
{
112112
caption: 'Computed',
113-
calculateCellValue: (data) => `${data.A}_${data.B}`,
113+
calculateFieldValue: (data) => `${data.A}_${data.B}`,
114114
},
115115
],
116116
headerFilter: {
@@ -192,7 +192,7 @@ test('should update column options with filterType and values (regular selection
192192

193193
await t
194194
.expect(columnOptions.filterType).eql(undefined)
195-
.expect(columnOptions.headerFilter.values).eql(['A_0', 'A_1']);
195+
.expect(columnOptions.filterValues).eql(['A_0', 'A_1']);
196196

197197
await t.click(cardView.element);
198198
}).before(async () => {
@@ -234,7 +234,7 @@ test('should update column options with filterType and values (selectAll case #0
234234

235235
await t
236236
.expect(columnOptions.filterType).eql('exclude')
237-
.expect(columnOptions.headerFilter.values).eql(null);
237+
.expect(columnOptions.filterValues).eql(null);
238238

239239
await t.click(cardView.element);
240240
}).before(async () => createWidget('dxCardView', {
@@ -278,7 +278,7 @@ test('should update column options with filterType and values (selectAll case #1
278278

279279
await t
280280
.expect(columnOptions.filterType).eql('exclude')
281-
.expect(columnOptions.headerFilter.values).eql(['A_2', 'A_3']);
281+
.expect(columnOptions.filterValues).eql(['A_2', 'A_3']);
282282

283283
await t.click(cardView.element);
284284
}).before(async () => createWidget('dxCardView', {
@@ -329,9 +329,7 @@ test('should apply filter from options (type: "include" by default)', async (t)
329329
columns: [
330330
{
331331
dataField: 'A',
332-
headerFilter: {
333-
values: ['A_0', 'A_1'],
334-
},
332+
filterValues: ['A_0', 'A_1'],
335333
},
336334
'B',
337335
'C',
@@ -375,9 +373,7 @@ test('should apply filter from options (type: "include")', async (t) => {
375373
columns: [
376374
{
377375
dataField: 'A',
378-
headerFilter: {
379-
values: ['A_0', 'A_1'],
380-
},
376+
filterValues: ['A_0', 'A_1'],
381377
filterType: 'include',
382378
},
383379
'B',
@@ -424,9 +420,7 @@ test('should apply filter from options (type: "exclude")', async (t) => {
424420
columns: [
425421
{
426422
dataField: 'A',
427-
headerFilter: {
428-
values: ['A_2', 'A_3', 'A_4'],
429-
},
423+
filterValues: ['A_2', 'A_3', 'A_4'],
430424
filterType: 'exclude',
431425
},
432426
'B',
@@ -515,7 +509,7 @@ test('should not update column options if popup cancel btn clicked', async (t) =
515509

516510
await t
517511
.expect(columnOptions.filterType).eql(undefined)
518-
.expect(columnOptions.headerFilter.values).eql(['A_4']);
512+
.expect(columnOptions.filterValues).eql(['A_4']);
519513

520514
await t.click(cardView.element);
521515
}).before(async () => createWidget('dxCardView', {
@@ -529,9 +523,7 @@ test('should not update column options if popup cancel btn clicked', async (t) =
529523
columns: [
530524
{
531525
dataField: 'A',
532-
headerFilter: {
533-
values: ['A_4'],
534-
},
526+
filterValues: ['A_4'],
535527
},
536528
'B',
537529
'C',

e2e/testcafe-devextreme/tests/cardView/headerFilter/remote.functional.ts

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ const clearRemoteOperations = () => ClientFunction(() => {
141141

142142
await t
143143
.expect(columnOptions.filterType).eql(undefined)
144-
.expect(columnOptions.headerFilter.values).eql(['A_0', 'A_1']);
144+
.expect(columnOptions.filterValues).eql(['A_0', 'A_1']);
145145

146146
await t.click(cardView.element);
147147
}).before(async (t) => {
@@ -188,7 +188,7 @@ const clearRemoteOperations = () => ClientFunction(() => {
188188

189189
await t
190190
.expect(columnOptions.filterType).eql('exclude')
191-
.expect(columnOptions.headerFilter.values).eql(null);
191+
.expect(columnOptions.filterValues).eql(null);
192192

193193
await t.click(cardView.element);
194194
}).before(async (t) => {
@@ -239,7 +239,7 @@ const clearRemoteOperations = () => ClientFunction(() => {
239239

240240
await t
241241
.expect(columnOptions.filterType).eql('exclude')
242-
.expect(columnOptions.headerFilter.values).eql(['A_2', 'A_3']);
242+
.expect(columnOptions.filterValues).eql(['A_2', 'A_3']);
243243

244244
await t.click(cardView.element);
245245
}).before(async (t) => {
@@ -299,9 +299,7 @@ const clearRemoteOperations = () => ClientFunction(() => {
299299
columns: [
300300
{
301301
dataField: 'A',
302-
headerFilter: {
303-
values: ['A_0', 'A_1'],
304-
},
302+
filterValues: ['A_0', 'A_1'],
305303
},
306304
'B',
307305
'C',
@@ -352,9 +350,7 @@ const clearRemoteOperations = () => ClientFunction(() => {
352350
columns: [
353351
{
354352
dataField: 'A',
355-
headerFilter: {
356-
values: ['A_0', 'A_1'],
357-
},
353+
filterValues: ['A_0', 'A_1'],
358354
filterType: 'include',
359355
},
360356
'B',
@@ -408,9 +404,7 @@ const clearRemoteOperations = () => ClientFunction(() => {
408404
columns: [
409405
{
410406
dataField: 'A',
411-
headerFilter: {
412-
values: ['A_2', 'A_3', 'A_4'],
413-
},
407+
filterValues: ['A_2', 'A_3', 'A_4'],
414408
filterType: 'exclude',
415409
},
416410
'B',
@@ -506,7 +500,7 @@ const clearRemoteOperations = () => ClientFunction(() => {
506500

507501
await t
508502
.expect(columnOptions.filterType).eql(undefined)
509-
.expect(columnOptions.headerFilter.values).eql(['A_4']);
503+
.expect(columnOptions.filterValues).eql(['A_4']);
510504

511505
await t.click(cardView.element);
512506
}).before(async (t) => {
@@ -522,9 +516,7 @@ const clearRemoteOperations = () => ClientFunction(() => {
522516
columns: [
523517
{
524518
dataField: 'A',
525-
headerFilter: {
526-
values: ['A_4'],
527-
},
519+
filterValues: ['A_4'],
528520
},
529521
'B',
530522
'C',

e2e/testcafe-devextreme/tests/cardView/headerFilter/visual.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ test('popup with tree', async (t) => {
100100
{
101101
dataField: 'A',
102102
dataType: 'date',
103-
// TODO calculateCellValue issue: Remove after task will be complete
104-
calculateCellValue: ({ A }) => new Date(A),
103+
// TODO calculateFieldValue issue: Remove after task will be complete
104+
calculateFieldValue: ({ A }) => new Date(A),
105105
},
106106
'B',
107107
'C',

packages/devextreme/js/__internal/grids/new/card_view/content_view/content/card/caption.test.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
describe, expect, it,
33
} from '@jest/globals';
4-
import type { Cell } from '@ts/grids/new/grid_core/columns_controller/types';
4+
import type { FieldInfo } from '@ts/grids/new/grid_core/columns_controller/types';
55
import { render } from 'inferno';
66

77
import { Caption } from './caption';
@@ -11,21 +11,21 @@ describe('Content View', () => {
1111
it('should render title', () => {
1212
const container = document.createElement('div');
1313

14-
const cell = { column: { caption: 'TEST_TITLE' } } as unknown as Cell;
14+
const field = { column: { caption: 'TEST_TITLE' } } as unknown as FieldInfo;
1515

16-
render(<Caption cell={cell} />, container);
16+
render(<Caption field={field} />, container);
1717

1818
expect(container).toMatchSnapshot();
1919
});
2020

2121
it('should render template with title', () => {
2222
const container = document.createElement('div');
2323

24-
const cell = { column: { caption: 'TEST_TITLE' } } as unknown as Cell;
24+
const field = { column: { caption: 'TEST_TITLE' } } as unknown as FieldInfo;
2525

26-
render(<Caption cell={cell}
26+
render(<Caption field={field}
2727
// eslint-disable-next-line @typescript-eslint/no-shadow
28-
template={({ cell }) => (<div test-template="true">{cell.column.caption}</div>)}
28+
template={({ field }) => (<div test-template="true">{field.column.caption}</div>)}
2929
/>, container);
3030

3131
expect(container).toMatchSnapshot();

packages/devextreme/js/__internal/grids/new/card_view/content_view/content/card/caption.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import type { Cell } from '@ts/grids/new/grid_core/columns_controller/types';
1+
import type { FieldInfo } from '@ts/grids/new/grid_core/columns_controller/types';
22
import type { ComponentType } from 'inferno';
33

44
export interface CaptionProps {
5-
cell: Cell;
6-
template?: ComponentType<{ cell: Cell }>;
5+
field: FieldInfo;
6+
template?: ComponentType<{ field: FieldInfo }>;
77
}
88

99
export const Caption = (props: CaptionProps): JSX.Element => {
@@ -12,9 +12,9 @@ export const Caption = (props: CaptionProps): JSX.Element => {
1212
return (
1313
<div className="dx-cardview-field-caption">
1414
{Template ? (
15-
<Template cell={props.cell} />
15+
<Template field={props.field} />
1616
)
17-
: <>{props.cell.column.caption}:</>
17+
: <>{props.field.column.caption}:</>
1818
}
1919
</div>
2020
);

packages/devextreme/js/__internal/grids/new/card_view/content_view/content/card/card.events.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ const mockOnClick = createMockCallback();
2020
const mockOnHold = createMockCallback();
2121

2222
const props = {
23-
row: {
24-
cells: [
23+
card: {
24+
fields: [
2525
{
2626
column: {
2727
dataField: 'Name',

packages/devextreme/js/__internal/grids/new/card_view/content_view/content/card/card.test.tsx

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { render } from 'inferno';
55
import { Card } from './card';
66

77
const props = {
8-
row: {
9-
cells: [
8+
card: {
9+
fields: [
1010
{
1111
column: {
1212
dataField: 'Name',
@@ -24,32 +24,34 @@ const props = {
2424
alt: 'Card Cover',
2525
},
2626
},
27-
toolbar: [
28-
{
29-
location: 'before',
30-
widget: 'dxCheckBox',
31-
},
32-
{
33-
location: 'before',
34-
text: 'Card Header',
35-
},
36-
{
37-
location: 'after',
38-
widget: 'dxButton',
39-
options: {
40-
icon: 'edit',
41-
stylingMode: 'text',
27+
header: {
28+
items: [
29+
{
30+
location: 'before',
31+
widget: 'dxCheckBox',
4232
},
43-
},
44-
{
45-
location: 'after',
46-
widget: 'dxButton',
47-
options: {
48-
icon: 'trash',
49-
stylingMode: 'text',
33+
{
34+
location: 'before',
35+
text: 'Card Header',
5036
},
51-
},
52-
],
37+
{
38+
location: 'after',
39+
widget: 'dxButton',
40+
options: {
41+
icon: 'edit',
42+
stylingMode: 'text',
43+
},
44+
},
45+
{
46+
location: 'after',
47+
widget: 'dxButton',
48+
options: {
49+
icon: 'trash',
50+
stylingMode: 'text',
51+
},
52+
},
53+
],
54+
},
5355
cover: {
5456
imageExpr: compileGetter('img'),
5557
altExpr: compileGetter('alt'),

0 commit comments

Comments
 (0)