feature: add col.filterAllowNull

This commit is contained in:
2024-02-04 13:15:42 +08:00
parent bed5c1aca1
commit a74436ac1f
3 changed files with 34 additions and 79 deletions

View File

@ -200,59 +200,6 @@ function getStatusText(status, dict) {
}
}
const SymbolDropdown = Symbol.for('ui-dropdown');
class DropdownColumn {
static create(col, trigger, parent) {
const drop = new Dropdown({ ...col.dropOptions, parent });
drop.onSelected = trigger;
return drop.create();
}
static _getDrop(element) {
const dropGlobal = global[SymbolDropdown];
if (dropGlobal == null) {
return null;
}
const dropId = element.dataset.dropId;
const drop = dropGlobal[dropId];
if (drop == null) {
return null;
}
return drop;
}
static _setValue(source, element, val) {
const data = source?.find(v => v.value === val);
if (data != null) {
val = data.text;
}
super.setValue(element, val);
}
static setValue(element, val, _item, col) {
if (element.tagName !== 'DIV') {
this._setValue(col.source, element, val);
return;
}
const drop = this._getDrop(element);
if (drop == null) {
return;
}
if (drop.source == null || drop.source.length === 0) {
let source = col.source;
if (source != null) {
drop.source = source;
}
}
drop.select(val, true);
}
static getValue(e) {
return e.value;
}
}
export function getMessageStatus(comm, r, _var) {
const messageStatus = {
0: r('P_CU_PENDING', 'Pending'),
@ -411,7 +358,7 @@ export function getMessageStatus(comm, r, _var) {
key: 'statusChanged',
caption: r('P_CU_REVISEDSTATUS', 'Revised Status'),
width: 155,
type: DropdownColumn,
type: Grid.ColumnTypes.Dropdown,
source: [
{ value: '-1', text: messageStatus[9999] },
{ value: '0', text: messageStatus[0] },

View File

@ -12,12 +12,10 @@
.status-grid,
.contacts-record,
.contacts-wo {
position: relative;
>.ui-grid {
overflow-x: visible;
>.ui-grid-body {
overflow: visible;
}
}
}
}
@ -496,7 +494,7 @@
height: 100%;
min-height: 120px;
>.ui-grid-body .ui-grid-body-content>.ui-grid-row>td {
>.ui-grid-wrapper>.ui-grid-table>tbody>.ui-grid-row>td {
vertical-align: top;
.col-icon {
@ -522,12 +520,14 @@
.contact-name {
overflow: hidden;
text-overflow: ellipsis;
line-height: 30px;
}
.contact-note {
color: #999;
overflow: hidden;
text-overflow: ellipsis;
margin: 3px 0 3px;
}
}
}