Skip to content

Commit 4cdef7a

Browse files
committed
chore(tables): prettier code formatting
1 parent 22b2b26 commit 4cdef7a

File tree

4 files changed

+34
-46
lines changed

4 files changed

+34
-46
lines changed

src/helper/modify-table-helper.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@ export default class ModifyTableHelper {
1111
): void => {
1212
const modTable = new ModifyTable(element, data);
1313

14-
modTable
15-
.modify()
16-
.adjustHeight();
17-
14+
modTable.modify().adjustHeight();
15+
1816
// console.log(data);
1917
// XmlHelper.dump(element);
2018
};

src/modify/modify-table.ts

Lines changed: 31 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import { XmlHelper } from '../helper/xml-helper';
32
import ModifyXmlHelper from '../helper/modify-xml-helper';
43
import { TableData, TableRow } from '../types/table-types';
@@ -9,68 +8,59 @@ export class ModifyTable {
98
table: ModifyXmlHelper;
109
xml: XMLDocument | Element;
1110

12-
constructor(
13-
table: XMLDocument | Element,
14-
data: TableData,
15-
) {
11+
constructor(table: XMLDocument | Element, data: TableData) {
1612
this.data = data;
1713

1814
this.table = new ModifyXmlHelper(table);
1915
this.xml = table;
2016
}
2117

2218
modify(): ModifyTable {
23-
this.setContents()
24-
this.sliceRows()
19+
this.setContents();
20+
this.sliceRows();
2521

26-
return this
22+
return this;
2723
}
2824

2925
setContents() {
3026
this.data.body.forEach((row: TableRow, r: number) => {
3127
row.values.forEach((cell: number | string, c: number) => {
32-
this.table.modify(
33-
this.row(r,
34-
this.column(c,
35-
this.cell(cell)
36-
)
37-
)
38-
)
39-
})
40-
})
28+
this.table.modify(this.row(r, this.column(c, this.cell(cell))));
29+
});
30+
});
4131
}
4232

4333
sliceRows() {
4434
this.table.modify({
45-
'a:tbl': this.slice('a:tr', this.data.body.length)
46-
})
35+
'a:tbl': this.slice('a:tr', this.data.body.length),
36+
});
4737
}
4838

4939
row = (index: number, children: ModificationTags): ModificationTags => {
5040
return {
5141
'a:tr': {
5242
index: index,
53-
children: children
54-
}
55-
}
56-
}
43+
children: children,
44+
},
45+
};
46+
};
5747

5848
column = (index: number, children: ModificationTags): ModificationTags => {
5949
return {
6050
'a:tc': {
6151
index: index,
62-
children: children
63-
}
64-
}
65-
}
52+
children: children,
53+
},
54+
};
55+
};
6656

6757
cell = (value: number | string): ModificationTags => {
6858
return {
6959
'a:t': {
7060
modify: ModifyXmlHelper.text(value),
71-
}
72-
}
73-
}
61+
},
62+
};
63+
};
7464

7565
slice(tag: string, length: number): Modification {
7666
return {
@@ -83,22 +73,24 @@ export class ModifyTable {
8373
},
8474
};
8575
}
86-
76+
8777
adjustHeight() {
88-
const tableHeight = Number(this.xml
89-
.getElementsByTagName('p:xfrm')[0]
90-
.getElementsByTagName('a:ext')[0]
91-
.getAttribute('cy'))
78+
const tableHeight = Number(
79+
this.xml
80+
.getElementsByTagName('p:xfrm')[0]
81+
.getElementsByTagName('a:ext')[0]
82+
.getAttribute('cy'),
83+
);
9284

93-
const rowHeight = tableHeight / this.data.body.length
85+
const rowHeight = tableHeight / this.data.body.length;
9486

9587
this.data.body.forEach((row: TableRow, r: number) => {
9688
this.table.modify({
9789
'a:tr': {
9890
index: r,
9991
modify: ModifyXmlHelper.attribute('h', Math.round(rowHeight)),
100-
}
101-
})
102-
})
92+
},
93+
});
94+
});
10395
}
10496
}

src/types/table-types.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
2-
31
export type TableRow = {
42
label?: string;
53
values: (string | number)[];

src/types/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export type ImportElement = {
4343
slideNumber: number;
4444
selector: string;
4545
mode: string;
46-
callback?: ShapeModificationCallback | ShapeModificationCallback[]
46+
callback?: ShapeModificationCallback | ShapeModificationCallback[];
4747
};
4848
export type ImportedElement = {
4949
mode: string;

0 commit comments

Comments
 (0)