@internetarchive/collection-browser 3.1.1-alpha-webdev6778.7 → 3.1.1-alpha-webdev6778.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/app-root.js +606 -606
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +140 -140
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/models.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +75 -75
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +54 -54
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +1 -3
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/expanded-date-picker.js +52 -52
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/manage/manage-bar.js +77 -77
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/models.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.js +376 -376
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +36 -36
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +42 -42
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +119 -119
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +97 -97
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/utils/analytics-events.js.map +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/test/collection-browser.test.js +187 -187
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +23 -23
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/dist/test/collection-facets.test.js +20 -20
- package/dist/test/collection-facets.test.js.map +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +37 -37
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +64 -64
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +57 -57
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/package.json +2 -2
- package/src/app-root.ts +1140 -1140
- package/src/collection-browser.ts +1 -1
- package/src/collection-facets/facet-row.ts +296 -296
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets/smart-facets/smart-facet-bar.ts +437 -437
- package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +185 -185
- package/src/data-source/collection-browser-data-source-interface.ts +333 -333
- package/src/data-source/collection-browser-data-source.ts +2 -4
- package/src/data-source/models.ts +43 -43
- package/src/expanded-date-picker.ts +191 -191
- package/src/manage/manage-bar.ts +247 -247
- package/src/models.ts +870 -870
- package/src/sort-filter-bar/sort-filter-bar.ts +1283 -1283
- package/src/tiles/base-tile-component.ts +53 -53
- package/src/tiles/grid/account-tile.ts +112 -112
- package/src/tiles/grid/search-tile.ts +90 -90
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +130 -130
- package/src/tiles/list/tile-list-compact.ts +236 -236
- package/src/utils/analytics-events.ts +29 -29
- package/src/utils/format-date.ts +42 -42
- package/test/collection-browser.test.ts +2359 -2359
- package/test/collection-facets/facet-row.test.ts +375 -375
- package/test/collection-facets.test.ts +928 -928
- package/test/sort-filter-bar/sort-filter-bar.test.ts +885 -885
- package/test/tiles/grid/item-tile.test.ts +464 -464
- package/test/tiles/list/tile-list-compact.test.ts +228 -228
- package/test/utils/format-date.test.ts +39 -39
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-facet-bar.js","sourceRoot":"","sources":["../../../../src/collection-facets/smart-facets/smart-facet-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EAGV,OAAO,GAER,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AASnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,wBAAwB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,UAAU,MAAM,+BAA+B,CAAC;AAEvD,OAAO,sBAAsB,CAAC;AAC9B,OAAO,wBAAwB,CAAC;AAEhC,MAAM,aAAa,GAAyC;IAC1D,UAAU,EAAE,cAAc;IAC1B,OAAO,EAAE,MAAM;IACf,OAAO,EAAE,SAAS;CACnB,CAAC;AAEF,SAAS,UAAU,CAAC,GAAW;IAC7B,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC;AAGM,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU;IAAtC;;QAWwB,sBAAiB,GAAG,KAAK,CAAC;QAE1B,uBAAkB,GAAG,KAAK,CAAC;QAIvC,kBAAa,GAAiB,EAAE,CAAC;QAEjC,gBAAW,GAAmB,EAAE,CAAC;IAuXpD,CA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E;oDAA0C;AAEjC;IAAhB,KAAK,EAAE;kDAA0C;AAEjC;IAAhB,KAAK,EAAE;uDAAwD;AArBrD,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CA0YzB","sourcesContent":["import {\r\n css,\r\n html,\r\n LitElement,\r\n TemplateResult,\r\n CSSResultGroup,\r\n nothing,\r\n PropertyValues,\r\n} from 'lit';\r\nimport { repeat } from 'lit/directives/repeat.js';\r\nimport { customElement, property, state } from 'lit/decorators.js';\r\nimport type { Aggregation, Bucket } from '@internetarchive/search-service';\r\nimport type { CollectionTitles } from '../../data-source/models';\r\nimport type {\r\n FacetEventDetails,\r\n FacetOption,\r\n FacetState,\r\n SelectedFacets,\r\n} from '../../models';\r\nimport { updateSelectedFacetBucket } from '../../utils/facet-utils';\r\nimport { SmartQueryHeuristicGroup } from './smart-facet-heuristics';\r\nimport type { SmartFacetDropdown } from './smart-facet-dropdown';\r\nimport type { SmartFacet, SmartFacetEvent } from './models';\r\nimport { smartFacetEquals } from './smart-facet-equals';\r\nimport { dedupe } from './dedupe';\r\nimport { log } from '../../utils/log';\r\nimport filterIcon from '../../assets/img/icons/filter';\r\n\r\nimport './smart-facet-button';\r\nimport './smart-facet-dropdown';\r\n\r\nconst fieldPrefixes: Partial<Record<FacetOption, string>> = {\r\n collection: 'Collection: ',\r\n creator: 'By: ',\r\n subject: 'About: ',\r\n};\r\n\r\nfunction capitalize(str: string) {\r\n return str.charAt(0).toUpperCase() + str.slice(1);\r\n}\r\n\r\n@customElement('smart-facet-bar')\r\nexport class SmartFacetBar extends LitElement {\r\n @property({ type: String }) query?: string;\r\n\r\n @property({ type: Object }) aggregations?: Record<string, Aggregation>;\r\n\r\n @property({ type: Object }) selectedFacets?: SelectedFacets;\r\n\r\n /** The map from collection identifiers to their titles */\r\n @property({ type: Object })\r\n collectionTitles?: CollectionTitles;\r\n\r\n @property({ type: Boolean }) filterToggleShown = false;\r\n\r\n @property({ type: Boolean }) filterToggleActive = false;\r\n\r\n @property({ type: String }) label?: string;\r\n\r\n @state() private heuristicRecs: SmartFacet[] = [];\r\n\r\n @state() private smartFacets: SmartFacet[][] = [];\r\n\r\n @state() private lastAggregations?: Record<string, Aggregation>;\r\n\r\n //\r\n // COMPONENT LIFECYCLE METHODS\r\n //\r\n\r\n render() {\r\n if (!this.query) return nothing;\r\n\r\n const shouldShowLabel = !!this.label && this.smartFacets.length > 0;\r\n return html`\r\n <div id=\"smart-facets-container\">\r\n ${this.filtersToggleTemplate}\r\n ${shouldShowLabel\r\n ? html`<p id=\"filters-label\">${this.label}</p>`\r\n : nothing}\r\n ${repeat(\r\n this.smartFacets,\r\n f =>\r\n `${f[0].label}|${f[0].facets[0].facetType}|${f[0].facets[0].bucketKey}`,\r\n facet => this.makeSmartFacet(facet),\r\n )}\r\n </div>\r\n `;\r\n }\r\n\r\n protected willUpdate(changed: PropertyValues): void {\r\n let shouldUpdateSmartFacets = false;\r\n\r\n if (changed.has('query')) {\r\n log('query change', changed.get('query'), this.query);\r\n this.lastAggregations = undefined;\r\n shouldUpdateSmartFacets = true;\r\n }\r\n\r\n if (\r\n changed.has('aggregations') &&\r\n !this.lastAggregations &&\r\n this.aggregations &&\r\n Object.keys(this.aggregations).length > 0\r\n ) {\r\n log('aggs change', changed.get('aggregations'), this.aggregations);\r\n this.lastAggregations = this.aggregations;\r\n shouldUpdateSmartFacets = true;\r\n }\r\n\r\n if (shouldUpdateSmartFacets) {\r\n log('should update smart facets, doing so...');\r\n this.updateSmartFacets();\r\n }\r\n }\r\n\r\n refresh(): void {\r\n this.lastAggregations = this.aggregations;\r\n this.updateSmartFacets();\r\n }\r\n\r\n deselectAll(): void {\r\n for (const sf of this.smartFacets) {\r\n for (const facet of sf) {\r\n facet.selected = false;\r\n }\r\n }\r\n this.requestUpdate();\r\n }\r\n\r\n private async updateSmartFacets(): Promise<void> {\r\n log('updating smart facets');\r\n if (this.query) {\r\n this.heuristicRecs =\r\n await new SmartQueryHeuristicGroup().getRecommendedFacets(this.query);\r\n log('heuristic recs are', this.heuristicRecs);\r\n this.smartFacets = dedupe(this.facetsToDisplay);\r\n log('smart facets are', this.smartFacets);\r\n }\r\n }\r\n\r\n //\r\n // OTHER METHODS\r\n //\r\n\r\n private makeSmartFacet(facets: SmartFacet[]) {\r\n if (facets.length === 0) {\r\n return nothing;\r\n }\r\n if (facets.length === 1) {\r\n return this.smartFacetButton(facets[0]);\r\n }\r\n return this.smartFacetDropdown(facets);\r\n }\r\n\r\n private smartFacetButton(facet: SmartFacet) {\r\n return html`\r\n <smart-facet-button\r\n .facetInfo=${facet}\r\n .labelPrefix=${fieldPrefixes[facet.facets[0].facetType]}\r\n .selected=${facet.selected ?? false}\r\n @facetClick=${this.facetClicked}\r\n ></smart-facet-button>\r\n `;\r\n }\r\n\r\n private smartFacetDropdown(facets: SmartFacet[]) {\r\n return html`\r\n <smart-facet-dropdown\r\n .facetInfo=${facets}\r\n .labelPrefix=${fieldPrefixes[facets[0].facets[0].facetType]}\r\n .activeFacetRef=${facets[0].facets[0]}\r\n @facetClick=${this.dropdownOptionClicked}\r\n @dropdownClick=${this.dropdownClicked}\r\n ></smart-facet-dropdown>\r\n `;\r\n }\r\n\r\n private get filtersToggleTemplate(): TemplateResult | typeof nothing {\r\n if (!this.filterToggleShown) return nothing;\r\n\r\n return html`\r\n <button\r\n id=\"filters-toggle\"\r\n class=${this.filterToggleActive ? 'active' : ''}\r\n title=\"${this.filterToggleActive ? 'Hide' : 'Show'} filters pane\"\r\n @click=${this.filterToggleClicked}\r\n >\r\n ${filterIcon}\r\n </button>\r\n `;\r\n }\r\n\r\n private get facetsToDisplay(): SmartFacet[][] {\r\n const facets: SmartFacet[][] = [];\r\n\r\n if (this.heuristicRecs.length > 0) {\r\n for (const rec of this.heuristicRecs) {\r\n // Suppress mediatype-only facets for now.\r\n if (rec.facets.length === 1 && rec.facets[0].facetType === 'mediatype')\r\n continue;\r\n\r\n facets.push([rec]);\r\n }\r\n }\r\n\r\n if (this.lastAggregations) {\r\n const keys = [\r\n 'mediatype',\r\n 'year',\r\n 'language',\r\n 'creator',\r\n 'subject',\r\n 'collection',\r\n ];\r\n for (const key of keys) {\r\n const agg = this.lastAggregations[key];\r\n if (!agg) continue;\r\n if (agg.buckets.length === 0) continue;\r\n if (['lending', 'year_histogram', 'date_histogram'].includes(key))\r\n continue;\r\n if (typeof agg.buckets[0] === 'number') continue;\r\n\r\n if (\r\n key === 'mediatype' &&\r\n this.selectedFacets &&\r\n Object.values(this.selectedFacets.mediatype ?? {}).some(\r\n bucket => bucket.state !== 'none',\r\n )\r\n ) {\r\n continue;\r\n }\r\n\r\n const facetType = key as FacetOption;\r\n const buckets = agg.buckets as Bucket[];\r\n\r\n const unusedBuckets = buckets.filter(b => {\r\n const selectedFacetBucket = this.selectedFacets?.[facetType]?.[b.key];\r\n if (selectedFacetBucket && selectedFacetBucket.state !== 'none') {\r\n return false;\r\n }\r\n return true;\r\n });\r\n\r\n if (facetType === 'mediatype') {\r\n continue;\r\n // Don't include mediatype bubbles\r\n } else if (facetType === 'collection' || facetType === 'subject') {\r\n const topBuckets = unusedBuckets.slice(0, 5);\r\n facets.push(topBuckets.map(b => this.toSmartFacet(facetType, [b])));\r\n } else {\r\n facets.push([this.toSmartFacet(facetType, [unusedBuckets[0]])]);\r\n }\r\n }\r\n }\r\n\r\n return facets;\r\n }\r\n\r\n private toSmartFacet(\r\n facetType: FacetOption,\r\n buckets: Bucket[],\r\n // prefix = true\r\n ): SmartFacet {\r\n return {\r\n facets: buckets.map(bucket => {\r\n let displayText = capitalize(bucket.key.toString());\r\n if (facetType === 'collection') {\r\n const title = this.collectionTitles?.get(bucket.key.toString());\r\n if (title) displayText = title;\r\n }\r\n\r\n return {\r\n facetType,\r\n bucketKey: bucket.key.toString(),\r\n displayText,\r\n };\r\n }),\r\n } as SmartFacet;\r\n }\r\n\r\n /**\r\n * Toggles the state of the given smart facet, and updates the selected facets accordingly.\r\n */\r\n private toggleSmartFacet(\r\n facet: SmartFacet,\r\n details: FacetEventDetails[],\r\n ): void {\r\n let newState: FacetState;\r\n if (facet.selected) {\r\n // When deselected, leave the smart facet where it is\r\n newState = 'none';\r\n this.smartFacets = this.smartFacets.map(f => {\r\n if (f[0] === facet) return [{ ...facet, selected: false }];\r\n return f;\r\n });\r\n } else {\r\n // When selected, move the toggled smart facet to the front of the list\r\n newState = 'selected';\r\n this.smartFacets = [\r\n [{ ...facet, selected: true }],\r\n ...this.smartFacets.filter(f => f[0] !== facet),\r\n ];\r\n }\r\n\r\n this.updateSelectedFacets(\r\n details.map(facet => ({\r\n ...facet,\r\n bucket: {\r\n ...facet.bucket,\r\n state: newState,\r\n },\r\n })),\r\n );\r\n }\r\n\r\n /**\r\n * Updates the selected facet buckets for each of the given facets,\r\n * and emits a `facetsChanged` event to notify parent components of\r\n * the new state.\r\n */\r\n private updateSelectedFacets(facets: FacetEventDetails[]): void {\r\n for (const facet of facets) {\r\n this.selectedFacets = updateSelectedFacetBucket(\r\n this.selectedFacets,\r\n facet.facetType,\r\n facet.bucket,\r\n true,\r\n );\r\n }\r\n\r\n const event = new CustomEvent<SelectedFacets>('facetsChanged', {\r\n detail: this.selectedFacets,\r\n });\r\n this.dispatchEvent(event);\r\n }\r\n\r\n /**\r\n * Handler for when a smart facet button is clicked\r\n */\r\n private facetClicked(e: CustomEvent<SmartFacetEvent>): void {\r\n this.toggleSmartFacet(e.detail.smartFacet, e.detail.details);\r\n }\r\n\r\n /**\r\n * Handler for when an option in a smart facet dropdown menu is selected\r\n */\r\n private dropdownOptionClicked(e: CustomEvent<SmartFacetEvent>): void {\r\n const existingFacet = this.smartFacets.find(\r\n sf => sf.length === 1 && smartFacetEquals(sf[0], e.detail.smartFacet),\r\n );\r\n if (existingFacet) {\r\n // The facet already exists outside the dropdown, so just select it there\r\n this.toggleSmartFacet(existingFacet[0], e.detail.details);\r\n return;\r\n }\r\n\r\n // Otherwise, prepend a new smart facet for the selected option\r\n this.smartFacets = [\r\n [{ ...e.detail.smartFacet, selected: true }],\r\n ...this.smartFacets,\r\n ];\r\n\r\n this.updateSelectedFacets(e.detail.details);\r\n }\r\n\r\n /**\r\n * Handler for when any dropdown is clicked (whether button, caret, or menu item)\r\n */\r\n private dropdownClicked(e: CustomEvent<SmartFacetDropdown>): void {\r\n log('smart bar: onDropdownClick', e.detail);\r\n this.shadowRoot\r\n ?.querySelectorAll('smart-facet-dropdown')\r\n .forEach(dropdown => {\r\n if (dropdown !== e.detail) {\r\n log('closing', dropdown);\r\n (dropdown as SmartFacetDropdown).close();\r\n }\r\n });\r\n }\r\n\r\n private filterToggleClicked(): void {\r\n this.dispatchEvent(new CustomEvent('filtersToggled'));\r\n }\r\n\r\n //\r\n // STYLES\r\n //\r\n\r\n static get styles(): CSSResultGroup {\r\n return css`\r\n #smart-facets-container {\r\n display: flex;\r\n align-items: center;\r\n gap: 5px 10px;\r\n padding: 10px 0;\r\n white-space: nowrap;\r\n overflow: scroll hidden;\r\n scrollbar-width: none;\r\n }\r\n\r\n #filters-toggle {\r\n margin: 0;\r\n border: 0;\r\n padding: 5px 8px;\r\n border-radius: 5px;\r\n background: white;\r\n color: #2c2c2c;\r\n border: 1px solid #194880;\r\n font-size: 1.4rem;\r\n font-family: inherit;\r\n text-decoration: none;\r\n cursor: pointer;\r\n }\r\n\r\n #filters-toggle.active {\r\n background: #194880;\r\n color: white;\r\n }\r\n\r\n #filters-toggle > svg {\r\n width: 12px;\r\n filter: invert(0.16667);\r\n vertical-align: -1px;\r\n }\r\n\r\n #filters-toggle.active > svg {\r\n filter: invert(1);\r\n }\r\n\r\n #filters-label {\r\n font-size: 1.4rem;\r\n font-weight: var(--smartFacetLabelFontWeight, normal);\r\n margin: 0 -5px 0 0;\r\n }\r\n `;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"smart-facet-bar.js","sourceRoot":"","sources":["../../../../src/collection-facets/smart-facets/smart-facet-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU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lit/directives/repeat.js';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport type { Aggregation, Bucket } from '@internetarchive/search-service';\nimport type { CollectionTitles } from '../../data-source/models';\nimport type {\n FacetEventDetails,\n FacetOption,\n FacetState,\n SelectedFacets,\n} from '../../models';\nimport { updateSelectedFacetBucket } from '../../utils/facet-utils';\nimport { SmartQueryHeuristicGroup } from './smart-facet-heuristics';\nimport type { SmartFacetDropdown } from './smart-facet-dropdown';\nimport type { SmartFacet, SmartFacetEvent } from './models';\nimport { smartFacetEquals } from './smart-facet-equals';\nimport { dedupe } from './dedupe';\nimport { log } from '../../utils/log';\nimport filterIcon from '../../assets/img/icons/filter';\n\nimport './smart-facet-button';\nimport './smart-facet-dropdown';\n\nconst fieldPrefixes: Partial<Record<FacetOption, string>> = {\n collection: 'Collection: ',\n creator: 'By: ',\n subject: 'About: ',\n};\n\nfunction capitalize(str: string) {\n return str.charAt(0).toUpperCase() + str.slice(1);\n}\n\n@customElement('smart-facet-bar')\nexport class SmartFacetBar extends LitElement {\n @property({ type: String }) query?: string;\n\n @property({ type: Object }) aggregations?: Record<string, Aggregation>;\n\n @property({ type: Object }) selectedFacets?: SelectedFacets;\n\n /** The map from collection identifiers to their titles */\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @property({ type: Boolean }) filterToggleShown = false;\n\n @property({ type: Boolean }) filterToggleActive = false;\n\n @property({ type: String }) label?: string;\n\n @state() private heuristicRecs: SmartFacet[] = [];\n\n @state() private smartFacets: SmartFacet[][] = [];\n\n @state() private lastAggregations?: Record<string, Aggregation>;\n\n //\n // COMPONENT LIFECYCLE METHODS\n //\n\n render() {\n if (!this.query) return nothing;\n\n const shouldShowLabel = !!this.label && this.smartFacets.length > 0;\n return html`\n <div id=\"smart-facets-container\">\n ${this.filtersToggleTemplate}\n ${shouldShowLabel\n ? html`<p id=\"filters-label\">${this.label}</p>`\n : nothing}\n ${repeat(\n this.smartFacets,\n f =>\n `${f[0].label}|${f[0].facets[0].facetType}|${f[0].facets[0].bucketKey}`,\n facet => this.makeSmartFacet(facet),\n )}\n </div>\n `;\n }\n\n protected willUpdate(changed: PropertyValues): void {\n let shouldUpdateSmartFacets = false;\n\n if (changed.has('query')) {\n log('query change', changed.get('query'), this.query);\n this.lastAggregations = undefined;\n shouldUpdateSmartFacets = true;\n }\n\n if (\n changed.has('aggregations') &&\n !this.lastAggregations &&\n this.aggregations &&\n Object.keys(this.aggregations).length > 0\n ) {\n log('aggs change', changed.get('aggregations'), this.aggregations);\n this.lastAggregations = this.aggregations;\n shouldUpdateSmartFacets = true;\n }\n\n if (shouldUpdateSmartFacets) {\n log('should update smart facets, doing so...');\n this.updateSmartFacets();\n }\n }\n\n refresh(): void {\n this.lastAggregations = this.aggregations;\n this.updateSmartFacets();\n }\n\n deselectAll(): void {\n for (const sf of this.smartFacets) {\n for (const facet of sf) {\n facet.selected = false;\n }\n }\n this.requestUpdate();\n }\n\n private async updateSmartFacets(): Promise<void> {\n log('updating smart facets');\n if (this.query) {\n this.heuristicRecs =\n await new SmartQueryHeuristicGroup().getRecommendedFacets(this.query);\n log('heuristic recs are', this.heuristicRecs);\n this.smartFacets = dedupe(this.facetsToDisplay);\n log('smart facets are', this.smartFacets);\n }\n }\n\n //\n // OTHER METHODS\n //\n\n private makeSmartFacet(facets: SmartFacet[]) {\n if (facets.length === 0) {\n return nothing;\n }\n if (facets.length === 1) {\n return this.smartFacetButton(facets[0]);\n }\n return this.smartFacetDropdown(facets);\n }\n\n private smartFacetButton(facet: SmartFacet) {\n return html`\n <smart-facet-button\n .facetInfo=${facet}\n .labelPrefix=${fieldPrefixes[facet.facets[0].facetType]}\n .selected=${facet.selected ?? false}\n @facetClick=${this.facetClicked}\n ></smart-facet-button>\n `;\n }\n\n private smartFacetDropdown(facets: SmartFacet[]) {\n return html`\n <smart-facet-dropdown\n .facetInfo=${facets}\n .labelPrefix=${fieldPrefixes[facets[0].facets[0].facetType]}\n .activeFacetRef=${facets[0].facets[0]}\n @facetClick=${this.dropdownOptionClicked}\n @dropdownClick=${this.dropdownClicked}\n ></smart-facet-dropdown>\n `;\n }\n\n private get filtersToggleTemplate(): TemplateResult | typeof nothing {\n if (!this.filterToggleShown) return nothing;\n\n return html`\n <button\n id=\"filters-toggle\"\n class=${this.filterToggleActive ? 'active' : ''}\n title=\"${this.filterToggleActive ? 'Hide' : 'Show'} filters pane\"\n @click=${this.filterToggleClicked}\n >\n ${filterIcon}\n </button>\n `;\n }\n\n private get facetsToDisplay(): SmartFacet[][] {\n const facets: SmartFacet[][] = [];\n\n if (this.heuristicRecs.length > 0) {\n for (const rec of this.heuristicRecs) {\n // Suppress mediatype-only facets for now.\n if (rec.facets.length === 1 && rec.facets[0].facetType === 'mediatype')\n continue;\n\n facets.push([rec]);\n }\n }\n\n if (this.lastAggregations) {\n const keys = [\n 'mediatype',\n 'year',\n 'language',\n 'creator',\n 'subject',\n 'collection',\n ];\n for (const key of keys) {\n const agg = this.lastAggregations[key];\n if (!agg) continue;\n if (agg.buckets.length === 0) continue;\n if (['lending', 'year_histogram', 'date_histogram'].includes(key))\n continue;\n if (typeof agg.buckets[0] === 'number') continue;\n\n if (\n key === 'mediatype' &&\n this.selectedFacets &&\n Object.values(this.selectedFacets.mediatype ?? {}).some(\n bucket => bucket.state !== 'none',\n )\n ) {\n continue;\n }\n\n const facetType = key as FacetOption;\n const buckets = agg.buckets as Bucket[];\n\n const unusedBuckets = buckets.filter(b => {\n const selectedFacetBucket = this.selectedFacets?.[facetType]?.[b.key];\n if (selectedFacetBucket && selectedFacetBucket.state !== 'none') {\n return false;\n }\n return true;\n });\n\n if (facetType === 'mediatype') {\n continue;\n // Don't include mediatype bubbles\n } else if (facetType === 'collection' || facetType === 'subject') {\n const topBuckets = unusedBuckets.slice(0, 5);\n facets.push(topBuckets.map(b => this.toSmartFacet(facetType, [b])));\n } else {\n facets.push([this.toSmartFacet(facetType, [unusedBuckets[0]])]);\n }\n }\n }\n\n return facets;\n }\n\n private toSmartFacet(\n facetType: FacetOption,\n buckets: Bucket[],\n // prefix = true\n ): SmartFacet {\n return {\n facets: buckets.map(bucket => {\n let displayText = capitalize(bucket.key.toString());\n if (facetType === 'collection') {\n const title = this.collectionTitles?.get(bucket.key.toString());\n if (title) displayText = title;\n }\n\n return {\n facetType,\n bucketKey: bucket.key.toString(),\n displayText,\n };\n }),\n } as SmartFacet;\n }\n\n /**\n * Toggles the state of the given smart facet, and updates the selected facets accordingly.\n */\n private toggleSmartFacet(\n facet: SmartFacet,\n details: FacetEventDetails[],\n ): void {\n let newState: FacetState;\n if (facet.selected) {\n // When deselected, leave the smart facet where it is\n newState = 'none';\n this.smartFacets = this.smartFacets.map(f => {\n if (f[0] === facet) return [{ ...facet, selected: false }];\n return f;\n });\n } else {\n // When selected, move the toggled smart facet to the front of the list\n newState = 'selected';\n this.smartFacets = [\n [{ ...facet, selected: true }],\n ...this.smartFacets.filter(f => f[0] !== facet),\n ];\n }\n\n this.updateSelectedFacets(\n details.map(facet => ({\n ...facet,\n bucket: {\n ...facet.bucket,\n state: newState,\n },\n })),\n );\n }\n\n /**\n * Updates the selected facet buckets for each of the given facets,\n * and emits a `facetsChanged` event to notify parent components of\n * the new state.\n */\n private updateSelectedFacets(facets: FacetEventDetails[]): void {\n for (const facet of facets) {\n this.selectedFacets = updateSelectedFacetBucket(\n this.selectedFacets,\n facet.facetType,\n facet.bucket,\n true,\n );\n }\n\n const event = new CustomEvent<SelectedFacets>('facetsChanged', {\n detail: this.selectedFacets,\n });\n this.dispatchEvent(event);\n }\n\n /**\n * Handler for when a smart facet button is clicked\n */\n private facetClicked(e: CustomEvent<SmartFacetEvent>): void {\n this.toggleSmartFacet(e.detail.smartFacet, e.detail.details);\n }\n\n /**\n * Handler for when an option in a smart facet dropdown menu is selected\n */\n private dropdownOptionClicked(e: CustomEvent<SmartFacetEvent>): void {\n const existingFacet = this.smartFacets.find(\n sf => sf.length === 1 && smartFacetEquals(sf[0], e.detail.smartFacet),\n );\n if (existingFacet) {\n // The facet already exists outside the dropdown, so just select it there\n this.toggleSmartFacet(existingFacet[0], e.detail.details);\n return;\n }\n\n // Otherwise, prepend a new smart facet for the selected option\n this.smartFacets = [\n [{ ...e.detail.smartFacet, selected: true }],\n ...this.smartFacets,\n ];\n\n this.updateSelectedFacets(e.detail.details);\n }\n\n /**\n * Handler for when any dropdown is clicked (whether button, caret, or menu item)\n */\n private dropdownClicked(e: CustomEvent<SmartFacetDropdown>): void {\n log('smart bar: onDropdownClick', e.detail);\n this.shadowRoot\n ?.querySelectorAll('smart-facet-dropdown')\n .forEach(dropdown => {\n if (dropdown !== e.detail) {\n log('closing', dropdown);\n (dropdown as SmartFacetDropdown).close();\n }\n });\n }\n\n private filterToggleClicked(): void {\n this.dispatchEvent(new CustomEvent('filtersToggled'));\n }\n\n //\n // STYLES\n //\n\n static get styles(): CSSResultGroup {\n return css`\n #smart-facets-container {\n display: flex;\n align-items: center;\n gap: 5px 10px;\n padding: 10px 0;\n white-space: nowrap;\n overflow: scroll hidden;\n scrollbar-width: none;\n }\n\n #filters-toggle {\n margin: 0;\n border: 0;\n padding: 5px 8px;\n border-radius: 5px;\n background: white;\n color: #2c2c2c;\n border: 1px solid #194880;\n font-size: 1.4rem;\n font-family: inherit;\n text-decoration: none;\n cursor: pointer;\n }\n\n #filters-toggle.active {\n background: #194880;\n color: white;\n }\n\n #filters-toggle > svg {\n width: 12px;\n filter: invert(0.16667);\n vertical-align: -1px;\n }\n\n #filters-toggle.active > svg {\n filter: invert(1);\n }\n\n #filters-label {\n font-size: 1.4rem;\n font-weight: var(--smartFacetLabelFontWeight, normal);\n margin: 0 -5px 0 0;\n }\n `;\n }\n}\n"]}
|
|
@@ -15,30 +15,30 @@ let SmartFacetDropdown = class SmartFacetDropdown extends LitElement {
|
|
|
15
15
|
const displayText = (_a = this.activeFacetRef.displayText) !== null && _a !== void 0 ? _a : this.activeFacetRef.bucketKey;
|
|
16
16
|
if (!displayText)
|
|
17
17
|
return nothing;
|
|
18
|
-
return html `
|
|
19
|
-
<div class="dropdown-container">
|
|
20
|
-
<ia-dropdown
|
|
21
|
-
class="dropdown"
|
|
22
|
-
displayCaret
|
|
23
|
-
closeOnSelect
|
|
24
|
-
closeOnEscape
|
|
25
|
-
closeOnBackdropClick
|
|
26
|
-
includeSelectedOption
|
|
27
|
-
usePopover
|
|
28
|
-
.options=${this.dropdownOptions}
|
|
29
|
-
.selectedOption=${this.activeDropdownOption}
|
|
30
|
-
.openViaButton=${false}
|
|
31
|
-
@optionSelected=${this.optionSelected}
|
|
32
|
-
@click=${this.onDropdownClick}
|
|
33
|
-
>
|
|
34
|
-
<span
|
|
35
|
-
class="dropdown-label"
|
|
36
|
-
slot="dropdown-label"
|
|
37
|
-
@click=${this.defaultOptionSelected}
|
|
38
|
-
>${(_b = this.labelPrefix) !== null && _b !== void 0 ? _b : nothing} ${displayText}</span
|
|
39
|
-
>
|
|
40
|
-
</ia-dropdown>
|
|
41
|
-
</div>
|
|
18
|
+
return html `
|
|
19
|
+
<div class="dropdown-container">
|
|
20
|
+
<ia-dropdown
|
|
21
|
+
class="dropdown"
|
|
22
|
+
displayCaret
|
|
23
|
+
closeOnSelect
|
|
24
|
+
closeOnEscape
|
|
25
|
+
closeOnBackdropClick
|
|
26
|
+
includeSelectedOption
|
|
27
|
+
usePopover
|
|
28
|
+
.options=${this.dropdownOptions}
|
|
29
|
+
.selectedOption=${this.activeDropdownOption}
|
|
30
|
+
.openViaButton=${false}
|
|
31
|
+
@optionSelected=${this.optionSelected}
|
|
32
|
+
@click=${this.onDropdownClick}
|
|
33
|
+
>
|
|
34
|
+
<span
|
|
35
|
+
class="dropdown-label"
|
|
36
|
+
slot="dropdown-label"
|
|
37
|
+
@click=${this.defaultOptionSelected}
|
|
38
|
+
>${(_b = this.labelPrefix) !== null && _b !== void 0 ? _b : nothing} ${displayText}</span
|
|
39
|
+
>
|
|
40
|
+
</ia-dropdown>
|
|
41
|
+
</div>
|
|
42
42
|
`;
|
|
43
43
|
}
|
|
44
44
|
//
|
|
@@ -51,8 +51,8 @@ let SmartFacetDropdown = class SmartFacetDropdown extends LitElement {
|
|
|
51
51
|
const firstFacet = smartFacet.facets[0];
|
|
52
52
|
return {
|
|
53
53
|
id: firstFacet.bucketKey,
|
|
54
|
-
label: html `<span>
|
|
55
|
-
${(_b = (_a = smartFacet.label) !== null && _a !== void 0 ? _a : firstFacet.displayText) !== null && _b !== void 0 ? _b : firstFacet.bucketKey}
|
|
54
|
+
label: html `<span>
|
|
55
|
+
${(_b = (_a = smartFacet.label) !== null && _a !== void 0 ? _a : firstFacet.displayText) !== null && _b !== void 0 ? _b : firstFacet.bucketKey}
|
|
56
56
|
</span>`,
|
|
57
57
|
};
|
|
58
58
|
})) !== null && _b !== void 0 ? _b : []);
|
|
@@ -122,34 +122,34 @@ let SmartFacetDropdown = class SmartFacetDropdown extends LitElement {
|
|
|
122
122
|
// STYLES
|
|
123
123
|
//
|
|
124
124
|
static get styles() {
|
|
125
|
-
return css `
|
|
126
|
-
.dropdown-container {
|
|
127
|
-
padding: 5px 5px;
|
|
128
|
-
border-radius: 5px;
|
|
129
|
-
background: white;
|
|
130
|
-
color: #2c2c2c;
|
|
131
|
-
border: 1px solid #194880;
|
|
132
|
-
font-size: 1.4rem;
|
|
133
|
-
font-family: inherit;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.dropdown-label {
|
|
137
|
-
font-size: 1.4rem;
|
|
138
|
-
font-family: inherit;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.dropdown {
|
|
142
|
-
--dropdownBorderColor: #194880;
|
|
143
|
-
--dropdownBorderWidth: 1px;
|
|
144
|
-
--dropdownBgColor: white;
|
|
145
|
-
--dropdownHoverBgColor: #f8f8f8;
|
|
146
|
-
--dropdownTextColor: #2c2c2c;
|
|
147
|
-
--dropdownHoverTextColor: #2c2c2c;
|
|
148
|
-
--dropdownCaretColor: #2c2c2c;
|
|
149
|
-
--dropdownWhiteSpace: nowrap;
|
|
150
|
-
--caretWidth: 14px;
|
|
151
|
-
--caretHeight: 14px;
|
|
152
|
-
}
|
|
125
|
+
return css `
|
|
126
|
+
.dropdown-container {
|
|
127
|
+
padding: 5px 5px;
|
|
128
|
+
border-radius: 5px;
|
|
129
|
+
background: white;
|
|
130
|
+
color: #2c2c2c;
|
|
131
|
+
border: 1px solid #194880;
|
|
132
|
+
font-size: 1.4rem;
|
|
133
|
+
font-family: inherit;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.dropdown-label {
|
|
137
|
+
font-size: 1.4rem;
|
|
138
|
+
font-family: inherit;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.dropdown {
|
|
142
|
+
--dropdownBorderColor: #194880;
|
|
143
|
+
--dropdownBorderWidth: 1px;
|
|
144
|
+
--dropdownBgColor: white;
|
|
145
|
+
--dropdownHoverBgColor: #f8f8f8;
|
|
146
|
+
--dropdownTextColor: #2c2c2c;
|
|
147
|
+
--dropdownHoverTextColor: #2c2c2c;
|
|
148
|
+
--dropdownCaretColor: #2c2c2c;
|
|
149
|
+
--dropdownWhiteSpace: nowrap;
|
|
150
|
+
--caretWidth: 14px;
|
|
151
|
+
--caretHeight: 14px;
|
|
152
|
+
}
|
|
153
153
|
`;
|
|
154
154
|
}
|
|
155
155
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"smart-facet-dropdown.js","sourceRoot":"","sources":["../../../../src/collection-facets/smart-facets/smart-facet-dropdown.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG/B,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAShD,EAAE;IACF,8BAA8B;IAC9B,EAAE;IAEF,MAAM;;QACJ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B,GAAG,CAAC,iCAAiC,EAAE,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAqB,eAAe,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CACvE,CAAC;IACJ,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,EAAE;IACF,SAAS;IACT,EAAE;IAEF,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BT,CAAC;IACJ,CAAC;CACF,CAAA;AAhL4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAA0B;AAExB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAsB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAA2B;AAEhC;IAArB,KAAK,CAAC,aAAa,CAAC;oDAAuB;AAPjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAiL9B","sourcesContent":["import { css, html, LitElement, CSSResultGroup, nothing } from 'lit';\
|
|
1
|
+
{"version":3,"file":"smart-facet-dropdown.js","sourceRoot":"","sources":["../../../../src/collection-facets/smart-facets/smart-facet-dropdown.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAkB,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAGnE,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAG/B,IAAM,kBAAkB,GAAxB,MAAM,kBAAmB,SAAQ,UAAU;IAShD,EAAE;IACF,8BAA8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AAC;IACJ,CAAC;IAEO,eAAe;QACrB,GAAG,CAAC,iCAAiC,EAAE,IAAI,CAAC,CAAC;QAC7C,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAqB,eAAe,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CACvE,CAAC;IACJ,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClB,IAAI,CAAC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;QAC7B,CAAC;IACH,CAAC;IAED,EAAE;IACF,SAAS;IACT,EAAE;IAEF,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4BT,CAAC;IACJ,CAAC;CACF,CAAA;AAhL4B;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;qDAA0B;AAExB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAsB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAA2B;AAEhC;IAArB,KAAK,CAAC,aAAa,CAAC;oDAAuB;AAPjC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CAiL9B","sourcesContent":["import { css, html, LitElement, CSSResultGroup, nothing } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport type { IaDropdown, optionInterface } from '@internetarchive/ia-dropdown';\nimport type { FacetRef, SmartFacet, SmartFacetEvent } from './models';\nimport { log } from '../../utils/log';\n\n@customElement('smart-facet-dropdown')\nexport class SmartFacetDropdown extends LitElement {\n @property({ type: Array }) facetInfo?: SmartFacet[];\n\n @property({ type: String }) labelPrefix?: string;\n\n @property({ type: Object }) activeFacetRef?: FacetRef;\n\n @query('ia-dropdown') dropdown?: IaDropdown;\n\n //\n // COMPONENT LIFECYCLE METHODS\n //\n\n render() {\n if (!this.facetInfo || !this.activeFacetRef) return nothing;\n if (this.facetInfo.length === 0) return nothing;\n\n const displayText =\n this.activeFacetRef.displayText ?? this.activeFacetRef.bucketKey;\n if (!displayText) return nothing;\n\n return html`\n <div class=\"dropdown-container\">\n <ia-dropdown\n class=\"dropdown\"\n displayCaret\n closeOnSelect\n closeOnEscape\n closeOnBackdropClick\n includeSelectedOption\n usePopover\n .options=${this.dropdownOptions}\n .selectedOption=${this.activeDropdownOption}\n .openViaButton=${false}\n @optionSelected=${this.optionSelected}\n @click=${this.onDropdownClick}\n >\n <span\n class=\"dropdown-label\"\n slot=\"dropdown-label\"\n @click=${this.defaultOptionSelected}\n >${this.labelPrefix ?? nothing} ${displayText}</span\n >\n </ia-dropdown>\n </div>\n `;\n }\n\n //\n // OTHER METHODS\n //\n\n private get dropdownOptions(): optionInterface[] {\n return (\n this.facetInfo?.map(smartFacet => {\n const firstFacet = smartFacet.facets[0];\n return {\n id: firstFacet.bucketKey,\n label: html`<span>\n ${smartFacet.label ??\n firstFacet.displayText ??\n firstFacet.bucketKey}\n </span>`,\n };\n }) ?? []\n );\n }\n\n private get activeDropdownOption(): optionInterface | undefined {\n if (!this.activeFacetRef) return undefined;\n return this.dropdownOptions.find(\n opt => opt.id === this.activeFacetRef?.bucketKey,\n );\n }\n\n /**\n * Handler for when the default option on the dropdown button is clicked\n */\n private defaultOptionSelected(): void {\n this.handleSelection(this.activeFacetRef?.bucketKey);\n }\n\n /**\n * Handler for when an option in the dropdown menu is selected\n */\n private optionSelected(e: CustomEvent<{ option: optionInterface }>): void {\n this.handleSelection(e.detail.option.id);\n }\n\n /**\n * Responds to a dropdown selection by emitting a `facetClick` event with\n * the appropriate facet details.\n */\n private handleSelection(bucketKey?: string): void {\n if (!bucketKey || !this.facetInfo || !this.activeFacetRef) return;\n\n let selectedSmartFacet;\n for (const smartFacet of this.facetInfo) {\n const selectedRef = smartFacet.facets.find(\n b => b.bucketKey === bucketKey,\n );\n if (selectedRef) {\n this.activeFacetRef = selectedRef;\n selectedSmartFacet = smartFacet;\n }\n }\n\n if (!selectedSmartFacet) return;\n\n this.dispatchEvent(\n new CustomEvent<SmartFacetEvent>('facetClick', {\n detail: {\n smartFacet: selectedSmartFacet,\n details: [\n {\n facetType: this.activeFacetRef.facetType,\n bucket: {\n key: this.activeFacetRef.bucketKey,\n count: 0,\n state: 'selected',\n },\n negative: false,\n },\n ],\n },\n }),\n );\n }\n\n private onDropdownClick(): void {\n log('smart dropdown: onDropdownClick', this);\n this.dispatchEvent(\n new CustomEvent<SmartFacetDropdown>('dropdownClick', { detail: this }),\n );\n }\n\n close(): void {\n if (this.dropdown) {\n this.dropdown.open = false;\n }\n }\n\n //\n // STYLES\n //\n\n static get styles(): CSSResultGroup {\n return css`\n .dropdown-container {\n padding: 5px 5px;\n border-radius: 5px;\n background: white;\n color: #2c2c2c;\n border: 1px solid #194880;\n font-size: 1.4rem;\n font-family: inherit;\n }\n\n .dropdown-label {\n font-size: 1.4rem;\n font-family: inherit;\n }\n\n .dropdown {\n --dropdownBorderColor: #194880;\n --dropdownBorderWidth: 1px;\n --dropdownBgColor: white;\n --dropdownHoverBgColor: #f8f8f8;\n --dropdownTextColor: #2c2c2c;\n --dropdownHoverTextColor: #2c2c2c;\n --dropdownCaretColor: #2c2c2c;\n --dropdownWhiteSpace: nowrap;\n --caretWidth: 14px;\n --caretHeight: 14px;\n }\n `;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collection-browser-data-source-interface.js","sourceRoot":"","sources":["../../../src/data-source/collection-browser-data-source-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type {\r\n FilterMap,\r\n Aggregation,\r\n CollectionExtraInfo,\r\n AccountExtraInfo,\r\n PageElementMap,\r\n SearchResponseSessionContext,\r\n} from '@internetarchive/search-service';\r\nimport type { ReactiveController } from 'lit';\r\nimport type {\r\n PrefixFilterType,\r\n PrefixFilterCounts,\r\n TileModel,\r\n} from '../models';\r\nimport type {\r\n PageSpecifierParams,\r\n CollectionTitles,\r\n TVChannelAliases,\r\n} from './models';\r\n\r\nexport interface CollectionBrowserDataSourceInterface\r\n extends ReactiveController {\r\n /**\r\n * How many tile models are present in this data source\r\n */\r\n readonly size: number;\r\n\r\n /**\r\n * How many results there are in the full result set for the current query\r\n * (not necessarily all loaded yet).\r\n */\r\n readonly totalResults: number;\r\n\r\n /**\r\n * Whether the host has a valid set of properties for performing a search.\r\n * For instance, on the search page this requires a valid search service and a\r\n * non-empty query, while collection pages allow searching with an empty query\r\n * for MDS but not FTS.\r\n */\r\n readonly canPerformSearch: boolean;\r\n\r\n /**\r\n * Whether the end of the set of results for the current query state has been\r\n * encountered (i.e., the last page of results).\r\n */\r\n readonly endOfDataReached: boolean;\r\n\r\n /**\r\n * True if the initial work for a new query state has been completed (i.e., firing initial\r\n * page/facet requests). False otherwise.\r\n */\r\n readonly queryInitialized: boolean;\r\n\r\n /**\r\n * A string key compactly representing the current full search state, which can\r\n * be used to determine, e.g., when a new search is required or whether an arriving\r\n * response is outdated.\r\n */\r\n readonly pageFetchQueryKey: string;\r\n\r\n /**\r\n * Similar to `pageFetchQueryKey`, but excluding properties that do not affect\r\n * the validity of a set of facets (e.g., sort).\r\n */\r\n readonly facetFetchQueryKey: string;\r\n\r\n /**\r\n * An object representing any collection- or profile-specific properties to be passed along\r\n * to the search service, specifying the exact page/tab to fetch results for.\r\n */\r\n readonly pageSpecifierParams: PageSpecifierParams | null;\r\n\r\n /**\r\n * A FilterMap object representing all filters applied to the current search,\r\n * including any facets, letter filters, and date ranges.\r\n */\r\n readonly filterMap: FilterMap;\r\n\r\n /**\r\n * The full set of aggregations retrieved for the current search.\r\n */\r\n readonly aggregations?: Record<string, Aggregation>;\r\n\r\n /**\r\n * The `year_histogram` or `date_histogram` aggregation retrieved for the current search.\r\n */\r\n readonly histogramAggregation?: Aggregation;\r\n\r\n /**\r\n * A map from collection identifiers that appear on hits or aggregations for the\r\n * current search, to their human-readable collection titles.\r\n */\r\n readonly collectionTitles: CollectionTitles;\r\n\r\n /**\r\n * A map from TV channel names appearing in `creator` aggregations, to their\r\n * more human-readable network names.\r\n */\r\n readonly tvChannelAliases: TVChannelAliases;\r\n\r\n /**\r\n * The \"extra info\" package provided by the PPS for collection pages, including details\r\n * used to populate the target collection header & About tab content.\r\n */\r\n readonly collectionExtraInfo?: CollectionExtraInfo;\r\n\r\n /**\r\n * The \"extra info\" package provided by the PPS for profile pages, including details\r\n * used to populate the profile header.\r\n */\r\n readonly accountExtraInfo?: AccountExtraInfo;\r\n\r\n /**\r\n * Context about the user session that produced the search response, from the PPS.\r\n */\r\n readonly sessionContext?: SearchResponseSessionContext;\r\n\r\n /**\r\n * The set of requested page elements for profile pages, if applicable. These represent\r\n * any content specific to the current profile tab.\r\n */\r\n readonly pageElements?: PageElementMap;\r\n\r\n /**\r\n * An array of the current target collection's parent collections. Should include *all*\r\n * ancestors in the collection hierarchy, not just the immediate parent.\r\n */\r\n readonly parentCollections?: string[];\r\n\r\n /**\r\n * An object storing result counts for the current search bucketed by letter prefix.\r\n * Keys are the result field on which the prefixes are considered (e.g., title/creator)\r\n * and values are a Record mapping letters to their counts.\r\n */\r\n readonly prefixFilterCountMap: Partial<\r\n Record<PrefixFilterType, PrefixFilterCounts>\r\n >;\r\n\r\n /**\r\n * Any error message from the most recent search results response.\r\n */\r\n readonly queryErrorMessage?: string;\r\n\r\n /**\r\n * An array of all the tile models whose management checkboxes are checked\r\n */\r\n readonly checkedTileModels: TileModel[];\r\n\r\n /**\r\n * An array of all the tile models whose management checkboxes are unchecked\r\n */\r\n readonly uncheckedTileModels: TileModel[];\r\n\r\n /**\r\n * A Promise which, after each query change, resolves once the fetches for the initial\r\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\r\n *\r\n * Ensure you await this component's `updateComplete` promise before awaiting this\r\n * one, to ensure you do not await an obsolete promise from the previous update.\r\n */\r\n readonly initialSearchComplete: Promise<boolean>;\r\n\r\n /**\r\n * Resets the data source to its empty state, with no result pages, aggregations, etc.\r\n */\r\n reset(): void;\r\n\r\n /**\r\n * Resets the data source's result pages, keeping other state intact.\r\n */\r\n resetPages(): void;\r\n\r\n /**\r\n * Adds the given page of tile models to the data source.\r\n * If the given page number already exists, that page will be overwritten.\r\n * This method expects that the provided tiles already fit the configured page size; it\r\n * will not split them into multiple pages.\r\n * @param pageNum Which page number to add (indexed starting from 1)\r\n * @param pageTiles The array of tile models for the new page\r\n */\r\n addPage(pageNum: number, pageTiles: TileModel[]): void;\r\n\r\n /**\r\n * Adds all of the given pages of tile models to the data source, splitting them into\r\n * multiple pages according to the configured page size if necessary. Any pages that\r\n * have tiles added by this method will have any existing content overwritten.\r\n * @param firstPageNum Which page number to start adding pages from (pages are indexed starting from 1)\r\n * @param tiles The full array of tile models to add across one or more pages\r\n */\r\n addMultiplePages(firstPageNum: number, tiles: TileModel[]): void;\r\n\r\n /**\r\n * Returns the given page of tile models from the data source.\r\n * @param pageNum Which page number to get (indexed starting from 1)\r\n */\r\n getPage(pageNum: number): TileModel[];\r\n\r\n /**\r\n * Returns the full set of paged tile models stored in this data source.\r\n */\r\n getAllPages(): Record<string, TileModel[]>;\r\n\r\n /**\r\n * Whether the data source contains any tiles for the given page number.\r\n * @param pageNum Which page number to query (indexed starting from 1)\r\n */\r\n hasPage(pageNum: number): boolean;\r\n\r\n /**\r\n * Returns the single tile model appearing at the given index in the\r\n * data source, with respect to the current page size. Returns `undefined` if\r\n * the corresponding page is not present on the data source or if it does not\r\n * contain a tile model at the corresponding index.\r\n * @param index The 0-based index (within the full data source) of the tile to get\r\n */\r\n getTileModelAt(index: number): TileModel | undefined;\r\n\r\n /**\r\n * Returns the first numeric tile index corresponding to the given tile model object,\r\n * or -1 if the given tile model is not present.\r\n * @param tile The tile model to search for in the data source\r\n */\r\n indexOf(tile: TileModel): number;\r\n\r\n /**\r\n * Requests that the data source fire a backend request for the given page of results.\r\n * @param pageNum Which page number to fetch results for\r\n * @param numInitialPages How many pages should be batched together on an initial fetch\r\n */\r\n fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;\r\n\r\n /**\r\n * Requests that the data source update its prefix bucket result counts for the given\r\n * type of prefix filter.\r\n * @param filterType Which prefixable field to update the buckets for (e.g., title/creator)\r\n */\r\n updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;\r\n\r\n /**\r\n * Fetches and caches the prefix filter counts for the current sort type,\r\n * provided it is one that permits prefix filtering. (If not, this does nothing).\r\n */\r\n updatePrefixFiltersForCurrentSort(): Promise<void>;\r\n\r\n /**\r\n * Clears the cached letter counts for both title and creator, and\r\n * fetches a new set of counts for whichever of them is the currently\r\n * selected sort option (which may be neither).\r\n *\r\n * Call this whenever the counts are invalidated (e.g., by a query change).\r\n */\r\n refreshLetterCounts(): void;\r\n\r\n /**\r\n * Returns the current page size of the data source.\r\n */\r\n getPageSize(): number;\r\n\r\n /**\r\n * Changes the page size used by the data source, discarding any previously-fetched pages.\r\n *\r\n * **Note: this operation will reset any data stored in the data source!**\r\n * @param pageSize\r\n */\r\n setPageSize(pageSize: number): void;\r\n\r\n /**\r\n * Sets the total number of pages that should be batched together on each initial fetch.\r\n * @param pages How many initial pages to batch\r\n */\r\n setNumInitialPages(numPages: number): void;\r\n\r\n /**\r\n * Sets the total result count for this data source to the given value.\r\n * @param count The number of total results to set\r\n */\r\n setTotalResultCount(count: number): void;\r\n\r\n /**\r\n * Sets whether this data source should suppress further data fetches, i.e. ignore any\r\n * future query changes on its host that would trigger a page/facet fetch.\r\n * @param suppressed Whether further fetches for this data source should be suppressed\r\n */\r\n setFetchesSuppressed(suppressed: boolean): void;\r\n\r\n /**\r\n * Sets whether the end of the current data has been reached, indicating whether further\r\n * pages should be looked up.\r\n * @param reached Whether we are at the end of the data for the current query state\r\n */\r\n setEndOfDataReached(reached: boolean): void;\r\n\r\n /**\r\n * Notifies the data source that a query change has occurred, which may trigger a data\r\n * reset & new fetches.\r\n */\r\n handleQueryChange(): Promise<void>;\r\n\r\n /**\r\n * Notifies the data source that the readiness state of the facets has been changed, which\r\n * may trigger facet fetches if they were previously delayed.\r\n */\r\n handleFacetReadinessChange(ready: boolean): Promise<void>;\r\n\r\n /**\r\n * Applies the given map function to all of the tile models in every page of the data\r\n * source.\r\n * @param callback A callback function to apply on each tile model, as with Array.map\r\n */\r\n map(\r\n callback: (\r\n model: TileModel,\r\n index: number,\r\n array: TileModel[],\r\n ) => TileModel,\r\n ): void;\r\n\r\n /**\r\n * Checks every tile's management checkbox\r\n */\r\n checkAllTiles(): void;\r\n\r\n /**\r\n * Unchecks every tile's management checkbox\r\n */\r\n uncheckAllTiles(): void;\r\n\r\n /**\r\n * Removes all tile models that are currently checked & adjusts the paging\r\n * of the data source to account for any new gaps in the data.\r\n */\r\n removeCheckedTiles(): void;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"collection-browser-data-source-interface.js","sourceRoot":"","sources":["../../../src/data-source/collection-browser-data-source-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type {\n FilterMap,\n Aggregation,\n CollectionExtraInfo,\n AccountExtraInfo,\n PageElementMap,\n SearchResponseSessionContext,\n} from '@internetarchive/search-service';\nimport type { ReactiveController } from 'lit';\nimport type {\n PrefixFilterType,\n PrefixFilterCounts,\n TileModel,\n} from '../models';\nimport type {\n PageSpecifierParams,\n CollectionTitles,\n TVChannelAliases,\n} from './models';\n\nexport interface CollectionBrowserDataSourceInterface\n extends ReactiveController {\n /**\n * How many tile models are present in this data source\n */\n readonly size: number;\n\n /**\n * How many results there are in the full result set for the current query\n * (not necessarily all loaded yet).\n */\n readonly totalResults: number;\n\n /**\n * Whether the host has a valid set of properties for performing a search.\n * For instance, on the search page this requires a valid search service and a\n * non-empty query, while collection pages allow searching with an empty query\n * for MDS but not FTS.\n */\n readonly canPerformSearch: boolean;\n\n /**\n * Whether the end of the set of results for the current query state has been\n * encountered (i.e., the last page of results).\n */\n readonly endOfDataReached: boolean;\n\n /**\n * True if the initial work for a new query state has been completed (i.e., firing initial\n * page/facet requests). False otherwise.\n */\n readonly queryInitialized: boolean;\n\n /**\n * A string key compactly representing the current full search state, which can\n * be used to determine, e.g., when a new search is required or whether an arriving\n * response is outdated.\n */\n readonly pageFetchQueryKey: string;\n\n /**\n * Similar to `pageFetchQueryKey`, but excluding properties that do not affect\n * the validity of a set of facets (e.g., sort).\n */\n readonly facetFetchQueryKey: string;\n\n /**\n * An object representing any collection- or profile-specific properties to be passed along\n * to the search service, specifying the exact page/tab to fetch results for.\n */\n readonly pageSpecifierParams: PageSpecifierParams | null;\n\n /**\n * A FilterMap object representing all filters applied to the current search,\n * including any facets, letter filters, and date ranges.\n */\n readonly filterMap: FilterMap;\n\n /**\n * The full set of aggregations retrieved for the current search.\n */\n readonly aggregations?: Record<string, Aggregation>;\n\n /**\n * The `year_histogram` or `date_histogram` aggregation retrieved for the current search.\n */\n readonly histogramAggregation?: Aggregation;\n\n /**\n * A map from collection identifiers that appear on hits or aggregations for the\n * current search, to their human-readable collection titles.\n */\n readonly collectionTitles: CollectionTitles;\n\n /**\n * A map from TV channel names appearing in `creator` aggregations, to their\n * more human-readable network names.\n */\n readonly tvChannelAliases: TVChannelAliases;\n\n /**\n * The \"extra info\" package provided by the PPS for collection pages, including details\n * used to populate the target collection header & About tab content.\n */\n readonly collectionExtraInfo?: CollectionExtraInfo;\n\n /**\n * The \"extra info\" package provided by the PPS for profile pages, including details\n * used to populate the profile header.\n */\n readonly accountExtraInfo?: AccountExtraInfo;\n\n /**\n * Context about the user session that produced the search response, from the PPS.\n */\n readonly sessionContext?: SearchResponseSessionContext;\n\n /**\n * The set of requested page elements for profile pages, if applicable. These represent\n * any content specific to the current profile tab.\n */\n readonly pageElements?: PageElementMap;\n\n /**\n * An array of the current target collection's parent collections. Should include *all*\n * ancestors in the collection hierarchy, not just the immediate parent.\n */\n readonly parentCollections?: string[];\n\n /**\n * An object storing result counts for the current search bucketed by letter prefix.\n * Keys are the result field on which the prefixes are considered (e.g., title/creator)\n * and values are a Record mapping letters to their counts.\n */\n readonly prefixFilterCountMap: Partial<\n Record<PrefixFilterType, PrefixFilterCounts>\n >;\n\n /**\n * Any error message from the most recent search results response.\n */\n readonly queryErrorMessage?: string;\n\n /**\n * An array of all the tile models whose management checkboxes are checked\n */\n readonly checkedTileModels: TileModel[];\n\n /**\n * An array of all the tile models whose management checkboxes are unchecked\n */\n readonly uncheckedTileModels: TileModel[];\n\n /**\n * A Promise which, after each query change, resolves once the fetches for the initial\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\n *\n * Ensure you await this component's `updateComplete` promise before awaiting this\n * one, to ensure you do not await an obsolete promise from the previous update.\n */\n readonly initialSearchComplete: Promise<boolean>;\n\n /**\n * Resets the data source to its empty state, with no result pages, aggregations, etc.\n */\n reset(): void;\n\n /**\n * Resets the data source's result pages, keeping other state intact.\n */\n resetPages(): void;\n\n /**\n * Adds the given page of tile models to the data source.\n * If the given page number already exists, that page will be overwritten.\n * This method expects that the provided tiles already fit the configured page size; it\n * will not split them into multiple pages.\n * @param pageNum Which page number to add (indexed starting from 1)\n * @param pageTiles The array of tile models for the new page\n */\n addPage(pageNum: number, pageTiles: TileModel[]): void;\n\n /**\n * Adds all of the given pages of tile models to the data source, splitting them into\n * multiple pages according to the configured page size if necessary. Any pages that\n * have tiles added by this method will have any existing content overwritten.\n * @param firstPageNum Which page number to start adding pages from (pages are indexed starting from 1)\n * @param tiles The full array of tile models to add across one or more pages\n */\n addMultiplePages(firstPageNum: number, tiles: TileModel[]): void;\n\n /**\n * Returns the given page of tile models from the data source.\n * @param pageNum Which page number to get (indexed starting from 1)\n */\n getPage(pageNum: number): TileModel[];\n\n /**\n * Returns the full set of paged tile models stored in this data source.\n */\n getAllPages(): Record<string, TileModel[]>;\n\n /**\n * Whether the data source contains any tiles for the given page number.\n * @param pageNum Which page number to query (indexed starting from 1)\n */\n hasPage(pageNum: number): boolean;\n\n /**\n * Returns the single tile model appearing at the given index in the\n * data source, with respect to the current page size. Returns `undefined` if\n * the corresponding page is not present on the data source or if it does not\n * contain a tile model at the corresponding index.\n * @param index The 0-based index (within the full data source) of the tile to get\n */\n getTileModelAt(index: number): TileModel | undefined;\n\n /**\n * Returns the first numeric tile index corresponding to the given tile model object,\n * or -1 if the given tile model is not present.\n * @param tile The tile model to search for in the data source\n */\n indexOf(tile: TileModel): number;\n\n /**\n * Requests that the data source fire a backend request for the given page of results.\n * @param pageNum Which page number to fetch results for\n * @param numInitialPages How many pages should be batched together on an initial fetch\n */\n fetchPage(pageNum: number, numInitialPages?: number): Promise<void>;\n\n /**\n * Requests that the data source update its prefix bucket result counts for the given\n * type of prefix filter.\n * @param filterType Which prefixable field to update the buckets for (e.g., title/creator)\n */\n updatePrefixFilterCounts(filterType: PrefixFilterType): Promise<void>;\n\n /**\n * Fetches and caches the prefix filter counts for the current sort type,\n * provided it is one that permits prefix filtering. (If not, this does nothing).\n */\n updatePrefixFiltersForCurrentSort(): Promise<void>;\n\n /**\n * Clears the cached letter counts for both title and creator, and\n * fetches a new set of counts for whichever of them is the currently\n * selected sort option (which may be neither).\n *\n * Call this whenever the counts are invalidated (e.g., by a query change).\n */\n refreshLetterCounts(): void;\n\n /**\n * Returns the current page size of the data source.\n */\n getPageSize(): number;\n\n /**\n * Changes the page size used by the data source, discarding any previously-fetched pages.\n *\n * **Note: this operation will reset any data stored in the data source!**\n * @param pageSize\n */\n setPageSize(pageSize: number): void;\n\n /**\n * Sets the total number of pages that should be batched together on each initial fetch.\n * @param pages How many initial pages to batch\n */\n setNumInitialPages(numPages: number): void;\n\n /**\n * Sets the total result count for this data source to the given value.\n * @param count The number of total results to set\n */\n setTotalResultCount(count: number): void;\n\n /**\n * Sets whether this data source should suppress further data fetches, i.e. ignore any\n * future query changes on its host that would trigger a page/facet fetch.\n * @param suppressed Whether further fetches for this data source should be suppressed\n */\n setFetchesSuppressed(suppressed: boolean): void;\n\n /**\n * Sets whether the end of the current data has been reached, indicating whether further\n * pages should be looked up.\n * @param reached Whether we are at the end of the data for the current query state\n */\n setEndOfDataReached(reached: boolean): void;\n\n /**\n * Notifies the data source that a query change has occurred, which may trigger a data\n * reset & new fetches.\n */\n handleQueryChange(): Promise<void>;\n\n /**\n * Notifies the data source that the readiness state of the facets has been changed, which\n * may trigger facet fetches if they were previously delayed.\n */\n handleFacetReadinessChange(ready: boolean): Promise<void>;\n\n /**\n * Applies the given map function to all of the tile models in every page of the data\n * source.\n * @param callback A callback function to apply on each tile model, as with Array.map\n */\n map(\n callback: (\n model: TileModel,\n index: number,\n array: TileModel[],\n ) => TileModel,\n ): void;\n\n /**\n * Checks every tile's management checkbox\n */\n checkAllTiles(): void;\n\n /**\n * Unchecks every tile's management checkbox\n */\n uncheckAllTiles(): void;\n\n /**\n * Removes all tile models that are currently checked & adjusts the paging\n * of the data source to account for any new gaps in the data.\n */\n removeCheckedTiles(): void;\n}\n"]}
|
|
@@ -356,7 +356,6 @@ export class CollectionBrowserDataSource {
|
|
|
356
356
|
* @inheritdoc
|
|
357
357
|
*/
|
|
358
358
|
async handleQueryChange() {
|
|
359
|
-
console.log('handleQueryChange');
|
|
360
359
|
// Don't react to the change if fetches are suppressed for this data source
|
|
361
360
|
if (this.suppressFetches)
|
|
362
361
|
return;
|
|
@@ -854,7 +853,6 @@ export class CollectionBrowserDataSource {
|
|
|
854
853
|
*/
|
|
855
854
|
async fetchPage(pageNumber, numInitialPages = 1) {
|
|
856
855
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
857
|
-
console.log('fetchPage', this.host.baseQuery, this.host.identifiers);
|
|
858
856
|
const trimmedQuery = (_a = this.host.baseQuery) === null || _a === void 0 ? void 0 : _a.trim();
|
|
859
857
|
// reset loading status
|
|
860
858
|
if (!this.canPerformSearch) {
|
|
@@ -905,7 +903,7 @@ export class CollectionBrowserDataSource {
|
|
|
905
903
|
aggregations: { omit: true },
|
|
906
904
|
};
|
|
907
905
|
params.uid = await this.requestUID(params, 'hits');
|
|
908
|
-
|
|
906
|
+
// log('=== FIRING PAGE REQUEST ===', params);
|
|
909
907
|
const searchResponse = await ((_b = this.host.searchService) === null || _b === void 0 ? void 0 : _b.search(params, this.host.searchType));
|
|
910
908
|
// log('=== RECEIVED PAGE RESPONSE IN CB ===', searchResponse);
|
|
911
909
|
const success = searchResponse === null || searchResponse === void 0 ? void 0 : searchResponse.success;
|