mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
Api: Handle add push messages in the nextmatch list
This commit is contained in:
parent
bf44ee753a
commit
69420c19ad
@ -509,8 +509,10 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
|||||||
case "delete":
|
case "delete":
|
||||||
// Handled above, more code to execute after loop
|
// Handled above, more code to execute after loop
|
||||||
break;
|
break;
|
||||||
case "edit":
|
|
||||||
case "add":
|
case "add":
|
||||||
|
this.refresh_add(uid);
|
||||||
|
break;
|
||||||
|
case "edit":
|
||||||
default:
|
default:
|
||||||
// Trigger refresh
|
// Trigger refresh
|
||||||
this.applyFilters();
|
this.applyFilters();
|
||||||
@ -520,6 +522,28 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
|||||||
// Trigger an event so app code can act on it
|
// Trigger an event so app code can act on it
|
||||||
jQuery(this).triggerHandler("refresh", [this, _row_ids, _type]);
|
jQuery(this).triggerHandler("refresh", [this, _row_ids, _type]);
|
||||||
};
|
};
|
||||||
|
/**
|
||||||
|
* An entry has been added. Put it in the list.
|
||||||
|
*
|
||||||
|
* @param uid
|
||||||
|
*/
|
||||||
|
et2_nextmatch.prototype.refresh_add = function (uid) {
|
||||||
|
var entry = this.controller._selectionMgr._getRegisteredRowsEntry(uid);
|
||||||
|
// Insert at the top of the list
|
||||||
|
entry.idx = 0;
|
||||||
|
this.controller._insertDataRow(entry, true);
|
||||||
|
if (this.onadd && !this.onadd(entry)) {
|
||||||
|
this.controller._grid.deleteRow(entry.idx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Set "new entry" class - but it has to stay so register and re-add it after the data is there
|
||||||
|
entry.row.tr.addClass("new_entry");
|
||||||
|
var callback = function (data) {
|
||||||
|
data.class += "new_entry";
|
||||||
|
this.egw().dataUnregisterUID(uid, callback, this);
|
||||||
|
};
|
||||||
|
this.egw().dataRegisterUID(uid, callback, this, this.getInstanceManager().etemplate_exec_id, this.id);
|
||||||
|
};
|
||||||
/**
|
/**
|
||||||
* Gets the selection
|
* Gets the selection
|
||||||
*
|
*
|
||||||
@ -2054,6 +2078,12 @@ var et2_nextmatch = /** @class */ (function (_super) {
|
|||||||
"default": et2_no_init,
|
"default": et2_no_init,
|
||||||
"description": "JS code that gets executed when a _file_ is dropped on a row. Other drop interactions are handled by the action system. Return false to prevent the default link action."
|
"description": "JS code that gets executed when a _file_ is dropped on a row. Other drop interactions are handled by the action system. Return false to prevent the default link action."
|
||||||
},
|
},
|
||||||
|
"onadd": {
|
||||||
|
"name": "onAdd",
|
||||||
|
"type": "js",
|
||||||
|
"default": et2_no_init,
|
||||||
|
"description": "JS code that gets executed when a new entry is added via refresh(). Allows apps to override the default handling. Return false to cancel the add."
|
||||||
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"name": "Settings",
|
"name": "Settings",
|
||||||
"type": "any",
|
"type": "any",
|
||||||
|
@ -179,6 +179,12 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
|||||||
"default": et2_no_init,
|
"default": et2_no_init,
|
||||||
"description": "JS code that gets executed when a _file_ is dropped on a row. Other drop interactions are handled by the action system. Return false to prevent the default link action."
|
"description": "JS code that gets executed when a _file_ is dropped on a row. Other drop interactions are handled by the action system. Return false to prevent the default link action."
|
||||||
},
|
},
|
||||||
|
"onadd": {
|
||||||
|
"name": "onAdd",
|
||||||
|
"type": "js",
|
||||||
|
"default": et2_no_init,
|
||||||
|
"description": "JS code that gets executed when a new entry is added via refresh(). Allows apps to override the default handling. Return false to cancel the add."
|
||||||
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"name": "Settings",
|
"name": "Settings",
|
||||||
"type": "any",
|
"type": "any",
|
||||||
@ -769,8 +775,10 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
|||||||
case "delete":
|
case "delete":
|
||||||
// Handled above, more code to execute after loop
|
// Handled above, more code to execute after loop
|
||||||
break;
|
break;
|
||||||
case "edit":
|
|
||||||
case "add":
|
case "add":
|
||||||
|
this.refresh_add(uid);
|
||||||
|
break;
|
||||||
|
case "edit":
|
||||||
default:
|
default:
|
||||||
// Trigger refresh
|
// Trigger refresh
|
||||||
this.applyFilters();
|
this.applyFilters();
|
||||||
@ -781,6 +789,33 @@ export class et2_nextmatch extends et2_DOMWidget implements et2_IResizeable, et2
|
|||||||
jQuery(this).triggerHandler("refresh",[this,_row_ids,_type]);
|
jQuery(this).triggerHandler("refresh",[this,_row_ids,_type]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An entry has been added. Put it in the list.
|
||||||
|
*
|
||||||
|
* @param uid
|
||||||
|
*/
|
||||||
|
protected refresh_add(uid:string)
|
||||||
|
{
|
||||||
|
var entry = this.controller._selectionMgr._getRegisteredRowsEntry(uid);
|
||||||
|
// Insert at the top of the list
|
||||||
|
entry.idx = 0;
|
||||||
|
this.controller._insertDataRow(entry,true);
|
||||||
|
|
||||||
|
if(this.onadd && !this.onadd(entry))
|
||||||
|
{
|
||||||
|
this.controller._grid.deleteRow(entry.idx);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set "new entry" class - but it has to stay so register and re-add it after the data is there
|
||||||
|
entry.row.tr.addClass("new_entry");
|
||||||
|
let callback = function(data) {
|
||||||
|
data.class += "new_entry";
|
||||||
|
this.egw().dataUnregisterUID(uid, callback, this);
|
||||||
|
};
|
||||||
|
this.egw().dataRegisterUID(uid, callback, this, this.getInstanceManager().etemplate_exec_id, this.id);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the selection
|
* Gets the selection
|
||||||
*
|
*
|
||||||
|
@ -183,6 +183,8 @@ var EgwApp = /** @class */ (function () {
|
|||||||
EgwApp.prototype.updateList = function (nm, pushData) {
|
EgwApp.prototype.updateList = function (nm, pushData) {
|
||||||
switch (pushData.type) {
|
switch (pushData.type) {
|
||||||
case 'add':
|
case 'add':
|
||||||
|
nm.refresh(this.uid(pushData), 'add');
|
||||||
|
break;
|
||||||
case 'unknown':
|
case 'unknown':
|
||||||
nm.applyFilters();
|
nm.applyFilters();
|
||||||
break;
|
break;
|
||||||
|
@ -284,6 +284,8 @@ export abstract class EgwApp
|
|||||||
switch (pushData.type)
|
switch (pushData.type)
|
||||||
{
|
{
|
||||||
case 'add':
|
case 'add':
|
||||||
|
nm.refresh(this.uid(pushData), 'add');
|
||||||
|
break;
|
||||||
case 'unknown':
|
case 'unknown':
|
||||||
nm.applyFilters();
|
nm.applyFilters();
|
||||||
break;
|
break;
|
||||||
|
@ -2094,6 +2094,25 @@ table.egwGridView_outer thead tr th.noResize:hover {
|
|||||||
.et2_nextmatch .subentry.level_3 div.et2_vbox {
|
.et2_nextmatch .subentry.level_3 div.et2_vbox {
|
||||||
margin-left: 7.5em;
|
margin-left: 7.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New entry (via push)
|
||||||
|
*/
|
||||||
|
.et2_nextmatch .new_entry {
|
||||||
|
animation: new_entry_pulse 5s;
|
||||||
|
animation-fill-mode: forwards;
|
||||||
|
}
|
||||||
|
@keyframes new_entry_pulse {
|
||||||
|
0% {
|
||||||
|
background-color: rgba(255,255,185,0);
|
||||||
|
}
|
||||||
|
15% {
|
||||||
|
background-color: rgba(255,255,185, 1);
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
background-color: rgba(255,255,185,0.3);
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* itempicker widget
|
* itempicker widget
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user