jsdk-offical
Version:
JSDK is the most comprehensive TypeScript framework, like JDK.
1,331 lines • 200 kB
TypeScript
//JSDK 2.7.0 MIT
/// <reference path="../libs/reflect/2.0.1/Reflect.d.ts" />
/// <reference path="../libs/ua-parser/0.7.20/ua-parser.d.ts" />
/// <reference path="../libs/jquery/3.2.1/jquery.d.ts" />
/// <reference path="../libs/bootstrap/4.0.0/bootstrap.d.ts" />
/// <reference path="../libs/datepicker/1.9.0/datepicker.d.ts" />
/// <reference path="../libs/daterangepicker/3.0.5/daterangepicker.d.ts" />
/// <reference path="../libs/blockui/2.70.0/blockui.d.ts" />
/// <reference path="../libs/sweetalert2/7.26.9/sweetalert2.d.ts" />
/// <reference path="../libs/ion-rangeslider/2.3.0/ion.rangeSlider.d.ts" />
/// <reference path="../libs/select2/4.0.11/select2.d.ts" />
/// <reference path="../libs/slidereveal/1.1.2/jquery.slidereveal.d.ts" />
/// <reference path="../libs/summernote/0.8.12/summernote.d.ts" />
/// <reference path="../libs/toastr/2.1.4/toastr.d.ts" />
/// <reference path="../libs/webuploader/0.1.5/webuploader.d.ts" />
/// <reference path="../libs/clipboard/2.0.0/clipboard.d.ts" />
/// <reference path="../libs/handlebars/4.1.2/handlebars.d.ts" />
declare module JS {
namespace an {
enum AnimState {
STOPPED = 0,
RUNNING = 1,
PAUSED = 2
}
type AnimDirection = 'forward' | 'backward' | 'alternate';
type AnimEvents = 'starting' | 'finished' | 'pausing' | 'paused' | 'looping' | 'looped' | 'updating' | 'updated';
class AnimInit {
targets?: AnimTargets;
duration?: number;
delay?: number;
endDelay?: number;
autoreset?: boolean;
direction?: AnimDirection;
loop?: boolean | number;
on?: {
starting?: EventHandler<Anim>;
finished?: EventHandler<Anim>;
pausing?: EventHandler<Anim>;
paused?: EventHandler<Anim>;
looping?: EventHandler1<Anim, number>;
looped?: EventHandler1<Anim, number>;
updating?: EventHandler3<Anim, number, number, number>;
updated?: EventHandler3<Anim, number, number, number>;
};
}
type AnimTargets = object | string | HTMLElement | Array<object | string | HTMLElement> | NodeListOf<HTMLElement>;
abstract class Anim {
protected _cfg: AnimInit;
protected _timer: Timer;
protected _dir: 'forward' | 'backward';
protected _loop: number;
protected _targets: Array<HTMLElement | object>;
protected _bus: EventBus;
constructor(cfg: AnimInit);
config<T extends AnimInit>(): T;
on(ev: string, fn: EventHandler<this>): this;
off(ev?: string): this;
private _tars;
targets(t: AnimTargets): this;
direction(): 'forward' | 'backward';
direction(d: 'forward' | 'backward'): this;
getState(): AnimState;
isRunning(): boolean;
getLooped(): number;
abstract play(): Promise<boolean>;
protected _reset(): void;
protected _resetTargets(): void;
protected _setupTimer(): void;
pause(): this;
stop(): this;
replay(): void;
}
}
}
import AnimState = JS.an.AnimState;
import AnimInit = JS.an.AnimInit;
import Anim = JS.an.Anim;
import AnimTargets = JS.an.AnimTargets;
declare module JS {
namespace an {
type AnimTimerEvents = TimerEvents | 'updating' | 'updated';
type AnimTimerInit = {
delay?: number;
endDelay?: number;
duration: number;
loop?: boolean | number;
};
class AnimTimer extends Timer {
protected _cfg: AnimTimerInit;
constructor(tick: TimerTask, cfg?: AnimTimerInit);
private _runTask;
private _loopEnd;
private _loopTick;
protected _cancelTimer(): void;
pause(): this;
tick(ts: number): void;
private _loop;
start(): void;
}
}
}
import AnimTimer = JS.an.AnimTimer;
import AnimTimerInit = JS.an.AnimTimerInit;
declare module JS {
namespace an {
type EasingFunction = (t: number, b: number, c: number, d: number, ...args: any[]) => number;
class Easings {
static LINEAR: EasingFunction;
static QUAD_IN: EasingFunction;
static QUAD_OUT: EasingFunction;
static QUAD_IN_OUT: EasingFunction;
static CUBIC_IN: EasingFunction;
static CUBIC_OUT: EasingFunction;
static CUBIC_IN_OUT: EasingFunction;
static QUART_IN: EasingFunction;
static QUART_OUT: EasingFunction;
static QUART_IN_OUT: EasingFunction;
static QUINT_IN: EasingFunction;
static QUINT_OUT: EasingFunction;
static QUINT_IN_OUT: EasingFunction;
static SINE_IN: EasingFunction;
static SINE_OUT: EasingFunction;
static SINE_IN_OUT: EasingFunction;
static EXPO_IN: EasingFunction;
static EXPO_OUT: EasingFunction;
static EXPO_IN_OUT: EasingFunction;
static CIRC_IN: EasingFunction;
static CIRC_OUT: EasingFunction;
static CIRC_IN_OUT: EasingFunction;
static ELASTIC_IN: EasingFunction;
static ELASTIC_OUT: EasingFunction;
static ELASTIC_IN_OUT: EasingFunction;
static BACK_IN: EasingFunction;
static BACK_OUT: EasingFunction;
static BACK_IN_OUT: EasingFunction;
static BOUNCE_IN: EasingFunction;
static BOUNCE_OUT: EasingFunction;
static BOUNCE_IN_OUT: EasingFunction;
static STEPS: EasingFunction;
}
}
}
import EasingFunction = JS.an.EasingFunction;
import Easings = JS.an.Easings;
declare module JS {
namespace util {
type ImageFrame = {
src: string | HTMLImageElement;
w: number;
h: number;
x: number;
y: number;
};
type ImageFrameOffsets = {
ox: number;
oy: number;
split?: number;
axis: 'x' | '-x' | 'y' | '-y';
total: number;
};
type ImageFrameOffset = [number, number];
type ImageFrameSet = {
src: string | HTMLImageElement;
w: number;
h: number;
items: Array<ImageFrameOffset> | ImageFrameOffsets;
};
class Images {
static parseFrames(frames: ImageFrameSet): ImageFrame[];
}
}
}
import ImageFrame = JS.util.ImageFrame;
import ImageFrameOffsets = JS.util.ImageFrameOffsets;
import ImageFrameOffset = JS.util.ImageFrameOffset;
import ImageFrameSet = JS.util.ImageFrameSet;
import Images = JS.util.Images;
declare module JS {
namespace an {
class FrameAnimInit extends AnimInit {
frames: ImageFrameSet;
onUpdateImage?: (el: HTMLElement | object, fr: ImageFrame) => void;
}
class FrameAnim extends Anim {
protected _cfg: FrameAnimInit;
private _frames;
constructor(cfg: FrameAnimInit);
private _updateImage;
private _fi;
protected _reset(): void;
protected _resetTargets(): void;
private _updateFrame;
private _lt;
protected _setupTimer(): void;
play(): Promise<boolean>;
}
}
}
import FrameAnimInit = JS.an.FrameAnimInit;
import FrameAnim = JS.an.FrameAnim;
declare module JS {
namespace an {
interface TimedTweenAnimInit extends TweenAnimInit {
type: 'tween';
}
interface TimedFrameAnimInit extends FrameAnimInit {
type: 'frame';
}
class TimelineInit {
targets?: AnimTargets;
duration?: number;
delay?: number;
endDelay?: number;
autoreset?: boolean;
on?: {
starting?: EventHandler<Anim>;
finished?: EventHandler<Anim>;
};
}
class Timeline {
protected _cfg: TimelineInit;
protected _targets: Array<HTMLElement | object>;
private _seqAnims;
private _synAnims;
protected _bus: EventBus;
constructor(cfg: TimelineInit);
on(ev: string, fn: EventHandler<this>): this;
off(ev?: string): this;
private _tars;
add(a: TimedTweenAnimInit | TimedFrameAnimInit, start?: number): this;
private _isRunning;
private _seqFinished;
private _synFinished;
private _resolve;
play(): Promise<boolean>;
}
}
}
import TimelineInit = JS.an.TimelineInit;
import Timeline = JS.an.Timeline;
declare module JS {
namespace an {
type AnimatedValueFunction = (target: HTMLElement | object, index: number, total: number) => number | string | Array<number | string>;
export type AnimatedValueType = CssValueString | number | Array<number | string> | AnimatedValueFunction;
export class TweenAnimInit extends AnimInit {
keys: JsonObject<AnimatedValueType>;
easing?: keyof typeof Easings | ((target: HTMLElement | object, i: number, total: number) => EasingFunction);
round?: number;
}
export class TweenAnim extends Anim {
protected _cfg: TweenAnimInit;
private _iniValues;
constructor(cfg: TweenAnimInit);
private _getValues;
private _saveIniValues;
protected _resetTargets(): void;
private _calc;
private _calcColor;
private _calcPercent;
private _calcNormal;
private _calcNormalVal;
private _updateTargets;
seek(dt: number): void;
protected _setupTimer(): void;
private _prepare;
play(): Promise<boolean>;
}
export {};
}
}
import TweenAnimInit = JS.an.TweenAnimInit;
import TweenAnim = JS.an.TweenAnim;
import AnimatedValueType = JS.an.AnimatedValueType;
declare module JS {
namespace app {
interface Api<T> extends HttpRequest {
dataKlass?: Klass<T>;
}
}
}
import Api = JS.app.Api;
interface Promise<T> {
always(fn: (this: this, v: any, success: boolean) => any | Promise<any>): Promise<T>;
}
declare module JS {
namespace core {
type PromiseContext<T> = {
resolve: (value: T) => void;
reject: (value: T) => void;
};
type PromisePlan<T> = (...args: any[]) => Promise<T>;
type PromisePlans<T> = Array<PromisePlan<T>>;
class Promises {
static create<T>(fn: (this: PromiseContext<T>, ...args: any[]) => void, ...args: any[]): Promise<T>;
static createPlan<T>(fn: (this: PromiseContext<T>, ...args: any[]) => void): PromisePlan<T>;
static newPlan<T>(p: PromisePlan<T>, args?: any[], ctx?: any): PromisePlan<T>;
static resolvePlan<T>(v: any): PromisePlan<T>;
static rejectPlan<T>(v: any): PromisePlan<T>;
static order<T>(ps: PromisePlans<T>): Promise<void>;
static all<T>(ps: PromisePlans<T>): Promise<T[]>;
static race<T>(ps: PromisePlans<T>): Promise<any>;
}
}
}
import Promises = JS.core.Promises;
import PromiseContext = JS.core.PromiseContext;
import PromisePlan = JS.core.PromisePlan;
import PromisePlans = JS.core.PromisePlans;
declare module JS {
namespace core {
class Loader {
static css(url: string, async?: boolean, uncached?: boolean): Promise<string>;
static js(url: string, async?: boolean, uncached?: boolean): Promise<string>;
}
}
}
import Loader = JS.core.Loader;
declare module JS {
let version: string;
type JSDKConfig = {
closeImport?: boolean;
cachedImport?: boolean | string;
minImport?: boolean;
jsdkRoot?: string;
libRoot?: string;
libs?: {
[key: string]: string | Array<string>;
};
};
function config(): JSDKConfig;
function config(opts: JSDKConfig): void;
function config<T>(key: keyof JSDKConfig): T;
function config(key: keyof JSDKConfig, val: any): void;
function imports(url: string | string[]): Promise<any>;
}
declare module JS {
namespace lang {
type PrimitiveType = null | undefined | string | number | boolean | String | Number | Boolean;
type JsonObject<T = any> = {
[key: string]: T;
};
type Callback<T = Function> = {
fn: T;
ctx?: any;
args?: Array<any>;
};
type Fallback<T = Function> = T | Callback<T>;
interface Klass<T> extends Function {
}
interface Iterware<T> {
each(fn: (item: T, index: number, iter: Iterware<T>) => boolean, thisArg?: any): boolean;
}
enum Type {
null = "null",
undefined = "undefined",
string = "string",
boolean = "boolean",
number = "number",
date = "date",
array = "array",
json = "json",
object = "object",
function = "function",
class = "class",
symbol = "symbol"
}
}
}
import JsonObject = JS.lang.JsonObject;
import Callback = JS.lang.Callback;
import Fallback = JS.lang.Fallback;
import Klass = JS.lang.Klass;
import Iterware = JS.lang.Iterware;
import Type = JS.lang.Type;
import PrimitiveType = JS.lang.PrimitiveType;
declare module JS {
namespace util {
class Types {
static isSymbol(o: any): boolean;
static isArguments(o: any): boolean;
static isNaN(n: any): boolean;
static isNumber(n: any): boolean;
static isNumeric(n: any): boolean;
static isFloat(n: number | string | Number): boolean;
static isInt(n: number | string | Number): boolean;
static isBoolean(obj: any): boolean;
static isString(obj: any): boolean;
static isDate(obj: any): boolean;
static isDefined(obj: any): boolean;
static isNull(obj: any): boolean;
static isUndefined(obj: any): boolean;
static isObject(obj: any): boolean;
static isJsonObject(obj: any): boolean;
static isArray(obj: any): boolean;
static isArrayLike(obj: any): boolean;
static isError(obj: any): boolean;
static isFile(obj: any): boolean;
static isFormData(obj: any): boolean;
static isBlob(obj: any): boolean;
static isFunction(fn: any, pure?: boolean): boolean;
static isRegExp(obj: any): boolean;
static isArrayBuffer(obj: any): boolean;
static isTypedArray(value: any): boolean;
static isElement(el: any): boolean;
static isWindow(el: any): boolean;
static isKlass(obj: any, klass: Klass<any>): boolean;
static ofKlass(obj: any, klass: Klass<any>): boolean;
static equalKlass(kls: any, klass?: Klass<any>): boolean;
static subklassOf(kls1: Klass<any>, kls2: Klass<any>): boolean;
static type(obj: any): Type;
}
}
}
import Types = JS.util.Types;
declare module JS {
namespace util {
class Check {
static isEmpty(v: any): boolean;
static isEmptyObject(v: any): boolean;
static isBlank(s: string): boolean;
static isFormatDate(s: string, format?: RegExp): boolean;
static isEmail(s: string, exp?: RegExp): boolean;
static isEmails(s: string, exp?: RegExp): boolean;
static isEmailDomain(str: string): boolean;
static isOnlyNumber(str: string): boolean;
static isPositive(n: number | string): boolean;
static isNegative(n: number | string): boolean;
static isHalfwidthChars(str: string): boolean;
static isFullwidthChars(str: any): boolean;
static isEnglishOnly(str: string): boolean;
static isChineseOnly(str: string): boolean;
static isFormatNumber(n: number | string, iLength: number, fLength?: number): boolean;
static greater(n1: number | string, n2: number | string): boolean;
static greaterEqual(n1: number | string, n2: number | string): boolean;
static less(n1: number | string, n2: number | string): boolean;
static lessEqual(n1: number | string, n2: number | string): boolean;
static isBetween(n: number | string, min: number | string, max: number | string): boolean;
static shorter(s: string, len: number): boolean;
static longer(s: string, len: number): boolean;
static equalLength(s: string, len: number): boolean;
static isLettersOnly(s: string): boolean;
static isLettersOrNumbers(s: string): boolean;
static isIP(s: string): boolean;
static isExistUrl(url: string): Promise<boolean>;
static isPattern(s: string, exp: RegExp): boolean;
static byServer(req: string | HttpRequest, judge: (res: HttpResponse) => boolean): Promise<boolean>;
}
}
}
import Check = JS.util.Check;
declare module JS {
namespace util {
class Jsons {
static parse(text: string, reviver?: (key: any, value: any) => any): any;
static stringify(value: any, replacer?: (key: string, value: any) => any | (number | string)[] | null, space?: string | number): string;
static clone<T>(obj: T): T;
static forEach<T>(json: JsonObject<T>, fn: (value: T, key: string) => any, that?: any): void;
static some<T>(json: JsonObject<T>, fn: (value: T, key: string) => boolean, that?: any): boolean;
static hasKey(json: JsonObject, key: string | number): boolean;
static values<T>(json: JsonObject<T>): T[];
static keys(json: JsonObject): string[];
static equalKeys(json1: JsonObject, json2: JsonObject): boolean;
static equal(json1: JsonObject<PrimitiveType>, json2: JsonObject<PrimitiveType>): boolean;
static replaceKeys(json: JsonObject, keyMapping: JsonObject<string> | ((this: JsonObject, val: any, key: string) => string), needClone?: boolean): JsonObject;
private static _union;
static union(...jsons: JsonObject[]): JsonObject;
static minus(json1: JsonObject, json2: JsonObject): JsonObject<any>;
static intersect(json1: JsonObject, json2: JsonObject): JsonObject<any>;
static filter(json: JsonObject, fn: (this: JsonObject, value: object, key: string) => boolean): JsonObject;
static find(data: JsonObject, path: string): any;
}
}
}
import Jsons = JS.util.Jsons;
declare module JS {
namespace net {
type URLString = string;
type QueryString = string;
type URIData = {
scheme?: string;
user?: string;
password?: string;
host: string;
port?: number;
path?: string;
params?: JsonObject<string>;
fragment?: string;
};
class URI {
private _scheme;
private _user;
private _pwd;
private _host;
private _port;
private _path;
private _params;
private _frag;
constructor(cfg?: string | URL | URIData);
private _parse;
private _parseStr;
userinfo(): string;
fragment(): string;
fragment(str: string): this;
queryString(): string;
queryString(str: string): this;
path(): string;
path(str: string): this;
port(): number;
port(port: number): this;
host(): string;
host(str: string): this;
user(): string;
user(str: string): this;
password(): string;
password(str: string): this;
scheme(): string;
scheme(str: string): this;
query(key: string): string;
query(key: string, value: string, encode?: boolean): this;
queryObject(): JsonObject<string>;
queryObject(params: JsonObject<string>, encode?: boolean): this;
isAbsolute(): boolean;
toAbsolute(): string;
toRelative(): string;
toString(): string;
static getAbsoluteDir(): any;
static toAbsoluteURL(url: string): string;
static toQueryString(json: JsonObject<string>, encode?: boolean): QueryString;
static parseQueryString(query: QueryString, decode?: boolean): JsonObject<string>;
}
}
}
import URI = JS.net.URI;
import URLString = JS.net.URLString;
import QueryString = JS.net.QueryString;
declare module JS {
namespace util {
type Locale = string;
class Locales {
static lang(locale: Locale): string;
static country(locale: Locale): string;
}
}
}
import Locale = JS.util.Locale;
import Locales = JS.util.Locales;
declare module JS {
namespace util {
type I18NResource = JsonObject<PrimitiveType | Array<any> | RegExp | JsonObject>;
class I18N {
private _lc;
private _d;
constructor(lc?: Locale);
private _load;
private _loadJson;
load(url: URLString, locale?: Locale): boolean;
get(): JsonObject;
get(key: string): any;
getKeys(): (string | number | symbol)[];
hasKey(k: string): boolean;
locale(): Locale;
locale(lc: Locale): this;
set(d: I18NResource): this;
}
}
}
import I18NResource = JS.util.I18NResource;
import I18N = JS.util.I18N;
interface Date {
getWeek(): number;
setWeek(week: number, dayOfWeek?: 0 | 1 | 2 | 3 | 4 | 5 | 6): Date;
clone(): Date;
setZeroTime(): Date;
setLastTime(): Date;
setNowTime(): Date;
equals(date: Date, type?: 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'M' | 'y'): boolean;
between(start: Date, end: Date): boolean;
isAfter(date: Date): boolean;
isBefore(date: Date): boolean;
isToday(date: Date): boolean;
add(v: number, type: 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'M' | 'y'): Date;
setTimezoneOffset(offset: number): Date;
formatTimezoneOffset(): string;
set(config: {
millisecond?: number;
second?: number;
minute?: number;
hour?: number;
day?: number;
week?: number;
month?: number;
year?: number;
timezoneOffset?: number;
}): Date;
diff(date?: Date): number;
format(format?: string, locale?: Locale): string;
}
declare module JS {
namespace util {
class Dates {
static I18N_RESOURCE: I18NResource;
static isValidDate(d: Date | string | number): boolean;
static isLeapYear(y: number): boolean;
static getDaysOfMonth(m: number, y?: number): number;
static getFirstDayOfMonth(d: Date): Date;
static getLastDayOfMonth(d: Date): Date;
static getDayOfWeek(d: Date, dayOfWeek: 0 | 1 | 2 | 3 | 4 | 5 | 6): Date;
}
}
}
import Dates = JS.util.Dates;
interface Number {
stringify(): string;
round(digit?: number): number;
toInt(): number;
format(digit?: number): string;
equals(n: number | string | Number, dLen?: number): boolean;
add(n: number | string | Number): number;
sub(n: number | string | Number): number;
mul(n: number | string | Number): number;
div(n: number | string | Number): number;
isNaN(): boolean;
isFinite(): boolean;
isZero(): boolean;
isFloat(): boolean;
isInt(): boolean;
isPositive(): boolean;
isNegative(): boolean;
isOdd(): boolean;
isEven(): boolean;
abs(): number;
fractionLength(): number;
integerLength(): number;
fractionalPart(): string;
integralPart(): string;
}
declare module JS {
namespace util {
class Numbers {
static min(...numbers: Array<number>): number;
static max(...numbers: Array<number>): number;
static termwise(...args: Array<number | '+' | '-' | '*' | '/'>): number;
static algebra(expression: string, values?: JsonObject<number | string | Number>): number;
}
}
}
import Numbers = JS.util.Numbers;
declare module JS {
namespace util {
class Konsole {
static clear(): void;
static count(label?: string): void;
static countReset(label?: string): void;
static time(label?: string): void;
static timeEnd(label?: string): void;
static trace(data: any, css?: string): void;
static text(data: string, css?: string): void;
private static _print;
static print(...data: any[]): void;
}
}
}
import Konsole = JS.util.Konsole;
declare module JS {
namespace lang {
class JSError extends Error {
cause: Error;
constructor(msg?: string, cause?: Error);
}
class RefusedError extends JSError {
}
class NotFoundError extends JSError {
}
class ArithmeticError extends JSError {
}
class ArgumentError extends JSError {
}
class StateError extends JSError {
}
class ParseError extends JSError {
}
class NetworkError extends JSError {
}
class TimeoutError extends JSError {
}
}
}
import JSError = JS.lang.JSError;
import RefusedError = JS.lang.RefusedError;
import NotFoundError = JS.lang.NotFoundError;
import ArithmeticError = JS.lang.ArithmeticError;
import ArgumentError = JS.lang.ArgumentError;
import StateError = JS.lang.StateError;
import ParseError = JS.lang.ParseError;
import NetworkError = JS.lang.NetworkError;
import TimeoutError = JS.lang.TimeoutError;
interface Array<T> {
add(a: T | T[], from?: number): this;
remove(index: number): boolean;
remove(find: (item: T, i: number, array: Array<T>) => boolean): boolean;
}
declare module JS {
namespace util {
class Arrays {
static newArray(a: ArrayLike<any>, from?: number): Array<any>;
static toArray<T>(a: T | T[]): T[];
static equal<T, K>(a1: Array<T>, a2: Array<K>, eq?: (item1: T, item2: K, index: number) => boolean): boolean;
static equalToString(a1: Array<any>, a2: Array<any>): boolean;
static same<T1, T2>(a1: Array<T1>, a2: Array<T2>, eq?: (t1: T1, t2: T2) => boolean): boolean;
static slice(args: ArrayLike<any>, fromIndex?: number, endIndex?: number): Array<any>;
}
}
}
import Arrays = JS.util.Arrays;
declare module JS {
namespace lang {
class AssertError extends JSError {
}
class Assert {
static fail(msg?: string): void;
static failNotSameType(expected: any, actual: any, msg?: string): void;
static failNotEqual(expected: any, actual: any, msg?: string): void;
static failEqual(expected: any, actual: any, msg?: string): void;
static _equal(expected: any, actual: any): boolean;
static equal(expected: object, actual: object, msg?: string): any;
static equal(expected: Date, actual: Date, msg?: string): any;
static equal(expected: PrimitiveType[], actual: PrimitiveType[], msg?: string): any;
static equal(expected: JsonObject<PrimitiveType>, actual: JsonObject<PrimitiveType>, msg?: string): any;
static equal(expected: PrimitiveType, actual: PrimitiveType, msg?: string): any;
static notEqual(expected: Date, actual: Date, msg?: string): any;
static notEqual(expected: PrimitiveType[], actual: PrimitiveType[], msg?: string): any;
static notEqual(expected: JsonObject<PrimitiveType>, actual: JsonObject<PrimitiveType>, msg?: string): any;
static notEqual(expected: PrimitiveType, actual: PrimitiveType, msg?: string): any;
static sameType(expected: any, actual: any, msg?: string): void;
static notSameType(expected: any, actual: any, msg?: string): void;
static true(condition: boolean, msg?: string): void;
static false(condition: boolean, msg?: string): void;
static defined(obj: object, msg?: string): void;
static notDefined(obj: object, msg?: string): void;
static error(fn: Fallback<any>, msg?: string): void;
static equalError(error: Klass<Error>, fn: Fallback<any>, msg?: string): void;
}
}
}
import Assert = JS.lang.Assert;
import AssertError = JS.lang.AssertError;
declare module JS {
namespace lang {
enum OS {
Windows = "Windows",
MacOS = "Mac OS",
Unix = "Unix",
Linux = "Linux",
CentOS = "CentOS",
Ubuntu = "Ubuntu",
iOS = "iOS",
Android = "Android",
WindowsPhone = "Windows Phone"
}
enum DeviceType {
desktop = "desktop",
console = "console",
mobile = "mobile",
tablet = "tablet",
smarttv = "smarttv",
wearable = "wearable",
embedded = "embedded"
}
enum Browser {
Edge = "Edge",
IE = "IE",
Firefox = "Firefox",
Chrome = "Chrome",
Opera = "Opera",
Safari = "Safari",
iOS = "iOS",
WeChat = "WeChat",
QQ = "QQ",
UC = "UC"
}
type BrowserDisplay = {
screenWidth: number;
screenHeight: number;
screenViewWidth: number;
screenViewHeight: number;
windowX: number;
windowY: number;
docX: number;
docY: number;
docScrollX: number;
docScrollY: number;
docWidth: number;
docHeight: number;
docViewWidth: number;
docViewHeight: number;
colorDepth: number;
pixelDepth: number;
devicePixelRatio: number;
};
type HardwareSupport = {
logicalCPUCores: number;
};
type SystemInfo = {
ua: string;
display: BrowserDisplay;
browser: {
name: string;
version?: string;
};
engine: {
name: string;
version: string;
};
device: {
model: string;
type: DeviceType;
vendor: string;
};
os: {
name: string;
version?: string;
};
locale: Locale;
cookieEnabled: boolean;
online: boolean;
hardware: {
cpuName: string;
cpuCores: number;
};
};
class System {
private static _info;
static info(refresh?: boolean): SystemInfo;
static display(refresh?: boolean): BrowserDisplay;
static isDevice(device: DeviceType): boolean;
static isBrowser(b: Browser | string): boolean;
static isOS(os: OS | string, version?: string): boolean;
static isLang(lang: string): boolean;
static isCountry(country: string): boolean;
static timezoneString(tz?: 'GMT' | 'UTC' | 'UT'): string;
static performance(): Performance;
static highResTime(): number;
}
}
}
import System = JS.lang.System;
import OS = JS.lang.OS;
import Browser = JS.lang.Browser;
import DeviceType = JS.lang.DeviceType;
import SystemInfo = JS.lang.SystemInfo;
import BrowserWindow = JS.lang.BrowserDisplay;
declare module JS {
namespace util {
class Bom {
static ready(fn: Function): void;
static iframeWindow(el: string | Element): Window;
static iframeDocument(el: string | Element): Document;
static fullscreen(): void;
static normalscreen(): void;
}
}
}
import Bom = JS.util.Bom;
declare module JS {
namespace ui {
interface IWidgetConfig {
}
interface IWidget {
id: string;
name(): string;
show(): this;
hide(): this;
isShown(): boolean;
locale(): string;
locale(locale: string): this;
on(type: string, fn: EventHandler<this>): this;
off(type?: string): this;
destroy(): void;
}
interface IValueWidget extends IWidget {
iniValue<T>(): T;
iniValue<T>(val?: T, render?: boolean): this;
value<T>(): T;
value<T>(val?: T, silent?: boolean): this;
reset(): this;
valueModel(): Model;
validate(): string | boolean;
clear(): this;
}
interface IDataWidget extends IWidget {
data<T>(): T;
data(data: any, silent?: boolean): this;
load<T>(api: string | HttpRequest): Promise<ResultSet<T>>;
reload(): this;
dataModel<M>(): M;
}
interface ICRUDWidget<T> extends IValueWidget {
crudValue(): T;
isCrud(): boolean;
}
type WidgetEvents = 'showing' | 'shown' | 'hiding' | 'hidden' | 'rendering' | 'rendered' | 'destroying' | 'destroyed';
function widget(fullName: string, alias?: string): any;
}
}
import widget = JS.ui.widget;
import IWidgetConfig = JS.ui.IWidgetConfig;
import IWidget = JS.ui.IWidget;
import IValueWidget = JS.ui.IValueWidget;
import IDataWidget = JS.ui.IDataWidget;
import ICRUDWidget = JS.ui.ICRUDWidget;
import WidgetEvents = JS.ui.WidgetEvents;
declare module JS {
namespace view {
interface ViewWidgetConfig extends IWidgetConfig {
id?: string;
klass?: string | Klass<IWidget>;
}
type ViewEvents = 'rendering' | 'rendered' | 'widgetiniting' | 'widgetinited' | 'dataupdated' | 'validated';
interface ViewConfig {
defaultConfig?: IWidgetConfig;
widgetConfigs?: JsonObject<ViewWidgetConfig | IWidgetConfig>;
}
abstract class View implements ICompo {
protected _widgets: JsonObject<IWidget>;
protected _model: Modelable<any>;
protected _eventBus: EventBus;
protected _config: ViewConfig;
static WIDGET_ATTRIBUTE: string;
initialize(): void;
destroy(): void;
config(): ViewConfig;
protected abstract _render(): any;
protected _fire(e: ViewEvents, args?: Array<any>): void;
render(): void;
getModel(): Modelable<any>;
getWidget<W extends IWidget>(id: string): W;
getWidgets(): JsonObject<IWidget>;
addWidget(wgt: IWidget): View;
removeWidget(id: string): View;
destroyWidget(id: string): View;
on(type: 'rendering', handler: EventHandler<this>): any;
on(type: 'rendered', handler: EventHandler<this>): any;
on(type: 'widgetiniting', handler: EventHandler2<this, string | Klass<IWidget>, ViewWidgetConfig>): any;
on(type: 'widgetinited', handler: EventHandler1<this, IWidget>): any;
on(type: 'dataupdated', handler: EventHandler2<this, any, any>): any;
on(type: 'validated', handler: EventHandler2<this, ValidateResult, any>): any;
off(type?: string): void;
eachWidget(fn: (w: IWidget) => void): void;
protected _newWidget<T extends IWidget>(id: string, cfg: ViewWidgetConfig | IWidgetConfig, defaults: IWidgetConfig): T;
}
}
}
import ViewEvents = JS.view.ViewEvents;
import ViewWidgetConfig = JS.view.ViewWidgetConfig;
import ViewConfig = JS.view.ViewConfig;
import View = JS.view.View;
declare module JS {
namespace app {
type PageEvents = 'fullscreening' | 'fullscreened' | 'normalscreening' | 'normalscreened' | 'leaving' | 'close';
abstract class Page implements ICompo {
initialize(): void;
destroy(): void;
abstract enter(): any;
private static _bus;
static fireEvent(e: PageEvents | string, args?: any[]): void;
static onEvent(e: PageEvents | string, handler: EventHandler<Page>, once?: boolean): void;
static offEvent(e: PageEvents | string): void;
private static _page;
static init(page: Klass<Page>): void;
static currentPage<T extends Page>(): T;
static view<V extends View>(v: Klass<V>): V;
static redirect(url: string, query?: string | JsonObject<string>): void;
static open(url: any, specs?: {
width?: number;
height?: number;
top?: number;
left?: number;
location?: boolean;
menubar?: boolean;
resizable?: boolean;
scrollbars?: boolean;
status?: boolean;
titlebar?: boolean;
toolbar?: boolean;
}): any;
static fullscreen(onoff: boolean): void;
}
}
}
import PageEvents = JS.app.PageEvents;
import Page = JS.app.Page;
declare module JS {
namespace app {
class AppEvent extends CustomEvent<any> {
fromUrl: string;
fromPage: string;
constructor(type: string, initDict?: any);
}
type AppConfig = {
name: string;
version?: string;
logLevel?: LogLevel;
properties?: JsonObject;
};
class App {
private static _cfg;
private static _logger;
static init(cfg: AppConfig): void;
static NS(): string;
static appName(): string;
static version(): string;
static logger(): Log;
static properties(): JsonObject;
static properties(properties: JsonObject): App;
static property(key: string): any;
static property(key: string, val: any): App;
static _bus: EventBus;
static fireEvent<E>(e: E, arg?: StoreDataType): void;
static onEvent<H = EventHandler<App>>(e: string, handler: H, once?: boolean): void;
static offEvent(e: string): void;
}
}
}
import App = JS.app.App;
import AppEvent = JS.app.AppEvent;
import AppConfig = JS.app.AppConfig;
declare module JS {
namespace model {
interface ResultSetFormat {
rootProperty?: string;
dataProperty?: string;
totalProperty?: string;
pageProperty?: string;
pageSizeProperty?: string;
messageProperty?: string;
versionProperty?: string;
langProperty?: string;
successProperty?: string;
successCode?: any;
isSuccess?: (root: any) => boolean;
}
class ResultSet<T = PrimitiveType | Array<any> | JsonObject | Model> {
static DEFAULT_FORMAT: ResultSetFormat;
private _rawObject;
private _data;
private _page;
private _pageSize;
private _total;
private _version;
private _lang;
private _msg;
private _success;
rawObject(): any;
rawObject(response: any): this;
data(): T;
data(data: T): this;
count(): number;
total(): number;
total(total: number): this;
page(): number;
page(page: number): this;
pageSize(): number;
pageSize(pageSize: number): this;
version(): string;
version(v: string): this;
lang(): string;
lang(lang: string): this;
message(): string;
message(msg: string): this;
success(): boolean;
success(success: boolean): this;
static parseJSON<T>(raw: JsonObject, format?: ResultSetFormat): ResultSet<T>;
}
}
}
import ResultSet = JS.model.ResultSet;
import ResultSetFormat = JS.model.ResultSetFormat;
declare module JS {
namespace model {
abstract class AjaxProxy {
abstract execute<T>(req: string | HttpRequest): Promise<ResultSet<T>>;
s: any;
}
}
}
import AjaxProxy = JS.model.AjaxProxy;
declare module JS {
namespace model {
class JsonProxy extends AjaxProxy {
constructor();
execute<T>(query: string | HttpRequest): Promise<ResultSet<T>>;
}
}
}
import JsonProxy = JS.model.JsonProxy;
declare module JS {
namespace app {
abstract class Service implements ICompo {
initialize(): void;
destroy(): void;
static DEFAULT_PROXY: Klass<AjaxProxy>;
protected _proxy: AjaxProxy;
proxy(proxy: AjaxProxy): this;
proxy(): AjaxProxy;
call<T>(api: Api<T>, params?: JsonObject): Promise<T>;
}
}
}
import Service = JS.app.Service;
declare module JS {
namespace math {
type ArrayPoint2 = [number, number];
type ArrayPoint3 = [number, number, number];
type PolarPoint2 = {
d: number;
a: number;
};
type PolarPoint3 = {
d: number;
ax: number;
az: number;
};
}
}
import ArrayPoint2 = JS.math.ArrayPoint2;
import ArrayPoint3 = JS.math.ArrayPoint3;
import PolarPoint2 = JS.math.PolarPoint2;
import PolarPoint3 = JS.math.PolarPoint3;
declare module JS {
namespace d2 {
type D2Line = [ArrayPoint2, ArrayPoint2];
type D2Rect = [number, number, number, number];
type D2Triangle = [ArrayPoint2, ArrayPoint2, ArrayPoint2];
type D2CirArc = [ArrayPoint2, number, number, number, boolean];
type D2Circle = [ArrayPoint2, number];
type D2Path = ArrayPoint2[];
type D2Text = [string, ArrayPoint2] | [string, ArrayPoint2, number];
type D2CssColor = string | 'transparent';
type D2FillPattern = {
image: HTMLImageElement | SVGImageElement | HTMLVideoElement;
repeat?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat';
};
type D2CssLinearGradient = {
dir: 'left' | 'right' | 'top' | 'bottom';
colors: Array<{
stop?: number;
color: string;
}>;
};
interface D2ElementAttributes {
x?: number | CssValueString;
y?: number | CssValueString;
opacity?: number | CssValueString;
zIndex?: number;
style?: string;
draggable?: boolean;
}
interface D2NewElementAttributes extends D2ElementAttributes {
id?: string;
}
}
}
import D2Line = JS.d2.D2Line;
import D2Rect = JS.d2.D2Rect;
import D2Triangle = JS.d2.D2Triangle;
import D2CirArc = JS.d2.D2CirArc;
import D2Circle = JS.d2.D2Circle;
import D2Path = JS.d2.D2Path;
import D2Text = JS.d2.D2Text;
declare module JS {
namespace d2 {
interface DrawStyle {
lineWidth?: number;
strokeStyle?: D2CssColor;
shadowStyle?: {
color?: D2CssColor;
blur?: number;
offsetX?: number;
offsetY?: number;
};
}
interface TransformDrawStyle extends DrawStyle {
translate?: [number, number];
rotate?: number;
scale?: [number, number];
transform?: [number, number, number, number, number, number];
}
interface RectDrawStyle extends TransformDrawStyle {
fillStyle?: D2CssColor | D2CssLinearGradient | D2FillPattern;
strokeStyle?: D2CssColor;
}
interface TextDrawStyle extends TransformDrawStyle {
fillStyle?: D2CssColor | D2CssLinearGradient;
strokeStyle?: D2CssColor;
textStyle?: {
font?: string;
align?: 'center' | 'left' | 'right';
};
}
interface DisplayConfig {
holder?: string | HTMLElement;
id: string;
x?: number;
y?: number;
zIndex?: number;
width?: number;
height?: number;
cssStyle?: string;
drawStyle?: DrawStyle;
mode: 'canvas' | 'div';
}
class Display {
protected _cfg: DisplayConfig;
protected _ctx: CanvasRenderingContext2D;
protected _div: HTMLElement;
protected _dStyle: DrawStyle;
constructor(cfg: DisplayConfig);
clear(rect?: D2Rect): void;
private _check;
private _canvasLG;
private _applyDrawStyle;
private _applyDrawingStyle;
private _textDrawingStyle;
private _transformStyle;
config(): DisplayConfig;
config(cfg: DisplayConfig): this;
setDrawStyle(style?: DrawStyle): this;
private _drawLine;
drawLine(line: D2Line | Line | Segment, style?: TransformDrawStyle): void;
drawCircle(arc: D2Circle | Circle, style?: TransformDrawStyle): void;
drawArc(arc: D2CirArc | CirArc, style?: TransformDrawStyle): void;
private _fillStyle;
drawRect(rect: D2Rect | Rect, style?: RectDrawStyle): void;
drawTri(tri: D2Triangle | Triangle, style?: TransformDrawStyle): void;
drawPath(p: D2Path, style?: TransformDrawStyle): void;
private _setAttrs;
drawText(t: D2Text, style?: TextDrawStyle, a?: D2NewElementAttributes): void;
changeText(id: string, text: string): void;
drawImage(img: HTMLImageElement | {
src: string | HTMLImageElement;
x: number;
y: number;
w: number;
h: number;
}, a?: D2NewElementAttributes): void;
changeImage(id: string, newImg: HTMLImageElement | {
src?: HTMLImageElement;
x: number;
y: number;
w?: number;
h?: number;
}): void;
updateChild(id: string, a: D2ElementAttributes): void;
removeChild(id: string): void;
appendChild(node: string | Node): this;
find(selector: string): HTMLElement;
findAll(selector: string): NodeListOf<HTMLElement>;
}
}
}
import DrawStyle = JS.d2.DrawStyle;
import TransformDrawStyle = JS.d2.TransformDrawStyle;
import TextDrawStyle = JS.d2.TextDrawStyle;
import RectDrawStyle = JS.d2.RectDrawStyle;
import DisplayConfig = JS.d2.DisplayConfig;
import Display = JS.d2.Display;
declare module JS {
namespace ds {
class BiMap<K, V> {
private _m;
constructor(m?: Array<[K, V]> | Map<K, V> | BiMap<K, V>);
inverse(): BiMap<V, K>;
delete(k: K): boolean;
forEach(fn: (value: V, key: K, map: Map<K, V>) => void, ctx?: any): void;
clear(): void;
size(): number;
has(k: K): boolean;
get(k: K): V;
put(k: K, v: V): void;
putAll(map: Array<[K, V]> | Map<K, V> | BiMap<K, V>): void;
static convert(json: JsonObject<string | number>): BiMap<string, string | number>;
}
}
}
import BiMap = JS.ds.BiMap;
declare module JS {
namespace ds {
type LinkedNode<T> = {
data: T;
next: LinkedNode<T>;
prev: LinkedNode<T>;
};
class LinkedList<T> implements Iterware<T> {
private _s;
private _hd;
private _tl;
constructor();
each(fn: (item: T, index: number, iter: LinkedList<T>) => boolean, thisArg?: any): boolean;
size(): number;
isEmpty(): boolean;
clear(): void;
clone(): LinkedList<T>;
toArray(): Array<T>;
getFirst(): T;
getLast(): T;
get(i: number): T;
private _findAt;
private _fromFirst;
private _fromLast;
indexOf(data: T, eq?: (data: T, item: T) => boolean): number;
lastIndexOf(data: T, eq?: (data: T, item: T) => boolean): number;
contains(data: T, eq?: (data: T, item: T) => boolean): boolean;
private _addLast;
private _addFirst;
add(a: T | T[]): void;
addAll(list: LinkedList<T>): void;
private _addAt;
addAt(i: number, a: T | T[]): void;
addLast(a: T | T[]): void;
addFirst(a: T | T[]): void;
removeFirst(): T;
removeLast(): T;
removeAt(i: number): T;
peek(): T;
peekFirst(): T;
peekLast(): T;
toString(): string;
}
}
}
import LinkedL