UNPKG

@mikezimm/fps-library-v2

Version:

Library of reusable typescript/javascript functions, interfaces and constants

51 lines (49 loc) 2.96 kB
/** * CodeAnalizerComment: Updated 3 imports on 2024-09-22 14:49:52 * Update:: import { checkItemsResults } to '@mikezimm/fps-core-v7/lib/components/molecules/process-results/CheckItemsResults;' * Update:: import { IFpsItemsReturn } to '@mikezimm/fps-core-v7/lib/components/molecules/process-results/CheckItemsResults;' * Update:: import { IFpsErrorObject } to '@mikezimm/fps-core-v7/lib/types/fps-returns/common/IFpsErrorObject;' */ /** * CodeAnalizerComment: Updated 5 imports on 2024-09-21 23:07:24 * Update:: import { IMinItemFetchProps } to '@mikezimm/fps-core-v7/lib/types/fps-returns/lists/items/IMinItemFetchProps;' * Update:: import { IAttachmentsErrorObj } to '@mikezimm/fps-core-v7/lib/types/fps-returns/lists/attachments/IAttachmentsErrorObj;' * Update:: import { checkItemsResults } to '@mikezimm/fps-core-v7/lib/components/molecules/process-results/CheckItemsResults;' * Update:: import { IFpsItemsReturn } to '@mikezimm/fps-core-v7/lib/components/molecules/process-results/CheckItemsResults;' * Update:: import { IFpsErrorObject } to '@mikezimm/fps-core-v7/lib/types/fps-returns/common/IFpsErrorObject;' */ /** * 2024-12-07: MOVE THIS TO fps-core-v7 ??? * MIGRATION CANDIDATE */ import * as React from 'react'; import { Link, } from '@fluentui/react/lib/Link'; import { getItemAttachmentsFlatAPI } from '@mikezimm/fps-core-v7/lib/restAPIs/lists/items/getItemAttachmentsFlatAPI'; export async function createPanelAttachmentElements(fpsSpService, webUrl, listTitle, item) { const attachments = []; if (item.Attachments && item.Attachments === true) { const fetchAttachments = await getItemAttachmentsFlatAPI(webUrl, listTitle, item.Id, fpsSpService, []); const AttachmentFiles = fetchAttachments.item.AttachmentFiles || []; // That fetch gets a single item so look for results.item.AttachmentFiles if (AttachmentFiles.length > 0) { attachments.push(React.createElement("h2", null, "(", AttachmentFiles.length, ") Attachments")); attachments.push(React.createElement("div", { style: { paddingBottom: "10px" } }, React.createElement("b", null, "CTRL-Click"), " to open in new window")); AttachmentFiles.map((a, index) => { const isLast = AttachmentFiles.length - 1 === index ? true : false; const { ServerRelativeUrl, FileName } = a || {}; let attachmentItem = React.createElement("div", { style: { padding: `6px 10px ${isLast === true ? 25 : 15}px 0px` } }, React.createElement(Link, { target: "_blank", href: ServerRelativeUrl }, " ", FileName)); attachments.push(attachmentItem); }); } } return attachments; } //# sourceMappingURL=fetchAttachments.js.map