MCPcopy
hub / github.com/baidu/amis / renderFooter

Method renderFooter

packages/amis-editor/src/renderer/FieldSetting.tsx:347–386  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

345
346 @autobind
347 renderFooter() {
348 const {classnames: cx, renderer, store, data: ctx, feat} = this.props;
349 const scaffoldData = store?.data;
350 const {initApi, listApi} = scaffoldData || {};
351 const {loading} = this.state;
352 const isForm = renderer === 'form';
353 const isCRUD = renderer === 'crud';
354 const fieldApi = isForm ? initApi : isCRUD ? listApi : '';
355 const isApiValid = isValidApi(normalizeApi(fieldApi)?.url);
356 const showAutoGenBtn =
357 (isForm &&
358 (feat === DSFeatureEnum.Edit || feat === DSFeatureEnum.View)) ||
359 (isCRUD && feat === DSFeatureEnum.List && ctx?.__step === 0);
360
361 return showAutoGenBtn ? (
362 <div
363 className={cx('ae-FieldSetting-footer', {
364 ['ae-FieldSetting-footer--form']: isForm
365 })}
366 >
367 <Button
368 size="sm"
369 level="link"
370 loading={loading}
371 disabled={!isApiValid || loading}
372 disabledTip={{
373 content: loading
374 ? '数据处理中...'
375 : isForm
376 ? '请先填写初始化接口'
377 : '请先填写接口',
378 tooltipTheme: 'dark'
379 }}
380 onClick={this.debounceGenerateFields}
381 >
382 <span>基于接口自动生成字段</span>
383 </Button>
384 </div>
385 ) : null;
386 }
387
388 render() {
389 const {

Callers 1

renderMethod · 0.95

Calls 2

isValidApiFunction · 0.90
normalizeApiFunction · 0.90

Tested by

no test coverage detected