sync
This commit is contained in:
@ -102,12 +102,16 @@ const SymbolDropdown = Symbol.for('ui-dropdown');
|
||||
|
||||
export class GridDropdownColumn extends GridColumn {
|
||||
static createEdit(trigger, col, parent) {
|
||||
const drop = new Dropdown({ ...col.dropOptions, parent });
|
||||
const drop = new Dropdown({
|
||||
...col.dropOptions,
|
||||
parent,
|
||||
holder: parent
|
||||
});
|
||||
drop.onselected = trigger;
|
||||
return drop.create();
|
||||
}
|
||||
|
||||
static #getDrop(element) {
|
||||
static _getDrop(element) {
|
||||
const dropGlobal = global[SymbolDropdown];
|
||||
if (dropGlobal == null) {
|
||||
return null;
|
||||
@ -120,7 +124,7 @@ export class GridDropdownColumn extends GridColumn {
|
||||
return drop;
|
||||
}
|
||||
|
||||
static #getSource(item, col) {
|
||||
static _getSource(item, col) {
|
||||
let source = col.source;
|
||||
if (typeof source === 'function') {
|
||||
source = source(item);
|
||||
@ -128,7 +132,7 @@ export class GridDropdownColumn extends GridColumn {
|
||||
return source;
|
||||
}
|
||||
|
||||
static #setValue(source, element, val) {
|
||||
static _setValue(source, element, val) {
|
||||
const data = source?.find(v => v.value === val);
|
||||
if (data != null) {
|
||||
val = data.text;
|
||||
@ -138,20 +142,20 @@ export class GridDropdownColumn extends GridColumn {
|
||||
|
||||
static setValue(element, val, item, col) {
|
||||
if (element.tagName !== 'DIV') {
|
||||
let source = this.#getSource(item, col);
|
||||
let source = this._getSource(item, col);
|
||||
if (source instanceof Promise) {
|
||||
source.then(s => this.#setValue(s, element, val));
|
||||
source.then(s => this._setValue(s, element, val));
|
||||
} else {
|
||||
this.#setValue(source, element, val);
|
||||
this._setValue(source, element, val);
|
||||
}
|
||||
return;
|
||||
}
|
||||
const drop = this.#getDrop(element);
|
||||
const drop = this._getDrop(element);
|
||||
if (drop == null) {
|
||||
return;
|
||||
}
|
||||
if (drop.source == null || drop.source.length === 0) {
|
||||
let source = this.#getSource(item, col);
|
||||
let source = this._getSource(item, col);
|
||||
if (source instanceof Promise) {
|
||||
source.then(s => {
|
||||
drop.source = s;
|
||||
@ -171,7 +175,7 @@ export class GridDropdownColumn extends GridColumn {
|
||||
|
||||
static setEnabled(element, enabled) {
|
||||
super.setEnabled(element , enabled);
|
||||
const drop = this.#getDrop(element);
|
||||
const drop = this._getDrop(element);
|
||||
if (drop == null) {
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user