leave edit event

This commit is contained in:
2024-01-23 10:40:49 +08:00
parent 27b2f1052f
commit 09e62c4304
6 changed files with 83 additions and 31 deletions

View File

@ -111,9 +111,18 @@ export class GridDropdownColumn extends GridColumn {
wrapper
});
drop.onselected = trigger;
if (typeof col.onDropExpanded === 'function') {
drop.onexpanded = col.onDropExpanded.bind(col, it.values, drop);
}
drop.onexpanded = function () {
if (it.__editing == null) {
it.__editing = {
[col.key]: true
}
} else {
it.__editing[col.key] = true;
}
if (typeof col.onDropExpanded === 'function') {
col.onDropExpanded.call(col, it.values, drop);
}
};
return drop.create();
}
@ -201,6 +210,21 @@ export class GridDropdownColumn extends GridColumn {
}
drop.disabled = enabled === false;
}
static leaveEdit(element, wrapper) {
wrapper.querySelectorAll('.ui-drop-box.active').forEach(e => {
if (e != null) {
e.classList.remove('active');
}
});
const drop = this._getDrop(element);
if (drop == null) {
return;
}
if (drop?.multiselect && typeof drop.oncollapsed === 'function') {
drop.oncollapsed();
}
}
}
export class GridCheckboxColumn extends GridColumn {