@fluid-topics/ft-search-bar 1.1.26 → 1.1.28
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/build/ft-search-bar.d.ts +3 -0
- package/build/ft-search-bar.js +16 -5
- package/build/ft-search-bar.light.js +114 -111
- package/build/ft-search-bar.min.js +521 -518
- package/package.json +16 -15
package/build/ft-search-bar.d.ts
CHANGED
|
@@ -64,6 +64,8 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
64
64
|
selectedFacetsManager: FacetsChipsManager;
|
|
65
65
|
desktopSearchBarManager: DesktopSearchBarManager;
|
|
66
66
|
mobileSearchBarManager: MobileSearchBarManager;
|
|
67
|
+
private currentSession;
|
|
68
|
+
constructor();
|
|
67
69
|
get request(): FtSearchRequest;
|
|
68
70
|
get facetsRequest(): Array<FtSearchFacetConf>;
|
|
69
71
|
get suggestRequest(): FtSuggestRequest;
|
|
@@ -116,4 +118,5 @@ export declare class FtSearchBar extends FtLitElement implements FtSearchBarProp
|
|
|
116
118
|
private enableFocusReactionCallback;
|
|
117
119
|
private enableFocusReactionOnAnyUserInteraction;
|
|
118
120
|
private enableFocusReaction;
|
|
121
|
+
private reloadWhenUserSessionChanges;
|
|
119
122
|
}
|
package/build/ft-search-bar.js
CHANGED
|
@@ -7,7 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { html, nothing } from "lit";
|
|
8
8
|
import { property, query, state } from "lit/decorators.js";
|
|
9
9
|
import { repeat } from "lit/directives/repeat.js";
|
|
10
|
-
import { Debouncer, flatDeep, FtLitElement, isTouchScreen, jsonProperty, ParametrizedLabelResolver, serializeRequest, waitFor } from "@fluid-topics/ft-wc-utils";
|
|
10
|
+
import { Debouncer, deepEqual, flatDeep, FtLitElement, isTouchScreen, jsonProperty, ParametrizedLabelResolver, serializeRequest, waitFor } from "@fluid-topics/ft-wc-utils";
|
|
11
11
|
import { FtSizeCategory, FtSizeWatcher } from "@fluid-topics/ft-size-watcher";
|
|
12
12
|
import { FtTypography, FtTypographyBody2 } from "@fluid-topics/ft-typography";
|
|
13
13
|
import { facetToFilter, selectedValues, unquote } from "./converters";
|
|
@@ -27,6 +27,7 @@ import { FacetsChipsManager } from "./managers/FacetsChipsManager";
|
|
|
27
27
|
import { MobileSearchBarManager } from "./managers/MobileSearchBarManager";
|
|
28
28
|
import { DesktopSearchBarManager } from "./managers/DesktopSearchBarManager";
|
|
29
29
|
import { FtRadio, FtRadioGroup, } from "@fluid-topics/ft-radio";
|
|
30
|
+
import { ftAppInfoStore } from "@fluid-topics/ft-app-context";
|
|
30
31
|
if (window.fluidtopics == null) {
|
|
31
32
|
console.warn("Fluid Topics public API was not found. You can find it here: https://www.npmjs.com/package/@fluid-topics/public-api");
|
|
32
33
|
}
|
|
@@ -62,8 +63,11 @@ export class SearchStateChangeEvent extends CustomEvent {
|
|
|
62
63
|
const doNothing = () => {
|
|
63
64
|
};
|
|
64
65
|
class FtSearchBar extends FtLitElement {
|
|
66
|
+
isMobileMenuOpen() {
|
|
67
|
+
return this.isMobile() && (this.forceMobileMenuOpen || this.forceMenuOpen || this.mobileMenuOpen);
|
|
68
|
+
}
|
|
65
69
|
constructor() {
|
|
66
|
-
super(
|
|
70
|
+
super();
|
|
67
71
|
this.dense = false;
|
|
68
72
|
this.mode = "auto";
|
|
69
73
|
this.forceMobileMenuOpen = false;
|
|
@@ -94,6 +98,7 @@ class FtSearchBar extends FtLitElement {
|
|
|
94
98
|
this.selectedFacetsManager = new FacetsChipsManager(this);
|
|
95
99
|
this.desktopSearchBarManager = new DesktopSearchBarManager(this);
|
|
96
100
|
this.mobileSearchBarManager = new MobileSearchBarManager(this, this.selectedFacetsManager, this.suggestManager);
|
|
101
|
+
this.currentSession = ftAppInfoStore.getState().session;
|
|
97
102
|
this.stateChangeEventDebouncer = new Debouncer(10);
|
|
98
103
|
this.updateLocalesDebouncer = new Debouncer(10);
|
|
99
104
|
this.facetsLoaded = false;
|
|
@@ -111,9 +116,7 @@ class FtSearchBar extends FtLitElement {
|
|
|
111
116
|
&& a.filters.length === b.filters.length
|
|
112
117
|
&& a.filters.every(fa => b.filters.some(fb => this.compareFilters(fa, fb)));
|
|
113
118
|
this.enableFocusReactionCallback = () => this.enableFocusReaction();
|
|
114
|
-
|
|
115
|
-
isMobileMenuOpen() {
|
|
116
|
-
return this.isMobile() && (this.forceMobileMenuOpen || this.forceMenuOpen || this.mobileMenuOpen);
|
|
119
|
+
ftAppInfoStore.subscribe(() => this.reloadWhenUserSessionChanges());
|
|
117
120
|
}
|
|
118
121
|
get request() {
|
|
119
122
|
return {
|
|
@@ -632,6 +635,14 @@ class FtSearchBar extends FtLitElement {
|
|
|
632
635
|
(_b = this.container) === null || _b === void 0 ? void 0 : _b.removeEventListener("click", this.enableFocusReactionCallback);
|
|
633
636
|
(_c = this.container) === null || _c === void 0 ? void 0 : _c.removeEventListener("keyup", this.enableFocusReactionCallback);
|
|
634
637
|
}
|
|
638
|
+
reloadWhenUserSessionChanges() {
|
|
639
|
+
var _a;
|
|
640
|
+
const { session } = ftAppInfoStore.getState();
|
|
641
|
+
if (!deepEqual((_a = this.currentSession) === null || _a === void 0 ? void 0 : _a.profile, session === null || session === void 0 ? void 0 : session.profile)) {
|
|
642
|
+
this.currentSession = session;
|
|
643
|
+
this.initSearchData();
|
|
644
|
+
}
|
|
645
|
+
}
|
|
635
646
|
}
|
|
636
647
|
FtSearchBar.elementDefinitions = {
|
|
637
648
|
"ft-accordion": FtAccordion,
|