From 305be35364044085bf81f092ed53fa0b506b6c65 Mon Sep 17 00:00:00 2001 From: rdeiser Date: Thu, 13 Aug 2026 09:09:42 -0500 Subject: [PATCH] feat(pickup-filter-custom-component): removes the archvies and special collections library from the tangible request option if the resource is not required to be viewed within the alma reading room --- .../custom1-module/customComponentMappings.ts | 4 +- .../pickup-filter/pickup-filter.component.ts | 47 +++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 src/app/pickup-filter/pickup-filter.component.ts diff --git a/src/app/custom1-module/customComponentMappings.ts b/src/app/custom1-module/customComponentMappings.ts index 3d6928ea..f00a7f67 100644 --- a/src/app/custom1-module/customComponentMappings.ts +++ b/src/app/custom1-module/customComponentMappings.ts @@ -3,6 +3,7 @@ import { Libraryh3lpComponent } from '../libraryh3lp/libraryh3lp.component'; import { NdeProblemReportCustom } from '../nde-problem-report-custom/nde-problem-report-custom.component'; import { PayFinesComponent } from '../pay-fines/pay-fines.component'; import { TrafficResultLimitComponent } from '../traffic-result-limit/traffic-result-limit.component'; +import { PickupFilterComponent } from '../pickup-filter/pickup-filter.component'; // Define the map export const selectorComponentMap = new Map([ @@ -10,5 +11,6 @@ export const selectorComponentMap = new Map([ ['nde-fines-before', PayFinesComponent], ['nde-full-display-service-container-after', NdeProblemReportCustom], ['nde-top-bar-after', LibraryAlertsPannelComponent], - ['nde-search-no-results-before', TrafficResultLimitComponent] + ['nde-search-no-results-before', TrafficResultLimitComponent], + ['nde-formly-general-wrapper-bottom', PickupFilterComponent], ]); diff --git a/src/app/pickup-filter/pickup-filter.component.ts b/src/app/pickup-filter/pickup-filter.component.ts new file mode 100644 index 00000000..00cb6f49 --- /dev/null +++ b/src/app/pickup-filter/pickup-filter.component.ts @@ -0,0 +1,47 @@ +import { Component, Input, OnInit, OnDestroy } from '@angular/core'; + +@Component({ + selector: 'custom-pickup-filter', + standalone: true, + template: '', +}) +export class PickupFilterComponent implements OnInit, OnDestroy { + @Input() private hostComponent!: any; + + private readonly HIDE_TEXT = ['Archives and Special Collections Library']; + private intervalId: any = null; + private observer: MutationObserver | null = null; + + ngOnInit(): void { + const hideOptions = () => { + const opts = document.querySelectorAll( + 'mat-option, .mat-mdc-option' + ) as NodeListOf; + opts.forEach((opt) => { + const txt = opt.innerText?.trim() ?? ''; + if (this.HIDE_TEXT.some((t) => txt.includes(t))) { + opt.style.display = 'none'; + opt.setAttribute('aria-hidden', 'true'); + } + }); + }; + + const input = document.querySelector( + '[data-qa="almaRequest.pickupLocation"] input' + ); + if (input) { + input.addEventListener('focus', hideOptions); + input.addEventListener('input', hideOptions); + + this.observer = new MutationObserver(hideOptions); + this.observer.observe(document.body, { childList: true, subtree: true }); + } + + this.intervalId = setInterval(hideOptions, 400); + } + + ngOnDestroy(): void { + if (this.intervalId) clearInterval(this.intervalId); + this.observer?.disconnect(); + } +}