add more doc

This commit is contained in:
lxsang 2020-06-12 20:24:39 +02:00
parent d5df803c2c
commit 218f6142c6
24 changed files with 1006 additions and 793 deletions

View File

@ -1,10 +1,3 @@
/*
* decaffeinate suggestions:
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com> // Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
// AnTOS Web desktop is is licensed under the GNU General Public // AnTOS Web desktop is is licensed under the GNU General Public
@ -26,45 +19,91 @@
namespace OS { namespace OS {
export namespace API { export namespace API {
/** /**
* * Observable entry type definition
* *
* @export * @export
* @interface ObservableEntryType * @interface ObservableEntryType
*/ */
export interface ObservableEntryType { export interface ObservableEntryType {
/**
* A Set of callbacks that should be called only once.
* These callbacks will be removed after the first
* occurrence of the corresponding event
*
* @memberof ObservableEntryType
*/
one: Set<(d: any) => void>; one: Set<(d: any) => void>;
/**
* A Set of callbacks that should be called
* every time the corresponding event is triggered
*
* @memberof ObservableEntryType
*/
many: Set<(d: any) => void>; many: Set<(d: any) => void>;
} }
/** /**
* * Announcement listener type definition
* *
* @export * @export
* @interface AnnouncerListenerType * @interface AnnouncerListenerType
*/ */
export interface AnnouncerListenerType { export interface AnnouncerListenerType {
[index: number]: { [index: number]: {
/**
* The event name
*
* @type {string}
*/
e: string; e: string;
/**
* The event callback
*
*/
f: (d: any) => void; f: (d: any) => void;
}[]; }[];
} }
/** /**
* * This class is the based class used in AntOS event
* * announcement system.
* It implements the observer pattern using simple
* subscribe/publish mechanism
* @export * @export
* @class Announcer * @class Announcer
*/ */
export class Announcer { export class Announcer {
/**
* The observable object that stores event name
* and its corresponding callback in [[ObservableEntryType]]
*
* @type {GenericObject<ObservableEntryType>}
* @memberof Announcer
*/
observable: GenericObject<ObservableEntryType>; observable: GenericObject<ObservableEntryType>;
/**
* Enable/disable the announcer
*
* @type {boolean}
* @memberof Announcer
*/
enable: boolean; enable: boolean;
/**
*Creates an instance of Announcer.
* @memberof Announcer
*/
constructor() { constructor() {
this.observable = {}; this.observable = {};
this.enable = true; this.enable = true;
} }
/** /**
* * Disable the announcer, when this function is called
* all events and their callbacks will be removed
* *
* @returns * @returns
* @memberof Announcer * @memberof Announcer
@ -75,10 +114,11 @@ namespace OS {
} }
/** /**
* Subscribe to an event, the callback will be called
* every time the corresponding event is trigged
* *
* * @param {string} evtName event name
* @param {string} evtName * @param {(d: any) => void} callback The corresponding callback
* @param {(d: any) => void} callback
* @returns {void} * @returns {void}
* @memberof Announcer * @memberof Announcer
*/ */
@ -96,10 +136,11 @@ namespace OS {
} }
/** /**
* Subscribe to an event, the callback will
* be called only once and then removed from the announcer
* *
* * @param {string} evtName event name
* @param {string} evtName * @param {(d: any) => void} callback the corresponding callback
* @param {(d: any) => void} callback
* @returns {void} * @returns {void}
* @memberof Announcer * @memberof Announcer
*/ */
@ -117,10 +158,12 @@ namespace OS {
} }
/** /**
* Unsubscribe the callback from an event
* *
* * @param {string} evtName event name
* @param {string} evtName * @param {(d: any) => void} [callback] the callback to be unsubscribed.
* @param {(d: any) => void} [callback] * When the `callback` is `*`, all callbacks related to `evtName` will be
* removed
* @memberof Announcer * @memberof Announcer
*/ */
off(evtName: string, callback?: (d: any) => void): void { off(evtName: string, callback?: (d: any) => void): void {
@ -147,10 +190,10 @@ namespace OS {
} }
/** /**
* Trigger an event
* *
* * @param {string} evtName event name
* @param {string} evtName * @param {*} data data object that will be send to all related callback
* @param {*} data
* @returns {void} * @returns {void}
* @memberof Announcer * @memberof Announcer
*/ */
@ -179,24 +222,39 @@ namespace OS {
} }
} }
} }
/**
* This namespace defines every thing related to the system announcement.
*
* The system announcement provides a global way to communicate between
* processes (applications/services) using the subscribe/publish
* mechanism
*/
export namespace announcer { export namespace announcer {
/**
* The global announcer object tha manages global events
* and callbacks
*/
export var observable: API.Announcer = new API.Announcer(); export var observable: API.Announcer = new API.Announcer();
/**
* This variable is used to allocate the `id` of message
* passing between publishers and subscribers in the
* system announcement
*/
export var quota: 0; export var quota: 0;
/**
* Place holder of all global events listeners
*/
export var listeners: API.AnnouncerListenerType = {}; export var listeners: API.AnnouncerListenerType = {};
/** /**
* * Subscribe to a global event
* *
* @export * @export
* @param {string} e * @param {string} e event name
* @param {(d: any) => void} f * @param {(d: any) => void} f event callback
* @param {GUI.BaseModel} a * @param {GUI.BaseModel} a the process (Application/service) related to the callback
*/ */
export function on( export function on(e: string, f: (d: any) => void, a: BaseModel): void {
e: string,
f: (d: any) => void,
a: BaseModel
): void {
if (!announcer.listeners[a.pid]) { if (!announcer.listeners[a.pid]) {
announcer.listeners[a.pid] = []; announcer.listeners[a.pid] = [];
} }
@ -205,64 +263,67 @@ namespace OS {
} }
/** /**
* * Trigger a global event
* *
* @export * @export
* @param {string} e * @param {string} e event name
* @param {*} d * @param {*} d data passing to all related callback
*/ */
export function trigger(e: string, d: any): void { export function trigger(e: string, d: any): void {
announcer.observable.trigger(e, d); announcer.observable.trigger(e, d);
} }
/** /**
* * Report system fail. This will trigger the global `fail`
* event
* *
* @export * @export
* @param {(string | FormattedString)} m * @param {(string | FormattedString)} m message string
* @param {Error} e * @param {Error} e error to be reported
*/ */
export function osfail(m: string | FormattedString, e: Error): void { export function osfail(m: string | FormattedString, e: Error): void {
announcer.ostrigger("fail", { m, e }); announcer.ostrigger("fail", { m, e });
} }
/** /**
* * Report system error. This will trigger the global `error`
* event
* *
* @export * @export
* @param {(string | FormattedString)} m * @param {(string | FormattedString)} m message string
* @param {Error} e * @param {Error} e error to be reported
*/ */
export function oserror(m: string | FormattedString, e: Error): void { export function oserror(m: string | FormattedString, e: Error): void {
announcer.ostrigger("error", { m, e }); announcer.ostrigger("error", { m, e });
} }
/** /**
* * Trigger system notification (`info` event)
* *
* @export * @export
* @param {(string | FormattedString)} m * @param {(string | FormattedString)} m notification message
*/ */
export function osinfo(m: string | FormattedString): void { export function osinfo(m: string | FormattedString): void {
announcer.ostrigger("info", { m, e: null }); announcer.ostrigger("info", { m, e: null });
} }
/** /**
* * trigger a specific global event
* *
* @export * @export
* @param {string} e * @param {string} e event name
* @param {*} d * @param {*} d event data
*/ */
export function ostrigger(e: string, d: any): void { export function ostrigger(e: string, d: any): void {
announcer.trigger(e, { id: 0, data: d, name: "OS" }); announcer.trigger(e, { id: 0, data: d, name: "OS" });
} }
/** /**
* * Unregister a process (application/service) from
* the global announcement system
* *
* @export * @export
* @param {GUI.BaseModel} app * @param {GUI.BaseModel} app reference to the process
* @returns {void} * @returns {void}
*/ */
export function unregister(app: BaseModel): void { export function unregister(app: BaseModel): void {
@ -279,14 +340,14 @@ namespace OS {
} }
/** /**
* * Allocate message id
* *
* @export * @export
* @returns {number} * @returns {number}
*/ */
export function getMID(): number { export function getMID(): number {
announcer.quota += 1; quota += 1;
return announcer.quota; return quota;
} }
} }
} }

View File

