@mikezimm/fps-library-v2
Version:
Library of reusable typescript/javascript functions, interfaces and constants
59 lines (58 loc) • 2.59 kB
JavaScript
/**
* CodeAnalizerComment: Updated 2 imports on 2024-09-22 14:49:52
* Update:: import { IItemWithSharingInfo } to '@mikezimm/fps-core-v7/lib/components/atoms/SharedItems/IItemWithSharingInfo;'
* Update:: import { openLinkInNewTabUsingDatahref } to '@mikezimm/fps-core-v7/lib/components/atoms/SharedItems/openLinkInNewTabUsingDatahref;'
*/
/**
* COPIED FROM PIVOT TILES ON 2023-12-09
*/
import * as React from 'react';
import { Link } from '@fluentui/react/lib/Link';
import * as PTIcons from '../Icons/standardPivotTiles';
import { createItemSharingTable } from './createItemSharingTable';
import { openLinkInNewTabUsingDatahref } from '@mikezimm/fps-core-v7/lib/components/atoms/SharedItems/openLinkInNewTabUsingDatahref';
/**
* This builds up the Shared Details tab-page in Pivot Tiles library permissions
*
* ICON FileType LinkToFile DETAILS TABLE
*
* This shows all sharing grouped by the file that was shared
* createShareEventsGroupedByItem was previously called: buildWasSharedRows
* @param sharedItems
* @param width
*/
export function createShareEventsGroupedByItem(sharedItems, width) {
const sharedElements = [];
//This builds the elements based on the sorting
sharedItems.map((item, index) => {
const FileLearRef = item.FileLeafRef ? item.FileLeafRef : '';
let shortFileName = item.FileLeafRef && item.FileLeafRef.length > 0 ? item.FileLeafRef.substr(0, 25) : '';
if (shortFileName.length < item.FileLeafRef.length) {
shortFileName += '...';
}
const UniquePermIcon = React.createElement("div", { id: index.toString() },
" ",
PTIcons.UniquePerms,
" ");
const shareTable = createItemSharingTable(item);
sharedElements.push(React.createElement("tr", null,
React.createElement("td", null,
" ",
UniquePermIcon,
" "),
React.createElement("td", null,
" ",
item.FileSystemObjectType === 0 ? 'File' : 'Folder',
" "),
React.createElement("td", { title: item.FileLeafRef },
" ",
React.createElement(Link, { onClick: openLinkInNewTabUsingDatahref, "data-href": item.FileRef }, shortFileName),
" "),
React.createElement("td", null,
" ",
shareTable,
" ")));
});
return sharedElements;
}
//# sourceMappingURL=createShareEventsGroupedByItem.js.map