@mikezimm/fps-core-v7
Version:
Library of reusable core interfaces, types and constants migrated from fps-library-v2
21 lines • 1.34 kB
JavaScript
/**
* 2024-09-06: Migrated to fps-core-v7\src\components\atoms\easy-pages\functions\
*/
import { SitePagesSource } from "../../../molecules/source-props/createSources/SitePages/SitePagesSource";
import { EasyPagesSysTab, EasyPagesDevTab, DefaultOverflowTab } from "../interfaces/epTypes";
//export type ISourceName = 'Current' | 'Parent' | 'Alternate' | typeof EasyPagesDevTab | typeof EasyPagesRepoTab ;
export function createNewSitePagesSource(fpsSpService, source, webUrl, tabs, EasyPageOverflowTab, showTricks) {
const NewSource = JSON.parse(JSON.stringify(SitePagesSource));
NewSource.fpsSpService = fpsSpService;
NewSource.webUrl = webUrl ? webUrl : '';
// 2023-07-07: Add filter to remove duplicates
NewSource.meta1 = tabs.filter((value, index) => tabs.indexOf(value) === index);
if (NewSource.meta1.indexOf(EasyPagesSysTab) < 0)
NewSource.meta1.push(EasyPagesSysTab);
if (showTricks === true && NewSource.meta1.indexOf(EasyPagesDevTab) < 0)
NewSource.meta1.push(EasyPagesDevTab);
NewSource.EasyPageOverflowTab = EasyPageOverflowTab ? EasyPageOverflowTab : DefaultOverflowTab;
// console.log( `epTypes createNewSitePagesSource ${source}`, JSON.parse(JSON.stringify(NewSource)) );
return NewSource;
}
//# sourceMappingURL=createNewSitePagesSource.js.map