@ -1,10 +1,3 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS205: Consider reworking code to avoid use of IIFEs
* DS208: Avoid top-level this
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com> // Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
// AnTOS Web desktop is is licensed under the GNU General Public // AnTOS Web desktop is is licensed under the GNU General Public
@ -24,9 +17,16 @@
//along with this program. If not, see https://www.gnu.org/licenses/. //along with this program. If not, see https://www.gnu.org/licenses/.
namespace OS { namespace OS {
/**
* This namespace is dedicated to application and service definition.
* When an application is loaded, its prototype definition will be
* inserted to this namespace for reuse lately
*/
export namespace application { export namespace application {
/** /**
* * Abstract prototype of all AntOS application.
* Any new application definition should extend
* this prototype
* *
* @export * @export
* @abstract * @abstract
@ -34,15 +34,46 @@ namespace OS {
* @extends {BaseModel} * @extends {BaseModel}
*/ */
export abstract class BaseApplication extends BaseModel { export abstract class BaseApplication extends BaseModel {
/**
* Placeholder of all settings specific to the application.
* The settings stored in this object will be saved to system
* setting when logout and can be reused in the next login session
*
* @type {GenericObject<any>}
* @memberof BaseApplication
*/
setting: GenericObject<any>; setting: GenericObject<any>;
/**
* Hotkeys (shortcuts) defined for this application
*
* @protected
* @type {GUI.ShortcutType}
* @memberof BaseApplication
*/
protected keycomb: GUI.ShortcutType; protected keycomb: GUI.ShortcutType;
/**
* Reference to the system dock
*
* @type {GUI.tag.AppDockTag}
* @memberof BaseApplication
*/
sysdock: GUI.tag.AppDockTag; sysdock: GUI.tag.AppDockTag;
/**
* Reference to the system application menu located
* on the system panel
*
* @type {GUI.tag.MenuTag}
* @memberof BaseApplication
*/
appmenu: GUI.tag.MenuTag; appmenu: GUI.tag.MenuTag;
/** /**
*Creates an instance of BaseApplication. *Creates an instance of BaseApplication.
* @param {string} name * @param {string} name application name
* @param {AppArgumentsType[]} args * @param {AppArgumentsType[]} args application arguments
* @memberof BaseApplication * @memberof BaseApplication
*/ */
constructor(name: string, args: AppArgumentsType[]) { constructor(name: string, args: AppArgumentsType[]) {
@ -62,11 +93,15 @@ namespace OS {
this.applySetting(m.data.m); this.applySetting(m.data.m);
} }
}); });
} }
/** /**
* Init the application, this function is called when the
* application process is called and docked the the application
* dock.
* *
* The application UI will be rendered after the execution
* of this function.
* *
* @returns {void} * @returns {void}
* @memberof BaseApplication * @memberof BaseApplication
@ -78,10 +113,12 @@ namespace OS {
this.on("focus", () => { this.on("focus", () => {
this.sysdock.selectedApp = this; this.sysdock.selectedApp = this;
this.appmenu.pid = this.pid; this.appmenu.pid = this.pid;
this.appmenu.items= this.baseMenu() || []; this.appmenu.items = this.baseMenu() || [];
this.appmenu.onmenuselect=(d: GUI.tag.MenuEventData): void => { this.appmenu.onmenuselect = (
d: GUI.tag.MenuEventData
): void => {
return this.trigger("menuselect", d); return this.trigger("menuselect", d);
} };
if (this.dialog) { if (this.dialog) {
return this.dialog.show(); return this.dialog.show();
} }
@ -107,9 +144,9 @@ namespace OS {
return this.loadScheme(); return this.loadScheme();
} }
/** /**
* * Render the application UI by first loading its scheme
* and then mount this scheme to the DOM tree
* *
* @protected * @protected
* @returns {void} * @returns {void}
@ -121,12 +158,14 @@ namespace OS {
return this.render(path); return this.render(path);
} }
/** /**
* * API function to perform an heavy task.
* This function will trigger the global `loading`
* event at the beginning of the task, and the `loaded`
* event after finishing the task
* *
* @protected * @protected
* @param {Promise<any>} promise * @param {Promise<any>} promise the promise on a task to be performed
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof BaseApplication * @memberof BaseApplication
*/ */
@ -145,17 +184,21 @@ namespace OS {
}); });
} }
/** /**
* * Bind a hotkey to the application, this function
* is used to define application keyboard shortcut
* *
* @protected * @protected
* @param {string} k * @param {string} k the hotkey to bind, should be in the following
* @param {(e: JQuery.MouseDownEvent) => void} f * format: `[ALT|SHIFT|CTRL|META]-KEY`, e.g. `CTRL-S`
* @param {(e: JQuery.KeyboardEventBase) => void} f the callback function
* @returns {void} * @returns {void}
* @memberof BaseApplication * @memberof BaseApplication
*/ */
protected bindKey(k: string, f: (e: JQuery.MouseDownEvent) => void): void { protected bindKey(
k: string,
f: (e: JQuery.KeyboardEventBase) => void
): void {
const arr = k.split("-"); const arr = k.split("-");
if (arr.length !== 2) { if (arr.length !== 2) {
return; return;
@ -168,12 +211,12 @@ namespace OS {
this.keycomb[fnk][c] = f; this.keycomb[fnk][c] = f;
} }
/** /**
* * Update the application local from the system
* locale or application specific locale configuration
* *
* @private * @private
* @param {string} name * @param {string} name locale name e.g. `en_GB`
* @returns {void} * @returns {void}
* @memberof BaseApplication * @memberof BaseApplication
*/ */
@ -194,19 +237,16 @@ namespace OS {
} }
/** /**
* Execute the callback subscribed to a
* keyboard shortcut
* *
* * @param {string} fnk meta or modifier key e.g. `CTRL`, `ALT`, `SHIFT` or `META`
* @param {string} fnk * @param {string} c a regular key
* @param {string} c * @param {JQuery.KeyboardEventBase} e JQuery keyboard event
* @param {JQuery.MouseDownEvent} e * @returns {boolean} return whether the shortcut is executed
* @returns {boolean}
* @memberof BaseApplication * @memberof BaseApplication
*/ */
shortcut( shortcut(fnk: string, c: string, e: JQuery.KeyDownEvent): boolean {
fnk: string,
c: string,
e: JQuery.KeyDownEvent
): boolean {
if (!this.keycomb[fnk]) { if (!this.keycomb[fnk]) {
return true; return true;
} }
@ -217,19 +257,17 @@ namespace OS {
return false; return false;
} }
/** /**
* * Apply a setting to the application
* *
* @protected * @protected
* @param {string} k * @param {string} k the setting name
* @memberof BaseApplication * @memberof BaseApplication
*/ */
protected applySetting(k: string): void {} protected applySetting(k: string): void {}
/** /**
* * Apply all settings to the application
* *
* @protected * @protected
* @memberof BaseApplication * @memberof BaseApplication
@ -241,13 +279,13 @@ namespace OS {
} }
} }
/** /**
* * Set a setting value to the application setting
* registry
* *
* @protected * @protected
* @param {string} k * @param {string} k setting name
* @param {*} v * @param {*} v setting value
* @returns {void} * @returns {void}
* @memberof BaseApplication * @memberof BaseApplication
*/ */
@ -257,7 +295,7 @@ namespace OS {
} }
/** /**
* * Show the appliation
* *
* @returns {void} * @returns {void}
* @memberof BaseApplication * @memberof BaseApplication
@ -267,7 +305,7 @@ namespace OS {
} }
/** /**
* * Blur the application
* *
* @returns {void} * @returns {void}
* @memberof BaseApplication * @memberof BaseApplication
@ -280,7 +318,7 @@ namespace OS {
} }
/** /**
* * Hide the application
* *
* @returns {void} * @returns {void}
* @memberof BaseApplication * @memberof BaseApplication
@ -290,7 +328,8 @@ namespace OS {
} }
/** /**
* * Maximize or restore the application window size
* and its position
* *
* @returns {void} * @returns {void}
* @memberof BaseApplication * @memberof BaseApplication
@ -300,21 +339,23 @@ namespace OS {
} }
/** /**
* * Get the application title
* *
* @returns {(string| FormattedString)} * @returns {(string| FormattedString)}
* @memberof BaseApplication * @memberof BaseApplication
*/ */
title(): string| FormattedString { title(): string | FormattedString {
return (this.scheme as GUI.tag.WindowTag).apptitle; return (this.scheme as GUI.tag.WindowTag).apptitle;
} }
/** /**
* Function called when the application exit.
* If the input exit event is prevented, the application
* process will not be killed
* *
* *
* @protected * @protected
* @param {BaseEvent} evt * @param {BaseEvent} evt exit event
* @memberof BaseApplication * @memberof BaseApplication
*/ */
protected onexit(evt: BaseEvent): void { protected onexit(evt: BaseEvent): void {
@ -328,7 +369,7 @@ namespace OS {
} }
/** /**
* * Get the application meta-data
* *
* @returns {API.PackageMetaType} * @returns {API.PackageMetaType}
* @memberof BaseApplication * @memberof BaseApplication
@ -337,9 +378,11 @@ namespace OS {
return application[this.name].meta; return application[this.name].meta;
} }
/** /**
* * Base menu definition. This function
* return the based menu definition of all applications.
* Other application specific menu entries
* should be defined in [[menu]] function
* *
* @protected * @protected
* @returns {GUI.BasicItemType[]} * @returns {GUI.BasicItemType[]}
@ -360,18 +403,17 @@ namespace OS {
} }
/** /**
* * The main application entry that is called after
* the application UI is rendered. This application
* must be implemented by all subclasses
* *
* @abstract * @abstract
* @memberof BaseApplication * @memberof BaseApplication
*/ */
abstract main(): void; abstract main(): void;
//main program
// implement by subclasses
/** /**
* * Application specific menu definition
* *
* @protected * @protected
* @returns {GUI.BasicItemType[]} * @returns {GUI.BasicItemType[]}
@ -383,9 +425,11 @@ namespace OS {
return []; return [];
} }
/** /**
* * The cleanup function that is called by [[onexit]] function.
* Application need to override this function to perform some
* specific task before exiting or to prevent the application
* to be exited
* *
* @protected * @protected
* @param {BaseEvent} e * @param {BaseEvent} e

View File

@ -1,11 +1,3 @@
/*
* decaffeinate suggestions:
* DS001: Remove Babel/TypeScript constructor workaround
* DS101: Remove unnecessary use of Array.from
* DS102: Remove unnecessary code created because of implicit returns
* DS208: Avoid top-level this
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com> // Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
// AnTOS Web desktop is is licensed under the GNU General Public // AnTOS Web desktop is is licensed under the GNU General Public
@ -26,7 +18,8 @@
namespace OS { namespace OS {
export namespace GUI { export namespace GUI {
/** /**
* * the SubWindow class is the abstract prototype of all
* modal windows or dialogs definition in AntOS
* *
* @export * @export
* @abstract * @abstract
@ -34,12 +27,26 @@ namespace OS {
* @extends {BaseModel} * @extends {BaseModel}
*/ */
export abstract class SubWindow extends BaseModel { export abstract class SubWindow extends BaseModel {
modal: false; /**
* Placeholder indicates whether the sub window is in
* modal mode. This value is reserver for future use
*
* @type {boolean}
* @memberof SubWindow
*/
modal: boolean;
/**
* Reference to the parent of the current sub-window
*
* @type {(BaseModel | typeof GUI)}
* @memberof SubWindow
*/
parent: BaseModel | typeof GUI; parent: BaseModel | typeof GUI;
/** /**
*Creates an instance of SubWindow. *Creates an instance of SubWindow.
* @param {string} name * @param {string} name SubWindow (class) name
* @memberof SubWindow * @memberof SubWindow
*/ */
constructor(name: string) { constructor(name: string) {
@ -49,7 +56,7 @@ namespace OS {
} }
/** /**
* * Exit the sub-window
* *
* @returns {void} * @returns {void}
* @memberof SubWindow * @memberof SubWindow
@ -69,7 +76,11 @@ namespace OS {
} }
/** /**
* Init the sub-window, this function is called
* on creation of the sub-window object. It is used
* to render the sub-window UI.
* *
* Need to be implemented by subclasses
* *
* @abstract * @abstract
* @memberof SubWindow * @memberof SubWindow
@ -77,7 +88,7 @@ namespace OS {
abstract init(): void; abstract init(): void;
/** /**
* * Main entry point after rendering of the sub-window
* *
* @abstract * @abstract
* @memberof SubWindow * @memberof SubWindow
@ -85,7 +96,8 @@ namespace OS {
abstract main(): void; abstract main(): void;
/** /**
* * Return the parent meta-data of the current
* sub-window
* *
* @returns {API.PackageMetaType} * @returns {API.PackageMetaType}
* @memberof SubWindow * @memberof SubWindow
@ -98,7 +110,7 @@ namespace OS {
} }
/** /**
* * Show the sub-window
* *
* @memberof SubWindow * @memberof SubWindow
*/ */
@ -108,7 +120,7 @@ namespace OS {
} }
/** /**
* * Hide the sub-window
* *
* @returns {void} * @returns {void}
* @memberof SubWindow * @memberof SubWindow
@ -121,7 +133,7 @@ namespace OS {
SubWindow.type = ModelType.SubWindow; SubWindow.type = ModelType.SubWindow;
/** /**
* * Abstract prototype of all AntOS dialogs widget
* *
* @export * @export
* @abstract * @abstract
@ -129,13 +141,24 @@ namespace OS {
* @extends {SubWindow} * @extends {SubWindow}
*/ */
export abstract class BaseDialog extends SubWindow { export abstract class BaseDialog extends SubWindow {
/**
* Placeholder for the dialog callback on exit
*
* @memberof BaseDialog
*/
handle: (d: any) => void; handle: (d: any) => void;
/**
* Placeholder of the dialog input data
*
* @type {GenericObject<any>}
* @memberof BaseDialog
*/
data: GenericObject<any>; data: GenericObject<any>;
title: string;
/** /**
*Creates an instance of BaseDialog. *Creates an instance of BaseDialog.
* @param {string} name * @param {string} name Dialog (class) name
* @memberof BaseDialog * @memberof BaseDialog
*/ */
constructor(name: string) { constructor(name: string) {
@ -143,9 +166,8 @@ namespace OS {
this.handle = undefined; this.handle = undefined;
} }
/** /**
* * Function called when dialog exits
* *
* @protected * @protected
* @param {BaseEvent} e * @param {BaseEvent} e
@ -160,20 +182,41 @@ namespace OS {
} }
/** /**
* * A basic dialog renders a dialog widget using the UI
* scheme provided in it constructor or defined in its
* class variable `scheme`
* *
* @export * @export
* @class BasicDialog * @class BasicDialog
* @extends {BaseDialog} * @extends {BaseDialog}
*/ */
export class BasicDialog extends BaseDialog { export class BasicDialog extends BaseDialog {
markup: string | OS.API.VFS.BaseFileHandle; /**
* Placeholder for the UI scheme to be rendered. This can
* be either the string definition of the scheme or
* the VFS file handle of the scheme file
*
* @private
* @type {(string | OS.API.VFS.BaseFileHandle)}
* @memberof BasicDialog
*/
private markup: string | OS.API.VFS.BaseFileHandle;
/**
* If the `markup` variable is not provided, the
* the [[init]] function will find the scheme definition
* in this class variable
*
* @static
* @type {string}
* @memberof BasicDialog
*/
static scheme: string; static scheme: string;
/** /**
*Creates an instance of BasicDialog. *Creates an instance of BasicDialog.
* @param {string} name * @param {string} name dialog name
* @param {(string | OS.API.VFS.BaseFileHandle)} [markup] * @param {(string | OS.API.VFS.BaseFileHandle)} [markup] UI scheme definition
* @memberof BasicDialog * @memberof BasicDialog
*/ */
constructor( constructor(
@ -185,7 +228,8 @@ namespace OS {
} }
/** /**
* * Render the dialog using the UI scheme provided by either
* the `markup` instance variable or the `scheme` class variable
* *
* @returns {void} * @returns {void}
* @memberof BasicDialog * @memberof BasicDialog
@ -193,11 +237,7 @@ namespace OS {
init(): void { init(): void {
if (this.markup) { if (this.markup) {
if (typeof this.markup === "string") { if (typeof this.markup === "string") {
return GUI.htmlToScheme( return GUI.htmlToScheme(this.markup, this, this.host);
this.markup,
this,
this.host
);
} else { } else {
// a file handle // a file handle
return this.render(this.markup.path); return this.render(this.markup.path);
@ -207,20 +247,14 @@ namespace OS {
GUI.dialogs[this.name].scheme GUI.dialogs[this.name].scheme
) { ) {
const html: string = GUI.dialogs[this.name].scheme; const html: string = GUI.dialogs[this.name].scheme;
return GUI.htmlToScheme( return GUI.htmlToScheme(html.trim(), this, this.host);
html.trim(), } else {
this,
this.host
);
}
else
{
this.error(__("Unable to find dialog scheme")); this.error(__("Unable to find dialog scheme"));
} }
} }
/** /**
* * Main entry point for the dialog
* *
* @memberof BasicDialog * @memberof BasicDialog
*/ */
@ -234,9 +268,25 @@ namespace OS {
} }
} }
/**
* The namespace `dialogs` is dedicated to all Dialog definition
* in AntOS
*/
export namespace dialogs { export namespace dialogs {
/** /**
* Simple prompt dialog to get user input text.
* The input date of the dialog:
* *
* ```
* {
* title: string, // window title
* label: string, // label text
* value: string // user input text
* }
* ```
*
* The data passing from the dialog to the callback function is
* in the string text of the user input value
* *
* @export * @export
* @class PromptDialog * @class PromptDialog
@ -252,7 +302,7 @@ namespace OS {
} }
/** /**
* * Main entry point
* *
* @memberof PromptDialog * @memberof PromptDialog
*/ */
@ -294,7 +344,9 @@ namespace OS {
$input.focus(); $input.focus();
} }
} }
/**
* Scheme definition of the Prompt dialog
*/
PromptDialog.scheme = `\ PromptDialog.scheme = `\
<afx-app-window width='200' height='150' apptitle = "Prompt"> <afx-app-window width='200' height='150' apptitle = "Prompt">
<afx-vbox> <afx-vbox>
@ -318,7 +370,11 @@ namespace OS {
`; `;
/** /**
* A text dialog is similar to a [[PromptDialog]] nut allows
* user to input multi-line text.
* *
* Refer to [[PromptDialog]] for the definition of input and callback data
* of the dialog
* *
* @export * @export
* @class TextDialog * @class TextDialog
@ -334,7 +390,7 @@ namespace OS {
} }
/** /**
* * Main entry point
* *
* @memberof TextDialog * @memberof TextDialog
*/ */
@ -365,7 +421,9 @@ namespace OS {
$input.focus(); $input.focus();
} }
} }
/**
* Scheme definition
*/
TextDialog.scheme = `\ TextDialog.scheme = `\
<afx-app-window data-id = "TextDialog" width='400' height='300'> <afx-app-window data-id = "TextDialog" width='400' height='300'>
<afx-vbox> <afx-vbox>
@ -388,7 +446,7 @@ namespace OS {
`; `;
/** /**
* * A Calendar dialog allows user to select a date
* *
* @export * @export
* @class CalendarDialog * @class CalendarDialog
@ -396,7 +454,19 @@ namespace OS {
*/ */
export class CalendarDialog extends BasicDialog { export class CalendarDialog extends BasicDialog {
/** /**
*Creates an instance of CalendarDialog. * Creates an instance of CalendarDialog.
*
* Input data:
*
* ```
* {
* title: string // window title
* }
* ```
*
* Callback data: a Date object represent the selected date
*
*
* @memberof CalendarDialog * @memberof CalendarDialog
*/ */
constructor() { constructor() {
@ -431,7 +501,9 @@ namespace OS {
}; };
} }
} }
/**
* Scheme definition
*/
CalendarDialog.scheme = `\ CalendarDialog.scheme = `\
<afx-app-window width='300' height='230' apptitle = "Calendar" > <afx-app-window width='300' height='230' apptitle = "Calendar" >
<afx-vbox> <afx-vbox>
@ -455,7 +527,16 @@ namespace OS {
`; `;
/** /**
* Color picker dialog
* *
* Input data:
*
* ```
* {
* title: string // window title
* }
* ```
* Callback data: [[ColorType]] object
* *
* @export * @export
* @class ColorPickerDialog * @class ColorPickerDialog
@ -499,7 +580,9 @@ namespace OS {
}; };
} }
} }
/**
* Scheme definition
*/
ColorPickerDialog.scheme = `\ ColorPickerDialog.scheme = `\
<afx-app-window width='320' height='250' apptitle = "Color picker" > <afx-app-window width='320' height='250' apptitle = "Color picker" >
<afx-vbox> <afx-vbox>
@ -523,7 +606,18 @@ namespace OS {
`; `;
/** /**
* Show key-value pair of the input object
* *
* Input data:
*
* ```
* {
* title: string, // window title
* [propName:string]: any
* }
* ```
*
* No data for callback
* *
* @export * @export
* @class InfoDialog * @class InfoDialog
@ -566,7 +660,9 @@ namespace OS {
}; };
} }
} }
/**
* Scheme definition
*/
InfoDialog.scheme = `\ InfoDialog.scheme = `\
<afx-app-window width='250' height='300' apptitle = "Info" > <afx-app-window width='250' height='300' apptitle = "Info" >
<afx-vbox> <afx-vbox>
@ -588,6 +684,26 @@ namespace OS {
</afx-app-window>\ </afx-app-window>\
`; `;
/**
* A simple confirm dialog
*
* Input data:
*
* ```
* {
* title: string, // window title
* icon?: string, // label icon
* iconclass?: string, // label iconclass
* text: string // label text
* }
* ```
*
* Callback data: `boolean`
*
* @export
* @class YesNoDialog
* @extends {BasicDialog}
*/
export class YesNoDialog extends BasicDialog { export class YesNoDialog extends BasicDialog {
/** /**
*Creates an instance of YesNoDialog. *Creates an instance of YesNoDialog.
@ -598,7 +714,7 @@ namespace OS {
} }
/** /**
* * Main entry point
* *
* @memberof YesNoDialog * @memberof YesNoDialog
*/ */
@ -625,7 +741,9 @@ namespace OS {
}; };
} }
} }
/**
* Scheme definition
*/
YesNoDialog.scheme = `\ YesNoDialog.scheme = `\
<afx-app-window width='200' height='150' apptitle = "Prompt"> <afx-app-window width='200' height='150' apptitle = "Prompt">
<afx-vbox> <afx-vbox>
@ -648,7 +766,22 @@ namespace OS {
`; `;
/** /**
* A selection dialog provide user with a list of options to
* select.
* *
* Input data:
*
* ```
* {
* title: string, // window title
* data:
* {
* text: string,
* [propName:string]: any
* } [] // list data
* ```
*
* Callback data: the selected data in the input list
* *
* @export * @export
* @class SelectionDialog * @class SelectionDialog
@ -664,7 +797,7 @@ namespace OS {
} }
/** /**
* * Main entry
* *
* @memberof SelectionDialog * @memberof SelectionDialog
*/ */
@ -694,7 +827,9 @@ namespace OS {
}; };
} }
} }
/**
* Scheme definition
*/
SelectionDialog.scheme = `\ SelectionDialog.scheme = `\
<afx-app-window width='250' height='300' apptitle = "Selection"> <afx-app-window width='250' height='300' apptitle = "Selection">
<afx-vbox> <afx-vbox>
@ -717,7 +852,12 @@ namespace OS {
`; `;
/** /**
* An About dialog is dedicated to show the parent
* application meta-data
* *
* Input data: no
*
* Callback data: no
* *
* @export * @export
* @class AboutDialog * @class AboutDialog
@ -733,7 +873,7 @@ namespace OS {
} }
/** /**
* * Main entry point
* *
* @returns {void} * @returns {void}
* @memberof AboutDialog * @memberof AboutDialog
@ -770,7 +910,9 @@ namespace OS {
}; };
} }
} }
/**
* Scheme definition
*/
AboutDialog.scheme = `\ AboutDialog.scheme = `\
<afx-app-window data-id = 'about-window' width='300' height='200'> <afx-app-window data-id = 'about-window' width='300' height='200'>
<afx-vbox> <afx-vbox>
@ -795,7 +937,21 @@ namespace OS {
`; `;
/** /**
* File dialog allows user to select a file/folder
* *
* Input data:
*
* ```
* {
* title: string, // window title
* root?: string, // the root path folder of the file view
* type?: "file"|"dir"|"app", // file type to be selected
* mimes?: string[], // mime types of file to be selected
* hidden?: boolean, // show/hide hidden file
* file?: string // file name
*
* }
* ```
* *
* @export * @export
* @class FileDialog * @class FileDialog
@ -935,7 +1091,9 @@ namespace OS {
} }
} }
} }
/**
* Scheme definition
*/
FileDialog.scheme = `\ FileDialog.scheme = `\
<afx-app-window width='400' height='300'> <afx-app-window width='400' height='300'>
<afx-hbox> <afx-hbox>

View File

@ -1,9 +1,3 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS208: Avoid top-level this
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com> // Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
// AnTOS Web desktop is is licensed under the GNU General Public // AnTOS Web desktop is is licensed under the GNU General Public
@ -23,42 +17,92 @@
//along with this program. If not, see https://www.gnu.org/licenses/. //along with this program. If not, see https://www.gnu.org/licenses/.
namespace OS { namespace OS {
/** /**
* * Application argument type definition
* *
* @export * @export
* @interface AppArgumentsType * @interface AppArgumentsType
*/ */
export interface AppArgumentsType { export interface AppArgumentsType {
/**
* File type to be open by the app
*
* @type {string}
* @memberof AppArgumentsType
*/
type?: string; type?: string;
/**
* File path to be opened
*
* @type {string}
* @memberof AppArgumentsType
*/
path: string; path: string;
/**
* Any other object
*/
[propName: string]: any; [propName: string]: any;
} }
/** /**
* * Enum definition of different model types
* *
* @export * @export
* @enum {number} * @enum {number}
*/ */
export enum ModelType { export enum ModelType {
/**
* Applications
*/
Application, Application,
/**
* Services
*/
Service, Service,
/**
* Sub-window such as dialogs
*/
SubWindow, SubWindow,
} }
/** /**
* * Base AntOS event definition
* *
* @export * @export
* @class BaseEvent * @class BaseEvent
*/ */
export class BaseEvent { export class BaseEvent {
/**
* The event name placeholder
*
* @type {string}
* @memberof BaseEvent
*/
name: string; name: string;
/**
* Placeholder indicates whether the event is forced to
* be happen
*
* @private
* @type {boolean}
* @memberof BaseEvent
*/
private force: boolean; private force: boolean;
/**
* Placeholder indicates whether the event is prevented.
* This value has not effect if `force` is set to `true`
*
* @type {boolean}
* @memberof BaseEvent
*/
prevent: boolean; prevent: boolean;
/** /**
*Creates an instance of BaseEvent. *Creates an instance of BaseEvent.
* @param {string} name * @param {string} name event name
* @param {boolean} force * @param {boolean} force indicates whether the event is forced
* @memberof BaseEvent * @memberof BaseEvent
*/ */
constructor(name: string, force: boolean) { constructor(name: string, force: boolean) {
@ -68,7 +112,8 @@ namespace OS {
} }
/** /**
* * Prevent the current event. This function
* has no effect if `force` is set to true
* *
* @memberof BaseEvent * @memberof BaseEvent
*/ */
@ -80,34 +125,164 @@ namespace OS {
} }
/** /**
* * The root model of all applications, dialogs or services
* in the system
* *
* @export * @export
* @abstract * @abstract
* @class BaseModel * @class BaseModel
*/ */
export abstract class BaseModel { export abstract class BaseModel {
/**
* The class name
*
* @type {string}
* @memberof BaseModel
*/
name: string; name: string;
/**
* The argument of the model
*
* @type {AppArgumentsType[]}
* @memberof BaseModel
*/
args: AppArgumentsType[]; args: AppArgumentsType[];
/**
* Each model has its own local announcement system
* to handle all local events inside that model.
*
* This observable object is propagate to all the
* UI elements ([[AFXTag]]) inside the model
*
* @protected
* @type {API.Announcer}
* @memberof BaseModel
*/
protected _observable: API.Announcer; protected _observable: API.Announcer;
/**
* Reference to the core API namespace
*
* @protected
* @type {typeof API}
* @memberof BaseModel
*/
protected _api: typeof API; protected _api: typeof API;
/**
* Reference to the core GUI namespace
*
* @protected
* @type {typeof GUI}
* @memberof BaseModel
*/
protected _gui: typeof GUI; protected _gui: typeof GUI;
/**
* Reference to the model's dialog
*
* @type {GUI.BaseDialog}
* @memberof BaseModel
*/
dialog: GUI.BaseDialog; dialog: GUI.BaseDialog;
/**
* The HTML element ID of the virtual desktop
*
* @protected
* @type {string}
* @memberof BaseModel
*/
protected host: string; protected host: string;
/**
* The process number of the current model.
* For sub-window this number is the number
* of the parent window
*
* @type {number}
* @memberof BaseModel
*/
pid: number; pid: number;
/**
* Reference the DOM element of the UI scheme belong to
* this model
*
* @type {HTMLElement}
* @memberof BaseModel
*/
scheme: HTMLElement; scheme: HTMLElement;
/**
* Reference to the system setting
*
* @protected
* @type {typeof setting}
* @memberof BaseModel
*/
protected systemsetting: typeof setting; protected systemsetting: typeof setting;
/**
* Placeholder for the process creation timestamp
*
* @type {number}
* @memberof BaseModel
*/
birth: number; birth: number;
/**
* Different model type
*
* @static
* @type {ModelType}
* @memberof BaseModel
*/
static type: ModelType; static type: ModelType;
/**
* Allow singleton on this model
*
* @static
* @type {boolean}
* @memberof BaseModel
*/
static singleton: boolean; static singleton: boolean;
/**
* The javacript of css dependencies of the model. All dependencies
* will be loaded before the model is rendered
*
* @static
* @type {string[]} list of VFS paths of dependencies
* @memberof BaseModel
*/
static dependencies: string[]; static dependencies: string[];
/**
* Reference to the CSS Element of the model
*
* @static
* @type {(HTMLElement | string)}
* @memberof BaseModel
*/
static style: HTMLElement | string; static style: HTMLElement | string;
/**
* Place holder for model meta-data
*
* @static
* @type {API.PackageMetaType}
* @memberof BaseModel
*/
static meta: API.PackageMetaType; static meta: API.PackageMetaType;
/** /**
*Creates an instance of BaseModel. *Creates an instance of BaseModel.
* @param {string} name * @param {string} name class name
* @param {AppArgumentsType[]} args * @param {AppArgumentsType[]} args arguments
* @memberof BaseModel * @memberof BaseModel
*/ */
constructor(name: string, args: AppArgumentsType[]) { constructor(name: string, args: AppArgumentsType[]) {
@ -126,12 +301,18 @@ namespace OS {
}); });
} }
get observable(): API.Announcer /**
{ * Getter: get the local announcer object
*
* @readonly
* @type {API.Announcer}
* @memberof BaseModel
*/
get observable(): API.Announcer {
return this._observable; return this._observable;
} }
/** /**
* * Update the model locale
* *
* @protected * @protected
* @param {string} name * @param {string} name
@ -139,10 +320,10 @@ namespace OS {
*/ */
protected updateLocale(name: string) {} protected updateLocale(name: string) {}
/** /**
* * Render the model's UI
* *
* @protected * @protected
* @param {string} p * @param {string} p VFS path to the UI scheme definition
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -151,9 +332,9 @@ namespace OS {
} }
/** /**
* Exit the model
* *
* * @param {boolean} force set this value to `true` will bypass the prevented exit event by user
* @param {boolean} force
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -171,7 +352,8 @@ namespace OS {
} }
/** /**
* * Model meta data, need to be implemented by
* subclasses
* *
* @abstract * @abstract
* @returns {API.PackageMetaType} * @returns {API.PackageMetaType}
@ -180,7 +362,7 @@ namespace OS {
abstract meta(): API.PackageMetaType; abstract meta(): API.PackageMetaType;
/** /**
* * VFS path to the model asset
* *
* @returns {string} * @returns {string}
* @memberof BaseModel * @memberof BaseModel
@ -193,13 +375,20 @@ namespace OS {
return null; return null;
} }
// call a server side script
/** /**
* * Execute a server side script and get back the result
* *
* @protected * @protected
* @param {GenericObject<any>} cmd * @param {GenericObject<any>} cmd execution indication, should be:
*
* ```
* {
* path?: string, // VFS path to the server side script
* code: string, // or server side code to be executed
* parameters: any // the parameters of the server side execution
* }
* ```
*
* @returns {Promise<any>} * @returns {Promise<any>}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -208,7 +397,18 @@ namespace OS {
} }
/** /**
* Connect to the server side api using a websocket connection
* *
* Server side script can be execute inside the stream by writing
* data in JSON format with the following interface
*
* ```
* {
* path?: string, // VFS path to the server side script
* code: string, // or server side code to be executed
* parameters: any // the parameters of the server side execution
* }
* ```
* *
* @protected * @protected
* @returns {Promise<WebSocket>} * @returns {Promise<WebSocket>}
@ -219,7 +419,7 @@ namespace OS {
} }
/** /**
* * Init the model before UI rendering
* *
* @abstract * @abstract
* @memberof BaseModel * @memberof BaseModel
@ -227,7 +427,7 @@ namespace OS {
abstract init(): void; abstract init(): void;
/** /**
* * Main entry point after UI rendering
* *
* @abstract * @abstract
* @memberof BaseModel * @memberof BaseModel
@ -235,7 +435,7 @@ namespace OS {
abstract main(): void; abstract main(): void;
/** /**
* * Show the model
* *
* @abstract * @abstract
* @memberof BaseModel * @memberof BaseModel
@ -243,33 +443,29 @@ namespace OS {
abstract show(): void; abstract show(): void;
/** /**
* * Hide the model
* *
* @abstract * @abstract
* @memberof BaseModel * @memberof BaseModel
*/ */
abstract hide(): void; abstract hide(): void;
//implement by sub class
/** /**
* * Function called when the model exits
* *
* @protected * @protected
* @abstract * @abstract
* @param {BaseEvent} e * @param {BaseEvent} e exit event
* @memberof BaseModel * @memberof BaseModel
*/ */
protected abstract onexit(e: BaseEvent): void; protected abstract onexit(e: BaseEvent): void;
//implement by subclass
/** /**
* * subscribe once to a local event
* *
* @protected * @protected
* @param {string} e * @param {string} e name of the event
* @param {(d: any) => void} f * @param {(d: any) => void} f event callback
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -277,13 +473,12 @@ namespace OS {
return this.observable.one(e, f); return this.observable.one(e, f);
} }
/** /**
* * Subscribe to a local event
* *
* @protected * @protected
* @param {string} e * @param {string} e event name
* @param {(d: any) => void} f * @param {(d: any) => void} f event callback
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -291,13 +486,12 @@ namespace OS {
return this.observable.on(e, f); return this.observable.on(e, f);
} }
/** /**
* * Unsubscribe an event
* *
* @protected * @protected
* @param {string} e * @param {string} e event name or `*` (all events)
* @param {(d: any) => void} [f] * @param {(d: any) => void} [f] callback to be unsubscribed, can be `undefined`
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -308,28 +502,26 @@ namespace OS {
return this.observable.off(e, f); return this.observable.off(e, f);
} }
/** /**
* * trigger a local event
* *
* @protected * @protected
* @param {string} e * @param {string} e event name
* @param {*} [d] * @param {*} [d] event data
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
trigger(e: string, d?: any): void { trigger(e: string, d?: any): void {
if(!this.observable) return; if (!this.observable) return;
this.observable.trigger(e, d); this.observable.trigger(e, d);
} }
/** /**
* * subscribe to an event on the global announcement system
* *
* @protected * @protected
* @param {string} e * @param {string} e event name
* @param {(d: any) => void} f * @param {(d: any) => void} f event callback
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -337,13 +529,14 @@ namespace OS {
return announcer.on(e, f, this); return announcer.on(e, f, this);
} }
/** /**
* Open a dialog
* *
* * @param {(GUI.BaseDialog | string)} d a dialog object or a dialog class name
* @param {(GUI.BaseDialog | string)} d * @param {GenericObject<any>} [data] input data of the dialog, refer to each
* @param {GenericObject<any>} [data] * dialog definition for the format of the input data
* @returns {Promise<any>} * @returns {Promise<any>} A promise on the callback data of the dialog, refer
* to each dialog definition for the format of the callback data
* @memberof BaseModel * @memberof BaseModel
*/ */
openDialog( openDialog(
@ -369,32 +562,30 @@ namespace OS {
this.dialog.handle = resolve; this.dialog.handle = resolve;
this.dialog.pid = this.pid; this.dialog.pid = this.pid;
this.dialog.data = data; this.dialog.data = data;
if (data && data.title) {
this.dialog.title = data.title;
}
return this.dialog.init(); return this.dialog.init();
}); });
} }
/** /**
* * Open a [[YesNoDialog]] to confirm a task
* *
* @protected * @protected
* @param {GenericObject<any>} data * @param {GenericObject<any>} data [[YesNoDialog]] input data
* @returns {Promise<any>} * @returns {Promise<boolean>}
* @memberof BaseModel * @memberof BaseModel
*/ */
protected ask(data: GenericObject<any>): Promise<any> { protected ask(data: GenericObject<any>): Promise<boolean> {
return this._gui.openDialog("YesNoDialog", data); return this._gui.openDialog("YesNoDialog", data);
} }
/** /**
* * Trigger a global event
* *
* @protected * @protected
* @param {string} t * @param {string} t event name
* @param {(string | FormattedString)} m * @param {(string | FormattedString)} m event message
* @param {Error} [e] * @param {Error} [e] error object if any
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -421,9 +612,9 @@ namespace OS {
} }
/** /**
* Publish a global notification
* *
* * @param {(string | FormattedString)} m notification string
* @param {(string | FormattedString)} m
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -432,9 +623,9 @@ namespace OS {
} }
/** /**
* Publish a global warning
* *
* * @param {(string | FormattedString)} m warning string
* @param {(string | FormattedString)} m
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -443,10 +634,10 @@ namespace OS {
} }
/** /**
* Report a global error
* *
* * @param {(string | FormattedString)} m error message
* @param {(string | FormattedString)} m * @param {Error} [e] error object if any
* @param {Error} [e]
* @returns * @returns
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -455,10 +646,10 @@ namespace OS {
} }
/** /**
* Report a global fail event
* *
* * @param {string} m fail message
* @param {string} m * @param {Error} [e] error object if any
* @param {Error} [e]
* @returns * @returns
* @memberof BaseModel * @memberof BaseModel
*/ */
@ -467,7 +658,7 @@ namespace OS {
} }
/** /**
* * Throw an error inside the model
* *
* @returns {Error} * @returns {Error}
* @memberof BaseModel * @memberof BaseModel
@ -477,7 +668,7 @@ namespace OS {
} }
/** /**
* * Update the model, this will update all its UI elements
* *
* @returns {void} * @returns {void}
* @memberof BaseModel * @memberof BaseModel
@ -489,7 +680,8 @@ namespace OS {
} }
/** /**
* * Find a HTMLElement in the UI of the model
* using the `data-id` attribute of the element
* *
* @protected * @protected
* @param {string} id * @param {string} id
@ -503,7 +695,8 @@ namespace OS {
} }
/** /**
* * Select all DOM Element inside the UI of the model
* using JQuery selector
* *
* @protected * @protected
* @param {string} sel * @param {string} sel

View File

@ -1,9 +1,3 @@
/*
* decaffeinate suggestions:
* DS102: Remove unnecessary code created because of implicit returns
* DS208: Avoid top-level this
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
*/
// Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com> // Copyright 2017-2018 Xuan Sang LE <xsang.le AT gmail DOT com>
// AnTOS Web desktop is is licensed under the GNU General Public // AnTOS Web desktop is is licensed under the GNU General Public

View File

@ -119,11 +119,18 @@ namespace OS {
} }
/** /**
* Setter to set the selected application in the dock * Setter:
*
* set the selected application in the dock
* this will trigger two event: * this will trigger two event:
* - `focus`: on the selected application * - `focus`: on the selected application
* - `blur`: on all other applications on the dock * - `blur`: on all other applications on the dock
* *
* Getter:
*
* Get the current selected application
* on the dock
*
* @memberof AppDockTag * @memberof AppDockTag
*/ */
set selectedApp(v: application.BaseApplication) { set selectedApp(v: application.BaseApplication) {
@ -143,13 +150,6 @@ namespace OS {
($(Ant.OS.GUI.workspace)[0] as FloatListTag).unselect(); ($(Ant.OS.GUI.workspace)[0] as FloatListTag).unselect();
} }
/**
* getter to get the current selected application
* on the dock
*
* @type {BaseApplication}
* @memberof AppDockTag
*/
get selectedApp(): application.BaseApplication { get selectedApp(): application.BaseApplication {
return this._selectedApp; return this._selectedApp;
} }

View File

@ -66,7 +66,9 @@ namespace OS {
} }
/** /**
* Set the text of the button * Setter: Set the text of the button
*
* Getter: Get the current button test
* *
* @memberof ButtonTag * @memberof ButtonTag
*/ */
@ -74,37 +76,28 @@ namespace OS {
(this.refs.label as LabelTag).text = v; (this.refs.label as LabelTag).text = v;
} }
/**
* Get the current button test
*
* @type {(string| FormattedString)}
* @memberof ButtonTag
*/
get text(): string | FormattedString { get text(): string | FormattedString {
return (this.refs.label as LabelTag).text; return (this.refs.label as LabelTag).text;
} }
/** /**
* Enable or disable the button * Setter: Enable or disable the button
*
* Getter: Get the `enable` property of the button
* *
* @memberof ButtonTag * @memberof ButtonTag
*/ */
set enable(v: boolean) { set enable(v: boolean) {
$(this.refs.button).prop("disabled", !v); $(this.refs.button).prop("disabled", !v);
} }
/**
* Get the `enable` property of the button
*
* @type {boolean}
* @memberof ButtonTag
*/
get enable(): boolean { get enable(): boolean {
return !$(this.refs.button).prop("disabled"); return !$(this.refs.button).prop("disabled");
} }
/** /**
* set or remove the attribute `selected` of the button * Setter: set or remove the attribute `selected` of the button
*
* Getter: check whether the attribute `selected` of the button is set
* *
* @memberof ButtonTag * @memberof ButtonTag
*/ */
@ -115,32 +108,20 @@ namespace OS {
$(this.refs.button).addClass("selected"); $(this.refs.button).addClass("selected");
} }
} }
/**
* check whether the attribute `selected` of the button is set
*
* @type {boolean}
* @memberof ButtonTag
*/
get selected(): boolean { get selected(): boolean {
return this.hasattr("selected"); return this.hasattr("selected");
} }
/** /**
* activate or deactivate the toggle mode of the button * Setter: activate or deactivate the toggle mode of the button
*
* Getter: Check whether the button is in toggle mode
* *
* @memberof ButtonTag * @memberof ButtonTag
*/ */
set toggle(v: boolean) { set toggle(v: boolean) {
this.attsw(v, "toggle"); this.attsw(v, "toggle");
} }
/**
* Check whether the button is in toggle mode
*
* @type {boolean}
* @memberof ButtonTag
*/
get toggle(): boolean { get toggle(): boolean {
return this.hasattr("toggle"); return this.hasattr("toggle");
} }

