Skip to content

Commit

Permalink
Searchfield configurable (SAP#2385)
Browse files Browse the repository at this point in the history
  • Loading branch information
JohannesDoberer authored Dec 14, 2021
1 parent d2c2081 commit 3a46018
Show file tree
Hide file tree
Showing 11 changed files with 669 additions and 24 deletions.
19 changes: 15 additions & 4 deletions core/src/navigation/GlobalSearch.html
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@
export let inputElem;
export let luigiCustomSearchRenderer__slot;
export let luigiCustomSearchItemRenderer__slotContainer;
export let globalSearchConfig;
const dispatch = createEventDispatcher();
const searchApiObj = {
fireItemSelected: item => {
Expand All @@ -107,23 +108,34 @@
};
let searchResults = {};
let showPopOverCustomSearch = false;
let search;
let search = {};
let isCustomSearchRenderer;
let isCustomSearchResultItemRenderer;
let searchFieldAlwaysVisible;

onMount(async () => {
search = await LuigiConfig.getConfigValueAsync('globalSearch');
search = globalSearchConfig;
let inputElement = inputElem;
const placeHolder = getSearchPlaceholder(search.searchProvider);
if (placeHolder) {
inputElement.placeholder = placeHolder;
}
getCustomRenderer();
});

beforeUpdate(() => {
search = globalSearchConfig;
getCustomRenderer();
});

function getCustomRenderer() {
isCustomSearchRenderer = GenericHelpers.isFunction(
search.searchProvider.customSearchResultRenderer
);
isCustomSearchResultItemRenderer = GenericHelpers.isFunction(
search.searchProvider.customSearchResultItemRenderer
);
});
}

function getSearchPlaceholder(searchProvider) {
if (!searchProvider || !searchProvider.inputPlaceholder) {
Expand Down Expand Up @@ -338,7 +350,6 @@
}

//remove arrow from the search popover

@media screen and (max-width: 1024px) {
.luigi-search-shell__mobile {
position: relative;
Expand Down
Loading

0 comments on commit 3a46018

Please sign in to comment.