add test and fix some tags

This commit is contained in:
Xuan Sang LE
2020-05-31 23:37:36 +02:00
parent ced3777d30
commit af496b0aac
4 changed files with 282 additions and 72 deletions

View File

@ -171,7 +171,9 @@ namespace OS {
get cellitem(): string {
return $(this).attr("cellitem");
}
get header(): GenericObject<any>[] {
return this._header;
}
set header(v: GenericObject<any>[]) {
this._header = v;
if (!v || v.length === 0) {
@ -237,14 +239,23 @@ namespace OS {
}
push(row: GenericObject<any>[], flag: boolean): void {
const rowel = $("<afx-grid-row>").css(
"display",
"contents"
);
if (flag) {
$(this.refs.grid).prepend(rowel[0]);
if(!this.rows.includes(row))
{
this.rows.unshift(row);
}
} else {
rowel.appendTo(this.refs.grid);
if(!this.rows.includes(row))
{
this.rows.push(row);
}
}
const el = rowel[0] as GridRowTag;
@ -320,12 +331,13 @@ namespace OS {
return;
}
$(this.selectedRow).removeClass();
this._selectedRow = row;
this._selectedRows = [row];
evt.data.item = row;
evt.data.items = [row];
$(row).removeClass().addClass("afx-grid-row-selected");
this._selectedRows = [row];
}
this._selectedRow = row;
this._onrowselect(evt);
return this.observable.trigger("rowselect", evt);
}

View File

@ -654,7 +654,6 @@ namespace OS {
let tag = this.itemtag;
if (item.tag) tag = item.tag;
const el = $(`<${tag}>`);
el.appendTo(this.refs.mlist);
if (flag) {
if (!this.has_data(item)) {
this.data.unshift(item);
@ -664,6 +663,7 @@ namespace OS {
if (!this.has_data(item)) {
this.data.push(item);
}
el.appendTo(this.refs.mlist);
}
el[0].uify(this.observable);
const element = el[0] as ListViewItemTag;

View File

@ -219,7 +219,6 @@ namespace OS {
};
e.preventDefault();
if (this.is_root() && this.has_nodes()) {
console.log("show submenu");
$(this.refs.submenu).show();
} else {
this.submenuoff();
@ -393,15 +392,15 @@ namespace OS {
* @returns {void}
* @memberof SimpleMenuEntryTag
*/
reset_radio(): void {
protected reset_radio(): void {
if (!this.has_nodes()) {
return;
}
for (let v of this.nodes) {
if (!v.domel.get("radio")) {
return;
if (!v.domel.radio) {
continue;
}
v.domel.set("checked", false);
v.domel.checked = false;
}
}