UNPKG

@mikezimm/fps-core-v7

Version:

Library of reusable core interfaces, types and constants migrated from fps-library-v2

50 lines 2.64 kB
/** * 2024-09-06: Migrated from same folder fps-library-v2\src\pnpjs\SourceItems * * Local imports import { getExpandColumns, ISourceProps, makeid } from '../../fpsReferences'; import { createSeriesSort } from '@mikezimm/fps-core-v7/lib/components/molecules/source-props/createOrderBy'; import { CurrentTenant } from '@mikezimm/fps-core-v7/lib/components/molecules/source-props/WindowLocationConstants'; import { GroupSelectsFull } from '@mikezimm/fps-core-v7/lib/restAPIs/sites/groups/GroupSelects'; */ import { createSeriesSort } from '../../createOrderBy'; import { makeid } from '../../../../../logic/Strings/guids'; import { getExpandColumns } from '../../Lists/getVX/getExpandV2'; import { getSiteCollectionUrlFromLink } from '../../../../../logic/Strings/getSiteCollectionUrlFromLink'; import { CurrentTenant } from '../../WindowLocationConstants'; export function createNavSource(webUrl, fpsSpService) { let Source = DefaultNavigationSource; Source.webUrl = webUrl; Source.absoluteWebUrl = getSiteCollectionUrlFromLink(webUrl); // Opted against this option since it may cause other issues... just adding to FPSFetchStatus // Source.webRelativeLink = webRelativeLink.indexOf('/') === 0 ? webRelativeLink : `/${webRelativeLink}`; // https://github.com/fps-solutions/Item-Ninja/issues/51 - need to add fpsSpService after parsing Source = JSON.parse(JSON.stringify(Source)); Source.fpsSpService = fpsSpService; // Opted against this option since it may cause other issues... just adding to FPSFetchStatus // Source.webRelativeLink = webRelativeLink.indexOf('/') === 0 ? webRelativeLink : `/${webRelativeLink}`; return Source; } /** * 2024-12-31: derived FullNavSelects from current return but using '*' in the source to simplify by default since I do not use this much */ export const FullNavSelects = ['Id', 'Title', 'Url', 'IsExternal', 'Target', 'ParentNodeId', 'IsPromoted', 'DisplayAsDropdown', 'Description', 'Order',]; const NavSelects = ['*']; export const DefaultNavigationSource = { refreshId: makeid(5), key: 'nav', defType: 'Nav', fpsContentType: ['nav'], tenant: CurrentTenant, webUrl: ``, webRelativeLink: '', viewItemLink: ``, columns: NavSelects, searchProps: NavSelects, selectThese: NavSelects, expandThese: getExpandColumns(NavSelects), defSearchButtons: [], orderBy: createSeriesSort('Title'), performanceSettings: { label: 'Nav', updateMiliseconds: true, includeMsStr: true, op: 'fetch' }, }; //# sourceMappingURL=createNavSource.js.map