Skip to content

Commit c59f9a1

Browse files
authored
refactor: adjust structures and items to add composites, support getTypes API (#4)
* refactor(infographic): items registration add values * refactor(infographic): list column grid row structure support zigzag * refactor(infographic): structure registration add composites * refactor(infographic): add api to get types
1 parent 0949f73 commit c59f9a1

60 files changed

Lines changed: 418 additions & 92 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/infographic/src/designs/items/BadgeCard.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,4 +136,7 @@ export const BadgeCard: ComponentType<BadgeCardProps> = (props) => {
136136
);
137137
};
138138

139-
registerItem('badge-card', { component: BadgeCard });
139+
registerItem('badge-card', {
140+
component: BadgeCard,
141+
composites: ['icon', 'label', 'value', 'desc'],
142+
});

packages/infographic/src/designs/items/BulletText.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,7 @@ export const BulletText: ComponentType<BulletTextProps> = (props) => {
7575
);
7676
};
7777

78-
registerItem('bullet-text', { component: BulletText });
78+
registerItem('bullet-text', {
79+
component: BulletText,
80+
composites: ['label'],
81+
});

packages/infographic/src/designs/items/CandyCardLite.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,7 @@ export const CandyCardLite: ComponentType<CandyCardLiteProps> = (props) => {
8282
);
8383
};
8484

85-
registerItem('candy-card-lite', { component: CandyCardLite });
85+
registerItem('candy-card-lite', {
86+
component: CandyCardLite,
87+
composites: ['icon', 'label', 'desc'],
88+
});

packages/infographic/src/designs/items/ChartColumn.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,4 +125,7 @@ export const ChartColumn: ComponentType<ChartColumnProps> = (props) => {
125125
);
126126
};
127127

128-
registerItem('chart-column', { component: ChartColumn });
128+
registerItem('chart-column', {
129+
component: ChartColumn,
130+
composites: ['label', 'value'],
131+
});

packages/infographic/src/designs/items/CircleNode.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ export const CircleNode: ComponentType<CircleNodeProps> = (props) => {
9393
);
9494
};
9595

96-
registerItem('circle-node', { component: CircleNode });
96+
registerItem('circle-node', {
97+
component: CircleNode,
98+
composites: ['label'],
99+
});
97100

98101
function fadeWithWhite(
99102
color: tinycolor.Instance,

packages/infographic/src/designs/items/CircularProgress.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,7 @@ export const CircularProgress: ComponentType<CircularProgressProps> = (
100100
);
101101
};
102102

103-
registerItem('circular-progress', { component: CircularProgress });
103+
registerItem('circular-progress', {
104+
component: CircularProgress,
105+
composites: ['label', 'value'],
106+
});

packages/infographic/src/designs/items/CompactCard.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,7 @@ export const CompactCard: ComponentType<CompactCardProps> = (props) => {
124124
);
125125
};
126126

127-
registerItem('compact-card', { component: CompactCard });
127+
registerItem('compact-card', {
128+
component: CompactCard,
129+
composites: ['icon', 'label', 'value', 'desc'],
130+
});

packages/infographic/src/designs/items/DoneList.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,7 @@ export const DoneList: ComponentType<DoneListProps> = (props) => {
6363
);
6464
};
6565

66-
registerItem('done-list', { component: DoneList });
66+
registerItem('done-list', {
67+
component: DoneList,
68+
composites: ['desc'],
69+
});

packages/infographic/src/designs/items/HorizontalIconArrow.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,15 @@ import type { BaseItemProps } from './types';
1818

1919
export interface HorizontalIconArrowProps extends BaseItemProps {
2020
width?: number;
21-
/** 翻转方向 */
22-
flipped?: boolean;
2321
}
2422

2523
export const HorizontalIconArrow: ComponentType<HorizontalIconArrowProps> = (
2624
props,
2725
) => {
28-
const [{ indexes, datum, width = 140, themeColors, flipped }, restProps] =
29-
getItemProps(props, ['width', 'flipped']);
30-
31-
const positionV = indexes[0] % 2 === (flipped ? 0 : 1) ? 'normal' : 'flipped';
26+
const [
27+
{ indexes, datum, width = 140, themeColors, positionV = 'normal' },
28+
restProps,
29+
] = getItemProps(props, ['width']);
3230

3331
const textAlignVertical = positionV === 'normal' ? 'bottom' : 'top';
3432
const label = (
@@ -183,7 +181,7 @@ const DotLine = (props: {
183181
width?: number;
184182
height?: number;
185183
fill: string;
186-
positionV?: 'normal' | 'flipped';
184+
positionV?: 'normal' | 'center' | 'flipped';
187185
}) => {
188186
const {
189187
x = 0,
@@ -218,4 +216,7 @@ const DotLine = (props: {
218216
);
219217
};
220218

221-
registerItem('horizontal-icon-arrow', { component: HorizontalIconArrow });
219+
registerItem('horizontal-icon-arrow', {
220+
component: HorizontalIconArrow,
221+
composites: ['icon', 'label', 'desc'],
222+
});

packages/infographic/src/designs/items/HorizontalIconLine.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,7 @@ export const HorizontalIconLine: ComponentType<HorizontalIconLineProps> = (
146146
);
147147
};
148148

149-
registerItem('horizontal-icon-line', { component: HorizontalIconLine });
149+
registerItem('horizontal-icon-line', {
150+
component: HorizontalIconLine,
151+
composites: ['icon', 'label', 'desc'],
152+
});

0 commit comments

Comments
 (0)