MCPcopy
hub / github.com/exceljs/exceljs / Range

Class Range

lib/doc/range.js:4–255  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2
3// used by worksheet to calculate sheet dimensions
4class Range {
5 constructor() {
6 this.decode(arguments);
7 }
8
9 setTLBR(t, l, b, r, s) {
10 if (arguments.length < 4) {
11 // setTLBR(tl, br, s)
12 const tl = colCache.decodeAddress(t);
13 const br = colCache.decodeAddress(l);
14 this.model = {
15 top: Math.min(tl.row, br.row),
16 left: Math.min(tl.col, br.col),
17 bottom: Math.max(tl.row, br.row),
18 right: Math.max(tl.col, br.col),
19 sheetName: b,
20 };
21
22 this.setTLBR(tl.row, tl.col, br.row, br.col, s);
23 } else {
24 // setTLBR(t, l, b, r, s)
25 this.model = {
26 top: Math.min(t, b),
27 left: Math.min(l, r),
28 bottom: Math.max(t, b),
29 right: Math.max(l, r),
30 sheetName: s,
31 };
32 }
33 }
34
35 decode(argv) {
36 switch (argv.length) {
37 case 5: // [t,l,b,r,s]
38 this.setTLBR(argv[0], argv[1], argv[2], argv[3], argv[4]);
39 break;
40 case 4: // [t,l,b,r]
41 this.setTLBR(argv[0], argv[1], argv[2], argv[3]);
42 break;
43
44 case 3: // [tl,br,s]
45 this.setTLBR(argv[0], argv[1], argv[2]);
46 break;
47 case 2: // [tl,br]
48 this.setTLBR(argv[0], argv[1]);
49 break;
50
51 case 1: {
52 const value = argv[0];
53 if (value instanceof Range) {
54 // copy constructor
55 this.model = {
56 top: value.model.top,
57 left: value.model.left,
58 bottom: value.model.bottom,
59 right: value.model.right,
60 sheetName: value.sheetName,
61 };

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…