mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
Merge pull request #7754 from Dora-boots/fix-clear-value
feat(amis-editor): timeline组件配置面板增加关联上下文配置
This commit is contained in:
commit
19b040fc6f
@ -29,7 +29,7 @@ export interface TimelineItemProps extends FormControlProps {
|
|||||||
|
|
||||||
export interface TimelineItemState {
|
export interface TimelineItemState {
|
||||||
items: Array<Partial<TimelineItem>>;
|
items: Array<Partial<TimelineItem>>;
|
||||||
source: 'custom' | 'api';
|
source: 'custom' | 'api' | 'variable';
|
||||||
api: SchemaApi;
|
api: SchemaApi;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ export default class TimelineItemControl extends React.Component<
|
|||||||
* 切换选项类型
|
* 切换选项类型
|
||||||
*/
|
*/
|
||||||
@autobind
|
@autobind
|
||||||
handleSourceChange(source: 'custom' | 'api') {
|
handleSourceChange(source: 'custom' | 'api' | 'variable') {
|
||||||
this.setState({source: source}, this.onChange);
|
this.setState({source: source}, this.onChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +80,11 @@ export default class TimelineItemControl extends React.Component<
|
|||||||
data.items = items.map(item => ({...item}));
|
data.items = items.map(item => ({...item}));
|
||||||
data.source = api;
|
data.source = api;
|
||||||
}
|
}
|
||||||
|
if (source === 'variable') {
|
||||||
|
const {items, api} = this.state;
|
||||||
|
data.items = items.map(item => ({...item}));
|
||||||
|
data.source = api;
|
||||||
|
}
|
||||||
onBulkChange && onBulkChange(data);
|
onBulkChange && onBulkChange(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -339,10 +344,14 @@ export default class TimelineItemControl extends React.Component<
|
|||||||
{
|
{
|
||||||
label: '接口获取',
|
label: '接口获取',
|
||||||
value: 'api'
|
value: 'api'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: '上下文变量',
|
||||||
|
value: 'variable'
|
||||||
}
|
}
|
||||||
] as Array<{
|
] as Array<{
|
||||||
label: string;
|
label: string;
|
||||||
value: 'custom' | 'api';
|
value: 'custom' | 'api' | 'variable';
|
||||||
}>
|
}>
|
||||||
).map(item => ({
|
).map(item => ({
|
||||||
...item,
|
...item,
|
||||||
@ -562,6 +571,19 @@ export default class TimelineItemControl extends React.Component<
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
) : null}
|
) : null}
|
||||||
|
|
||||||
|
{source === 'variable'
|
||||||
|
? render(
|
||||||
|
'variable',
|
||||||
|
getSchemaTpl('sourceBindControl', {
|
||||||
|
label: false,
|
||||||
|
className: 'ae-ExtendMore'
|
||||||
|
}),
|
||||||
|
{
|
||||||
|
onChange: this.handleAPIChange
|
||||||
|
}
|
||||||
|
)
|
||||||
|
: null}
|
||||||
{this.renderApiPanel()}
|
{this.renderApiPanel()}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user