Merge branch 'main' into pages

This commit is contained in:
Frank Knoll
2024-07-14 21:51:24 +02:00
9 changed files with 28217 additions and 361 deletions

File diff suppressed because one or more lines are too long

View File

@@ -5,29 +5,29 @@ class PageInitializer {
PageInitializer.#configureVaccine(vaccine);
}
static #configureSymptom({ symptomSelectElement, searchParam, prrByVaccineTableElement, downloadPrrByVaccineTableButton, keyColumnName }) {
static #configureSymptom({ symptomSelectElement, urlSearchParam, prrByVaccineTableElement, downloadPrrByVaccineTableButton, keyColumnName }) {
const prrByVaccineTableView = new PrrByVaccineTableView(prrByVaccineTableElement, downloadPrrByVaccineTableButton, keyColumnName);
Select2.initializeSelectElement(
{
selectElement: symptomSelectElement,
textOfOption2Select: searchParam.get(),
minimumInputLength: 0,
textOfOption2Select: urlSearchParam.get(),
onSelectOptionHavingValueAndText: (id, text) => {
prrByVaccineTableView.displayPrrByVaccineTable4Symptom(id, text);
searchParam.set(text);
},
minimumInputLength: 0
urlSearchParam.set(text);
}
});
}
static #configureVaccine({ vaccineSelectElement, searchParam, prrBySymptomTableElement, downloadPrrBySymptomTableButton, valueName }) {
static #configureVaccine({ vaccineSelectElement, urlSearchParam, prrBySymptomTableElement, downloadPrrBySymptomTableButton, valueName }) {
const prrBySymptomTableView = new PrrBySymptomTableView(prrBySymptomTableElement, downloadPrrBySymptomTableButton, valueName);
Select2.initializeSelectElement(
{
selectElement: vaccineSelectElement,
textOfOption2Select: searchParam.get(),
textOfOption2Select: urlSearchParam.get(),
onSelectOptionHavingValueAndText: (id, text) => {
prrBySymptomTableView.displayPrrBySymptomTable4Vaccine(id, text);
searchParam.set(text);
urlSearchParam.set(text);
},
minimumInputLength: 0
});

View File

@@ -1,16 +0,0 @@
class SearchParam {
#name;
constructor(name) {
this.#name = name;
}
get() {
return UrlUtils.getSearchParamOfCurrentUrl(this.#name);
}
set(value) {
UrlUtils.setSearchParamOfCurrentUrl(this.#name, value);
}
}

View File

@@ -1,50 +0,0 @@
class Select2 {
static initializeSelectElement(
{
selectElement,
textOfOption2Select,
onSelectOptionHavingValueAndText,
minimumInputLength
}) {
selectElement.select2({ minimumInputLength: minimumInputLength });
selectElement.on(
'select2:select',
function (event) {
const id = event.params.data.id;
const text = event.params.data.text;
onSelectOptionHavingValueAndText(id, text);
});
Select2.#selectOptionHavingText(selectElement, textOfOption2Select);
}
static #selectOptionHavingText(selectElement, text) {
const option = Select2.#getOptionHavingText(selectElement, text);
if (option === undefined) {
return;
}
Select2.#selectOption(selectElement, option);
}
static #getOptionHavingText(selectElement, text) {
if (text === null) {
return undefined;
}
return Array
.from(selectElement[0].options)
.find(option => option.text == text);
}
static #selectOption(selectElement, option) {
selectElement.val(option.value).trigger('change');
selectElement.trigger({
type: 'select2:select',
params: {
data: {
"id": option.value,
"text": option.text
}
}
});
}
}