View File

@ -142,53 +142,53 @@ namespace OS {
} }
/** /**
* Setter:
*
* chang the view of the widget, there are three different views * chang the view of the widget, there are three different views
* - `icon` * - `icon`
* - `list` * - `list`
* - `tree` * - `tree`
* *
* Getter:
*
* Get the current view setting of the widget
*
* @memberof FileViewTag * @memberof FileViewTag
*/ */
set view(v: string) { set view(v: string) {
$(this).attr("view", v); $(this).attr("view", v);
this.switchView(); this.switchView();
} }
/**
* Get the current view setting of the widget
*
* @type {string}
* @memberof FileViewTag
*/
get view(): string { get view(): string {
return $(this).attr("view"); return $(this).attr("view");
} }
/** /**
* Setter:
*
* Turn on/off the changing current working directory feature * Turn on/off the changing current working directory feature
* of the widget when a directory is double clicked. If enabled, * of the widget when a directory is double clicked. If enabled,
* the widget will use the configured [[fetch]] function to query * the widget will use the configured [[fetch]] function to query
* the content of the selected directory * the content of the selected directory
* *
* Getter:
*
* check whether changing current working directory feature
* is enabled
*
* @memberof FileViewTag * @memberof FileViewTag
*/ */
set chdir(v: boolean) { set chdir(v: boolean) {
this.attsw(v, "chdir"); this.attsw(v, "chdir");
} }
/**
* check whether changing current working directory feature
* is enabled
*
* @type {boolean}
* @memberof FileViewTag
*/
get chdir(): boolean { get chdir(): boolean {
return this.hasattr("chdir"); return this.hasattr("chdir");
} }
/** /**
* Enable or disable the status bar of the widget * Setter : Enable or disable the status bar of the widget
*
* Getter: Check whether the status bar is enabled
* *
* @memberof FileViewTag * @memberof FileViewTag
*/ */
@ -200,20 +200,20 @@ namespace OS {
} }
$(this.refs.status).hide(); $(this.refs.status).hide();
} }
/**
* Check whether the status bar is enabled
*
* @type {boolean}
* @memberof FileViewTag
*/
get status(): boolean { get status(): boolean {
return this.hasattr("status"); return this.hasattr("status");
} }
/** /**
* Setter:
*
* Allow the widget to show or hide hidden file * Allow the widget to show or hide hidden file
* *
* Getter:
*
* Check whether the hidden file should be shown in
* the widget
*
* @memberof FileViewTag * @memberof FileViewTag
*/ */
set showhidden(v: boolean) { set showhidden(v: boolean) {
@ -223,14 +223,6 @@ namespace OS {
} }
this.switchView(); this.switchView();
} }
/**
* Check whether the hidden file should be shown in
* the widget
*
* @type {boolean}
* @memberof FileViewTag
*/
get showhidden(): boolean { get showhidden(): boolean {
return this.hasattr("showhidden"); return this.hasattr("showhidden");
} }
@ -247,11 +239,17 @@ namespace OS {
} }
/** /**
* Setter:
*
* Set the path of the current working directory. * Set the path of the current working directory.
* When called the widget will refresh the current * When called the widget will refresh the current
* working directory using the configured [[fetch]] * working directory using the configured [[fetch]]
* function * function
* *
* Getter:
*
* Get the path of the current working directory
*
* @memberof FileViewTag * @memberof FileViewTag
*/ */
set path(v: string) { set path(v: string) {
@ -276,19 +274,14 @@ namespace OS {
announcer.oserror(e.toString(), e) announcer.oserror(e.toString(), e)
); );
} }
/**
* Get the path of the current working directory
*
* @type {string}
* @memberof FileViewTag
*/
get path(): string { get path(): string {
return this._path; return this._path;
} }
/** /**
* Set the data of the current working directory * Setter: Set the data of the current working directory
*
* Getter: Get the data of the current working directory
* *
* @memberof FileViewTag * @memberof FileViewTag
*/ */
@ -299,13 +292,6 @@ namespace OS {
this._data = v; this._data = v;
this.refreshData(); this.refreshData();
} }
/**
* Get the data of the current working directory
*
* @type {API.FileInfoType[]}
* @memberof FileViewTag
*/
get data(): API.FileInfoType[] { get data(): API.FileInfoType[] {
return this._data; return this._data;
} }

