Skip to content

Commit 9af6d56

Browse files
committed
chore: improve interfaces, types and add comments for intellisense
1 parent bc05afa commit 9af6d56

File tree

2 files changed

+195
-22
lines changed

2 files changed

+195
-22
lines changed

packages/excel-builder-vanilla-types/dist/index.d.ts

Lines changed: 99 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -158,133 +158,222 @@ export type ExcelColorStyle = string | {
158158
theme: number;
159159
};
160160
export interface ExcelAlignmentStyle {
161+
/** Horizontal alignment of cell content */
161162
horizontal?: "center" | "fill" | "general" | "justify" | "left" | "right";
163+
/** Justify last line (for justified alignment) */
162164
justifyLastLine?: boolean;
163-
readingOrder?: string;
164-
relativeIndent?: boolean;
165+
/** Reading order (1 = LTR, 2 = RTL) */
166+
readingOrder?: 1 | 2;
167+
/** Indent cell content (number of spaces) */
168+
indent?: number;
169+
/** Shrink text to fit cell */
165170
shrinkToFit?: boolean;
171+
/** Text rotation angle or preset */
166172
textRotation?: string | number;
173+
/** Vertical alignment of cell content */
167174
vertical?: "bottom" | "distributed" | "center" | "justify" | "top";
175+
/** Wrap text within cell */
168176
wrapText?: boolean;
169177
}
170-
export type ExcelBorderLineStyle = "continuous" | "dash" | "dashDot" | "dashDotDot" | "dotted" | "double" | "lineStyleNone" | "medium" | "slantDashDot" | "thin" | "thick";
178+
export type ExcelBorderLineStyle = "continuous" | "dash" | "dashDot" | "dashDotDot" | "dotted" | "double" | "none" | "medium" | "slantDashDot" | "thin" | "thick";
171179
export interface ExcelBorderStyle {
180+
/** Bottom border configuration */
172181
bottom?: {
173182
color?: ExcelColorStyle;
174183
style?: ExcelBorderLineStyle;
175184
};
185+
/** Top border configuration */
176186
top?: {
177187
color?: ExcelColorStyle;
178188
style?: ExcelBorderLineStyle;
179189
};
190+
/** Left border configuration */
180191
left?: {
181192
color?: ExcelColorStyle;
182193
style?: ExcelBorderLineStyle;
183194
};
195+
/** Right border configuration */
184196
right?: {
185197
color?: ExcelColorStyle;
186198
style?: ExcelBorderLineStyle;
187199
};
188-
diagonal?: any;
200+
/** Diagonal border configuration */
201+
diagonal?: {
202+
color?: ExcelColorStyle;
203+
style?: ExcelBorderLineStyle;
204+
};
205+
/** Outline border (all sides) */
189206
outline?: boolean;
207+
/** Diagonal up border */
190208
diagonalUp?: boolean;
209+
/** Diagonal down border */
191210
diagonalDown?: boolean;
192211
}
193212
export interface ExcelColumn {
213+
/** Auto-fit column width to content */
194214
bestFit?: boolean;
215+
/** Collapse grouped columns */
195216
collapsed?: boolean;
217+
/** Custom column width */
196218
customWidth?: number;
219+
/** Hide column from view */
197220
hidden?: boolean;
221+
/** Maximum column index for this config */
198222
max?: number;
223+
/** Minimum column index for this config */
199224
min?: number;
225+
/** Outline level for grouping */
200226
outlineLevel?: number;
227+
/** Enable phonetic guide (East Asian languages) */
201228
phonetic?: boolean;
229+
/** Style ID for column */
202230
style?: number;
231+
/** Column width in Excel units */
203232
width?: number;
204233
}
205234
export interface ExcelTableColumn {
235+
/** Column display name */
206236
name: string;
207-
dataCellStyle?: any;
237+
/** Style for data cells in this column */
238+
dataCellStyle?: ExcelStyleInstruction;
239+
/** Differential style ID for data cells */
208240
dataDxfId?: number;
241+
/** Style for header row cell */
209242
headerRowCellStyle?: ExcelStyleInstruction;
243+
/** Differential style ID for header row */
210244
headerRowDxfId?: number;
245+
/** Style for totals row cell */
211246
totalsRowCellStyle?: ExcelStyleInstruction;
247+
/** Differential style ID for totals row */
212248
totalsRowDxfId?: number;
213-
totalsRowFunction?: any;
249+
/** Function for totals row (e.g. SUM, COUNT) */
250+
totalsRowFunction?: string;
251+
/** Label for totals row cell */
214252
totalsRowLabel?: string;
253+
/** Formula for column values */
215254
columnFormula?: string;
255+
/** Is column formula an array formula? */
216256
columnFormulaIsArrayType?: boolean;
257+
/** Formula for totals row */
217258
totalFormula?: string;
259+
/** Is totals formula an array formula? */
218260
totalFormulaIsArrayType?: boolean;
219261
}
220262
export interface ExcelFillStyle {
263+
/** Fill type: gradient or pattern */
221264
type?: "gradient" | "pattern";
265+
/** Pattern type (if pattern fill) */
222266
patternType?: string;
267+
/** Gradient angle (if gradient fill) */
223268
degree?: number;
269+
/** Foreground color for fill */
224270
fgColor?: ExcelColorStyle;
271+
/** Gradient start color */
225272
start?: ExcelColorStyle;
273+
/** Gradient end color and position */
226274
end?: {
227275
pureAt?: number;
228276
color?: ExcelColorStyle;
229277
};
230278
}
231279
export interface ExcelFontStyle {
280+
/** Bold text */
232281
bold?: boolean;
282+
/** Font color */
233283
color?: ExcelColorStyle;
284+
/** Font family name */
234285
fontName?: string;
286+
/** Italic text */
235287
italic?: boolean;
288+
/** Outline font effect */
236289
outline?: boolean;
290+
/** Font size in points */
237291
size?: number;
292+
/** Shadow effect */
238293
shadow?: boolean;
294+
/** Strikethrough text */
239295
strike?: boolean;
296+
/** Subscript text */
240297
subscript?: boolean;
298+
/** Superscript text */
241299
superscript?: boolean;
300+
/** Underline style */
242301
underline?: boolean | "single" | "double" | "singleAccounting" | "doubleAccounting";
243302
}
244303
export interface ExcelMetadata {
304+
/** Type of metadata (custom usage) */
245305
type?: string;
306+
/** Style ID for metadata */
246307
style?: number;
247308
}
248309
export interface ExcelColumnMetadata {
249-
value: any;
310+
/** Cell value */
311+
value: string | number | boolean | Date | null;
312+
/** Optional metadata for the value */
250313
metadata?: ExcelMetadata;
251314
}
252315
export interface ExcelMargin {
316+
/** Top margin in inches */
253317
top: number;
318+
/** Bottom margin in inches */
254319
bottom: number;
320+
/** Left margin in inches */
255321
left: number;
322+
/** Right margin in inches */
256323
right: number;
324+
/** Header margin in inches */
257325
header: number;
326+
/** Footer margin in inches */
258327
footer: number;
259328
}
260329
export interface ExcelSortState {
330+
/** Is sort case sensitive? */
261331
caseSensitive?: boolean;
262-
dataRange?: any;
332+
/** Data range to sort */
333+
dataRange?: string;
334+
/** Sort by column (true) or row (false) */
263335
columnSort?: boolean;
336+
/** Sort direction: ascending or descending */
264337
sortDirection?: "ascending" | "descending";
265-
sortRange?: any;
338+
/** Range to sort (defaults to dataRange) */
339+
sortRange?: string;
266340
}
267341
/** Excel custom formatting that will be applied to a column */
268342
export interface ExcelStyleInstruction {
343+
/** Unique style instruction ID (internal use) */
269344
id?: number;
345+
/** Cell alignment style (horizontal, vertical, wrap, etc.) */
270346
alignment?: ExcelAlignmentStyle;
347+
/** Cell border style or border style ID */
271348
border?: ExcelBorderStyle | number;
349+
/** Border style ID (if referencing a shared style) */
272350
borderId?: number;
351+
/** Cell fill style (pattern, gradient, color) or fill style ID */
273352
fill?: ExcelFillStyle | number;
353+
/** Fill style ID (if referencing a shared style) */
274354
fillId?: number;
355+
/** Cell font style (bold, italic, color, etc.) or font style ID */
275356
font?: ExcelFontStyle | number;
357+
/** Font style ID (if referencing a shared style) */
276358
fontId?: number;
359+
/** Custom cell format string or format ID (e.g., date, currency) */
277360
format?: string | number;
361+
/** Row height in points (if set at row level) */
278362
height?: number;
363+
/** Number format string (Excel format codes) */
279364
numFmt?: string;
365+
/** Number format ID (if referencing a shared format) */
280366
numFmtId?: number;
367+
/** Column width in Excel units (if set at column level) */
281368
width?: number;
369+
/** Extended format ID (Open XML xfId, for advanced style referencing) */
282370
xfId?: number;
371+
/** Cell protection settings (locked, hidden) */
283372
protection?: {
284373
locked?: boolean;
285374
hidden?: boolean;
286375
};
287-
/** style id */
376+
/** Style ID (if referencing a shared style) */
288377
style?: number;
289378
}
290379
export type ChartType = "column" | "bar" | "line" | "pie" | "doughnut" | "scatter";

0 commit comments

Comments
 (0)