issue: customer communication contacts grid height.

change: replace schedule date control.
change: date validation from 1753-01-01 to 9999-12-31.
This commit is contained in:
2024-04-07 08:39:44 +08:00
parent 0ff48a0ac4
commit b6fe3e34f5
9 changed files with 66 additions and 16 deletions

View File

@ -445,8 +445,9 @@ export class GridDropdownColumn extends GridColumn {
* @param {any} val
* @param {GridItemWrapper} wrapper
* @param {GridColumnDefinition} col
* @param {Grid} grid
*/
static setValue(element, val, wrapper, col) {
static setValue(element, val, wrapper, col, grid) {
if (element.tagName !== 'DIV') {
let source = this._getSource(wrapper, col);
if (source instanceof Promise) {
@ -460,19 +461,42 @@ export class GridDropdownColumn extends GridColumn {
if (drop == null) {
return;
}
const ignoreCase = col.dropRestrictCase !== true;
if (drop.source == null || drop.source.length === 0) {
let source = this._getSource(wrapper, col);
if (source instanceof Promise) {
source.then(s => {
drop.source = s;
drop.select(val, true);
drop.select(val, true, ignoreCase);
})
return;
} else if (source != null) {
drop.source = source;
}
}
drop.select(val, true);
if (typeof val === 'string' && val !== '') {
const lVal = String(val).toLowerCase();
const item = drop.source.find(s => {
let v = s[col.dropOptions?.valueKey ?? 'value'];
if (ignoreCase) {
return String(v).toLowerCase() === lVal;
}
return v === val;
});
if (item == null) {
let text;
if (col.text == null && typeof col.filter === 'function') {
text = col.filter(wrapper.values, false, grid._var.refs.body);
} else {
text = val;
}
drop.source.push({
[col.dropOptions?.textKey ?? 'text']: text,
[col.dropOptions?.valueKey ?? 'value']: val
});
}
}
drop.select(val, true, ignoreCase);
}
/**

View File

@ -258,6 +258,7 @@ let r = lang;
* @property {boolean} [filterAsValue=false] - 列头过滤强制使用 `Value` 字段
* @property {GridItemSortCallback} [sortFilter] - 自定义列排序函数
* @property {DropdownOptions} [dropOptions] - 列为下拉列表类型时以该值设置下拉框的参数
* @property {boolean} [dropRestrictCase=false] - 下拉列表是否区分大小写
* @property {(GridSourceItem[] | Promise<GridSourceItem[]> | GridDropdownSourceCallback)} [source] - 列为下拉列表类型时以该值设置下拉列表数据源,支持返回异步对象,也支持调用函数返回
* @property {boolean} [sourceCache=false] - 下拉列表数据源是否缓存结果即行数据未发生变化时仅从source属性获取一次值
* @property {("fa-light" | "fa-regular" | "fa-solid")} [iconType=fa-light] - 列为图标类型时以该值设置图标样式
@ -1924,7 +1925,8 @@ export class Grid {
}
const it = this._var.currentSource[index];
// clear dropdown source cache
delete it.source;
// FIXME: 清除缓存会导致选中状态下动态数据源下拉列表显示为空
// delete it.source;
it.values = item;
if (this.sortIndex >= 0) {
this.sortColumn();
@ -4127,7 +4129,8 @@ export class Grid {
return;
}
const vals = this._var.currentSource[this._var.startIndex + index];
delete vals.source;
// FIXME: 清除缓存会导致选中状态下动态数据源下拉列表显示为空
// delete vals.source;
const item = vals.values;
if (item == null) {
return;