View File

@ -49,6 +49,8 @@ namespace OS {
} }
/** /**
* Setter:
*
* Set the direction of the list item layout. * Set the direction of the list item layout.
* Two directions are available: * Two directions are available:
* - `vertical` * - `vertical`
@ -56,20 +58,17 @@ namespace OS {
* *
* This setter acts as a DOM attribute * This setter acts as a DOM attribute
* *
* Getter:
*
* Get the currently set direction of list
* item layout
*
* @memberof FloatListTag * @memberof FloatListTag
*/ */
set dir(v: string) { set dir(v: string) {
$(this).attr("dir", v); $(this).attr("dir", v);
this.calibrate(); this.calibrate();
} }
/**
* Get the currently set direction of list
* item layout
*
* @type {string}
* @memberof FloatListTag
*/
get dir(): string { get dir(): string {
return $(this).attr("dir"); return $(this).attr("dir");
} }

View File

@ -163,9 +163,15 @@ namespace OS {
} }
/** /**
* Setter:
*
* Set the data of the cell, this will trigger * Set the data of the cell, this will trigger
* the [[ondatachange]] function * the [[ondatachange]] function
* *
* Getter:
*
* Get the current cell data placeholder
*
* @memberof GridCellPrototype * @memberof GridCellPrototype
*/ */
set data(v: GenericObject<any>) { set data(v: GenericObject<any>) {
@ -177,22 +183,21 @@ namespace OS {
} }
this.selected = v.selected; this.selected = v.selected;
} }
/**
* Get the current cell data placeholder
*
* @type {GenericObject<any>}
* @memberof GridCellPrototype
*/
get data(): GenericObject<any> { get data(): GenericObject<any> {
return this._data; return this._data;
} }
/** /**
* Setter:
*
* Set/unset the current cell as selected. * Set/unset the current cell as selected.
* This will trigger the [[cellselect]] * This will trigger the [[cellselect]]
* event * event
* *
* Getter:
*
* Check whether the current cell is selected
*
* @memberof GridCellPrototype * @memberof GridCellPrototype
*/ */
set selected(v: boolean) { set selected(v: boolean) {
@ -203,13 +208,6 @@ namespace OS {
} }
this.cellselect({ id: this.aid, data: this }, false); this.cellselect({ id: this.aid, data: this }, false);
} }
/**
* Check whether the current cell is selected
*
* @type {boolean}
* @memberof GridCellPrototype
*/
get selected(): boolean { get selected(): boolean {
return this.hasattr("selected"); return this.hasattr("selected");
} }
@ -487,45 +485,37 @@ namespace OS {
} }
/** /**
* set the tag name of the header cells * Setter: set the tag name of the header cells
*
* Getter: get the grid header tag name
* *
* @memberof GridViewTag * @memberof GridViewTag
*/ */
set headeritem(v: string) { set headeritem(v: string) {
$(this).attr("headeritem", v); $(this).attr("headeritem", v);
} }
/**
* get the grid header tag name
*
* @type {string}
* @memberof GridViewTag
*/
get headeritem(): string { get headeritem(): string {
return $(this).attr("headeritem"); return $(this).attr("headeritem");
} }
/** /**
* set the tag name of the grid cell * Setter: set the tag name of the grid cell
*
* Getter: get the tag name of the grid cell
* *
* @memberof GridViewTag * @memberof GridViewTag
*/ */
set cellitem(v: string) { set cellitem(v: string) {
$(this).attr("cellitem", v); $(this).attr("cellitem", v);
} }
/**
* get the tag name of the grid cell
*
* @type {string}
* @memberof GridViewTag
*/
get cellitem(): string { get cellitem(): string {
return $(this).attr("cellitem"); return $(this).attr("cellitem");
} }
/** /**
* get the header data placeholder * Setter: set the header data
*
* Getter: get the header data placeholder
* *
* @type {GenericObject<any>[]} * @type {GenericObject<any>[]}
* @memberof GridViewTag * @memberof GridViewTag
@ -533,12 +523,6 @@ namespace OS {
get header(): GenericObject<any>[] { get header(): GenericObject<any>[] {
return this._header; return this._header;
} }
/**
* the set the header data
*
* @memberof GridViewTag
*/
set header(v: GenericObject<any>[]) { set header(v: GenericObject<any>[]) {
this._header = v; this._header = v;
if (!v || v.length === 0) { if (!v || v.length === 0) {
@ -592,7 +576,9 @@ namespace OS {
} }
/** /**
* set the rows data * Setter: set the rows data
*
* Getter: get the rows data
* *
* @memberof GridViewTag * @memberof GridViewTag
*/ */
@ -601,31 +587,20 @@ namespace OS {
this._rows = rows; this._rows = rows;
rows.map((row) => this.push(row, false)); rows.map((row) => this.push(row, false));
} }
/**
* get the rows data
*
* @type {GenericObject<any>[][]}
* @memberof GridViewTag
*/
get rows(): GenericObject<any>[][] { get rows(): GenericObject<any>[][] {
return this._rows; return this._rows;
} }
/** /**
* activate deactivate multi-select * Setter: activate deactivate multi-select
*
* Getter: check whether the `multiselect` option is activated
* *
* @memberof GridViewTag * @memberof GridViewTag
*/ */
set multiselect(v: boolean) { set multiselect(v: boolean) {
this.attsw(v, "multiselect"); this.attsw(v, "multiselect");
} }
/**
* check whether the `multiselect` option is activated
* @type {boolean}
* @memberof GridViewTag
*/
get multiselect(): boolean { get multiselect(): boolean {
return this.hasattr("multiselect"); return this.hasattr("multiselect");
} }

View File

@ -102,7 +102,9 @@ namespace OS {
} }
/** /**
* Set the text of the label * Setter: Set the text of the label
*
* Getter: Get the text displayed on the label
* *
* @memberof LabelTag * @memberof LabelTag
*/ */
@ -115,13 +117,6 @@ namespace OS {
$(this.refs.text).hide(); $(this.refs.text).hide();
} }
} }
/**
* Get the text displayed on the label
*
* @type {(string| FormattedString)}
* @memberof LabelTag
*/
get text(): string | FormattedString { get text(): string | FormattedString {
return this._text; return this._text;
} }

View File

@ -83,7 +83,9 @@ namespace OS {
} }
/** /**
* Turn on/off the `closable` feature of the list item * Setter: Turn on/off the `closable` feature of the list item
*
* Getter: Check whether the item is closable
* *
* @memberof ListViewItemTag * @memberof ListViewItemTag
*/ */
@ -95,13 +97,6 @@ namespace OS {
$(this.refs.btcl).hide(); $(this.refs.btcl).hide();
} }
} }
/**
* Check whether the item is closable
*
* @type {boolean}
* @memberof ListViewItemTag
*/
get closable(): boolean { get closable(): boolean {
return this.hasattr("closable"); return this.hasattr("closable");
} }
@ -115,7 +110,9 @@ namespace OS {
} }
/** /**
* select/unselect the current item * Setter: select/unselect the current item
*
* Getter: Check whether the current item is selected
* *
* @memberof ListViewItemTag * @memberof ListViewItemTag
*/ */
@ -129,13 +126,6 @@ namespace OS {
$(this.refs.item).addClass("selected"); $(this.refs.item).addClass("selected");
this._onselect({ id: this.aid, data: this }); this._onselect({ id: this.aid, data: this });
} }
/**
* Check whether the current item is selected
*
* @type {boolean}
* @memberof ListViewItemTag
*/
get selected(): boolean { get selected(): boolean {
return this.hasattr("selected"); return this.hasattr("selected");
} }
@ -225,22 +215,21 @@ namespace OS {
} }
/** /**
* Setter:
*
* Set the data of the list item. This will * Set the data of the list item. This will
* trigger the [[ondatachange]] function * trigger the [[ondatachange]] function
* *
* Getter:
*
* Get the data of the current list item
*
* @memberof ListViewItemTag * @memberof ListViewItemTag
*/ */
set data(v: GenericObject<any>) { set data(v: GenericObject<any>) {
this._data = v; this._data = v;
this.ondatachange(); this.ondatachange();
} }
/**
* Get the data of the current list item
*
* @type {GenericObject<any>}
* @memberof ListViewItemTag
*/
get data(): GenericObject<any> { get data(): GenericObject<any> {
return this._data; return this._data;
} }
@ -509,7 +498,9 @@ namespace OS {
protected reload(d?: any): void {} protected reload(d?: any): void {}
/** /**
* toggle between dropdown and traditional list * Setter: toggle between dropdown and traditional list
*
* Getter: Check whether the list is dropdown or traditional list
* *
* @memberof ListViewTag * @memberof ListViewTag
*/ */
@ -586,52 +577,45 @@ namespace OS {
this._onitemclose = v; this._onitemclose = v;
} }
/**
* Check whether the list is dropdown or traditional list
*
* @type {boolean}
* @memberof ListViewTag
*/
get dropdown(): boolean { get dropdown(): boolean {
return this.hasAttribute("dropdown"); return this.hasAttribute("dropdown");
} }
/** /**
* Setter:
*
* Set the default tag name of list's items. * Set the default tag name of list's items.
* If the tag name is not specified in the * If the tag name is not specified in the
* data of a list item, this tag will be used * data of a list item, this tag will be used
* *
* Getter:
*
* Get the default tag name of list item
*
* @memberof ListViewTag * @memberof ListViewTag
*/ */
set itemtag(v: string) { set itemtag(v: string) {
$(this).attr("itemtag", v); $(this).attr("itemtag", v);
} }
/**
* Get the default tag name of list item
*
* @type {string}
* @memberof ListViewTag
*/
get itemtag(): string { get itemtag(): string {
return $(this).attr("itemtag"); return $(this).attr("itemtag");
} }
/** /**
* Setter:
*
* Turn on/off of the `multiselect` feature * Turn on/off of the `multiselect` feature
* *
* Getter:
*
* Check whether multi-select is allowed
* in this list
*
* @memberof ListViewTag * @memberof ListViewTag
*/ */
set multiselect(v: boolean) { set multiselect(v: boolean) {
this.attsw(v, "multiselect"); this.attsw(v, "multiselect");
} }
/**
* Check whether multi-select is allowed
* in this list
*
* @memberof ListViewTag
*/
get multiselect() { get multiselect() {
if (this.dropdown) { if (this.dropdown) {
return false; return false;
@ -640,20 +624,15 @@ namespace OS {
} }
/** /**
* Enable/disable drag and drop event in the list * Setter: Enable/disable drag and drop event in the list
*
* Getter: Check whether the drag and drop event is enabled
* *
* @memberof ListViewTag * @memberof ListViewTag
*/ */
set dragndrop(v: boolean) { set dragndrop(v: boolean) {
this.attsw(v, "dragndrop"); this.attsw(v, "dragndrop");
} }
/**
* Check whether the drag and drop event is enabled
*
* @type {boolean}
* @memberof ListViewTag
*/
get dragndrop(): boolean { get dragndrop(): boolean {
return this.hasattr("dragndrop"); return this.hasattr("dragndrop");
} }
@ -699,7 +678,9 @@ namespace OS {
} }
/** /**
* Get data of the list * Getter: Get data of the list
*
* Setter: Set data to the list
* *
* @type {GenericObject<any>[]} * @type {GenericObject<any>[]}
* @memberof ListViewTag * @memberof ListViewTag
@ -707,12 +688,6 @@ namespace OS {
get data(): GenericObject<any>[] { get data(): GenericObject<any>[] {
return this._data; return this._data;
} }
/**
* Set data to the list
*
* @memberof ListViewTag
*/
set data(data: GenericObject<any>[]) { set data(data: GenericObject<any>[]) {
this._data = data; this._data = data;
this._selectedItem = undefined; this._selectedItem = undefined;
@ -740,7 +715,9 @@ namespace OS {
protected ondatachange(): void {} protected ondatachange(): void {}
/** /**
* Select list item(s) by their indexes * Setter: Select list item(s) by their indexes
*
* Getter: Get the indexes of all selected items
* *
* @memberof ListViewTag * @memberof ListViewTag
*/ */
@ -793,12 +770,6 @@ namespace OS {
return this._selectedItems; return this._selectedItems;
} }
/**
* Get the indexes of all selected items
*
* @type {(number | number[])}
* @memberof ListViewTag
*/
get selected(): number | number[] { get selected(): number | number[] {
if (this.multiselect) { if (this.multiselect) {
return this.selectedItems.map(function ( return this.selectedItems.map(function (

View File

@ -89,25 +89,22 @@ namespace OS {
} }
/** /**
* Set the `sub menu entry select` event handle * Setter: Set the `sub menu entry select` event handle
*
* Getter: get the current `sub menu entry select` event handle
* *
* @memberof MenuEntryTag * @memberof MenuEntryTag
*/ */
set onchildselect(v: TagEventCallback<MenuEventData>) { set onchildselect(v: TagEventCallback<MenuEventData>) {
this._onchildselect = v; this._onchildselect = v;
} }
/**
* get the current `sub menu entry select` event handle
*
* @type {TagEventCallback}
* @memberof MenuEntryTag
*/
get onchildselect(): TagEventCallback<MenuEventData> { get onchildselect(): TagEventCallback<MenuEventData> {
return this._onchildselect; return this._onchildselect;
} }
/** /**
* Set data to the entry * Setter: Set data to the entry
*
* Getter: Get data of the current menu entry
* *
* @memberof MenuEntryTag * @memberof MenuEntryTag
*/ */
@ -115,13 +112,6 @@ namespace OS {
this._data = data; this._data = data;
this.set(data); this.set(data);
} }
/**
* Get data of the current menu entry
*
* @type {GenericObject<any>}
* @memberof MenuEntryTag
*/
get data(): GenericObject<any> { get data(): GenericObject<any> {
return this._data; return this._data;
} }
@ -180,7 +170,9 @@ namespace OS {
} }
/** /**
* Set the sub-menu data * Setter: Set the sub-menu data
*
* Getter: Get the sub-menu data
* *
* @memberof MenuEntryTag * @memberof MenuEntryTag
*/ */
@ -204,13 +196,6 @@ namespace OS {
}); });
} }
} }
/**
* Get the sub-menu data
*
* @type {GenericObject<any>[]}
* @memberof MenuEntryTag
*/
get nodes(): GenericObject<any>[] { get nodes(): GenericObject<any>[] {
if (this.data && this.data.nodes) { if (this.data && this.data.nodes) {
return this.data.nodes; return this.data.nodes;
@ -333,7 +318,9 @@ namespace OS {
protected reload(d?: any): void {} protected reload(d?: any): void {}
/** /**
* Turn on/off the checker feature of the menu entry * Setter: Turn on/off the checker feature of the menu entry
*
* Getter: Check whether the checker feature is enabled on this menu entry
* *
* @memberof SimpleMenuEntryTag * @memberof SimpleMenuEntryTag
*/ */
@ -345,19 +332,14 @@ namespace OS {
$(this.refs.switch).hide(); $(this.refs.switch).hide();
} }
} }
/**
* Check whether the checker feature is enabled on this menu entry
*
* @type {boolean}
* @memberof SimpleMenuEntryTag
*/
get switch(): boolean { get switch(): boolean {
return this.hasattr("switch"); return this.hasattr("switch");
} }
/** /**
* Turn on/off the radio feature of the menu entry * Setter: Turn on/off the radio feature of the menu entry
*
* Getter: Check whether the radio feature is enabled
* *
* @memberof SimpleMenuEntryTag * @memberof SimpleMenuEntryTag
*/ */
@ -369,22 +351,21 @@ namespace OS {
$(this.refs.switch).hide(); $(this.refs.switch).hide();
} }
} }
/**
* Check whether the radio feature is enabled
*
* @type {boolean}
* @memberof SimpleMenuEntryTag
*/
get radio(): boolean { get radio(): boolean {
return this.hasattr("radio"); return this.hasattr("radio");
} }
/** /**
* Setter:
*
* Toggle the switch on the menu entry, this setter * Toggle the switch on the menu entry, this setter
* only works when the `checker` or `radio` feature is * only works when the `checker` or `radio` feature is
* enabled * enabled
* *
* Getter:
*
* Check whether the switch is turned on
*
* @memberof SimpleMenuEntryTag * @memberof SimpleMenuEntryTag
*/ */
set checked(v: boolean) { set checked(v: boolean) {
@ -395,13 +376,6 @@ namespace OS {
} }
(this.refs.switch as SwitchTag).swon = v; (this.refs.switch as SwitchTag).swon = v;
} }
/**
* Check whether the switch is turned on
*
* @type {boolean}
* @memberof SimpleMenuEntryTag
*/
get checked(): boolean { get checked(): boolean {
return this.hasattr("checked"); return this.hasattr("checked");
} }
@ -623,7 +597,9 @@ namespace OS {
protected reload(d?: any): void {} protected reload(d?: any): void {}
/** /**
* Set the menu items data * Setter: Set the menu items data
*
* Getter: Get menu items data
* *
* @memberof MenuTag * @memberof MenuTag
*/ */
@ -632,19 +608,14 @@ namespace OS {
$(this.refs.container).empty(); $(this.refs.container).empty();
data.map((item) => this.push(item, false)); data.map((item) => this.push(item, false));
} }
/**
* Get menu items data
*
* @type {GenericObject<any>[]}
* @memberof MenuTag
*/
get items(): GenericObject<any>[] { get items(): GenericObject<any>[] {
return this._items; return this._items;
} }
/** /**
* Set whether the current menu is a context menu * Setter: Set whether the current menu is a context menu
*
* Getter: Check whether the current menu is a context menu
* *
* @memberof MenuTag * @memberof MenuTag
*/ */
@ -657,13 +628,6 @@ namespace OS {
$(this.refs.wrapper).addClass("context"); $(this.refs.wrapper).addClass("context");
$(this).hide(); $(this).hide();
} }
/**
* Check whether the current menu is a context menu
*
* @type {boolean}
* @memberof MenuTag
*/
get context(): boolean { get context(): boolean {
return this.hasattr("context"); return this.hasattr("context");
} }
@ -678,22 +642,21 @@ namespace OS {
} }
/** /**
* Setter:
*
* Set the default tag name of the menu item. * Set the default tag name of the menu item.
* If the tag is not specified in an item data, * If the tag is not specified in an item data,
* this value will be used * this value will be used
* *
* Getter:
*
* Get the default menu entry tag name
*
* @memberof MenuTag * @memberof MenuTag
*/ */
set contentag(v: string) { set contentag(v: string) {
$(this).attr("contentag", v); $(this).attr("contentag", v);
} }
/**
* Get the default menu entry tag name
*
* @type {string}
* @memberof MenuTag
*/
get contentag(): string { get contentag(): string {
return $(this).attr("contentag"); return $(this).attr("contentag");
} }

View File

@ -149,7 +149,9 @@ namespace OS {
} }
/** /**
* Set the spinner value * Setter: Set the spinner value
*
* Getter: Get the spinner value
* *
* @memberof NSpinnerTag * @memberof NSpinnerTag
*/ */
@ -160,13 +162,6 @@ namespace OS {
this._onchange(evt); this._onchange(evt);
this.observable.trigger("nspin", evt); this.observable.trigger("nspin", evt);
} }
/**
* Get the spinner value
*
* @type {number}
* @memberof NSpinnerTag
*/
get value(): number { get value(): number {
return this._value; return this._value;
} }

View File

@ -64,9 +64,15 @@ namespace OS {
protected reload(d?: any): void {} protected reload(d?: any): void {}
/** /**
* Setter:
*
* Set the width of the tag, the tag width should be in form of: * Set the width of the tag, the tag width should be in form of:
* `100px` of `80%` * `100px` of `80%`
* *
* Getter:
*
* Get the tag width
*
* @memberof OverlayTag * @memberof OverlayTag
*/ */
set width(v: string) { set width(v: string) {
@ -76,21 +82,20 @@ namespace OS {
this._width = v; this._width = v;
this.calibrate(); this.calibrate();
} }
/**
* Get the tag width
*
* @type {string}
* @memberof OverlayTag
*/
get width(): string { get width(): string {
return this._width; return this._width;
} }
/** /**
* Setter:
*
* Set the tag height, the tag height should be in form of: * Set the tag height, the tag height should be in form of:
* `100px` of `80%` * `100px` of `80%`
* *
* Getter:
*
* Get the tag height
*
* @memberof OverlayTag * @memberof OverlayTag
*/ */
set height(v: string) { set height(v: string) {
@ -100,13 +105,6 @@ namespace OS {
this._height = v; this._height = v;
this.calibrate(); this.calibrate();
} }
/**
* Get the tag height
*
* @type {string}
* @memberof OverlayTag
*/
get height(): string { get height(): string {
return this._height; return this._height;
} }

View File

@ -81,22 +81,21 @@ namespace OS {
*/ */
protected reload(d?: any): void {} protected reload(d?: any): void {}
/** /**
* Setter:
*
* Set resize direction, two possible values: * Set resize direction, two possible values:
* - `hz` - horizontal direction, resize by width * - `hz` - horizontal direction, resize by width
* - `ve` - vertical direction, resize by height * - `ve` - vertical direction, resize by height
* *
* Getter:
*
* Get the resize direction
*
* @memberof ResizerTag * @memberof ResizerTag
*/ */
set dir(v: string) { set dir(v: string) {
$(this).attr("dir", v); $(this).attr("dir", v);
} }
/**
* Get the resize direction
*
* @type {string}
* @memberof ResizerTag
*/
get dir(): string { get dir(): string {
return $(this).attr("dir"); return $(this).attr("dir");
} }

View File

@ -100,7 +100,9 @@ namespace OS {
} }
/** /**
* Enable/disable the slider * Setter: Enable/disable the slider
*
* Getter: Check whether the slider is enabled
* *
* @memberof SliderTag * @memberof SliderTag
*/ */
@ -119,19 +121,14 @@ namespace OS {
$(this).unbind("mouseover").unbind("mouseout"); $(this).unbind("mouseover").unbind("mouseout");
} }
} }
/**
* Check whether the slider is enabled
*
* @type {boolean}
* @memberof SliderTag
*/
get enable(): boolean { get enable(): boolean {
return this.hasattr("enable"); return this.hasattr("enable");
} }
/** /**
* Set the slider value * Setter: Set the slider value
*
* Getter: Get the current slider value
* *
* @memberof SliderTag * @memberof SliderTag
*/ */
@ -139,19 +136,14 @@ namespace OS {
this._value = v; this._value = v;
this.calibrate(); this.calibrate();
} }
/**
* Get the current slider value
*
* @type {number}
* @memberof SliderTag
*/
get value(): number { get value(): number {
return this._value; return this._value;
} }
/** /**
* Set the maximum value of the slider * Setter: Set the maximum value of the slider
*
* Getter: Get the maximum value of the slider
* *
* @memberof SliderTag * @memberof SliderTag
*/ */
@ -159,13 +151,6 @@ namespace OS {
this._max = v; this._max = v;
this.calibrate(); this.calibrate();
} }
/**
* Get the maximum value of the slider
*
* @type {number}
* @memberof SliderTag
*/
get max(): number { get max(): number {
return this._max; return this._max;
} }

View File

@ -19,7 +19,9 @@ namespace OS {
private _onchange: TagEventCallback<boolean>; private _onchange: TagEventCallback<boolean>;
/** /**
* Turn on/off the switch * Setter: Turn on/off the switch
*
* Getter: Check whether the switch is turned on
* *
* @memberof SwitchTag * @memberof SwitchTag
*/ */
@ -30,32 +32,20 @@ namespace OS {
$(this.refs.switch).addClass("swon"); $(this.refs.switch).addClass("swon");
} }
} }
/**
* Check whether the switch is turned on
*
* @type {boolean}
* @memberof SwitchTag
*/
get swon(): boolean { get swon(): boolean {
return this.hasattr("swon"); return this.hasattr("swon");
} }
/** /**
* Enable the switch * Setter: Enable the switch
*
* Getter: Check whether the switch is enabled
* *
* @memberof SwitchTag * @memberof SwitchTag
*/ */
set enable(v: boolean) { set enable(v: boolean) {
this.attsw(v, "enable"); this.attsw(v, "enable");
} }
/**
* Check whether the switch is enabled
*
* @type {boolean}
* @memberof SwitchTag
*/
get enable(): boolean { get enable(): boolean {
return this.hasattr("enable"); return this.hasattr("enable");
} }

View File

@ -69,20 +69,15 @@ namespace OS {
protected reload(d?: any): void {} protected reload(d?: any): void {}
/** /**
* Enable/disable a tab to be closed * Setter: Enable/disable a tab to be closed
*
* Getter: Check whether tabs can be closed
* *
* @memberof TabBarTag * @memberof TabBarTag
*/ */
set closable(v: boolean) { set closable(v: boolean) {
this.attsw(v, "closable"); this.attsw(v, "closable");
} }
/**
* Check whether tabs can be closed
*
* @type {boolean}
* @memberof TabBarTag
*/
get closable(): boolean { get closable(): boolean {
return this.hasattr("closable"); return this.hasattr("closable");
} }
@ -120,7 +115,9 @@ namespace OS {
} }
/** /**
* Set tabs data * Setter: Set tabs data
*
* Getter: Get all tabs data
* *
* @memberof TabBarTag * @memberof TabBarTag
*/ */
@ -130,32 +127,20 @@ namespace OS {
} }
(this.refs.list as ListViewTag).data = v; (this.refs.list as ListViewTag).data = v;
} }
/**
* Get all tabs data
*
* @type {GenericObject<any>[]}
* @memberof TabBarTag
*/
get items(): GenericObject<any>[] { get items(): GenericObject<any>[] {
return (this.refs.list as ListViewTag).data; return (this.refs.list as ListViewTag).data;
} }
/** /**
* Select a tab by its index * Setter: Select a tab by its index
*
* Getter: Get the currently selected tab
* *
* @memberof TabBarTag * @memberof TabBarTag
*/ */
set selected(v: number | number[]) { set selected(v: number | number[]) {
(this.refs.list as ListViewTag).selected = v; (this.refs.list as ListViewTag).selected = v;
} }
/**
* Get the currently selected tab
*
* @type {(number | number[])}
* @memberof TabBarTag
*/
get selected(): number | number[] { get selected(): number | number[] {
return (this.refs.list as ListViewTag).selected; return (this.refs.list as ListViewTag).selected;
} }

View File

@ -89,10 +89,16 @@ namespace OS {
} }
/** /**
* Setter:
*
* Set the tab bar direction: * Set the tab bar direction:
* - `row`: horizontal direction * - `row`: horizontal direction
* - `column`: vertical direction * - `column`: vertical direction
* *
* Getter:
*
* Get the tab bar direction
*
* @memberof TabContainerTag * @memberof TabContainerTag
*/ */
set dir(v: "row" | "column") { set dir(v: "row" | "column") {
@ -102,21 +108,20 @@ namespace OS {
} }
(this.refs.wrapper as TileLayoutTag).dir = v; (this.refs.wrapper as TileLayoutTag).dir = v;
} }
/**
* Get the tab bar direction
*
* @type {("row"| "column")}
* @memberof TabContainerTag
*/
get dir(): "row" | "column" { get dir(): "row" | "column" {
return $(this).attr("dir") as any; return $(this).attr("dir") as any;
} }
/** /**
* Setter:
*
* Select a tab using the its tab data type. * Select a tab using the its tab data type.
* This will show the attached container to the tab * This will show the attached container to the tab
* *
* Getter:
*
* Get the tab data of the currently selected Tab
*
* @memberof TabContainerTag * @memberof TabContainerTag
*/ */
set selectedTab(v: TabContainerTabType) { set selectedTab(v: TabContainerTabType) {
@ -131,13 +136,6 @@ namespace OS {
$(v.container).show(); $(v.container).show();
this.observable.trigger("resize", undefined); this.observable.trigger("resize", undefined);
} }
/**
* Get the tab data of the currently selected Tab
*
* @type {TabContainerTabType}
* @memberof TabContainerTag
*/
get selectedTab(): TabContainerTabType { get selectedTab(): TabContainerTabType {
return this._selectedTab; return this._selectedTab;
} }

View File

@ -40,7 +40,9 @@ namespace OS {
protected reload(d?: any): void {} protected reload(d?: any): void {}
/** /**
* Set the name of the tile container, should be: `hbox` or `vbox` * Setter: Set the name of the tile container, should be: `hbox` or `vbox`
*
* Getter: Get the name of the tile container
* *
* @memberof TileLayoutTag * @memberof TileLayoutTag
*/ */
@ -54,22 +56,21 @@ namespace OS {
.addClass(`afx-${v}-container`); .addClass(`afx-${v}-container`);
this.calibrate(); this.calibrate();
} }
/**
* Get the name of the tile container
*
* @type {string}
* @memberof TileLayoutTag
*/
get name(): string { get name(): string {
return $(this).attr("name"); return $(this).attr("name");
} }
/** /**
* Setter:
*
* SET the layout direction, should be: * SET the layout direction, should be:
* - `row`: horizontal direction * - `row`: horizontal direction
* - `column`: vertical direction * - `column`: vertical direction
* *
* Getter:
*
* Get layout direction
*
* @memberof TileLayoutTag * @memberof TileLayoutTag
*/ */
set dir(v: "row" | "column") { set dir(v: "row" | "column") {
@ -80,13 +81,6 @@ namespace OS {
$(this.refs.yield).css("flex-direction", v); $(this.refs.yield).css("flex-direction", v);
this.calibrate(); this.calibrate();
} }
/**
* Get layout direction
*
* @type {("row"| "column")}
* @memberof TileLayoutTag
*/
get dir(): "row" | "column" { get dir(): "row" | "column" {
return $(this).attr("dir") as any; return $(this).attr("dir") as any;
} }

View File

@ -110,7 +110,7 @@ namespace OS {
/** /**
* Placeholder for the `fetch` function of the node. * Placeholder for the `fetch` function of the node.
* This function is used to fetch the child nodes of the * This function is used to fetch the child nodes of the
* current nodes. This function should a promise on * current nodes. This function should return a promise on
* a list of [[TreeViewDataType]] * a list of [[TreeViewDataType]]
* *
* @memberof TreeViewItemPrototype * @memberof TreeViewItemPrototype
@ -161,9 +161,15 @@ namespace OS {
} }
/** /**
* Set the data of the current node. This wll trigger the * Setter:
*
* Set the data of the current node. This will trigger the
* [[ondatachange]] function * [[ondatachange]] function
* *
* Getter:
*
* Get the current node's data
*
* @memberof TreeViewItemPrototype * @memberof TreeViewItemPrototype
*/ */
set data(v: TreeViewDataType) { set data(v: TreeViewDataType) {
@ -179,22 +185,21 @@ namespace OS {
v.domel = this; v.domel = this;
this.ondatachange(); this.ondatachange();
} }
/**
* Get the current node's data
*
* @type {TreeViewDataType}
* @memberof TreeViewItemPrototype
*/
get data(): TreeViewDataType { get data(): TreeViewDataType {
return this._data; return this._data;
} }
/** /**
* Setter:
*
* Select or unselect the current node. * Select or unselect the current node.
* This will trigger the item select event * This will trigger the item select event
* on the tree root if the parameter is `true` * on the tree root if the parameter is `true`
* *
* Getter:
*
* Check whether the current node is selected
*
* @memberof TreeViewItemPrototype * @memberof TreeViewItemPrototype
*/ */
set selected(v: boolean) { set selected(v: boolean) {
@ -212,22 +217,21 @@ namespace OS {
$(this.refs.wrapper).addClass("afx_tree_item_selected"); $(this.refs.wrapper).addClass("afx_tree_item_selected");
} }
} }
/**
* Check whether the current node is selected
*
* @type {boolean}
* @memberof TreeViewItemPrototype
*/
get selected(): boolean { get selected(): boolean {
return this.hasattr("selected"); return this.hasattr("selected");
} }
/** /**
* Setter:
*
* Refresh the current node and expands its sub tree. * Refresh the current node and expands its sub tree.
* This function only works if the current node is not * This function only works if the current node is not
* a leaf node * a leaf node
* *
* Getter:
*
* Check whether the current node is expanded
*
* @memberof TreeViewItemPrototype * @memberof TreeViewItemPrototype
*/ */
set open(v: boolean) { set open(v: boolean) {
@ -265,18 +269,13 @@ namespace OS {
); );
} }
} }
/**
* Check whether the current node is expanded
*
* @type {boolean}
* @memberof TreeViewItemPrototype
*/
get open(): boolean { get open(): boolean {
return this.hasattr("open"); return this.hasattr("open");
} }
/** /**
* Get the current indent level * Setter: Set the current indent level of this node from the root node
*
* Getter: Get the current indent level
* *
* @type {number} * @type {number}
* @memberof TreeViewItemPrototype * @memberof TreeViewItemPrototype
@ -284,12 +283,6 @@ namespace OS {
get indent(): number { get indent(): number {
return this._indent; return this._indent;
} }
/**
* Set the current indent level of this node from the root node
*
* @memberof TreeViewItemPrototype
*/
set indent(v: number) { set indent(v: number) {
if (!v) { if (!v) {
return; return;
@ -320,7 +313,9 @@ namespace OS {
} }
/** /**
* Get the child nodes data of the current node * Getter: Get the child nodes data of the current node
*
* Setter: Set the child nodes data of the current node
* *
* @type {TreeViewDataType[]} * @type {TreeViewDataType[]}
* @memberof TreeViewItemPrototype * @memberof TreeViewItemPrototype
@ -329,12 +324,6 @@ namespace OS {
if (!this._data) return undefined; if (!this._data) return undefined;
return this._data.nodes; return this._data.nodes;
} }
/**
* Set the child nodes data of the current node
*
* @memberof TreeViewItemPrototype
*/
set nodes(nodes: TreeViewDataType[]) { set nodes(nodes: TreeViewDataType[]) {
if (!nodes || !this.data) { if (!nodes || !this.data) {
return; return;
@ -523,7 +512,7 @@ namespace OS {
*/ */
export class TreeViewTag extends AFXTag { export class TreeViewTag extends AFXTag {
/** /**
* Reference the the selected node * Reference to the selected node
* *
* @private * @private
* @type {TreeViewItemPrototype} * @type {TreeViewItemPrototype}
@ -646,7 +635,7 @@ namespace OS {
/** /**
* Placeholder for the `fetch` function of the tree. * Placeholder for the `fetch` function of the tree.
* This function is used to fetch the child nodes of the * This function is used to fetch the child nodes of the
* current tree. This function should a promise on * current tree. This function should return a promise on
* a list of [[TreeViewDataType]] * a list of [[TreeViewDataType]]
* *
* @memberof TreeViewItemPrototype * @memberof TreeViewItemPrototype
@ -700,20 +689,15 @@ namespace OS {
*/ */
protected reload(d?: any): void {} protected reload(d?: any): void {}
/** /**
* Enable/disable drag and drop event on the tree * Setter: Enable/disable drag and drop event on the tree
*
* Getter: Check whether the drag and drop event is enabled
* *
* @memberof TreeViewTag * @memberof TreeViewTag
*/ */
set dragndrop(v: boolean) { set dragndrop(v: boolean) {
this.attsw(v, "dragndrop"); this.attsw(v, "dragndrop");
} }
/**
* Check whether the drag and drop event is enabled
*
* @type {boolean}
* @memberof TreeViewTag
*/
get dragndrop(): boolean { get dragndrop(): boolean {
return this.hasattr("dragndrop"); return this.hasattr("dragndrop");
} }
@ -737,24 +721,23 @@ namespace OS {
} }
/** /**
* Setter:
*
* Set the default tag name of the tree node. * Set the default tag name of the tree node.
* If there is no tag name in the node data, * If there is no tag name in the node data,
* this value will be used when creating node. * this value will be used when creating node.
* *
* Defaut to `afx-tree-view-item` * Defaut to `afx-tree-view-item`
* *
* Getter:
*
* Get the default node tag name
*
* @memberof TreeViewTag * @memberof TreeViewTag
*/ */
set itemtag(v: string) { set itemtag(v: string) {
$(this).attr("itemtag", v); $(this).attr("itemtag", v);
} }
/**
* Get the default node tag name
*
* @type {string}
* @memberof TreeViewTag
*/
get itemtag(): string { get itemtag(): string {
return $(this).attr("itemtag"); return $(this).attr("itemtag");
} }
@ -771,7 +754,9 @@ namespace OS {
} }
/** /**
* Get the DOM element of the selected node * Setter: Set the selected node using its DOM element
*
* Getter: Get the DOM element of the selected node
* *
* @type {TreeViewItemPrototype} * @type {TreeViewItemPrototype}
* @memberof TreeViewTag * @memberof TreeViewTag
@ -779,12 +764,6 @@ namespace OS {
get selectedItem(): TreeViewItemPrototype { get selectedItem(): TreeViewItemPrototype {
return this._selectedItem; return this._selectedItem;
} }
/**
* Set the selected node using its DOM element
*
* @memberof TreeViewTag
*/
set selectedItem(v: TreeViewItemPrototype) { set selectedItem(v: TreeViewItemPrototype) {
if (!v) { if (!v) {
return; return;
@ -887,9 +866,15 @@ namespace OS {
} }
/** /**
* Setter:
*
* Set the tree data. This operation will create * Set the tree data. This operation will create
* all tree node elements of the current tree * all tree node elements of the current tree
* *
* Getter:
*
* Get the tree data
*
* @memberof TreeViewTag * @memberof TreeViewTag
*/ */
set data(v: TreeViewDataType) { set data(v: TreeViewDataType) {
@ -923,13 +908,6 @@ namespace OS {
} }
} }
} }
/**
* Get the tree data
*
* @type {TreeViewDataType}
* @memberof TreeViewTag
*/
get data(): TreeViewDataType { get data(): TreeViewDataType {
return this._data; return this._data;
} }

View File

@ -120,7 +120,9 @@ namespace OS {
protected reload(d?: any): void {} protected reload(d?: any): void {}
/** /**
* Set the window width * Setter: Set the window width
*
* Getter: Get the window width
* *
* @memberof WindowTag * @memberof WindowTag
*/ */
@ -131,19 +133,14 @@ namespace OS {
} }
this.setsize({ w: v, h: this.height }); this.setsize({ w: v, h: this.height });
} }
/**
* Get the window width
*
* @type {number}
* @memberof WindowTag
*/
get width(): number { get width(): number {
return this._width; return this._width;
} }
/** /**
* Set the window height * Setter: Set the window height
*
* Getter: Get the window height
* *
* @memberof WindowTag * @memberof WindowTag
*/ */
@ -157,19 +154,14 @@ namespace OS {
h: v, h: v,
}); });
} }
/**
* Get the window height
*
* @type {number}
* @memberof WindowTag
*/
get height(): number { get height(): number {
return this._height; return this._height;
} }
/** /**
* enable/disable window minimizable * Setter: enable/disable window minimizable
*
* getter: Check whether the window is minimizable
* *
* @memberof WindowTag * @memberof WindowTag
*/ */
@ -181,19 +173,14 @@ namespace OS {
$(this.refs["minbt"]).hide(); $(this.refs["minbt"]).hide();
} }
} }
/**
* Check whether the window is minimizable
*
* @type {boolean}
* @memberof WindowTag
*/
get minimizable(): boolean { get minimizable(): boolean {
return this.hasattr("minimizable"); return this.hasattr("minimizable");
} }
/** /**
* enable/disable widow resizable * Setter: enable/disable widow resizable
*
* Getter: Check whether the current window is resizable
* *
* @memberof WindowTag * @memberof WindowTag
*/ */
@ -207,19 +194,14 @@ namespace OS {
$(this.refs["grip"]).hide(); $(this.refs["grip"]).hide();
} }
} }
/**
* Check whether the current window is resizable
*
* @type {boolean}
* @memberof WindowTag
*/
get resizable(): boolean { get resizable(): boolean {
return this.hasattr("resizable"); return this.hasattr("resizable");
} }
/** /**
* Set the window title * Setter: Set the window title
*
* Getter: Get window title
* *
* @memberof WindowTag * @memberof WindowTag
*/ */
@ -229,13 +211,6 @@ namespace OS {
(this.refs["txtTitle"] as LabelTag).text = v; (this.refs["txtTitle"] as LabelTag).text = v;
} }
} }
/**
* Get window title
*
* @type {(string| FormattedString)}
* @memberof WindowTag
*/
get apptitle(): string | FormattedString { get apptitle(): string | FormattedString {
return $(this).attr("apptitle"); return $(this).attr("apptitle");
} }

View File

@ -360,7 +360,9 @@ namespace OS {
} }
/** /**
* Setter to set the id of the tag in string or number * Setter: set the id of the tag in string or number
*
* Getter: get the id of the current tag
* *
* @memberof AFXTag * @memberof AFXTag
*/ */
@ -368,12 +370,6 @@ namespace OS {
$(this).attr("data-id", v); $(this).attr("data-id", v);
} }
/**
* Getter to get the id of the current tag
*
* @type {(string | number)}
* @memberof AFXTag
*/
get aid(): string | number { get aid(): string | number {
return $(this).attr("data-id"); return $(this).attr("data-id");
} }