mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
Merge pull request #3271 from thornbill/fix-number-filter
Fix number option in alphapicker
This commit is contained in:
commit
7701049335
@ -280,6 +280,16 @@ import 'material-design-icons-iconfont';
|
||||
element.removeEventListener(name, fn);
|
||||
}
|
||||
|
||||
updateControls(query) {
|
||||
if (query.NameLessThan) {
|
||||
this.value('#');
|
||||
} else {
|
||||
this.value(query.NameStartsWith);
|
||||
}
|
||||
|
||||
this.visible(query.SortBy.indexOf('SortName') === 0);
|
||||
}
|
||||
|
||||
visible(visible) {
|
||||
const element = this.options.element;
|
||||
element.style.visibility = visible ? 'visible' : 'hidden';
|
||||
|
@ -23,24 +23,13 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
itemsContainer.innerHTML = '';
|
||||
};
|
||||
|
||||
const updateFilterControls = () => {
|
||||
if (this.alphaPicker) {
|
||||
this.alphaPicker.value(query.NameStartsWith);
|
||||
if (query.SortBy.indexOf('SortName') === 0) {
|
||||
this.alphaPicker.visible(true);
|
||||
} else {
|
||||
this.alphaPicker.visible(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function fetchData() {
|
||||
isLoading = true;
|
||||
loading.show();
|
||||
return ApiClient.getItems(ApiClient.getCurrentUserId(), query);
|
||||
}
|
||||
|
||||
function afterRefresh(result) {
|
||||
const afterRefresh = (result) => {
|
||||
function onNextPageClick() {
|
||||
if (isLoading) {
|
||||
return;
|
||||
@ -64,7 +53,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
}
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
updateFilterControls();
|
||||
this.alphaPicker?.updateControls(query);
|
||||
const pagingHtml = libraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
@ -94,7 +83,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
import('../../components/autoFocuser').then(({default: autoFocuser}) => {
|
||||
autoFocuser.autoFocus(tabContent);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
const getItemsHtml = (items) => {
|
||||
let html;
|
||||
@ -173,7 +162,13 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
if (alphaPickerElement) {
|
||||
alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
|
||||
const newValue = e.detail.value;
|
||||
query.NameStartsWith = newValue;
|
||||
if (newValue === '#') {
|
||||
query.NameLessThan = 'A';
|
||||
delete query.NameStartsWith;
|
||||
} else {
|
||||
query.NameStartsWith = newValue;
|
||||
delete query.NameLessThan;
|
||||
}
|
||||
query.StartIndex = 0;
|
||||
itemsContainer.refreshItems();
|
||||
});
|
||||
@ -301,9 +296,9 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
onViewStyleChange();
|
||||
};
|
||||
|
||||
this.renderTab = function () {
|
||||
this.renderTab = () => {
|
||||
itemsContainer.refreshItems();
|
||||
updateFilterControls();
|
||||
this.alphaPicker?.updateControls(query);
|
||||
};
|
||||
|
||||
this.destroy = function () {
|
||||
|
@ -81,7 +81,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
}
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
updateFilterControls(tabContent);
|
||||
this.alphaPicker?.updateControls(query);
|
||||
const pagingHtml = libraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
@ -183,11 +183,6 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
});
|
||||
};
|
||||
|
||||
const updateFilterControls = (tabContent) => {
|
||||
const query = getQuery(tabContent);
|
||||
this.alphaPicker.value(query.NameStartsWith);
|
||||
};
|
||||
|
||||
const data = {};
|
||||
let isLoading = false;
|
||||
|
||||
@ -216,7 +211,13 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
|
||||
const newValue = e.detail.value;
|
||||
const query = getQuery(tabContent);
|
||||
query.NameStartsWith = newValue;
|
||||
if (newValue === '#') {
|
||||
query.NameLessThan = 'A';
|
||||
delete query.NameStartsWith;
|
||||
} else {
|
||||
query.NameStartsWith = newValue;
|
||||
delete query.NameLessThan;
|
||||
}
|
||||
query.StartIndex = 0;
|
||||
reloadItems();
|
||||
});
|
||||
@ -268,9 +269,9 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
|
||||
initPage(tabContent);
|
||||
|
||||
this.renderTab = function () {
|
||||
this.renderTab = () => {
|
||||
reloadItems();
|
||||
updateFilterControls(tabContent);
|
||||
this.alphaPicker?.updateControls(getQuery(tabContent));
|
||||
};
|
||||
|
||||
this.destroy = function () {};
|
||||
|
@ -112,7 +112,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
}
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
updateFilterControls();
|
||||
this.alphaPicker?.updateControls(query);
|
||||
let html;
|
||||
const pagingHtml = libraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
@ -185,20 +185,6 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
});
|
||||
};
|
||||
|
||||
const updateFilterControls = () => {
|
||||
const query = getQuery();
|
||||
|
||||
if (this.alphaPicker) {
|
||||
this.alphaPicker.value(query.NameStartsWith);
|
||||
|
||||
if (query.SortBy.indexOf('SortName') === 0) {
|
||||
this.alphaPicker.visible(true);
|
||||
} else {
|
||||
this.alphaPicker.visible(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
let savedQueryKey;
|
||||
let pageData;
|
||||
let isLoading = false;
|
||||
@ -230,7 +216,13 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
|
||||
const newValue = e.detail.value;
|
||||
const query = getQuery();
|
||||
query.NameStartsWith = newValue;
|
||||
if (newValue === '#') {
|
||||
query.NameLessThan = 'A';
|
||||
delete query.NameStartsWith;
|
||||
} else {
|
||||
query.NameStartsWith = newValue;
|
||||
delete query.NameLessThan;
|
||||
}
|
||||
query.StartIndex = 0;
|
||||
reloadItems();
|
||||
});
|
||||
@ -302,9 +294,9 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
initPage(tabContent);
|
||||
onViewStyleChange();
|
||||
|
||||
this.renderTab = function () {
|
||||
this.renderTab = () => {
|
||||
reloadItems();
|
||||
updateFilterControls();
|
||||
this.alphaPicker?.updateControls(getQuery());
|
||||
};
|
||||
|
||||
this.destroy = function () {};
|
||||
|
@ -99,7 +99,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
}
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
updateFilterControls(page);
|
||||
this.alphaPicker?.updateControls(query);
|
||||
let html;
|
||||
const pagingHtml = libraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
@ -167,11 +167,6 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
});
|
||||
};
|
||||
|
||||
const updateFilterControls = (tabContent) => {
|
||||
const query = getQuery(tabContent);
|
||||
this.alphaPicker.value(query.NameStartsWith);
|
||||
};
|
||||
|
||||
const data = {};
|
||||
let isLoading = false;
|
||||
|
||||
@ -201,7 +196,13 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
|
||||
const newValue = e.detail.value;
|
||||
const query = getQuery(tabContent);
|
||||
query.NameStartsWith = newValue;
|
||||
if (newValue === '#') {
|
||||
query.NameLessThan = 'A';
|
||||
delete query.NameStartsWith;
|
||||
} else {
|
||||
query.NameStartsWith = newValue;
|
||||
delete query.NameLessThan;
|
||||
}
|
||||
query.StartIndex = 0;
|
||||
reloadItems(tabContent);
|
||||
});
|
||||
@ -234,9 +235,9 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
initPage(tabContent);
|
||||
onViewStyleChange();
|
||||
|
||||
this.renderTab = function () {
|
||||
this.renderTab = () => {
|
||||
reloadItems(tabContent);
|
||||
updateFilterControls(tabContent);
|
||||
this.alphaPicker?.updateControls(getQuery(tabContent));
|
||||
};
|
||||
|
||||
this.destroy = function () {};
|
||||
|
@ -97,7 +97,7 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
}
|
||||
|
||||
window.scrollTo(0, 0);
|
||||
updateFilterControls(page);
|
||||
this.alphaPicker?.updateControls(query);
|
||||
let html;
|
||||
const pagingHtml = libraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
@ -196,20 +196,6 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
});
|
||||
};
|
||||
|
||||
const updateFilterControls = (tabContent) => {
|
||||
const query = getQuery(tabContent);
|
||||
|
||||
if (this.alphaPicker) {
|
||||
this.alphaPicker.value(query.NameStartsWith);
|
||||
|
||||
if (query.SortBy.indexOf('SortName') === 0) {
|
||||
this.alphaPicker.visible(true);
|
||||
} else {
|
||||
this.alphaPicker.visible(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
const data = {};
|
||||
let isLoading = false;
|
||||
|
||||
@ -239,7 +225,13 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
|
||||
const newValue = e.detail.value;
|
||||
const query = getQuery(tabContent);
|
||||
query.NameStartsWith = newValue;
|
||||
if (newValue === '#') {
|
||||
query.NameLessThan = 'A';
|
||||
delete query.NameStartsWith;
|
||||
} else {
|
||||
query.NameStartsWith = newValue;
|
||||
delete query.NameLessThan;
|
||||
}
|
||||
query.StartIndex = 0;
|
||||
reloadItems(tabContent);
|
||||
});
|
||||
@ -301,9 +293,9 @@ import '../../elements/emby-itemscontainer/emby-itemscontainer';
|
||||
initPage(tabContent);
|
||||
onViewStyleChange();
|
||||
|
||||
this.renderTab = function () {
|
||||
this.renderTab = () => {
|
||||
reloadItems(tabContent);
|
||||
updateFilterControls(tabContent);
|
||||
this.alphaPicker?.updateControls(getQuery(tabContent));
|
||||
};
|
||||
|
||||
this.destroy = function () {};
|
||||
|
Loading…
Reference in New Issue
Block a user