Skip to content

Commit 04e4b9c

Browse files
authored
Scheduler: simplify pivot grid export demos (#30523)
Co-authored-by: Vladimir Bushmanov <[email protected]>
1 parent ae23da4 commit 04e4b9c

File tree

5 files changed

+11
-18
lines changed

5 files changed

+11
-18
lines changed

apps/demos/Demos/PivotGrid/ExcelJSCellCustomization/Angular/app/app.component.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ if (!/localhost/.test(document.location.host)) {
1313
enableProdMode();
1414
}
1515

16-
type CellData = DxPivotGridTypes.CellPreparedEvent['cell'] & { area?: string };
16+
type CellData = DxPivotGridTypes.CellPreparedEvent['cell'];
1717

1818
let modulePrefix = '';
1919
// @ts-ignore
@@ -87,17 +87,15 @@ export class AppComponent {
8787
});
8888
}
8989

90-
onCellPrepared({ cell, area, cellElement }: DxPivotGridTypes.CellPreparedEvent) {
91-
const cellData = { ...cell, area };
92-
93-
if (this.isDataCell(cellData) || this.isTotalCell(cellData)) {
94-
const appearance = this.getConditionalAppearance(cellData);
90+
onCellPrepared({ cell, cellElement }: DxPivotGridTypes.CellPreparedEvent) {
91+
if (this.isDataCell(cell) || this.isTotalCell(cell)) {
92+
const appearance = this.getConditionalAppearance(cell);
9593
Object.assign(cellElement.style, this.getCssStyles(appearance));
9694
}
9795
}
9896

9997
isDataCell(cell: CellData) {
100-
return (cell.area === 'data' && cell.rowType === 'D' && cell.columnType === 'D');
98+
return cell.rowType === 'D' && cell.columnType === 'D';
10199
}
102100

103101
isTotalCell(cell: CellData) {

apps/demos/Demos/PivotGrid/ExcelJSCellCustomization/React/App.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const dataSource = new PivotGridDataSource({
4545
store: sales,
4646
});
4747

48-
const isDataCell = (cell) => (cell.area === 'data' && cell.rowType === 'D' && cell.columnType === 'D');
48+
const isDataCell = (cell) => cell.rowType === 'D' && cell.columnType === 'D';
4949

5050
const isTotalCell = (cell) => (cell.type === 'T' || cell.type === 'GT' || cell.rowType === 'T' || cell.rowType === 'GT' || cell.columnType === 'T' || cell.columnType === 'GT');
5151

@@ -104,9 +104,7 @@ const onExporting = (e: PivotGridTypes.ExportingEvent) => {
104104
});
105105
};
106106

107-
const onCellPrepared = ({ cell, area, cellElement }: any) => {
108-
cell.area = area;
109-
107+
const onCellPrepared = ({ cell, cellElement }: any) => {
110108
if (isDataCell(cell) || isTotalCell(cell)) {
111109
const appearance = getConditionalAppearance(cell);
112110
Object.assign(cellElement.style, getCssStyles(appearance));

apps/demos/Demos/PivotGrid/ExcelJSCellCustomization/ReactJs/App.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ const dataSource = new PivotGridDataSource({
3838
],
3939
store: sales,
4040
});
41-
const isDataCell = (cell) =>
42-
cell.area === 'data' && cell.rowType === 'D' && cell.columnType === 'D';
41+
const isDataCell = (cell) => cell.rowType === 'D' && cell.columnType === 'D';
4342
const isTotalCell = (cell) =>
4443
cell.type === 'T'
4544
|| cell.type === 'GT'
@@ -94,8 +93,7 @@ const onExporting = (e) => {
9493
});
9594
});
9695
};
97-
const onCellPrepared = ({ cell, area, cellElement }) => {
98-
cell.area = area;
96+
const onCellPrepared = ({ cell, cellElement }) => {
9997
if (isDataCell(cell) || isTotalCell(cell)) {
10098
const appearance = getConditionalAppearance(cell);
10199
Object.assign(cellElement.style, getCssStyles(appearance));

apps/demos/Demos/PivotGrid/ExcelJSCellCustomization/Vue/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ function onExporting(e: DxPivotGridTypes.ExportingEvent) {
8989
});
9090
});
9191
}
92-
function onCellPrepared({ cell, area, cellElement }: DxPivotGridTypes.CellPreparedEvent) {
92+
function onCellPrepared({ cell, cellElement }: DxPivotGridTypes.CellPreparedEvent) {
9393
if (isDataCell(cell) || isTotalCell(cell)) {
9494
const appearance = getConditionalAppearance(cell);
9595
Object.assign(cellElement.style, getCssStyles(appearance));

apps/demos/Demos/PivotGrid/ExcelJSCellCustomization/jQuery/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ $(() => {
3939
},
4040
onCellPrepared(e) {
4141
const { cell } = e;
42-
cell.area = e.area;
4342

4443
if (isDataCell(cell) || isTotalCell(cell)) {
4544
const appearance = getConditionalAppearance(cell);
@@ -79,7 +78,7 @@ $(() => {
7978
});
8079

8180
function isDataCell(cell) {
82-
return (cell.area === 'data' && cell.rowType === 'D' && cell.columnType === 'D');
81+
return cell.rowType === 'D' && cell.columnType === 'D';
8382
}
8483

8584
function isTotalCell(cell) {

0 commit comments

Comments
 (0)