From 2bdb5c6a970836f77b6d584d2acad8992c398ea0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E4=BD=B3=E8=B1=AA?= <1440054388@qq.com> Date: Wed, 2 Nov 2022 11:02:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20timeline=E6=97=B6=E9=97=B4=E8=BD=B4?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E8=87=AA=E5=AE=9A=E4=B9=89=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=20(#5668)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix:折叠器Collapse自定义图标&inputNumber对含后缀生效 * 修改 * 正则修改 * 正则修改 * 正则修改 * feat:将默认px替换为rem 2px===0.125rem * feat:timeline时间轴支持自定义图标 Co-authored-by: xujiahao01 --- packages/amis-ui/src/components/TimelineItem.tsx | 8 ++++++-- packages/amis/src/renderers/Timeline.tsx | 5 +++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/amis-ui/src/components/TimelineItem.tsx b/packages/amis-ui/src/components/TimelineItem.tsx index 7f8d9afea..2d558da81 100644 --- a/packages/amis-ui/src/components/TimelineItem.tsx +++ b/packages/amis-ui/src/components/TimelineItem.tsx @@ -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) {
{icon ? (
- + {typeof icon === 'object' ? ( + generateIcon(cx, icon as any) + ) : ( + + )}
) : (
{ + 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) }; } );