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

Method handleClickFile

packages/amis/src/renderers/Form/InputFile.tsx:622–644  ·  view source on GitHub ↗
(file: FileX | FileValue, e: React.MouseEvent)

Source from the content-addressed store, hash-verified

620 }
621
622 handleClickFile(file: FileX | FileValue, e: React.MouseEvent) {
623 e.preventDefault();
624 e.stopPropagation();
625
626 const {downloadUrl} = this.props;
627 const urlField = this.props.urlField || 'url';
628 const valueField = this.props.valueField || 'value';
629
630 const fileUrl =
631 file[urlField as keyof typeof file] ||
632 file[valueField as keyof typeof file];
633
634 const api =
635 typeof downloadUrl === 'string' &&
636 !~downloadUrl.indexOf('$') &&
637 typeof fileUrl === 'string'
638 ? `${downloadUrl}${fileUrl}`
639 : downloadUrl
640 ? downloadUrl
641 : undefined;
642
643 api && this.handleApi(api, file);
644 }
645
646 downloadTpl(e: React.MouseEvent) {
647 e.preventDefault();

Callers

nothing calls this directly

Calls 1

handleApiMethod · 0.95

Tested by

no test coverage detected