mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-03 04:18:29 +08:00
feat: timeline时间轴支持自定义图标 (#5668)
* fix:折叠器Collapse自定义图标&inputNumber对含后缀生效 * 修改 * 正则修改 * 正则修改 * 正则修改 * feat:将默认px替换为rem 2px===0.125rem * feat:timeline时间轴支持自定义图标 Co-authored-by: xujiahao01 <xujiahao01@baidu.com>
This commit is contained in:
parent
1a56155632
commit
2bdb5c6a97
@ -1,6 +1,6 @@
|
||||
import React, {ReactNode, useState} from 'react';
|
||||
import {localeable, LocaleProps} from 'amis-core';
|
||||
import {themeable, ThemeProps} from 'amis-core';
|
||||
import {themeable, ThemeProps, generateIcon} from 'amis-core';
|
||||
import {Icon} from './icons';
|
||||
|
||||
export interface TimelineItemProps {
|
||||
@ -111,7 +111,11 @@ export function TimelineItem(props: TimelineItem) {
|
||||
<div className={cx('TimelineItem-line')}></div>
|
||||
{icon ? (
|
||||
<div className={cx('TimelineItem-icon')}>
|
||||
<Icon icon={icon} className="icon" />
|
||||
{typeof icon === 'object' ? (
|
||||
generateIcon(cx, icon as any)
|
||||
) : (
|
||||
<Icon icon={icon} className="icon" />
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
|
@ -97,10 +97,11 @@ export function TimelineCmpt(props: TimelineProps) {
|
||||
// 处理源数据
|
||||
const resolveTimelineItems = timelineItemsRow?.map(
|
||||
(timelineItem: TimelineItemSchema) => {
|
||||
const {icon, title} = timelineItem;
|
||||
return {
|
||||
...timelineItem,
|
||||
icon: resolveRender('icon', timelineItem.icon),
|
||||
title: resolveRender('title', timelineItem.title)
|
||||
icon: typeof icon === 'string' ? filter(icon, data) : icon,
|
||||
title: resolveRender('title', title)
|
||||
};
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user