mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-11-08 14:08:22 +01:00
Improvement antos API + bugs fixed
This commit is contained in:
parent
235a9334d6
commit
9fe744fde7
Binary file not shown.
@ -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
|
||||
*
|
||||
|
@ -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");
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,11 @@ namespace OS {
|
||||
protected logger() {
|
||||
if(!this.app.setting.showBottomBar)
|
||||
{
|
||||
this.app.showBottomBar(true);
|
||||
this.app.showOutput(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.app.showOutput(false);
|
||||
}
|
||||
return this.app.logger;
|
||||
}
|
||||
|
@ -86,6 +86,31 @@ namespace OS {
|
||||
.catch((e) => this.logger().error(__("Unable to read meta-data: {0}", e.stack)));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @memberof ExtensionMaker
|
||||
*/
|
||||
installFromURL(): void
|
||||
{
|
||||
this.logger().clear();
|
||||
this.app
|
||||
.openDialog("PromptDialog", {
|
||||
title: __("Enter URI"),
|
||||
label: __("Please enter extension URI:")
|
||||
})
|
||||
.then(async (v) => {
|
||||
if(!v) return;
|
||||
try {
|
||||
await this.installZip(v);
|
||||
this.logger().info(__("Extension installed"));
|
||||
return this.app.loadExtensionMetaData();
|
||||
} catch (e) {
|
||||
return this.app.error(__("Unable to install extension: {0}", v));
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
/**
|
||||
*
|
||||
*
|
||||
@ -295,6 +320,10 @@ namespace OS {
|
||||
if (this.app.extensions[meta.meta.name]) {
|
||||
this.app.extensions[meta.meta.name].text = meta.meta.text;
|
||||
this.app.extensions[meta.meta.name].nodes = [];
|
||||
if(this.app.extensions[meta.meta.name].ext && this.app.extensions[meta.meta.name].ext.cleanup)
|
||||
{
|
||||
this.app.extensions[meta.meta.name].ext.cleanup();
|
||||
}
|
||||
this.app.extensions[meta.meta.name].ext = new App.extensions[meta.meta.name](this.app);
|
||||
for (v of meta.meta.actions) {
|
||||
this.app.extensions[meta.meta.name].addAction(v);
|
||||
|
@ -40,8 +40,12 @@
|
||||
"name": "release"
|
||||
},
|
||||
{
|
||||
"text": "__(Install extension)",
|
||||
"text": "__(Install extension from file)",
|
||||
"name": "install"
|
||||
},
|
||||
{
|
||||
"text": "__(Install extension from URL)",
|
||||
"name": "installFromURL"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -448,6 +448,11 @@ namespace OS {
|
||||
this.trigger("resize");
|
||||
}
|
||||
|
||||
showOutput(toggle:boolean = false): void {
|
||||
if(toggle)
|
||||
this.showBottomBar(true);
|
||||
this.bottombar.selectedIndex = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply [[showBottomBar]] from user setting value
|
||||
@ -936,6 +941,14 @@ namespace OS {
|
||||
let v: GenericObject<any>;
|
||||
const dirties = this.eum.dirties();
|
||||
if (dirties.length === 0) {
|
||||
// cleanup all extension
|
||||
for(let k in this.extensions)
|
||||
{
|
||||
if(this.extensions[k].ext && this.extensions[k].ext.cleanup)
|
||||
{
|
||||
this.extensions[k].ext.cleanup();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
evt.preventDefault();
|
||||
|
@ -7,4 +7,7 @@ class App.extensions.{0} extends App.BaseExtension
|
||||
super app
|
||||
|
||||
test: () ->
|
||||
@notify "Test action is invoked"
|
||||
@notify "Test action is invoked"
|
||||
|
||||
cleanup: () ->
|
||||
# clean up the extension on application exit
|
Loading…
Reference in New Issue
Block a user