@sheetxl/models
Version:
Models - A Headless javascript spreadsheet library.
254 lines • 6.28 kB
TypeScript
import { Rectangle, Bounds } from "@sheetxl/common";
import { SerializableProperties } from "../primitives";
import { AdjustedColor } from "../color";
/**
* Types of fill styles used for painting surfaces.
*/
export declare enum FillType {
/**
* No fill
*/
None = "none",
/**
* A solid color
*/
Solid = "solid",
/**
* A gradient
*/
Gradient = "gradient",
/**
* A pattern
*/
Pattern = "pattern",
/**
* An Image
* @remarks
* Not support in cells. This is currently only support in drawML (charts, shapes, powerpoint)
*/
Image = "pattern",
/**
* An Image
* @remarks
* Not support in cells. This is currently only support in drawML (charts, shapes, powerpoint)
*/
Background = "background",
/**
* Inherit the fill from the group
* @remarks
* This has no effect if not in a group
* Not support in cells. This is currently only support in drawML (charts, shapes, powerpoint)
*/
Group = "group",
/**
* For allowing custom types
* @remarks
* Placeholder and not yet implemented. This will have a function callback
*/
Custom = "custom"
}
export interface FillValues {
/**
* If null then the fill type will inherit.
*/
fillType: FillType;
}
export interface SolidFillValues extends FillValues {
/**
* The solid color
*/
color: AdjustedColor;
fillType: FillType.Solid;
}
export declare enum TileMirror {
None = "none",
Vertical = "v",
horizontal = "h",
Both = "b"
}
/**
* Is this applied to all fills or just gradient and texture? Review OOXML
*/
export declare class FillTile {
align?: string;
mirror?: TileMirror;
bounds?: Rectangle;
}
export interface GradientStop {
/**
* If not specified then the offsets will be equally weighted based off of the number of stops.
*/
offset?: number;
/**
* The color of the stop
*/
color: AdjustedColor;
}
export declare enum GradientType {
Linear = "linear",
Path = "path",// Not support by our rendering (we could fake since cells are always rectangular) https://stackoverflow.com/questions/47166364/svg-rectangular-and-path-gradient)
Circular = "circular",// Note support by Excel
Rect = "rect"
}
export interface GradientFillValues extends FillValues {
/**
* If null then the fill type will inherit.
* This must be at least two stops
*/
stops: GradientStop[];
/**
* The type of gradient
* @defaultValue GradientType.Linear
*/
gradientType: GradientType;
/**
* The angle of the gradient in degrees if gradient type is linear
*/
angle: number;
fillType: FillType.Gradient;
/**
* Used for path and circular gradients
*/
fillTo: Rectangle;
}
/**
* List of Excel patterns. Rationalize with full drawML list
*/
export declare enum SheetPatternType {
/**
* 'None' style
*
* @remarks
* Acts like a none fill
*/
None = "none",
/**
* 'None' style
*
* @remarks
* Acts like a solid fill
*/
Solid = "solid",
/**
* 'Dark Gary' style
*/
DarkGray = "darkGray",
/**
* 'Medium Gray' style
*/
MediumGray = "mediumGray",
/**
* 'Light Gray' style
*/
LightGray = "lightGray",
/**
* 'Gray 0.0625' style
*/
Gray0625 = "gray0625",
/**
* 'Gray 0.125' style
*/
Gray125 = "gray125",
/**
* 'Dark Horizontal' style
*/
DarkHorizontal = "darkHorizontal",
/**
* 'Dark Vertical' style
*/
DarkVertical = "darkVertical",
/**
* 'Dark Down' style
*/
DarkDown = "darkDown",
/**
* 'Dark Up' style
*/
DarkUp = "darkUp",
/**
* 'Dark Grid' style
*/
DarkGrid = "darkGrid",
/**
* 'Dark Trellis' style
*/
DarkTrellis = "darkTrellis",
/**
* 'Light Horizontal' style
*/
LightHorizontal = "lightHorizontal",
/**
* 'Light Vertical' style
*/
LightVertical = "lightVertical",
/**
* 'Light Down' style
*/
LightDown = "lightDown",
/**
* 'Light Up' style
*/
LightUp = "lightUp",
/**
* 'Light Grid' style
*/
LightGrid = "lightGrid",
/**
* 'Light Trellis' style
*/
LightTrellis = "lightTrellis",
/**
* 'Custom' style
* @remarks
* Then a pattern must be provided
* Not yet implemented
*/
Custom = "custom"
}
export interface PatternFillValues extends FillValues {
/**
* The foreground color for the pattern
*/
foreground: AdjustedColor;
background: AdjustedColor;
patternType: SheetPatternType;
fillType: FillType.Pattern;
}
export interface NoneFillValues extends FillValues {
fillType: FillType.None;
}
export interface GroupFillValues extends FillValues {
fillType: FillType.Group;
}
export interface BackgroundFillValues extends FillValues {
fillType: FillType.Background;
}
export interface IFill extends Readonly<FillValues> {
/**
* Return the fill as a set of css string that are suitable for css.
* @remarks
*
* Not all fill styles will offer an exact css equivalent.
* Additionally due to the nature of css having different properties for the same logic value
* (for example color, backgroundColor)
*/
asCSS(darkMode?: boolean, bounds?: Bounds): React.CSSProperties;
toJSON(): SerializableProperties<FillValues>;
}
export interface INoneFill extends Readonly<NoneFillValues>, IFill {
fillType: FillType.None;
toJSON(): SerializableProperties<NoneFillValues>;
}
export interface ISolidFill extends Readonly<SolidFillValues>, IFill {
fillType: FillType.Solid;
toJSON(): SerializableProperties<SolidFillValues>;
}
export interface IGradientFill extends Readonly<GradientFillValues>, IFill {
fillType: FillType.Gradient;
toJSON(): SerializableProperties<GradientFillValues>;
}
export interface IPatternFill extends Readonly<PatternFillValues>, IFill {
fillType: FillType.Pattern;
toJSON(): SerializableProperties<PatternFillValues>;
}
//# sourceMappingURL=IFill.d.ts.map