mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-11-20 20:54:27 +01:00
7167 : fix classDef style application for treemap diagramtype
on-behalf-of: @Mermaid-Chart <hello@mermaidchart.com>
This commit is contained in:
@@ -21,7 +21,7 @@ const populate = (ast: TreemapAst, db: TreemapDB) => {
|
|||||||
type: string;
|
type: string;
|
||||||
value?: number;
|
value?: number;
|
||||||
classSelector?: string;
|
classSelector?: string;
|
||||||
cssCompiledStyles?: string;
|
cssCompiledStyles?: string[];
|
||||||
}[] = [];
|
}[] = [];
|
||||||
|
|
||||||
// Extract classes and styles from the treemap
|
// Extract classes and styles from the treemap
|
||||||
@@ -44,7 +44,7 @@ const populate = (ast: TreemapAst, db: TreemapDB) => {
|
|||||||
|
|
||||||
// Get styles as a string if they exist
|
// Get styles as a string if they exist
|
||||||
const styles = item.classSelector ? db.getStylesForClass(item.classSelector) : [];
|
const styles = item.classSelector ? db.getStylesForClass(item.classSelector) : [];
|
||||||
const cssCompiledStyles = styles.length > 0 ? styles.join(';') : undefined;
|
const cssCompiledStyles = styles.length > 0 ? styles : undefined;
|
||||||
|
|
||||||
const itemData = {
|
const itemData = {
|
||||||
level,
|
level,
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export function buildHierarchy(
|
|||||||
type: string;
|
type: string;
|
||||||
value?: number;
|
value?: number;
|
||||||
classSelector?: string;
|
classSelector?: string;
|
||||||
cssCompiledStyles?: string;
|
cssCompiledStyles?: string[];
|
||||||
}[]
|
}[]
|
||||||
): TreemapNode[] {
|
): TreemapNode[] {
|
||||||
if (!items.length) {
|
if (!items.length) {
|
||||||
@@ -29,7 +29,7 @@ export function buildHierarchy(
|
|||||||
};
|
};
|
||||||
node.classSelector = item?.classSelector;
|
node.classSelector = item?.classSelector;
|
||||||
if (item?.cssCompiledStyles) {
|
if (item?.cssCompiledStyles) {
|
||||||
node.cssCompiledStyles = [item.cssCompiledStyles];
|
node.cssCompiledStyles = item.cssCompiledStyles;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.type === 'Leaf' && item.value !== undefined) {
|
if (item.type === 'Leaf' && item.value !== undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user