Improvement antos API + bugs fixed

This commit is contained in:
lxsang
2020-12-21 15:55:02 +01:00
parent 235a9334d6
commit 9fe744fde7
8 changed files with 88 additions and 4 deletions

View File

@ -88,6 +88,28 @@ namespace OS {
this._ontabselect = f;
}
/**
* Get all tab items in the container
*
* @readonly
* @type {TabContainerTabType[]}
* @memberof TabContainerTag
*/
get tabs(): TabContainerTabType[]
{
return (this.refs.bar as TabBarTag).items as TabContainerTabType[];
}
/**
* Select a tab by its index
*
* @memberof TabContainerTag
*/
set selectedIndex(i: number) {
(this.refs.bar as TabBarTag).selected = i;
}
/**
* Setter:
*
@ -135,6 +157,7 @@ namespace OS {
}
$(v.container).show();
this.observable.trigger("resize", undefined);
$(v.container).attr("tabindex",-1).css("outline", "none").trigger("focus");
}
get selectedTab(): TabContainerTabType {
return this._selectedTab;
@ -182,9 +205,10 @@ namespace OS {
*
* @param {GenericObject<any>} item tab descriptor
* @param {boolean} insert insert the tab content to the container ?
* @returns {ListViewItemTag} the tab DOM element
* @memberof TabContainerTag
*/
public addTab(item: GenericObject<any>, insert: boolean): void {
public addTab(item: GenericObject<any>, insert: boolean): ListViewItemTag {
if (insert) {
$(this.refs.yield).append(item.container);
}
@ -196,6 +220,7 @@ namespace OS {
item
);
el.selected = true;
return el;
}
/**
@ -210,6 +235,7 @@ namespace OS {
}
(this.refs.bar as TabBarTag).delete(tab);
}
/**
* Mount the tag and bind basic events
*

View File

@ -1596,6 +1596,11 @@ namespace OS {
* @memberof URLFileHandle
*/
protected _rd(t: string): Promise<any> {
//read the file
if (t === "binary") {
//return API.handle.fileblob(this.path);
return API.blob(this.path+ "?_=" + new Date().getTime());
}
return API.get(this.path, t ? t : "text");
}
}