-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
135 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,3 +99,6 @@ Icon | |
Network Trash Folder | ||
Temporary Items | ||
.apdisk | ||
|
||
/src/Resources/app/storefront/dist | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build: | ||
zip: | ||
assets: | ||
enable_es_build_for_storefront: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"name": "frosh-share-basket", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@friendsofshopware/storefront-types": "^0.1.1" | ||
} | ||
} |
65 changes: 0 additions & 65 deletions
65
...es/app/storefront/src/frosh-platform-filter-search/frosh-platform-filter-search.plugin.js
This file was deleted.
Oops, something went wrong.
61 changes: 61 additions & 0 deletions
61
...es/app/storefront/src/frosh-platform-filter-search/frosh-platform-filter-search.plugin.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
type HTMLElementEvent<T extends HTMLElement> = Event & { | ||
target: T; | ||
} | ||
|
||
export default class FroshPlatformSearchFilterPlugin extends window.PluginBaseClass { | ||
static options = { | ||
dropdownSelector: '.filter-panel-items-container .dropdown', | ||
}; | ||
|
||
init() { | ||
this._registerEvents(); | ||
} | ||
|
||
_registerEvents() { | ||
this.el.addEventListener('input', this._onInput.bind(this)); | ||
|
||
const dropdowns = document.querySelectorAll(this.options.dropdownSelector); | ||
if(dropdowns) { | ||
dropdowns.forEach((dropdown) => { | ||
dropdown.addEventListener('shown.bs.dropdown', this._onDropdownShown.bind(this)); | ||
}); | ||
} | ||
} | ||
|
||
_onInput(event: HTMLElementEvent<HTMLInputElement>) { | ||
const value = event.target.value.trim().toLowerCase(); | ||
const dropdown = event.target.closest('.filter-multi-select-dropdown'); | ||
|
||
const list = dropdown.querySelector('.filter-multi-select-list'); | ||
const listItems = list.querySelectorAll('li'); | ||
const listItemsArray = Array.from(listItems); | ||
|
||
for (const listItem of listItemsArray) { | ||
listItem.style.display = 'none'; | ||
const labelElement = listItem.querySelector( '.filter-multi-select-item-label') as HTMLLabelElement; | ||
const label = labelElement.innerText.trim().toLowerCase(); | ||
|
||
if (label.includes(value)) { | ||
listItem.style.display = null; | ||
} | ||
} | ||
} | ||
|
||
_onDropdownShown(event) { | ||
const dropdown = event.relatedTarget.closest('.dropdown'); | ||
const filterInput = dropdown.querySelector('[data-frosh-platform-filter-search=true]'); | ||
|
||
if (!filterInput) { | ||
return; | ||
} | ||
|
||
const dropdownMenu = dropdown.querySelector('.dropdown-menu'); | ||
if (dropdownMenu) { | ||
dropdownMenu.classList.add('fpfs-dropdown-is--expanded'); | ||
} | ||
|
||
filterInput.focus({ | ||
preventScroll: true | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import FroshPlatformSearchFilterPlugin from './frosh-platform-filter-search/frosh-platform-filter-search.plugin'; | ||
|
||
window.PluginManager.register('FroshPlatformFilterSearch', FroshPlatformSearchFilterPlugin, '[data-frosh-platform-filter-search=true]'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"types": ["@friendsofshopware/storefront-types"], | ||
"target": "ES2020", | ||
"module": "CommonJS" | ||
} | ||
} |