mirror of
https://github.com/lxsang/antos-frontend.git
synced 2024-12-27 17:58:22 +01:00
enhance the core API and default application
This commit is contained in:
parent
fb462fe31b
commit
f84da77825
@ -943,10 +943,13 @@ namespace OS {
|
|||||||
<afx-vbox>
|
<afx-vbox>
|
||||||
<afx-file-view data-id = "fileview" view="tree" status = "false"></afx-file-view>
|
<afx-file-view data-id = "fileview" view="tree" status = "false"></afx-file-view>
|
||||||
<input data-height = '26' type = "text" data-id = "filename" style="margin-left:5px; margin-right:5px;display:none;" />
|
<input data-height = '26' type = "text" data-id = "filename" style="margin-left:5px; margin-right:5px;display:none;" />
|
||||||
<div data-height = '30' style=' text-align:right;padding:3px;'>
|
<afx-hbox data-height = '30'>
|
||||||
|
<div style=' text-align:right;'>
|
||||||
<afx-button data-id = "bt-ok" text = "__(Ok)"></afx-button>
|
<afx-button data-id = "bt-ok" text = "__(Ok)"></afx-button>
|
||||||
<afx-button data-id = "bt-cancel" text = "__(Cancel)"></afx-button>
|
<afx-button data-id = "bt-cancel" text = "__(Cancel)"></afx-button>
|
||||||
</div>
|
</div>
|
||||||
|
<div data-width="5"></div>
|
||||||
|
</afx-hbox>
|
||||||
</afx-vbox>
|
</afx-vbox>
|
||||||
</afx-hbox>
|
</afx-hbox>
|
||||||
</afx-app-window>\
|
</afx-app-window>\
|
||||||
|
@ -319,7 +319,8 @@ namespace OS {
|
|||||||
* @memberof BaseModel
|
* @memberof BaseModel
|
||||||
*/
|
*/
|
||||||
trigger(e: string, d?: any): void {
|
trigger(e: string, d?: any): void {
|
||||||
return this.observable.trigger(e, d);
|
if(!this.observable) return;
|
||||||
|
this.observable.trigger(e, d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -509,9 +510,9 @@ namespace OS {
|
|||||||
* @returns {HTMLElement}
|
* @returns {HTMLElement}
|
||||||
* @memberof BaseModel
|
* @memberof BaseModel
|
||||||
*/
|
*/
|
||||||
protected select(sel: string): HTMLElement {
|
protected select(sel: string): JQuery<HTMLElement> {
|
||||||
if (this.scheme) {
|
if (this.scheme) {
|
||||||
return $(sel, this.scheme)[0];
|
return $(sel, this.scheme);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ namespace OS {
|
|||||||
* @memberof DB
|
* @memberof DB
|
||||||
*/
|
*/
|
||||||
save(d: any): Promise<API.RequestResult> {
|
save(d: any): Promise<API.RequestResult> {
|
||||||
return new Promise(async function (resolve, reject) {
|
return new Promise(async (resolve, reject) => {
|
||||||
try {
|
try {
|
||||||
const r = await Ant.OS.API.handle.dbquery("save", {
|
const r = await Ant.OS.API.handle.dbquery("save", {
|
||||||
table: this.table,
|
table: this.table,
|
||||||
|
@ -314,10 +314,10 @@ namespace OS {
|
|||||||
*/
|
*/
|
||||||
export function unloadApp(app: string): void {
|
export function unloadApp(app: string): void {
|
||||||
PM.killAll(app, true);
|
PM.killAll(app, true);
|
||||||
if (app[app] && app[app].style) {
|
if (application[app] && application[app].style) {
|
||||||
$(app[app].style).remove();
|
$(application[app].style).remove();
|
||||||
}
|
}
|
||||||
delete app[app];
|
delete application[app];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -333,7 +333,6 @@ namespace OS {
|
|||||||
path = setting.system.packages[app].path;
|
path = setting.system.packages[app].path;
|
||||||
}
|
}
|
||||||
const js = path + "/main.js";
|
const js = path + "/main.js";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const d = await js.asFileHandle().read("script");
|
const d = await js.asFileHandle().read("script");
|
||||||
try {
|
try {
|
||||||
@ -613,9 +612,11 @@ namespace OS {
|
|||||||
function bindContextMenu(event: JQuery.MouseEventBase): void {
|
function bindContextMenu(event: JQuery.MouseEventBase): void {
|
||||||
var handle = function (e: HTMLElement) {
|
var handle = function (e: HTMLElement) {
|
||||||
if (e.contextmenuHandle) {
|
if (e.contextmenuHandle) {
|
||||||
|
const m = $("#contextmenu")[0] as tag.MenuTag;
|
||||||
|
m.onmenuselect = () => {}
|
||||||
return e.contextmenuHandle(
|
return e.contextmenuHandle(
|
||||||
event,
|
event,
|
||||||
$("#contextmenu")[0] as tag.MenuTag
|
m
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
const p = $(e).parent().get(0);
|
const p = $(e).parent().get(0);
|
||||||
@ -995,7 +996,6 @@ namespace OS {
|
|||||||
loadTheme(setting.appearance.theme, true);
|
loadTheme(setting.appearance.theme, true);
|
||||||
wallpaper(undefined);
|
wallpaper(undefined);
|
||||||
OS.announcer.observable.one("syspanelloaded", async function () {
|
OS.announcer.observable.one("syspanelloaded", async function () {
|
||||||
// TODO load packages list then build system menu
|
|
||||||
OS.announcer.observable.on("systemlocalechange", (name) =>
|
OS.announcer.observable.on("systemlocalechange", (name) =>
|
||||||
$("#syspanel")[0].update()
|
$("#syspanel")[0].update()
|
||||||
);
|
);
|
||||||
|
@ -34,7 +34,10 @@ namespace OS {
|
|||||||
* @protected
|
* @protected
|
||||||
* @memberof NSpinnerTag
|
* @memberof NSpinnerTag
|
||||||
*/
|
*/
|
||||||
protected init(): void {}
|
protected init(): void {
|
||||||
|
this._value = 0;
|
||||||
|
this.step = 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -67,7 +70,7 @@ namespace OS {
|
|||||||
});
|
});
|
||||||
|
|
||||||
$(this.refs.decr).click((e) => {
|
$(this.refs.decr).click((e) => {
|
||||||
return (this.value = this.value - this.step);
|
this.value = this.value - this.step;
|
||||||
});
|
});
|
||||||
|
|
||||||
// @observable.on "calibrate", () -> @calibrate()
|
// @observable.on "calibrate", () -> @calibrate()
|
||||||
|
@ -66,6 +66,7 @@ namespace OS {
|
|||||||
protected init(): void {
|
protected init(): void {
|
||||||
this.swon = false;
|
this.swon = false;
|
||||||
this.enable = true;
|
this.enable = true;
|
||||||
|
this._onchange = this._onchanging = (e) => {};
|
||||||
}
|
}
|
||||||
protected calibrate(): void {}
|
protected calibrate(): void {}
|
||||||
protected reload(d?: any): void {}
|
protected reload(d?: any): void {}
|
||||||
|
@ -128,7 +128,7 @@ namespace OS {
|
|||||||
*
|
*
|
||||||
* @memberof TabContainerTag
|
* @memberof TabContainerTag
|
||||||
*/
|
*/
|
||||||
set tabbarheigh(v: number) {
|
set tabbarheight(v: number) {
|
||||||
$(this.refs.bar).attr("data-height", `${v}`);
|
$(this.refs.bar).attr("data-height", `${v}`);
|
||||||
(this.refs.wrapper as TileLayoutTag).calibrate();
|
(this.refs.wrapper as TileLayoutTag).calibrate();
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,8 @@ namespace OS {
|
|||||||
$(this).css("display", "block");
|
$(this).css("display", "block");
|
||||||
$(this.refs.yield)
|
$(this.refs.yield)
|
||||||
.css("display", "flex")
|
.css("display", "flex")
|
||||||
.css("width", "100%");
|
.css("width", "100%")
|
||||||
|
.css("height", "100%");
|
||||||
this.observable.on("resize", (e) => this.calibrate());
|
this.observable.on("resize", (e) => this.calibrate());
|
||||||
return this.calibrate();
|
return this.calibrate();
|
||||||
}
|
}
|
||||||
@ -67,6 +68,7 @@ namespace OS {
|
|||||||
$(this.refs.yield)
|
$(this.refs.yield)
|
||||||
.children()
|
.children()
|
||||||
.each(function (e) {
|
.each(function (e) {
|
||||||
|
$(this).css("height", "100%");
|
||||||
let attv = $(this).attr("data-width");
|
let attv = $(this).attr("data-width");
|
||||||
let dw = 0;
|
let dw = 0;
|
||||||
if (attv && attv !== "grow") {
|
if (attv && attv !== "grow") {
|
||||||
@ -108,6 +110,7 @@ namespace OS {
|
|||||||
.children()
|
.children()
|
||||||
.each(function (e) {
|
.each(function (e) {
|
||||||
let dh = 0;
|
let dh = 0;
|
||||||
|
$(this).css("width", "100%");
|
||||||
let attv = $(this).attr("data-height");
|
let attv = $(this).attr("data-height");
|
||||||
if (attv && attv !== "grow") {
|
if (attv && attv !== "grow") {
|
||||||
if (attv[attv.length - 1] === "%") {
|
if (attv[attv.length - 1] === "%") {
|
||||||
|
@ -168,10 +168,12 @@ namespace OS {
|
|||||||
$(this.refs.toggle).addClass(
|
$(this.refs.toggle).addClass(
|
||||||
"afx-tree-view-folder-open"
|
"afx-tree-view-folder-open"
|
||||||
);
|
);
|
||||||
}
|
} else {
|
||||||
$(this.refs.toggle).addClass("afx-tree-view-folder-close");
|
$(this.refs.toggle).addClass("afx-tree-view-folder-close");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
|
@ -241,7 +241,23 @@ namespace OS {
|
|||||||
name: string,
|
name: string,
|
||||||
cls: { new (): T }
|
cls: { new (): T }
|
||||||
): void {
|
): void {
|
||||||
|
try {
|
||||||
customElements.define(name, cls);
|
customElements.define(name, cls);
|
||||||
|
} catch (error) {
|
||||||
|
const proto = customElements.get(name);
|
||||||
|
if(cls)
|
||||||
|
{
|
||||||
|
const props = Object.getOwnPropertyNames(cls.prototype);
|
||||||
|
// redefine the class
|
||||||
|
for(let prop of props)
|
||||||
|
{
|
||||||
|
proto.prototype[prop] = cls.prototype[prop];
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
throw error;
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<afx-app-window data-id = "files-app-window" apptitle="Files" width="600" height="400">
|
<afx-app-window data-id = "files-app-window" apptitle="Files" width="600" height="400">
|
||||||
<afx-vbox>
|
<afx-vbox>
|
||||||
<afx-hbox data-height = "30" data-id = "nav-bar">
|
<afx-hbox data-height = "23" data-id = "nav-bar">
|
||||||
<afx-button data-width = "23" data-id = "btback" iconclass = "fa fa-arrow-left"></afx-button>
|
<afx-button data-width = "23" data-id = "btback" iconclass = "fa fa-arrow-left"></afx-button>
|
||||||
<input type = "text" data-id = "navinput"></input>
|
<input type = "text" data-id = "navinput"></input>
|
||||||
<div data-width = "2"></div>
|
<div data-width = "2"></div>
|
||||||
@ -8,6 +8,7 @@
|
|||||||
<div data-width = "2"></div>
|
<div data-width = "2"></div>
|
||||||
<afx-button data-width = "23" data-id = "btlist" iconclass = "fa fa-th-list"></afx-button>
|
<afx-button data-width = "23" data-id = "btlist" iconclass = "fa fa-th-list"></afx-button>
|
||||||
</afx-hbox>
|
</afx-hbox>
|
||||||
|
<div data-height="5"></div>
|
||||||
<afx-hbox>
|
<afx-hbox>
|
||||||
<afx-list-view data-id = "favouri" data-width = "150" min-width="100">
|
<afx-list-view data-id = "favouri" data-width = "150" min-width="100">
|
||||||
</afx-list-view>
|
</afx-list-view>
|
||||||
|
@ -179,15 +179,14 @@ detail:
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.loglist.onitemclose = (e) => {
|
this.loglist.onitemclose = (e) => {
|
||||||
let el;
|
let el: TAG.ListViewItemTag;
|
||||||
if (e && e.data) {
|
if (e && e.data) {
|
||||||
el = e.data.item;
|
el = e.data.item;
|
||||||
}
|
}
|
||||||
if (!el) {
|
if (!el) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const data = el.get("data");
|
const data = el.data;
|
||||||
console.log(data);
|
|
||||||
if (!data.selected) {
|
if (!data.selected) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ afx-grid-view afx-grid-row.afx-grid-row-selected afx-grid-cell
|
|||||||
}
|
}
|
||||||
afx-grid-view afx-grid-row.afx-grid-row-selected afx-grid-cell.afx-grid-cell-selected
|
afx-grid-view afx-grid-row.afx-grid-row-selected afx-grid-cell.afx-grid-cell-selected
|
||||||
{
|
{
|
||||||
font-weight: bold;
|
font-weight: normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
afx-tree-view{
|
|
||||||
padding:3px;
|
|
||||||
}
|
|
||||||
afx-tree-view div{
|
afx-tree-view div{
|
||||||
padding:3px;
|
padding:3px;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,3 @@
|
|||||||
afx-tree-view{
|
|
||||||
padding:3px;
|
|
||||||
}
|
|
||||||
afx-tree-view div{
|
afx-tree-view div{
|
||||||
padding:3px;
|
padding:3px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user