From b07c7ad24b8ae052625777012f2ff51475d35a21 Mon Sep 17 00:00:00 2001 From: liqiu03 Date: Thu, 27 Oct 2022 15:13:21 +0800 Subject: [PATCH] =?UTF-8?q?amis-saas-6518=20[Bug]=20=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=EF=BC=9A=E3=80=90=E7=BB=84=E4=BB=B6=E4=BC=98=E5=8C=96=E7=AC=AC?= =?UTF-8?q?=E4=BA=94=E6=89=B9=E3=80=91=E6=97=B6=E9=97=B4=E8=BD=B4-?= =?UTF-8?q?=E6=95=B0=E6=8D=AE-=E6=8E=A5=E5=8F=A3=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=EF=BC=8C=E9=80=9A=E8=BF=87=E8=BE=93=E5=85=A5=E6=A1=86=E3=80=81?= =?UTF-8?q?API=E4=B8=AD=E5=BF=83=E3=80=81=E9=AB=98=E7=BA=A7=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=9A=84API,=E9=85=8D=E7=BD=AE=E5=90=8E=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E8=8E=B7=E5=8F=96=E6=95=B0=E6=8D=AE=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: If39046a5e2f2a83ec9ebd2b7f4c3433853466007 --- packages/amis-editor/src/plugin/Timeline.tsx | 5 +++-- packages/amis-editor/src/renderer/TimelineItemControl.tsx | 5 +++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/amis-editor/src/plugin/Timeline.tsx b/packages/amis-editor/src/plugin/Timeline.tsx index 3d6df6dc2..27247d0cc 100644 --- a/packages/amis-editor/src/plugin/Timeline.tsx +++ b/packages/amis-editor/src/plugin/Timeline.tsx @@ -20,8 +20,9 @@ export class TimelinePlugin extends BasePlugin { label: '时间轴', name: 'timeline', items: [ - {time: '2012-12-21', title: '节点数据'}, - {time: '2012-12-24', title: '节点数据'} + {time: '2012-12-21', title: '节点示例数据'}, + {time: '2012-12-24', title: '节点示例数据'}, + {time: '2012-12-27', title: '节点示例数据'} ] }; previewSchema = { diff --git a/packages/amis-editor/src/renderer/TimelineItemControl.tsx b/packages/amis-editor/src/renderer/TimelineItemControl.tsx index f74812d9e..93cbc3e5c 100644 --- a/packages/amis-editor/src/renderer/TimelineItemControl.tsx +++ b/packages/amis-editor/src/renderer/TimelineItemControl.tsx @@ -77,6 +77,9 @@ export default class TimelineItemControl extends React.Component< data.items = items.map(item => ({...item})); } if (source === 'api') { + const {items, api} = this.state; + data.items = items.map(item => ({...item})); + data.source = api; } onBulkChange && onBulkChange(data); } @@ -396,6 +399,7 @@ export default class TimelineItemControl extends React.Component< renderOption(props: TimelineItem & {index: number}) { const {time, title, index} = props; + const delDisabled = !(this.state.items.length > 2); return (
  • @@ -472,6 +476,7 @@ export default class TimelineItemControl extends React.Component< type: 'button', className: 'ae-TimelineItemControlItem-action', label: '删除', + disabled: delDisabled, onClick: () => this.toggleDelete(index) } ]