WbwDetailAttachment.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import type { _UploadFile } from "antd/es/upload/interface";
  2. import type {
  3. IAttachmentRequest,
  4. IAttachmentResponse,
  5. } from "../../../api/Attachments"; // eslint-disable-line
  6. import WbwDetailUpload from "./WbwDetailUpload";
  7. import type { IWbw, IWbwAttachment } from "./WbwWord";
  8. interface IWidget {
  9. data: IWbw;
  10. onChange?: Function;
  11. onUpload?: Function;
  12. onDialogOpen?: Function;
  13. }
  14. const WbwDetailAttachmentWidget = ({
  15. data,
  16. onChange,
  17. onUpload,
  18. onDialogOpen,
  19. }: IWidget) => {
  20. return (
  21. <div>
  22. <WbwDetailUpload
  23. data={data}
  24. onUpload={(fileList: IAttachmentRequest[]) => {
  25. if (typeof onUpload !== "undefined") {
  26. onUpload(fileList);
  27. }
  28. }}
  29. onDialogOpen={(open: boolean) => {
  30. if (typeof onDialogOpen !== "undefined") {
  31. onDialogOpen(open);
  32. }
  33. }}
  34. onChange={(value: IWbwAttachment[]) => {
  35. if (typeof onChange !== "undefined") {
  36. onChange(value);
  37. }
  38. }}
  39. />
  40. </div>
  41. );
  42. };
  43. export default WbwDetailAttachmentWidget;