UNPKG

@mikezimm/fps-core-v7

Version:

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

50 lines (49 loc) 3.12 kB
/** * CodeAnalizerComment: Updated 2 imports on 2024-09-22 02:56:43 * Update:: import { fetchListList } to '@mikezimm/fps-core-v7/lib/banner/components/ItemPicker/functions/fetchListList;' * Update:: import { testValidWebUrl } to '@mikezimm/fps-core-v7/lib/banner/components/ItemPicker/functions/onListItemPropPaneStart;' */ import { fetchListList } from "../../ItemPicker/functions/fetchListList"; import { testValidWebUrl } from "../../ItemPicker/functions/onListItemPropPaneStart"; // eslint-disable-next-line @typescript-eslint/no-explicit-any export async function onwebUrlPickerValueChanged(thisWPClass, propertyPath, oldValue, newValue, approvedWebs, BaseTemplate, idx) { if ((propertyPath === `webUrlPickerValue${idx}`) && (newValue)) { const wpProps = thisWPClass.properties; const webUrlIsApproved = testValidWebUrl(approvedWebs, wpProps[`webUrlPickerValue${idx}`]); thisWPClass._fetchInstance = Math.floor(Math.random() * 79797979).toString(); thisWPClass[`_webUrlPickerValueApproved${idx}`] = false; wpProps[`listPickerValue${idx}`] = ''; wpProps[`listItemPickerValue${idx}`] = ''; thisWPClass[`_listsDropdownDisabled${idx}`] = true; thisWPClass[`_itemsDropdownDisabled${idx}`] = true; if (webUrlIsApproved === false) { thisWPClass[`_listPickerList${idx}`] = []; thisWPClass[`_approvedLists${idx}`] = []; } else { //Not sure what thisWPClass does but am keeping same model as with libraries const previousItem = wpProps[`listPickerValue${idx}`]; await thisWPClass.onPropertyPaneFieldChanged(`listPickerValue${idx}`, previousItem, wpProps[`listPickerValue${idx}`]); //Added last check to only get libraries when the Url ends in / if (newValue !== '' && newValue.length > 0 && newValue.charAt(newValue.length - 1) === '/') { let restFilter = `Hidden eq false`; // ADDED 2024-10-15 if (BaseTemplate) restFilter = `${restFilter} and BaseTemplate eq ${BaseTemplate}`; // ADDED 2024-10-15 // 2025-02-13: Fixed: https://github.com/fps-solutions/Core-FPT1.20.X/issues/1Z change thisWPClass.context to thisWPClass._fpsSpService // eslint-disable-next-line @typescript-eslint/no-explicit-any await fetchListList(thisWPClass._fpsSpService, wpProps[`webUrlPickerValue${idx}`], restFilter) .then((result) => { if (result.items.length) { // store items thisWPClass[`_listPickerList${idx}`] = result.items; thisWPClass[`_approvedLists${idx}`] = thisWPClass[`_listPickerList${idx}`]; // enable item selector thisWPClass[`_listsDropdownDisabled${idx}`] = false; } }); } } thisWPClass.refreshPaneReRender(); } } //# sourceMappingURL=onWebUrlPickerValueChanged.js.map