mirror of
https://github.com/ONLYOFFICE/web-apps.git
synced 2026-04-07 14:06:16 +08:00
Change pagination in mentions
This commit is contained in:
@ -127,10 +127,10 @@ Common.UI.ExternalUsers = new( function() {
|
||||
}
|
||||
var type = data.c || 'mention',
|
||||
users = data.users || [];
|
||||
if (data.total===undefined) // use old scheme
|
||||
if (data.isPaginated===undefined) // use old scheme
|
||||
externalUsers[type] = users;
|
||||
isUsersLoading = false;
|
||||
Common.NotificationCenter.trigger('mentions:setusers', type, users, data.total);
|
||||
Common.NotificationCenter.trigger('mentions:setusers', type, users, data.isPaginated);
|
||||
});
|
||||
|
||||
Common.NotificationCenter.on('mentions:clearusers', function(type) {
|
||||
|
||||
@ -1222,7 +1222,7 @@ define([
|
||||
right: right,
|
||||
from: 0,
|
||||
count: 100,
|
||||
total: undefined,
|
||||
isPaginated: undefined,
|
||||
requestNext: undefined
|
||||
};
|
||||
var data = this._state.emailSearch;
|
||||
@ -1235,14 +1235,14 @@ define([
|
||||
|
||||
onEmailListMenuNext: function() {
|
||||
var data = this._state.emailSearch;
|
||||
if (data && data.total!==undefined && data.from + data.count < data.total) {
|
||||
if (data && data.isPaginated!==undefined) {
|
||||
data.from += data.count;
|
||||
Common.UI.ExternalUsers.get('mention', undefined, data.from, data.count, data.str);
|
||||
}
|
||||
},
|
||||
|
||||
onEmailListMenuCallback: function(type, users, total) {
|
||||
if (!this._state.emailSearch || users.length<1 || type && type!=='mention') return;
|
||||
onEmailListMenuCallback: function(type, users, isPaginated) {
|
||||
if (!this._state.emailSearch || type && type!=='mention') return;
|
||||
|
||||
var me = this,
|
||||
menu = me.emailMenu,
|
||||
@ -1250,9 +1250,9 @@ define([
|
||||
left = this._state.emailSearch.left,
|
||||
right = this._state.emailSearch.right,
|
||||
from = this._state.emailSearch.from,
|
||||
isClientSearch = total===undefined;// || from===0 && !str && total<this._state.emailSearch.count; ???
|
||||
isClientSearch = isPaginated===undefined;
|
||||
|
||||
this._state.emailSearch.total = total;
|
||||
this._state.emailSearch.isPaginated = isPaginated;
|
||||
isClientSearch && (this._state.emailSearch = null);
|
||||
|
||||
var menuContainer = me.$window.find(Common.Utils.String.format('#menu-container-{0}', menu.id)),
|
||||
@ -1291,7 +1291,7 @@ define([
|
||||
}
|
||||
}
|
||||
|
||||
if (users.length>0) {
|
||||
if (users && users.length>0) {
|
||||
if (isClientSearch) {
|
||||
str = str.toLowerCase();
|
||||
if (str.length>0) {
|
||||
@ -1345,7 +1345,7 @@ define([
|
||||
menu.scroller.update({alwaysVisibleY: true});
|
||||
if (!isClientSearch) {
|
||||
(from===0) && menu.scroller.scrollTop(0);
|
||||
me._state.emailSearch.requestNext = menu.items.length<me._state.emailSearch.total ? (1 - 10/menu.items.length) * menu.cmpEl.get(0).scrollHeight : -1;
|
||||
me._state.emailSearch.requestNext = users && users.length>0 ? (1 - 10/menu.items.length) * menu.cmpEl.get(0).scrollHeight : -1;
|
||||
}
|
||||
} else {
|
||||
menu.rendered && menu.cmpEl.css('display', 'none');
|
||||
|
||||
@ -101,7 +101,7 @@ define([], function () {
|
||||
str: '',
|
||||
from: 0,
|
||||
count: 100,
|
||||
total: undefined,
|
||||
isPaginated: undefined,
|
||||
requestNext: undefined
|
||||
};
|
||||
this._initSettings = true;
|
||||
@ -412,7 +412,7 @@ define([], function () {
|
||||
str: str,
|
||||
from: 0,
|
||||
count: 100,
|
||||
total: undefined,
|
||||
isPaginated: undefined,
|
||||
requestNext: undefined,
|
||||
scrollTop: 0
|
||||
};
|
||||
@ -422,18 +422,18 @@ define([], function () {
|
||||
|
||||
onUserMenuNext: function() {
|
||||
var data = this.userSearch;
|
||||
if (data && data.total!==undefined && data.from + data.count < data.total) {
|
||||
if (data && data.isPaginated!==undefined) {
|
||||
data.from += data.count;
|
||||
Common.UI.ExternalUsers.get('protect', undefined, data.from, data.count, data.str);
|
||||
}
|
||||
},
|
||||
|
||||
onUserMenuCallback: function(type, users, total) {
|
||||
onUserMenuCallback: function(type, users, isPaginated) {
|
||||
if (type!=='protect') return;
|
||||
|
||||
var me = this,
|
||||
from = this.userSearch.from,
|
||||
isClientSearch = total===undefined;
|
||||
isClientSearch = isPaginated===undefined;
|
||||
|
||||
if (this._initSettings) {
|
||||
if (users && _.find(users, function(item) { return item.id!==undefined && item.id!==null; })) { // has id in user info
|
||||
@ -468,7 +468,7 @@ define([], function () {
|
||||
var arr = [],
|
||||
str = this.cmbUser.getRawValue();
|
||||
|
||||
this.userSearch.total = total;
|
||||
this.userSearch.isPaginated = isPaginated;
|
||||
isClientSearch && (this.userSearch = null);
|
||||
|
||||
if (users && users.length>0) {
|
||||
@ -514,10 +514,10 @@ define([], function () {
|
||||
}
|
||||
this.cmbUser.setRawValue(str);
|
||||
|
||||
if (arr.length>0) {
|
||||
if (me.cmbUser.store.length>0) {
|
||||
this.cmbUser.openMenu(0, function() {
|
||||
if (!isClientSearch) {
|
||||
me.userSearch.requestNext = me.cmbUser.store.length<me.userSearch.total ? (1 - 10/me.cmbUser.store.length) * me.cmbUser.scroller.cmpEl.get(0).scrollHeight : -1;
|
||||
me.userSearch.requestNext = users && users.length>0 ? (1 - 10/me.cmbUser.store.length) * me.cmbUser.scroller.cmpEl.get(0).scrollHeight : -1;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user