UNPKG

@mikezimm/fps-library-v2

Version:

Library of reusable typescript/javascript functions, interfaces and constants

64 lines (63 loc) 3.5 kB
/** * CodeAnalizerComment: Updated 4 imports on 2024-09-21 23:07:24 * Update:: import { getExpandColumns } to '@mikezimm/fps-core-v7/lib/components/molecules/source-props/Lists/getVX/getExpandV2;' * Update:: import { getSelectColumns } to '@mikezimm/fps-core-v7/lib/components/molecules/source-props/Lists/getVX/getSelectV2;' * Update:: import { CurrentTenant } to '@mikezimm/fps-core-v7/lib/components/molecules/source-props/IMinSourceFetchProps;' * Update:: import { ISourceProps } to '@mikezimm/fps-core-v7/lib/components/molecules/source-props/ISourceProps;' */ import { getExpandColumns } from "@mikezimm/fps-core-v7/lib/components/molecules/source-props/Lists/getVX/getExpandV2"; import { getSelectColumns } from "@mikezimm/fps-core-v7/lib/components/molecules/source-props/Lists/getVX/getSelectV2"; import { CurrentTenant } from '@mikezimm/fps-core-v7/lib/components/molecules/source-props/WindowLocationConstants'; import { makeid } from "@mikezimm/fps-core-v7/lib/logic/Strings/guids"; /** * This was originally derived and copied from LinkUp web part */ // eslint-disable-next-line @typescript-eslint/no-explicit-any export function getLinkSourceProps(fpsSpService, columns, webUrl, listTitle, webRelativeLink, restFilter, sortAsc) { const loadThisData = webUrl && webUrl && listTitle ? true : false; if (loadThisData === true) { // eslint-disable-next-line @typescript-eslint/no-explicit-any const tileColsAny = columns; const allColumns = Object.keys(columns).map(col => { return tileColsAny[col]; }); // https://github.com/fps-solutions/LinkUp/issues/50 : If webRelativeLink is not a '/lists/ AND not Site Pages AND 'File_x0020_Type' is not already there, then add it if (webRelativeLink && webRelativeLink.indexOf('/lists/') === -1 && listTitle !== 'Site Pages' && allColumns.indexOf('File_x0020_Type') === -1) { allColumns.push('File_x0020_Type'); } const expandThese = getExpandColumns(allColumns).map((col) => { return col.replace('.Url', ''); }); const selectThese = getSelectColumns(allColumns).map((col) => { return col.replace('.Url', ''); }); const searchProps = []; if (columns.colTitleText) searchProps.push(columns.colTitleText); if (columns.colDescription) searchProps.push(columns.colDescription); if (columns.colCategory) searchProps.push(columns.colCategory); const SourceProps = { fpsSpService: fpsSpService, key: listTitle, refreshId: makeid(5), defType: 'item', fpsContentType: ['item',], webRelativeLink: webRelativeLink ? webRelativeLink : ``, searchSource: '', searchSourceDesc: '', defSearchButtons: ['*', '-',], tenant: CurrentTenant, webUrl: webUrl, listTitle: listTitle, fetchCount: 1000, columns: ['ID', ...selectThese], searchProps: searchProps, selectThese: selectThese, expandThese: expandThese, restFilter: restFilter, orderBy: { prop: columns.colSort ? columns.colSort : 'Id', order: sortAsc ? 'asc' : 'desc', asc: sortAsc ? true : false, }, }; return SourceProps; } } //# sourceMappingURL=getLinkSourceProps.js.map