Skip to content

Commit bd05e4d

Browse files
committed
grid.column.AnimatedChange: cellRenderer() => toggle animation class #6536
1 parent 8db076d commit bd05e4d

2 files changed

Lines changed: 34 additions & 6 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@keyframes grid-animated-cell-1 {
2+
50% {background-color:var(--button-ripple-background-color);}
3+
}
4+
5+
@keyframes grid-animated-cell-2 {
6+
50% {background-color:var(--button-ripple-background-color);}
7+
}
8+
9+
.neo-grid-container {
10+
.neo-grid-row, .neo-grid-row.neo-even {
11+
.neo-grid-cell {
12+
&.neo-animated-1 {
13+
animation-name : grid-animated-cell-1;
14+
animation-duration : .4s;
15+
animation-timing-function: ease-in-out;
16+
}
17+
18+
&.neo-animated-2 {
19+
animation-name : grid-animated-cell-2;
20+
animation-duration : .4s;
21+
animation-timing-function: ease-in-out;
22+
}
23+
}
24+
}
25+
}

src/grid/column/AnimatedChange.mjs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import Column from './Base.mjs';
1+
import Column from './Base.mjs';
2+
import VdomUtil from '../../util/VDom.mjs'
23

34
/**
45
* @class Neo.grid.column.AnimatedChange
@@ -30,11 +31,13 @@ class AnimatedChange extends Column {
3031
* @param {Number|String} data.value
3132
* @returns {*}
3233
*/
33-
cellRenderer({value}) {
34-
return {
35-
cls : ['neo-animated-change', 'neo-grid-cell'],
36-
html: value
37-
}
34+
cellRenderer({dataField, gridContainer, record, value}) {
35+
let {view} = gridContainer,
36+
cellId = view.getCellId(record, dataField),
37+
node = VdomUtil.find(view.vdom, cellId)?.vdom,
38+
cls = !node ? [] : node.cls.includes('neo-animated-1') ? ['neo-animated-2'] : ['neo-animated-1'];
39+
40+
return {cls, html: value}
3841
}
3942
}
4043

0 commit comments

Comments
 (0)