|
14 | 14 | const hows = $derived(data.hows); |
15 | 15 | const assignments = $derived(data.assignments); |
16 | 16 | const profiles = $derived(data.profiles); |
| 17 | + const changes = $derived(data.changes); |
17 | 18 |
|
18 | 19 | function howToString(how: HowRow, depth = 0): string { |
19 | 20 | return `\n${'\t'.repeat(depth)}${depth > 0 ? '•' : ''} ${how.what}${how.how.map((id) => { |
|
24 | 25 | } |
25 | 26 |
|
26 | 27 | async function exportOrg() { |
27 | | - const headers = [ |
| 28 | + const processHeaders = [ |
28 | 29 | { |
29 | 30 | value: 'Process', |
30 | 31 | fontWeight: 'bold' as const |
|
71 | 72 | ]; |
72 | 73 | }); |
73 | 74 |
|
74 | | - const data: SheetData = [headers, ...processRows]; |
75 | | - await writeXlsxFile(data, { |
| 75 | + const processData: SheetData = [processHeaders, ...processRows]; |
| 76 | +
|
| 77 | + const changeHeaders = [ |
| 78 | + { |
| 79 | + value: 'What', |
| 80 | + fontWeight: 'bold' as const |
| 81 | + }, |
| 82 | + { |
| 83 | + value: 'Status', |
| 84 | + fontWeight: 'bold' as const |
| 85 | + }, |
| 86 | + { |
| 87 | + value: 'Visiblity', |
| 88 | + fontWeight: 'bold' as const |
| 89 | + }, |
| 90 | + { |
| 91 | + value: 'Description', |
| 92 | + fontWeight: 'bold' as const |
| 93 | + }, |
| 94 | + { |
| 95 | + value: 'Proposal', |
| 96 | + fontWeight: 'bold' as const |
| 97 | + }, |
| 98 | + { |
| 99 | + value: 'Lead', |
| 100 | + fontWeight: 'bold' as const |
| 101 | + } |
| 102 | + ]; |
| 103 | +
|
| 104 | + const changesRows = changes.map((change) => { |
| 105 | + return [ |
| 106 | + { value: change.what, wrap: true, alignVertical: 'top' as const }, |
| 107 | + { value: change.status, wrap: true, alignVertical: 'top' as const }, |
| 108 | + { value: change.visibility, wrap: true, alignVertical: 'top' as const }, |
| 109 | + { value: change.description, wrap: true, alignVertical: 'top' as const }, |
| 110 | + { value: change.proposal, wrap: true, alignVertical: 'top' as const }, |
| 111 | + { |
| 112 | + value: profiles.find((profile) => profile.id === change.lead)?.name || '—', |
| 113 | + wrap: true, |
| 114 | + alignVertical: 'top' as const |
| 115 | + } |
| 116 | + ]; |
| 117 | + }); |
| 118 | +
|
| 119 | + const changeData: SheetData = [changeHeaders, ...changesRows]; |
| 120 | +
|
| 121 | + await writeXlsxFile([processData, changeData], { |
76 | 122 | columns: [ |
77 | | - { width: 30 }, |
78 | | - { width: 60 }, |
79 | | - ...roles.map(() => { |
80 | | - return { width: 3 }; |
81 | | - }) |
| 123 | + [ |
| 124 | + { width: 30 }, |
| 125 | + { width: 60 }, |
| 126 | + ...roles.map(() => { |
| 127 | + return { width: 3 }; |
| 128 | + }) |
| 129 | + ], |
| 130 | + [{ width: 30 }, { width: 60 }, { width: 60 }, { width: 20 }] |
82 | 131 | ], |
| 132 | + sheets: ['processes', 'changes'], |
83 | 133 | fileName: 'export.xlsx' |
84 | 134 | }); |
85 | 135 | } |
|
0 commit comments