mirror of
https://github.com/lxsang/antos-frontend.git
synced 2025-04-16 21:06:44 +02: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;
|
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:
|
* Setter:
|
||||||
*
|
*
|
||||||
@ -135,6 +157,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
$(v.container).show();
|
$(v.container).show();
|
||||||
this.observable.trigger("resize", undefined);
|
this.observable.trigger("resize", undefined);
|
||||||
|
$(v.container).attr("tabindex",-1).css("outline", "none").trigger("focus");
|
||||||
}
|
}
|
||||||
get selectedTab(): TabContainerTabType {
|
get selectedTab(): TabContainerTabType {
|
||||||
return this._selectedTab;
|
return this._selectedTab;
|
||||||
@ -182,9 +205,10 @@ namespace OS {
|
|||||||
*
|
*
|
||||||
* @param {GenericObject<any>} item tab descriptor
|
* @param {GenericObject<any>} item tab descriptor
|
||||||
* @param {boolean} insert insert the tab content to the container ?
|
* @param {boolean} insert insert the tab content to the container ?
|
||||||
|
* @returns {ListViewItemTag} the tab DOM element
|
||||||
* @memberof TabContainerTag
|
* @memberof TabContainerTag
|
||||||
*/
|
*/
|
||||||
public addTab(item: GenericObject<any>, insert: boolean): void {
|
public addTab(item: GenericObject<any>, insert: boolean): ListViewItemTag {
|
||||||
if (insert) {
|
if (insert) {
|
||||||
$(this.refs.yield).append(item.container);
|
$(this.refs.yield).append(item.container);
|
||||||
}
|
}
|
||||||
@ -196,6 +220,7 @@ namespace OS {
|
|||||||
item
|
item
|
||||||
);
|
);
|
||||||
el.selected = true;
|
el.selected = true;
|
||||||
|
return el;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -210,6 +235,7 @@ namespace OS {
|
|||||||
}
|
}
|
||||||
(this.refs.bar as TabBarTag).delete(tab);
|
(this.refs.bar as TabBarTag).delete(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mount the tag and bind basic events
|
* Mount the tag and bind basic events
|
||||||
*
|
*
|
||||||
|
@ -1596,6 +1596,11 @@ namespace OS {
|
|||||||
* @memberof URLFileHandle
|
* @memberof URLFileHandle
|
||||||
*/
|
*/
|
||||||
protected _rd(t: string): Promise<any> {
|
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");
|
return API.get(this.path, t ? t : "text");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,11 @@ namespace OS {
|
|||||||
protected logger() {
|
protected logger() {
|
||||||
if(!this.app.setting.showBottomBar)
|
if(!this.app.setting.showBottomBar)
|
||||||
{
|
{
|
||||||
this.app.showBottomBar(true);
|
this.app.showOutput(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.app.showOutput(false);
|
||||||
}
|
}
|
||||||
return this.app.logger;
|
return this.app.logger;
|
||||||
}
|
}
|
||||||
|
@ -86,6 +86,31 @@ namespace OS {
|
|||||||
.catch((e) => this.logger().error(__("Unable to read meta-data: {0}", e.stack)));
|
.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]) {
|
if (this.app.extensions[meta.meta.name]) {
|
||||||
this.app.extensions[meta.meta.name].text = meta.meta.text;
|
this.app.extensions[meta.meta.name].text = meta.meta.text;
|
||||||
this.app.extensions[meta.meta.name].nodes = [];
|
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);
|
this.app.extensions[meta.meta.name].ext = new App.extensions[meta.meta.name](this.app);
|
||||||
for (v of meta.meta.actions) {
|
for (v of meta.meta.actions) {
|
||||||
this.app.extensions[meta.meta.name].addAction(v);
|
this.app.extensions[meta.meta.name].addAction(v);
|
||||||
|
@ -40,8 +40,12 @@
|
|||||||
"name": "release"
|
"name": "release"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"text": "__(Install extension)",
|
"text": "__(Install extension from file)",
|
||||||
"name": "install"
|
"name": "install"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "__(Install extension from URL)",
|
||||||
|
"name": "installFromURL"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -448,6 +448,11 @@ namespace OS {
|
|||||||
this.trigger("resize");
|
this.trigger("resize");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showOutput(toggle:boolean = false): void {
|
||||||
|
if(toggle)
|
||||||
|
this.showBottomBar(true);
|
||||||
|
this.bottombar.selectedIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply [[showBottomBar]] from user setting value
|
* Apply [[showBottomBar]] from user setting value
|
||||||
@ -936,6 +941,14 @@ namespace OS {
|
|||||||
let v: GenericObject<any>;
|
let v: GenericObject<any>;
|
||||||
const dirties = this.eum.dirties();
|
const dirties = this.eum.dirties();
|
||||||
if (dirties.length === 0) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
@ -7,4 +7,7 @@ class App.extensions.{0} extends App.BaseExtension
|
|||||||
super app
|
super app
|
||||||
|
|
||||||
test: () ->
|
test: () ->
|
||||||
@notify "Test action is invoked"
|
@notify "Test action is invoked"
|
||||||
|
|
||||||
|
cleanup: () ->
|
||||||
|
# clean up the extension on application exit
|
Loading…
x
Reference in New Issue
Block a user