docs: add JSDoc to CellStyle.baseStyleNames (#222)
parent
e48f3fa052
commit
e5a28b3f30
|
@ -38,7 +38,23 @@ export type Properties = {
|
|||
[k: string]: any;
|
||||
};
|
||||
|
||||
export type CellStyle = CellStateStyle & { baseStyleNames?: string[] };
|
||||
export type CellStyle = CellStateStyle & {
|
||||
/**
|
||||
* Names of styles used to fill properties before applying the specific properties defined in {@link CellStateStyle}.
|
||||
*
|
||||
* Here's the initial algorithm for populating properties:
|
||||
* - Take the style name in order from the table
|
||||
* - Retrieve the style associated with the style registered in {@link StyleSheet}.
|
||||
* Ignore unknown styles
|
||||
* - Merge the current style with the style retrieved from `StyleSheet`.
|
||||
*
|
||||
* Once the initial population of properties is complete, merge the style with the properties defined {@link CellStateStyle}.
|
||||
*
|
||||
**NOTE**: the order of styles in the array is important: if the same property is defined in several styles,
|
||||
* the value actually used is that defined in the last style declared in the array.
|
||||
*/
|
||||
baseStyleNames?: string[];
|
||||
};
|
||||
|
||||
export type CellStateStyle = {
|
||||
/**
|
||||
|
|
|
@ -184,10 +184,10 @@ export class Stylesheet {
|
|||
// creates style with the given baseStyleNames. (merges from left to right)
|
||||
style = cellStyle.baseStyleNames.reduce(
|
||||
(acc, styleName) => {
|
||||
return (acc = {
|
||||
return {
|
||||
...acc,
|
||||
...this.styles.get(styleName),
|
||||
});
|
||||
};
|
||||
},
|
||||
{ ...defaultStyle }
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue