From 218f6142c6affd51d8e2274032eb2e78d8501d99 Mon Sep 17 00:00:00 2001 From: lxsang Date: Fri, 12 Jun 2020 20:24:39 +0200 Subject: [PATCH] add more doc --- src/core/Announcerment.ts | 165 +++++++++----- src/core/BaseApplication.ts | 174 +++++++++------ src/core/BaseDialog.ts | 270 +++++++++++++++++----- src/core/BaseModel.ts | 369 +++++++++++++++++++++++-------- src/core/BaseService.ts | 6 - src/core/tags/AppDockTag.ts | 16 +- src/core/tags/ButtonTag.ts | 43 +--- src/core/tags/FileViewTag.ts | 78 +++---- src/core/tags/FloatListTag.ts | 15 +- src/core/tags/GridViewTag.ts | 79 +++---- src/core/tags/LabelTag.ts | 11 +- src/core/tags/ListViewTag.ts | 103 ++++----- src/core/tags/MenuTag.ts | 103 +++------ src/core/tags/NSpinnerTag.ts | 11 +- src/core/tags/OverlayTag.ts | 26 +-- src/core/tags/ResizerTag.ts | 13 +- src/core/tags/SliderTag.ts | 33 +-- src/core/tags/SwitchTag.ts | 22 +- src/core/tags/TabBarTag.ts | 33 +-- src/core/tags/TabContainerTag.ts | 26 +-- src/core/tags/TileLayoutTags.ts | 24 +- src/core/tags/TreeViewTag.ts | 114 ++++------ src/core/tags/WindowTag.ts | 55 ++--- src/core/tags/tag.ts | 10 +- 24 files changed, 1006 insertions(+), 793 deletions(-) diff --git a/src/core/Announcerment.ts b/src/core/Announcerment.ts index 9938f41..b03c3bf 100644 --- a/src/core/Announcerment.ts +++ b/src/core/Announcerment.ts @@ -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 // AnTOS Web desktop is is licensed under the GNU General Public @@ -26,45 +19,91 @@ namespace OS { export namespace API { /** - * + * Observable entry type definition * * @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>; + + /** + * A Set of callbacks that should be called + * every time the corresponding event is triggered + * + * @memberof ObservableEntryType + */ many: Set<(d: any) => void>; } /** - * + * Announcement listener type definition * * @export * @interface AnnouncerListenerType */ export interface AnnouncerListenerType { [index: number]: { + /** + * The event name + * + * @type {string} + */ e: string; + + /** + * The event callback + * + */ 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 * @class Announcer */ export class Announcer { + /** + * The observable object that stores event name + * and its corresponding callback in [[ObservableEntryType]] + * + * @type {GenericObject} + * @memberof Announcer + */ observable: GenericObject; + + /** + * Enable/disable the announcer + * + * @type {boolean} + * @memberof Announcer + */ enable: boolean; + + /** + *Creates an instance of Announcer. + * @memberof Announcer + */ constructor() { this.observable = {}; this.enable = true; } /** - * + * Disable the announcer, when this function is called + * all events and their callbacks will be removed * * @returns * @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 - * @param {(d: any) => void} callback + * @param {string} evtName event name + * @param {(d: any) => void} callback The corresponding callback * @returns {void} * @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 - * @param {(d: any) => void} callback + * @param {string} evtName event name + * @param {(d: any) => void} callback the corresponding callback * @returns {void} * @memberof Announcer */ @@ -117,10 +158,12 @@ namespace OS { } /** + * Unsubscribe the callback from an event * - * - * @param {string} evtName - * @param {(d: any) => void} [callback] + * @param {string} evtName event name + * @param {(d: any) => void} [callback] the callback to be unsubscribed. + * When the `callback` is `*`, all callbacks related to `evtName` will be + * removed * @memberof Announcer */ off(evtName: string, callback?: (d: any) => void): void { @@ -147,10 +190,10 @@ namespace OS { } /** + * Trigger an event * - * - * @param {string} evtName - * @param {*} data + * @param {string} evtName event name + * @param {*} data data object that will be send to all related callback * @returns {void} * @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 { + /** + * The global announcer object tha manages global events + * and callbacks + */ 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; + /** + * Place holder of all global events listeners + */ export var listeners: API.AnnouncerListenerType = {}; /** - * + * Subscribe to a global event * * @export - * @param {string} e - * @param {(d: any) => void} f - * @param {GUI.BaseModel} a + * @param {string} e event name + * @param {(d: any) => void} f event callback + * @param {GUI.BaseModel} a the process (Application/service) related to the callback */ - export function on( - e: string, - f: (d: any) => void, - a: BaseModel - ): void { + export function on(e: string, f: (d: any) => void, a: BaseModel): void { if (!announcer.listeners[a.pid]) { announcer.listeners[a.pid] = []; } @@ -205,64 +263,67 @@ namespace OS { } /** - * + * Trigger a global event * * @export - * @param {string} e - * @param {*} d + * @param {string} e event name + * @param {*} d data passing to all related callback */ export function trigger(e: string, d: any): void { announcer.observable.trigger(e, d); } /** - * + * Report system fail. This will trigger the global `fail` + * event * * @export - * @param {(string | FormattedString)} m - * @param {Error} e + * @param {(string | FormattedString)} m message string + * @param {Error} e error to be reported */ export function osfail(m: string | FormattedString, e: Error): void { announcer.ostrigger("fail", { m, e }); } /** - * + * Report system error. This will trigger the global `error` + * event * * @export - * @param {(string | FormattedString)} m - * @param {Error} e + * @param {(string | FormattedString)} m message string + * @param {Error} e error to be reported */ export function oserror(m: string | FormattedString, e: Error): void { announcer.ostrigger("error", { m, e }); } /** - * + * Trigger system notification (`info` event) * * @export - * @param {(string | FormattedString)} m + * @param {(string | FormattedString)} m notification message */ export function osinfo(m: string | FormattedString): void { announcer.ostrigger("info", { m, e: null }); } /** - * + * trigger a specific global event * * @export - * @param {string} e - * @param {*} d + * @param {string} e event name + * @param {*} d event data */ export function ostrigger(e: string, d: any): void { announcer.trigger(e, { id: 0, data: d, name: "OS" }); } /** - * + * Unregister a process (application/service) from + * the global announcement system * * @export - * @param {GUI.BaseModel} app + * @param {GUI.BaseModel} app reference to the process * @returns {void} */ export function unregister(app: BaseModel): void { @@ -279,14 +340,14 @@ namespace OS { } /** - * + * Allocate message id * * @export * @returns {number} */ export function getMID(): number { - announcer.quota += 1; - return announcer.quota; + quota += 1; + return quota; } } } diff --git a/src/core/BaseApplication.ts b/src/core/BaseApplication.ts index 36027b1..c9102e6 100644 --- a/src/core/BaseApplication.ts +++ b/src/core/BaseApplication.ts @@ -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 // 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/. 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 { /** - * + * Abstract prototype of all AntOS application. + * Any new application definition should extend + * this prototype * * @export * @abstract @@ -34,15 +34,46 @@ namespace OS { * @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} + * @memberof BaseApplication + */ setting: GenericObject; + + /** + * Hotkeys (shortcuts) defined for this application + * + * @protected + * @type {GUI.ShortcutType} + * @memberof BaseApplication + */ protected keycomb: GUI.ShortcutType; + + /** + * Reference to the system dock + * + * @type {GUI.tag.AppDockTag} + * @memberof BaseApplication + */ 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; /** *Creates an instance of BaseApplication. - * @param {string} name - * @param {AppArgumentsType[]} args + * @param {string} name application name + * @param {AppArgumentsType[]} args application arguments * @memberof BaseApplication */ constructor(name: string, args: AppArgumentsType[]) { @@ -62,11 +93,15 @@ namespace OS { 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} * @memberof BaseApplication @@ -78,10 +113,12 @@ namespace OS { this.on("focus", () => { this.sysdock.selectedApp = this; this.appmenu.pid = this.pid; - this.appmenu.items= this.baseMenu() || []; - this.appmenu.onmenuselect=(d: GUI.tag.MenuEventData): void => { - return this.trigger("menuselect", d); - } + this.appmenu.items = this.baseMenu() || []; + this.appmenu.onmenuselect = ( + d: GUI.tag.MenuEventData + ): void => { + return this.trigger("menuselect", d); + }; if (this.dialog) { return this.dialog.show(); } @@ -107,9 +144,9 @@ namespace OS { return this.loadScheme(); } - /** - * + * Render the application UI by first loading its scheme + * and then mount this scheme to the DOM tree * * @protected * @returns {void} @@ -121,12 +158,14 @@ namespace OS { 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 - * @param {Promise} promise + * @param {Promise} promise the promise on a task to be performed * @returns {Promise} * @memberof BaseApplication */ @@ -145,17 +184,21 @@ namespace OS { }); } - /** - * + * Bind a hotkey to the application, this function + * is used to define application keyboard shortcut * * @protected - * @param {string} k - * @param {(e: JQuery.MouseDownEvent) => void} f + * @param {string} k the hotkey to bind, should be in the following + * format: `[ALT|SHIFT|CTRL|META]-KEY`, e.g. `CTRL-S` + * @param {(e: JQuery.KeyboardEventBase) => void} f the callback function * @returns {void} * @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("-"); if (arr.length !== 2) { return; @@ -168,12 +211,12 @@ namespace OS { this.keycomb[fnk][c] = f; } - /** - * + * Update the application local from the system + * locale or application specific locale configuration * * @private - * @param {string} name + * @param {string} name locale name e.g. `en_GB` * @returns {void} * @memberof BaseApplication */ @@ -194,19 +237,16 @@ namespace OS { } /** + * Execute the callback subscribed to a + * keyboard shortcut * - * - * @param {string} fnk - * @param {string} c - * @param {JQuery.MouseDownEvent} e - * @returns {boolean} + * @param {string} fnk meta or modifier key e.g. `CTRL`, `ALT`, `SHIFT` or `META` + * @param {string} c a regular key + * @param {JQuery.KeyboardEventBase} e JQuery keyboard event + * @returns {boolean} return whether the shortcut is executed * @memberof BaseApplication */ - shortcut( - fnk: string, - c: string, - e: JQuery.KeyDownEvent - ): boolean { + shortcut(fnk: string, c: string, e: JQuery.KeyDownEvent): boolean { if (!this.keycomb[fnk]) { return true; } @@ -217,19 +257,17 @@ namespace OS { return false; } - /** - * + * Apply a setting to the application * * @protected - * @param {string} k + * @param {string} k the setting name * @memberof BaseApplication */ protected applySetting(k: string): void {} - /** - * + * Apply all settings to the application * * @protected * @memberof BaseApplication @@ -241,13 +279,13 @@ namespace OS { } } - /** - * + * Set a setting value to the application setting + * registry * * @protected - * @param {string} k - * @param {*} v + * @param {string} k setting name + * @param {*} v setting value * @returns {void} * @memberof BaseApplication */ @@ -257,7 +295,7 @@ namespace OS { } /** - * + * Show the appliation * * @returns {void} * @memberof BaseApplication @@ -267,7 +305,7 @@ namespace OS { } /** - * + * Blur the application * * @returns {void} * @memberof BaseApplication @@ -280,7 +318,7 @@ namespace OS { } /** - * + * Hide the application * * @returns {void} * @memberof BaseApplication @@ -290,7 +328,8 @@ namespace OS { } /** - * + * Maximize or restore the application window size + * and its position * * @returns {void} * @memberof BaseApplication @@ -300,21 +339,23 @@ namespace OS { } /** - * + * Get the application title * * @returns {(string| FormattedString)} * @memberof BaseApplication */ - title(): string| FormattedString { + title(): string | FormattedString { 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 - * @param {BaseEvent} evt + * @param {BaseEvent} evt exit event * @memberof BaseApplication */ protected onexit(evt: BaseEvent): void { @@ -328,7 +369,7 @@ namespace OS { } /** - * + * Get the application meta-data * * @returns {API.PackageMetaType} * @memberof BaseApplication @@ -337,9 +378,11 @@ namespace OS { 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 * @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 * @memberof BaseApplication */ abstract main(): void; - //main program - // implement by subclasses - /** - * + * Application specific menu definition * * @protected * @returns {GUI.BasicItemType[]} @@ -383,9 +425,11 @@ namespace OS { 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 * @param {BaseEvent} e diff --git a/src/core/BaseDialog.ts b/src/core/BaseDialog.ts index 668cf98..0b2deb3 100644 --- a/src/core/BaseDialog.ts +++ b/src/core/BaseDialog.ts @@ -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 // AnTOS Web desktop is is licensed under the GNU General Public @@ -26,7 +18,8 @@ namespace OS { export namespace GUI { /** - * + * the SubWindow class is the abstract prototype of all + * modal windows or dialogs definition in AntOS * * @export * @abstract @@ -34,12 +27,26 @@ namespace OS { * @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; /** *Creates an instance of SubWindow. - * @param {string} name + * @param {string} name SubWindow (class) name * @memberof SubWindow */ constructor(name: string) { @@ -49,7 +56,7 @@ namespace OS { } /** - * + * Exit the sub-window * * @returns {void} * @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 * @memberof SubWindow @@ -77,7 +88,7 @@ namespace OS { abstract init(): void; /** - * + * Main entry point after rendering of the sub-window * * @abstract * @memberof SubWindow @@ -85,7 +96,8 @@ namespace OS { abstract main(): void; /** - * + * Return the parent meta-data of the current + * sub-window * * @returns {API.PackageMetaType} * @memberof SubWindow @@ -98,7 +110,7 @@ namespace OS { } /** - * + * Show the sub-window * * @memberof SubWindow */ @@ -108,7 +120,7 @@ namespace OS { } /** - * + * Hide the sub-window * * @returns {void} * @memberof SubWindow @@ -121,7 +133,7 @@ namespace OS { SubWindow.type = ModelType.SubWindow; /** - * + * Abstract prototype of all AntOS dialogs widget * * @export * @abstract @@ -129,13 +141,24 @@ namespace OS { * @extends {SubWindow} */ export abstract class BaseDialog extends SubWindow { + /** + * Placeholder for the dialog callback on exit + * + * @memberof BaseDialog + */ handle: (d: any) => void; + + /** + * Placeholder of the dialog input data + * + * @type {GenericObject} + * @memberof BaseDialog + */ data: GenericObject; - title: string; /** *Creates an instance of BaseDialog. - * @param {string} name + * @param {string} name Dialog (class) name * @memberof BaseDialog */ constructor(name: string) { @@ -143,9 +166,8 @@ namespace OS { this.handle = undefined; } - /** - * + * Function called when dialog exits * * @protected * @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 * @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; /** *Creates an instance of BasicDialog. - * @param {string} name - * @param {(string | OS.API.VFS.BaseFileHandle)} [markup] + * @param {string} name dialog name + * @param {(string | OS.API.VFS.BaseFileHandle)} [markup] UI scheme definition * @memberof BasicDialog */ 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} * @memberof BasicDialog @@ -193,11 +237,7 @@ namespace OS { init(): void { if (this.markup) { if (typeof this.markup === "string") { - return GUI.htmlToScheme( - this.markup, - this, - this.host - ); + return GUI.htmlToScheme(this.markup, this, this.host); } else { // a file handle return this.render(this.markup.path); @@ -207,20 +247,14 @@ namespace OS { GUI.dialogs[this.name].scheme ) { const html: string = GUI.dialogs[this.name].scheme; - return GUI.htmlToScheme( - html.trim(), - this, - this.host - ); - } - else - { + return GUI.htmlToScheme(html.trim(), this, this.host); + } else { this.error(__("Unable to find dialog scheme")); } } /** - * + * Main entry point for the dialog * * @memberof BasicDialog */ @@ -234,9 +268,25 @@ namespace OS { } } + /** + * The namespace `dialogs` is dedicated to all Dialog definition + * in AntOS + */ 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 * @class PromptDialog @@ -252,7 +302,7 @@ namespace OS { } /** - * + * Main entry point * * @memberof PromptDialog */ @@ -294,7 +344,9 @@ namespace OS { $input.focus(); } } - + /** + * Scheme definition of the Prompt dialog + */ PromptDialog.scheme = `\ @@ -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 * @class TextDialog @@ -334,7 +390,7 @@ namespace OS { } /** - * + * Main entry point * * @memberof TextDialog */ @@ -365,7 +421,9 @@ namespace OS { $input.focus(); } } - + /** + * Scheme definition + */ TextDialog.scheme = `\ @@ -388,7 +446,7 @@ namespace OS { `; /** - * + * A Calendar dialog allows user to select a date * * @export * @class CalendarDialog @@ -396,7 +454,19 @@ namespace OS { */ 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 */ constructor() { @@ -431,7 +501,9 @@ namespace OS { }; } } - + /** + * Scheme definition + */ CalendarDialog.scheme = `\ @@ -455,7 +527,16 @@ namespace OS { `; /** + * Color picker dialog * + * Input data: + * + * ``` + * { + * title: string // window title + * } + * ``` + * Callback data: [[ColorType]] object * * @export * @class ColorPickerDialog @@ -499,7 +580,9 @@ namespace OS { }; } } - + /** + * Scheme definition + */ ColorPickerDialog.scheme = `\ @@ -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 * @class InfoDialog @@ -566,7 +660,9 @@ namespace OS { }; } } - + /** + * Scheme definition + */ InfoDialog.scheme = `\ @@ -588,6 +684,26 @@ namespace OS { \ `; + /** + * 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 { /** *Creates an instance of YesNoDialog. @@ -598,7 +714,7 @@ namespace OS { } /** - * + * Main entry point * * @memberof YesNoDialog */ @@ -625,7 +741,9 @@ namespace OS { }; } } - + /** + * Scheme definition + */ YesNoDialog.scheme = `\ @@ -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 * @class SelectionDialog @@ -664,7 +797,7 @@ namespace OS { } /** - * + * Main entry * * @memberof SelectionDialog */ @@ -694,7 +827,9 @@ namespace OS { }; } } - + /** + * Scheme definition + */ SelectionDialog.scheme = `\ @@ -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 * @class AboutDialog @@ -733,7 +873,7 @@ namespace OS { } /** - * + * Main entry point * * @returns {void} * @memberof AboutDialog @@ -770,7 +910,9 @@ namespace OS { }; } } - + /** + * Scheme definition + */ AboutDialog.scheme = `\ @@ -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 * @class FileDialog @@ -935,7 +1091,9 @@ namespace OS { } } } - + /** + * Scheme definition + */ FileDialog.scheme = `\ diff --git a/src/core/BaseModel.ts b/src/core/BaseModel.ts index 91ca889..66b8c01 100644 --- a/src/core/BaseModel.ts +++ b/src/core/BaseModel.ts @@ -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 // 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/. namespace OS { /** - * + * Application argument type definition * * @export * @interface AppArgumentsType */ export interface AppArgumentsType { + /** + * File type to be open by the app + * + * @type {string} + * @memberof AppArgumentsType + */ type?: string; + + /** + * File path to be opened + * + * @type {string} + * @memberof AppArgumentsType + */ path: string; + /** + * Any other object + */ [propName: string]: any; } /** - * + * Enum definition of different model types * * @export * @enum {number} */ export enum ModelType { + /** + * Applications + */ Application, + + /** + * Services + */ Service, + + /** + * Sub-window such as dialogs + */ SubWindow, } /** - * + * Base AntOS event definition * * @export * @class BaseEvent */ export class BaseEvent { + /** + * The event name placeholder + * + * @type {string} + * @memberof BaseEvent + */ name: string; + + /** + * Placeholder indicates whether the event is forced to + * be happen + * + * @private + * @type {boolean} + * @memberof BaseEvent + */ 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; /** *Creates an instance of BaseEvent. - * @param {string} name - * @param {boolean} force + * @param {string} name event name + * @param {boolean} force indicates whether the event is forced * @memberof BaseEvent */ 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 */ @@ -80,34 +125,164 @@ namespace OS { } /** - * + * The root model of all applications, dialogs or services + * in the system * * @export * @abstract * @class BaseModel */ export abstract class BaseModel { + /** + * The class name + * + * @type {string} + * @memberof BaseModel + */ name: string; + + /** + * The argument of the model + * + * @type {AppArgumentsType[]} + * @memberof BaseModel + */ 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; + + /** + * Reference to the core API namespace + * + * @protected + * @type {typeof API} + * @memberof BaseModel + */ protected _api: typeof API; + + /** + * Reference to the core GUI namespace + * + * @protected + * @type {typeof GUI} + * @memberof BaseModel + */ protected _gui: typeof GUI; + + /** + * Reference to the model's dialog + * + * @type {GUI.BaseDialog} + * @memberof BaseModel + */ dialog: GUI.BaseDialog; + + /** + * The HTML element ID of the virtual desktop + * + * @protected + * @type {string} + * @memberof BaseModel + */ 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; + + /** + * Reference the DOM element of the UI scheme belong to + * this model + * + * @type {HTMLElement} + * @memberof BaseModel + */ scheme: HTMLElement; + + /** + * Reference to the system setting + * + * @protected + * @type {typeof setting} + * @memberof BaseModel + */ protected systemsetting: typeof setting; + + /** + * Placeholder for the process creation timestamp + * + * @type {number} + * @memberof BaseModel + */ birth: number; + + /** + * Different model type + * + * @static + * @type {ModelType} + * @memberof BaseModel + */ static type: ModelType; + + /** + * Allow singleton on this model + * + * @static + * @type {boolean} + * @memberof BaseModel + */ 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[]; + + /** + * Reference to the CSS Element of the model + * + * @static + * @type {(HTMLElement | string)} + * @memberof BaseModel + */ static style: HTMLElement | string; + + /** + * Place holder for model meta-data + * + * @static + * @type {API.PackageMetaType} + * @memberof BaseModel + */ static meta: API.PackageMetaType; /** *Creates an instance of BaseModel. - * @param {string} name - * @param {AppArgumentsType[]} args + * @param {string} name class name + * @param {AppArgumentsType[]} args arguments * @memberof BaseModel */ 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; } /** - * + * Update the model locale * * @protected * @param {string} name @@ -139,10 +320,10 @@ namespace OS { */ protected updateLocale(name: string) {} /** - * + * Render the model's UI * * @protected - * @param {string} p + * @param {string} p VFS path to the UI scheme definition * @returns {void} * @memberof BaseModel */ @@ -151,9 +332,9 @@ namespace OS { } /** + * Exit the model * - * - * @param {boolean} force + * @param {boolean} force set this value to `true` will bypass the prevented exit event by user * @returns {void} * @memberof BaseModel */ @@ -171,7 +352,8 @@ namespace OS { } /** - * + * Model meta data, need to be implemented by + * subclasses * * @abstract * @returns {API.PackageMetaType} @@ -180,7 +362,7 @@ namespace OS { abstract meta(): API.PackageMetaType; /** - * + * VFS path to the model asset * * @returns {string} * @memberof BaseModel @@ -193,13 +375,20 @@ namespace OS { return null; } - // call a server side script - /** - * + * Execute a server side script and get back the result * * @protected - * @param {GenericObject} cmd + * @param {GenericObject} 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} * @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 * @returns {Promise} @@ -219,7 +419,7 @@ namespace OS { } /** - * + * Init the model before UI rendering * * @abstract * @memberof BaseModel @@ -227,7 +427,7 @@ namespace OS { abstract init(): void; /** - * + * Main entry point after UI rendering * * @abstract * @memberof BaseModel @@ -235,7 +435,7 @@ namespace OS { abstract main(): void; /** - * + * Show the model * * @abstract * @memberof BaseModel @@ -243,33 +443,29 @@ namespace OS { abstract show(): void; /** - * + * Hide the model * * @abstract * @memberof BaseModel */ abstract hide(): void; - //implement by sub class - /** - * + * Function called when the model exits * * @protected * @abstract - * @param {BaseEvent} e + * @param {BaseEvent} e exit event * @memberof BaseModel */ protected abstract onexit(e: BaseEvent): void; - //implement by subclass - /** - * + * subscribe once to a local event * * @protected - * @param {string} e - * @param {(d: any) => void} f + * @param {string} e name of the event + * @param {(d: any) => void} f event callback * @returns {void} * @memberof BaseModel */ @@ -277,13 +473,12 @@ namespace OS { return this.observable.one(e, f); } - /** - * + * Subscribe to a local event * * @protected - * @param {string} e - * @param {(d: any) => void} f + * @param {string} e event name + * @param {(d: any) => void} f event callback * @returns {void} * @memberof BaseModel */ @@ -291,13 +486,12 @@ namespace OS { return this.observable.on(e, f); } - /** - * + * Unsubscribe an event * * @protected - * @param {string} e - * @param {(d: any) => void} [f] + * @param {string} e event name or `*` (all events) + * @param {(d: any) => void} [f] callback to be unsubscribed, can be `undefined` * @returns {void} * @memberof BaseModel */ @@ -308,28 +502,26 @@ namespace OS { return this.observable.off(e, f); } - /** - * + * trigger a local event * * @protected - * @param {string} e - * @param {*} [d] + * @param {string} e event name + * @param {*} [d] event data * @returns {void} * @memberof BaseModel */ trigger(e: string, d?: any): void { - if(!this.observable) return; + if (!this.observable) return; this.observable.trigger(e, d); } - /** - * + * subscribe to an event on the global announcement system * * @protected - * @param {string} e - * @param {(d: any) => void} f + * @param {string} e event name + * @param {(d: any) => void} f event callback * @returns {void} * @memberof BaseModel */ @@ -337,13 +529,14 @@ namespace OS { return announcer.on(e, f, this); } - /** + * Open a dialog * - * - * @param {(GUI.BaseDialog | string)} d - * @param {GenericObject} [data] - * @returns {Promise} + * @param {(GUI.BaseDialog | string)} d a dialog object or a dialog class name + * @param {GenericObject} [data] input data of the dialog, refer to each + * dialog definition for the format of the input data + * @returns {Promise} A promise on the callback data of the dialog, refer + * to each dialog definition for the format of the callback data * @memberof BaseModel */ openDialog( @@ -369,32 +562,30 @@ namespace OS { this.dialog.handle = resolve; this.dialog.pid = this.pid; this.dialog.data = data; - if (data && data.title) { - this.dialog.title = data.title; - } + return this.dialog.init(); }); } /** - * + * Open a [[YesNoDialog]] to confirm a task * * @protected - * @param {GenericObject} data - * @returns {Promise} + * @param {GenericObject} data [[YesNoDialog]] input data + * @returns {Promise} * @memberof BaseModel */ - protected ask(data: GenericObject): Promise { + protected ask(data: GenericObject): Promise { return this._gui.openDialog("YesNoDialog", data); } /** - * + * Trigger a global event * * @protected - * @param {string} t - * @param {(string | FormattedString)} m - * @param {Error} [e] + * @param {string} t event name + * @param {(string | FormattedString)} m event message + * @param {Error} [e] error object if any * @returns {void} * @memberof BaseModel */ @@ -421,9 +612,9 @@ namespace OS { } /** + * Publish a global notification * - * - * @param {(string | FormattedString)} m + * @param {(string | FormattedString)} m notification string * @returns {void} * @memberof BaseModel */ @@ -432,9 +623,9 @@ namespace OS { } /** + * Publish a global warning * - * - * @param {(string | FormattedString)} m + * @param {(string | FormattedString)} m warning string * @returns {void} * @memberof BaseModel */ @@ -443,10 +634,10 @@ namespace OS { } /** + * Report a global error * - * - * @param {(string | FormattedString)} m - * @param {Error} [e] + * @param {(string | FormattedString)} m error message + * @param {Error} [e] error object if any * @returns * @memberof BaseModel */ @@ -455,10 +646,10 @@ namespace OS { } /** + * Report a global fail event * - * - * @param {string} m - * @param {Error} [e] + * @param {string} m fail message + * @param {Error} [e] error object if any * @returns * @memberof BaseModel */ @@ -467,7 +658,7 @@ namespace OS { } /** - * + * Throw an error inside the model * * @returns {Error} * @memberof BaseModel @@ -477,7 +668,7 @@ namespace OS { } /** - * + * Update the model, this will update all its UI elements * * @returns {void} * @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 * @param {string} id @@ -503,7 +695,8 @@ namespace OS { } /** - * + * Select all DOM Element inside the UI of the model + * using JQuery selector * * @protected * @param {string} sel diff --git a/src/core/BaseService.ts b/src/core/BaseService.ts index c21092d..61bf6f2 100644 --- a/src/core/BaseService.ts +++ b/src/core/BaseService.ts @@ -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 // AnTOS Web desktop is is licensed under the GNU General Public diff --git a/src/core/tags/AppDockTag.ts b/src/core/tags/AppDockTag.ts index e04d358..912d725 100644 --- a/src/core/tags/AppDockTag.ts +++ b/src/core/tags/AppDockTag.ts @@ -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: * - `focus`: on the selected application * - `blur`: on all other applications on the dock * + * Getter: + * + * Get the current selected application + * on the dock + * * @memberof AppDockTag */ set selectedApp(v: application.BaseApplication) { @@ -143,13 +150,6 @@ namespace OS { ($(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 { return this._selectedApp; } diff --git a/src/core/tags/ButtonTag.ts b/src/core/tags/ButtonTag.ts index c38a9b8..fcffd8f 100644 --- a/src/core/tags/ButtonTag.ts +++ b/src/core/tags/ButtonTag.ts @@ -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 */ @@ -74,37 +76,28 @@ namespace OS { (this.refs.label as LabelTag).text = v; } - /** - * Get the current button test - * - * @type {(string| FormattedString)} - * @memberof ButtonTag - */ get text(): string | FormattedString { 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 */ set enable(v: boolean) { $(this.refs.button).prop("disabled", !v); } - - /** - * Get the `enable` property of the button - * - * @type {boolean} - * @memberof ButtonTag - */ get enable(): boolean { 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 */ @@ -115,32 +108,20 @@ namespace OS { $(this.refs.button).addClass("selected"); } } - - /** - * check whether the attribute `selected` of the button is set - * - * @type {boolean} - * @memberof ButtonTag - */ get selected(): boolean { 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 */ set toggle(v: boolean) { this.attsw(v, "toggle"); } - - /** - * Check whether the button is in toggle mode - * - * @type {boolean} - * @memberof ButtonTag - */ get toggle(): boolean { return this.hasattr("toggle"); } diff --git a/src/core/tags/FileViewTag.ts b/src/core/tags/FileViewTag.ts index 377cfe1..e0eac7a 100644 --- a/src/core/tags/FileViewTag.ts +++ b/src/core/tags/FileViewTag.ts @@ -142,53 +142,53 @@ namespace OS { } /** + * Setter: + * * chang the view of the widget, there are three different views * - `icon` * - `list` * - `tree` * + * Getter: + * + * Get the current view setting of the widget + * * @memberof FileViewTag */ set view(v: string) { $(this).attr("view", v); this.switchView(); } - - /** - * Get the current view setting of the widget - * - * @type {string} - * @memberof FileViewTag - */ get view(): string { return $(this).attr("view"); } /** + * Setter: + * * Turn on/off the changing current working directory feature * of the widget when a directory is double clicked. If enabled, * the widget will use the configured [[fetch]] function to query * the content of the selected directory * + * Getter: + * + * check whether changing current working directory feature + * is enabled + * * @memberof FileViewTag */ set chdir(v: boolean) { this.attsw(v, "chdir"); } - - /** - * check whether changing current working directory feature - * is enabled - * - * @type {boolean} - * @memberof FileViewTag - */ get chdir(): boolean { 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 */ @@ -200,20 +200,20 @@ namespace OS { } $(this.refs.status).hide(); } - - /** - * Check whether the status bar is enabled - * - * @type {boolean} - * @memberof FileViewTag - */ get status(): boolean { return this.hasattr("status"); } /** + * Setter: + * * Allow the widget to show or hide hidden file * + * Getter: + * + * Check whether the hidden file should be shown in + * the widget + * * @memberof FileViewTag */ set showhidden(v: boolean) { @@ -223,14 +223,6 @@ namespace OS { } this.switchView(); } - - /** - * Check whether the hidden file should be shown in - * the widget - * - * @type {boolean} - * @memberof FileViewTag - */ get showhidden(): boolean { return this.hasattr("showhidden"); } @@ -247,11 +239,17 @@ namespace OS { } /** + * Setter: + * * Set the path of the current working directory. * When called the widget will refresh the current * working directory using the configured [[fetch]] * function * + * Getter: + * + * Get the path of the current working directory + * * @memberof FileViewTag */ set path(v: string) { @@ -276,19 +274,14 @@ namespace OS { announcer.oserror(e.toString(), e) ); } - - /** - * Get the path of the current working directory - * - * @type {string} - * @memberof FileViewTag - */ get path(): string { 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 */ @@ -299,13 +292,6 @@ namespace OS { this._data = v; this.refreshData(); } - - /** - * Get the data of the current working directory - * - * @type {API.FileInfoType[]} - * @memberof FileViewTag - */ get data(): API.FileInfoType[] { return this._data; } diff --git a/src/core/tags/FloatListTag.ts b/src/core/tags/FloatListTag.ts index 550d769..903bc25 100644 --- a/src/core/tags/FloatListTag.ts +++ b/src/core/tags/FloatListTag.ts @@ -49,12 +49,19 @@ namespace OS { } /** + * Setter: + * * Set the direction of the list item layout. * Two directions are available: * - `vertical` * - `horizontal` * * This setter acts as a DOM attribute + * + * Getter: + * + * Get the currently set direction of list + * item layout * * @memberof FloatListTag */ @@ -62,14 +69,6 @@ namespace OS { $(this).attr("dir", v); this.calibrate(); } - - /** - * Get the currently set direction of list - * item layout - * - * @type {string} - * @memberof FloatListTag - */ get dir(): string { return $(this).attr("dir"); } diff --git a/src/core/tags/GridViewTag.ts b/src/core/tags/GridViewTag.ts index d906a07..1336fe0 100644 --- a/src/core/tags/GridViewTag.ts +++ b/src/core/tags/GridViewTag.ts @@ -163,9 +163,15 @@ namespace OS { } /** + * Setter: + * * Set the data of the cell, this will trigger * the [[ondatachange]] function * + * Getter: + * + * Get the current cell data placeholder + * * @memberof GridCellPrototype */ set data(v: GenericObject) { @@ -177,22 +183,21 @@ namespace OS { } this.selected = v.selected; } - - /** - * Get the current cell data placeholder - * - * @type {GenericObject} - * @memberof GridCellPrototype - */ get data(): GenericObject { return this._data; } /** + * Setter: + * * Set/unset the current cell as selected. * This will trigger the [[cellselect]] * event * + * Getter: + * + * Check whether the current cell is selected + * * @memberof GridCellPrototype */ set selected(v: boolean) { @@ -203,13 +208,6 @@ namespace OS { } this.cellselect({ id: this.aid, data: this }, false); } - - /** - * Check whether the current cell is selected - * - * @type {boolean} - * @memberof GridCellPrototype - */ get selected(): boolean { 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 */ set headeritem(v: string) { $(this).attr("headeritem", v); } - - /** - * get the grid header tag name - * - * @type {string} - * @memberof GridViewTag - */ get headeritem(): string { 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 */ set cellitem(v: string) { $(this).attr("cellitem", v); } - - /** - * get the tag name of the grid cell - * - * @type {string} - * @memberof GridViewTag - */ get cellitem(): string { return $(this).attr("cellitem"); } /** - * get the header data placeholder + * Setter: set the header data + * + * Getter: get the header data placeholder * * @type {GenericObject[]} * @memberof GridViewTag @@ -533,12 +523,6 @@ namespace OS { get header(): GenericObject[] { return this._header; } - - /** - * the set the header data - * - * @memberof GridViewTag - */ set header(v: GenericObject[]) { this._header = v; 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 */ @@ -601,31 +587,20 @@ namespace OS { this._rows = rows; rows.map((row) => this.push(row, false)); } - - /** - * get the rows data - * - * @type {GenericObject[][]} - * @memberof GridViewTag - */ get rows(): GenericObject[][] { return this._rows; } /** - * activate deactivate multi-select + * Setter: activate deactivate multi-select + * + * Getter: check whether the `multiselect` option is activated * * @memberof GridViewTag */ set multiselect(v: boolean) { this.attsw(v, "multiselect"); } - - /** - * check whether the `multiselect` option is activated - * @type {boolean} - * @memberof GridViewTag - */ get multiselect(): boolean { return this.hasattr("multiselect"); } diff --git a/src/core/tags/LabelTag.ts b/src/core/tags/LabelTag.ts index 4792413..1a87414 100644 --- a/src/core/tags/LabelTag.ts +++ b/src/core/tags/LabelTag.ts @@ -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 */ @@ -115,13 +117,6 @@ namespace OS { $(this.refs.text).hide(); } } - - /** - * Get the text displayed on the label - * - * @type {(string| FormattedString)} - * @memberof LabelTag - */ get text(): string | FormattedString { return this._text; } diff --git a/src/core/tags/ListViewTag.ts b/src/core/tags/ListViewTag.ts index 234e64e..ca611f2 100644 --- a/src/core/tags/ListViewTag.ts +++ b/src/core/tags/ListViewTag.ts @@ -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 */ @@ -95,13 +97,6 @@ namespace OS { $(this.refs.btcl).hide(); } } - - /** - * Check whether the item is closable - * - * @type {boolean} - * @memberof ListViewItemTag - */ get closable(): boolean { 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 */ @@ -129,13 +126,6 @@ namespace OS { $(this.refs.item).addClass("selected"); this._onselect({ id: this.aid, data: this }); } - - /** - * Check whether the current item is selected - * - * @type {boolean} - * @memberof ListViewItemTag - */ get selected(): boolean { return this.hasattr("selected"); } @@ -225,22 +215,21 @@ namespace OS { } /** + * Setter: + * * Set the data of the list item. This will * trigger the [[ondatachange]] function * + * Getter: + * + * Get the data of the current list item + * * @memberof ListViewItemTag */ set data(v: GenericObject) { this._data = v; this.ondatachange(); } - - /** - * Get the data of the current list item - * - * @type {GenericObject} - * @memberof ListViewItemTag - */ get data(): GenericObject { return this._data; } @@ -509,7 +498,9 @@ namespace OS { 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 */ @@ -586,52 +577,45 @@ namespace OS { this._onitemclose = v; } - /** - * Check whether the list is dropdown or traditional list - * - * @type {boolean} - * @memberof ListViewTag - */ get dropdown(): boolean { return this.hasAttribute("dropdown"); } /** + * Setter: + * * Set the default tag name of list's items. * If the tag name is not specified in the * data of a list item, this tag will be used * + * Getter: + * + * Get the default tag name of list item + * * @memberof ListViewTag */ set itemtag(v: string) { $(this).attr("itemtag", v); } - - /** - * Get the default tag name of list item - * - * @type {string} - * @memberof ListViewTag - */ get itemtag(): string { return $(this).attr("itemtag"); } /** + * Setter: + * * Turn on/off of the `multiselect` feature * + * Getter: + * + * Check whether multi-select is allowed + * in this list + * * @memberof ListViewTag */ set multiselect(v: boolean) { this.attsw(v, "multiselect"); } - - /** - * Check whether multi-select is allowed - * in this list - * - * @memberof ListViewTag - */ get multiselect() { if (this.dropdown) { 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 */ set dragndrop(v: boolean) { this.attsw(v, "dragndrop"); } - - /** - * Check whether the drag and drop event is enabled - * - * @type {boolean} - * @memberof ListViewTag - */ get dragndrop(): boolean { 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[]} * @memberof ListViewTag @@ -707,12 +688,6 @@ namespace OS { get data(): GenericObject[] { return this._data; } - - /** - * Set data to the list - * - * @memberof ListViewTag - */ set data(data: GenericObject[]) { this._data = data; this._selectedItem = undefined; @@ -740,7 +715,9 @@ namespace OS { 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 */ @@ -793,12 +770,6 @@ namespace OS { return this._selectedItems; } - /** - * Get the indexes of all selected items - * - * @type {(number | number[])} - * @memberof ListViewTag - */ get selected(): number | number[] { if (this.multiselect) { return this.selectedItems.map(function ( diff --git a/src/core/tags/MenuTag.ts b/src/core/tags/MenuTag.ts index 0238888..bb9e9d5 100644 --- a/src/core/tags/MenuTag.ts +++ b/src/core/tags/MenuTag.ts @@ -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 */ set onchildselect(v: TagEventCallback) { this._onchildselect = v; } - - /** - * get the current `sub menu entry select` event handle - * - * @type {TagEventCallback} - * @memberof MenuEntryTag - */ get onchildselect(): TagEventCallback { return this._onchildselect; } /** - * Set data to the entry + * Setter: Set data to the entry + * + * Getter: Get data of the current menu entry * * @memberof MenuEntryTag */ @@ -115,13 +112,6 @@ namespace OS { this._data = data; this.set(data); } - - /** - * Get data of the current menu entry - * - * @type {GenericObject} - * @memberof MenuEntryTag - */ get data(): GenericObject { 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 */ @@ -204,13 +196,6 @@ namespace OS { }); } } - - /** - * Get the sub-menu data - * - * @type {GenericObject[]} - * @memberof MenuEntryTag - */ get nodes(): GenericObject[] { if (this.data && this.data.nodes) { return this.data.nodes; @@ -333,7 +318,9 @@ namespace OS { 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 */ @@ -345,19 +332,14 @@ namespace OS { $(this.refs.switch).hide(); } } - - /** - * Check whether the checker feature is enabled on this menu entry - * - * @type {boolean} - * @memberof SimpleMenuEntryTag - */ get switch(): boolean { 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 */ @@ -369,21 +351,20 @@ namespace OS { $(this.refs.switch).hide(); } } - - /** - * Check whether the radio feature is enabled - * - * @type {boolean} - * @memberof SimpleMenuEntryTag - */ get radio(): boolean { return this.hasattr("radio"); } /** + * Setter: + * * Toggle the switch on the menu entry, this setter * only works when the `checker` or `radio` feature is * enabled + * + * Getter: + * + * Check whether the switch is turned on * * @memberof SimpleMenuEntryTag */ @@ -395,13 +376,6 @@ namespace OS { } (this.refs.switch as SwitchTag).swon = v; } - - /** - * Check whether the switch is turned on - * - * @type {boolean} - * @memberof SimpleMenuEntryTag - */ get checked(): boolean { return this.hasattr("checked"); } @@ -623,7 +597,9 @@ namespace OS { protected reload(d?: any): void {} /** - * Set the menu items data + * Setter: Set the menu items data + * + * Getter: Get menu items data * * @memberof MenuTag */ @@ -632,19 +608,14 @@ namespace OS { $(this.refs.container).empty(); data.map((item) => this.push(item, false)); } - - /** - * Get menu items data - * - * @type {GenericObject[]} - * @memberof MenuTag - */ get items(): GenericObject[] { 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 */ @@ -657,13 +628,6 @@ namespace OS { $(this.refs.wrapper).addClass("context"); $(this).hide(); } - - /** - * Check whether the current menu is a context menu - * - * @type {boolean} - * @memberof MenuTag - */ get context(): boolean { return this.hasattr("context"); } @@ -678,22 +642,21 @@ namespace OS { } /** + * Setter: + * * Set the default tag name of the menu item. * If the tag is not specified in an item data, * this value will be used + * + * Getter: + * + * Get the default menu entry tag name * * @memberof MenuTag */ set contentag(v: string) { $(this).attr("contentag", v); } - - /** - * Get the default menu entry tag name - * - * @type {string} - * @memberof MenuTag - */ get contentag(): string { return $(this).attr("contentag"); } diff --git a/src/core/tags/NSpinnerTag.ts b/src/core/tags/NSpinnerTag.ts index 1f3876d..2f438ec 100644 --- a/src/core/tags/NSpinnerTag.ts +++ b/src/core/tags/NSpinnerTag.ts @@ -149,7 +149,9 @@ namespace OS { } /** - * Set the spinner value + * Setter: Set the spinner value + * + * Getter: Get the spinner value * * @memberof NSpinnerTag */ @@ -160,13 +162,6 @@ namespace OS { this._onchange(evt); this.observable.trigger("nspin", evt); } - - /** - * Get the spinner value - * - * @type {number} - * @memberof NSpinnerTag - */ get value(): number { return this._value; } diff --git a/src/core/tags/OverlayTag.ts b/src/core/tags/OverlayTag.ts index ae4f7bf..21e82e6 100644 --- a/src/core/tags/OverlayTag.ts +++ b/src/core/tags/OverlayTag.ts @@ -64,8 +64,14 @@ namespace OS { protected reload(d?: any): void {} /** + * Setter: + * * Set the width of the tag, the tag width should be in form of: * `100px` of `80%` + * + * Getter: + * + * Get the tag width * * @memberof OverlayTag */ @@ -76,20 +82,19 @@ namespace OS { this._width = v; this.calibrate(); } - - /** - * Get the tag width - * - * @type {string} - * @memberof OverlayTag - */ get width(): string { return this._width; } /** + * Setter: + * * Set the tag height, the tag height should be in form of: * `100px` of `80%` + * + * Getter: + * + * Get the tag height * * @memberof OverlayTag */ @@ -100,13 +105,6 @@ namespace OS { this._height = v; this.calibrate(); } - - /** - * Get the tag height - * - * @type {string} - * @memberof OverlayTag - */ get height(): string { return this._height; } diff --git a/src/core/tags/ResizerTag.ts b/src/core/tags/ResizerTag.ts index bdb0ca4..a21092b 100644 --- a/src/core/tags/ResizerTag.ts +++ b/src/core/tags/ResizerTag.ts @@ -81,22 +81,21 @@ namespace OS { */ protected reload(d?: any): void {} /** + * Setter: + * * Set resize direction, two possible values: * - `hz` - horizontal direction, resize by width * - `ve` - vertical direction, resize by height + * + * Getter: + * + * Get the resize direction * * @memberof ResizerTag */ set dir(v: string) { $(this).attr("dir", v); } - - /** - * Get the resize direction - * - * @type {string} - * @memberof ResizerTag - */ get dir(): string { return $(this).attr("dir"); } diff --git a/src/core/tags/SliderTag.ts b/src/core/tags/SliderTag.ts index c984ad9..699e78d 100644 --- a/src/core/tags/SliderTag.ts +++ b/src/core/tags/SliderTag.ts @@ -100,7 +100,9 @@ namespace OS { } /** - * Enable/disable the slider + * Setter: Enable/disable the slider + * + * Getter: Check whether the slider is enabled * * @memberof SliderTag */ @@ -119,19 +121,14 @@ namespace OS { $(this).unbind("mouseover").unbind("mouseout"); } } - - /** - * Check whether the slider is enabled - * - * @type {boolean} - * @memberof SliderTag - */ get enable(): boolean { return this.hasattr("enable"); } /** - * Set the slider value + * Setter: Set the slider value + * + * Getter: Get the current slider value * * @memberof SliderTag */ @@ -139,19 +136,14 @@ namespace OS { this._value = v; this.calibrate(); } - - /** - * Get the current slider value - * - * @type {number} - * @memberof SliderTag - */ get value(): number { 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 */ @@ -159,13 +151,6 @@ namespace OS { this._max = v; this.calibrate(); } - - /** - * Get the maximum value of the slider - * - * @type {number} - * @memberof SliderTag - */ get max(): number { return this._max; } diff --git a/src/core/tags/SwitchTag.ts b/src/core/tags/SwitchTag.ts index 2337e52..04bcd46 100644 --- a/src/core/tags/SwitchTag.ts +++ b/src/core/tags/SwitchTag.ts @@ -19,7 +19,9 @@ namespace OS { private _onchange: TagEventCallback; /** - * Turn on/off the switch + * Setter: Turn on/off the switch + * + * Getter: Check whether the switch is turned on * * @memberof SwitchTag */ @@ -30,32 +32,20 @@ namespace OS { $(this.refs.switch).addClass("swon"); } } - - /** - * Check whether the switch is turned on - * - * @type {boolean} - * @memberof SwitchTag - */ get swon(): boolean { return this.hasattr("swon"); } /** - * Enable the switch + * Setter: Enable the switch + * + * Getter: Check whether the switch is enabled * * @memberof SwitchTag */ set enable(v: boolean) { this.attsw(v, "enable"); } - - /** - * Check whether the switch is enabled - * - * @type {boolean} - * @memberof SwitchTag - */ get enable(): boolean { return this.hasattr("enable"); } diff --git a/src/core/tags/TabBarTag.ts b/src/core/tags/TabBarTag.ts index 933ec19..b18d463 100644 --- a/src/core/tags/TabBarTag.ts +++ b/src/core/tags/TabBarTag.ts @@ -69,20 +69,15 @@ namespace OS { 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 */ set closable(v: boolean) { this.attsw(v, "closable"); } - - /** - * Check whether tabs can be closed - * - * @type {boolean} - * @memberof TabBarTag - */ get closable(): boolean { return this.hasattr("closable"); } @@ -120,7 +115,9 @@ namespace OS { } /** - * Set tabs data + * Setter: Set tabs data + * + * Getter: Get all tabs data * * @memberof TabBarTag */ @@ -130,32 +127,20 @@ namespace OS { } (this.refs.list as ListViewTag).data = v; } - - /** - * Get all tabs data - * - * @type {GenericObject[]} - * @memberof TabBarTag - */ get items(): GenericObject[] { 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 */ set selected(v: number | number[]) { (this.refs.list as ListViewTag).selected = v; } - - /** - * Get the currently selected tab - * - * @type {(number | number[])} - * @memberof TabBarTag - */ get selected(): number | number[] { return (this.refs.list as ListViewTag).selected; } diff --git a/src/core/tags/TabContainerTag.ts b/src/core/tags/TabContainerTag.ts index 51f18cc..efd05ab 100644 --- a/src/core/tags/TabContainerTag.ts +++ b/src/core/tags/TabContainerTag.ts @@ -89,9 +89,15 @@ namespace OS { } /** + * Setter: + * * Set the tab bar direction: * - `row`: horizontal direction * - `column`: vertical direction + * + * Getter: + * + * Get the tab bar direction * * @memberof TabContainerTag */ @@ -102,20 +108,19 @@ namespace OS { } (this.refs.wrapper as TileLayoutTag).dir = v; } - - /** - * Get the tab bar direction - * - * @type {("row"| "column")} - * @memberof TabContainerTag - */ get dir(): "row" | "column" { return $(this).attr("dir") as any; } /** + * Setter: + * * Select a tab using the its tab data type. * This will show the attached container to the tab + * + * Getter: + * + * Get the tab data of the currently selected Tab * * @memberof TabContainerTag */ @@ -131,13 +136,6 @@ namespace OS { $(v.container).show(); this.observable.trigger("resize", undefined); } - - /** - * Get the tab data of the currently selected Tab - * - * @type {TabContainerTabType} - * @memberof TabContainerTag - */ get selectedTab(): TabContainerTabType { return this._selectedTab; } diff --git a/src/core/tags/TileLayoutTags.ts b/src/core/tags/TileLayoutTags.ts index a483c64..c4b1431 100644 --- a/src/core/tags/TileLayoutTags.ts +++ b/src/core/tags/TileLayoutTags.ts @@ -40,7 +40,9 @@ namespace OS { 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 */ @@ -54,21 +56,20 @@ namespace OS { .addClass(`afx-${v}-container`); this.calibrate(); } - - /** - * Get the name of the tile container - * - * @type {string} - * @memberof TileLayoutTag - */ get name(): string { return $(this).attr("name"); } /** + * Setter: + * * SET the layout direction, should be: * - `row`: horizontal direction * - `column`: vertical direction + * + * Getter: + * + * Get layout direction * * @memberof TileLayoutTag */ @@ -80,13 +81,6 @@ namespace OS { $(this.refs.yield).css("flex-direction", v); this.calibrate(); } - - /** - * Get layout direction - * - * @type {("row"| "column")} - * @memberof TileLayoutTag - */ get dir(): "row" | "column" { return $(this).attr("dir") as any; } diff --git a/src/core/tags/TreeViewTag.ts b/src/core/tags/TreeViewTag.ts index d415e92..7b4a5f6 100644 --- a/src/core/tags/TreeViewTag.ts +++ b/src/core/tags/TreeViewTag.ts @@ -110,7 +110,7 @@ namespace OS { /** * Placeholder for the `fetch` function of the node. * 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]] * * @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 * + * Getter: + * + * Get the current node's data + * * @memberof TreeViewItemPrototype */ set data(v: TreeViewDataType) { @@ -179,22 +185,21 @@ namespace OS { v.domel = this; this.ondatachange(); } - - /** - * Get the current node's data - * - * @type {TreeViewDataType} - * @memberof TreeViewItemPrototype - */ get data(): TreeViewDataType { return this._data; } /** + * Setter: + * * Select or unselect the current node. * This will trigger the item select event * on the tree root if the parameter is `true` * + * Getter: + * + * Check whether the current node is selected + * * @memberof TreeViewItemPrototype */ set selected(v: boolean) { @@ -212,22 +217,21 @@ namespace OS { $(this.refs.wrapper).addClass("afx_tree_item_selected"); } } - - /** - * Check whether the current node is selected - * - * @type {boolean} - * @memberof TreeViewItemPrototype - */ get selected(): boolean { return this.hasattr("selected"); } /** + * Setter: + * * Refresh the current node and expands its sub tree. * This function only works if the current node is not * a leaf node * + * Getter: + * + * Check whether the current node is expanded + * * @memberof TreeViewItemPrototype */ set open(v: boolean) { @@ -265,18 +269,13 @@ namespace OS { ); } } - - /** - * Check whether the current node is expanded - * - * @type {boolean} - * @memberof TreeViewItemPrototype - */ get open(): boolean { 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} * @memberof TreeViewItemPrototype @@ -284,12 +283,6 @@ namespace OS { get indent(): number { return this._indent; } - - /** - * Set the current indent level of this node from the root node - * - * @memberof TreeViewItemPrototype - */ set indent(v: number) { if (!v) { 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[]} * @memberof TreeViewItemPrototype @@ -329,12 +324,6 @@ namespace OS { if (!this._data) return undefined; return this._data.nodes; } - - /** - * Set the child nodes data of the current node - * - * @memberof TreeViewItemPrototype - */ set nodes(nodes: TreeViewDataType[]) { if (!nodes || !this.data) { return; @@ -523,7 +512,7 @@ namespace OS { */ export class TreeViewTag extends AFXTag { /** - * Reference the the selected node + * Reference to the selected node * * @private * @type {TreeViewItemPrototype} @@ -646,7 +635,7 @@ namespace OS { /** * Placeholder for the `fetch` function of the tree. * 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]] * * @memberof TreeViewItemPrototype @@ -700,20 +689,15 @@ namespace OS { */ 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 */ set dragndrop(v: boolean) { this.attsw(v, "dragndrop"); } - - /** - * Check whether the drag and drop event is enabled - * - * @type {boolean} - * @memberof TreeViewTag - */ get dragndrop(): boolean { return this.hasattr("dragndrop"); } @@ -737,24 +721,23 @@ namespace OS { } /** + * Setter: + * * Set the default tag name of the tree node. * If there is no tag name in the node data, * this value will be used when creating node. * * Defaut to `afx-tree-view-item` * + * Getter: + * + * Get the default node tag name + * * @memberof TreeViewTag */ set itemtag(v: string) { $(this).attr("itemtag", v); } - - /** - * Get the default node tag name - * - * @type {string} - * @memberof TreeViewTag - */ get itemtag(): string { 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} * @memberof TreeViewTag @@ -779,12 +764,6 @@ namespace OS { get selectedItem(): TreeViewItemPrototype { return this._selectedItem; } - - /** - * Set the selected node using its DOM element - * - * @memberof TreeViewTag - */ set selectedItem(v: TreeViewItemPrototype) { if (!v) { return; @@ -887,9 +866,15 @@ namespace OS { } /** + * Setter: + * * Set the tree data. This operation will create * all tree node elements of the current tree * + * Getter: + * + * Get the tree data + * * @memberof TreeViewTag */ set data(v: TreeViewDataType) { @@ -923,13 +908,6 @@ namespace OS { } } } - - /** - * Get the tree data - * - * @type {TreeViewDataType} - * @memberof TreeViewTag - */ get data(): TreeViewDataType { return this._data; } diff --git a/src/core/tags/WindowTag.ts b/src/core/tags/WindowTag.ts index 705c5da..ee86136 100644 --- a/src/core/tags/WindowTag.ts +++ b/src/core/tags/WindowTag.ts @@ -120,7 +120,9 @@ namespace OS { protected reload(d?: any): void {} /** - * Set the window width + * Setter: Set the window width + * + * Getter: Get the window width * * @memberof WindowTag */ @@ -131,19 +133,14 @@ namespace OS { } this.setsize({ w: v, h: this.height }); } - - /** - * Get the window width - * - * @type {number} - * @memberof WindowTag - */ get width(): number { return this._width; } /** - * Set the window height + * Setter: Set the window height + * + * Getter: Get the window height * * @memberof WindowTag */ @@ -157,19 +154,14 @@ namespace OS { h: v, }); } - - /** - * Get the window height - * - * @type {number} - * @memberof WindowTag - */ get height(): number { return this._height; } /** - * enable/disable window minimizable + * Setter: enable/disable window minimizable + * + * getter: Check whether the window is minimizable * * @memberof WindowTag */ @@ -181,19 +173,14 @@ namespace OS { $(this.refs["minbt"]).hide(); } } - - /** - * Check whether the window is minimizable - * - * @type {boolean} - * @memberof WindowTag - */ get minimizable(): boolean { return this.hasattr("minimizable"); } /** - * enable/disable widow resizable + * Setter: enable/disable widow resizable + * + * Getter: Check whether the current window is resizable * * @memberof WindowTag */ @@ -207,19 +194,14 @@ namespace OS { $(this.refs["grip"]).hide(); } } - - /** - * Check whether the current window is resizable - * - * @type {boolean} - * @memberof WindowTag - */ get resizable(): boolean { return this.hasattr("resizable"); } /** - * Set the window title + * Setter: Set the window title + * + * Getter: Get window title * * @memberof WindowTag */ @@ -229,13 +211,6 @@ namespace OS { (this.refs["txtTitle"] as LabelTag).text = v; } } - - /** - * Get window title - * - * @type {(string| FormattedString)} - * @memberof WindowTag - */ get apptitle(): string | FormattedString { return $(this).attr("apptitle"); } diff --git a/src/core/tags/tag.ts b/src/core/tags/tag.ts index a42c569..9ba7bbd 100644 --- a/src/core/tags/tag.ts +++ b/src/core/tags/tag.ts @@ -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 */ @@ -368,12 +370,6 @@ namespace OS { $(this).attr("data-id", v); } - /** - * Getter to get the id of the current tag - * - * @type {(string | number)} - * @memberof AFXTag - */ get aid(): string | number { return $(this).attr("data-id"); }