From 4a723dcede4df6e08b030f36d8c9e182ae807bac Mon Sep 17 00:00:00 2001 From: jinho park Date: Wed, 18 Jan 2017 10:34:44 +0900 Subject: [PATCH] [juijs] update jui, jui-core, jui-grid library (#13806) * add jui-core * update index.d.ts for jui-core * update index.d.ts for jui * update index.d.ts for jui * update index.d.ts for jui-grid * update index.d.ts for jui-grid * fixed lint * fixed lint for jui-core and jui-grid * remove jquery.d.ts in tsconfig.json * update rule for lint * update rule for lint * fixed space-before-function-paren problems * update jui-core/index.d.ts --- jui-core/index.d.ts | 824 +++++++++++++++++++++ jui-core/jui-core-tests.ts | 15 + jui-core/tsconfig.json | 20 + jui-core/tslint.json | 1 + jui-grid/index.d.ts | 996 ++++++++++++++++++++++++++ jui-grid/jui-grid-tests.ts | 182 +++++ jui-grid/tsconfig.json | 20 + jui-grid/tslint.json | 1 + jui/index.d.ts | 1380 ++++++++++++++++++++++++++++++++++++ jui/jui-tests.ts | 124 ++++ jui/tsconfig.json | 20 + jui/tslint.json | 1 + 12 files changed, 3584 insertions(+) create mode 100644 jui-core/index.d.ts create mode 100644 jui-core/jui-core-tests.ts create mode 100644 jui-core/tsconfig.json create mode 100644 jui-core/tslint.json create mode 100644 jui-grid/index.d.ts create mode 100644 jui-grid/jui-grid-tests.ts create mode 100644 jui-grid/tsconfig.json create mode 100644 jui-grid/tslint.json create mode 100644 jui/index.d.ts create mode 100644 jui/jui-tests.ts create mode 100644 jui/tsconfig.json create mode 100644 jui/tslint.json diff --git a/jui-core/index.d.ts b/jui-core/index.d.ts new file mode 100644 index 0000000000..0f1184c0a3 --- /dev/null +++ b/jui-core/index.d.ts @@ -0,0 +1,824 @@ +// Type definitions for jui-core 2.0 +// Project: https://github.com/juijs/jui-core +// Definitions by: JinHo Park +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare var jui: JuiStatic; + +interface UtilBase { + /** + * @property browser check browser agent + * @property {Boolean} browser.webkit Webkit 브라우저 체크 + * @property {Boolean} browser.mozilla Mozilla 브라우저 체크 + * @property {Boolean} browser.msie IE 브라우저 체크 */ + browser: { + webkit: boolean, + mozilla: boolean, + msie: boolean + }; + + /** + * @property {Boolean} isTouch + * check touch device + */ + isTouch: boolean; + + /** + * @method inherit + * + * 프로토타입 기반의 상속 제공 + * + * @param {Function} ctor base Class + * @param {Function} superCtor super Class + */ + inherit( ctor: ((...args: any[]) => any), superCtor: ((...args: any[]) => any) ): void; + + /** + * @method extend + * + * implements object extend + * + * @param {Object|Function} origin + * @param {Object|Function} add + * @param {Boolean} skip + * @return {Object} + */ + extend(origin: any, add: any, skip: boolean): any; + + /** + * convert px to integer + * @param {String or Number} px + * @return {Number} + */ + pxToInt(px: string| number): number; + + /** + * @method clone + * implements object clone + * @param {Array/Object} obj 복사할 객체 + * @return {Array} + */ + clone(obj: any): any[]; + + /** + * @method deepClone + * implements object deep clone + * @param obj + * @param emit + * @return {*} + */ + deepClone(obj: any, emit: any): any[]; + + /** + * @method sort + * use QuickSort + * @param {Array} array + * @return {QuickSort} + */ + sort(array: any[]): UtilQuickSort; + + /** + * @method runtime + * + * caculate callback runtime + * + * @param {String} name + * @param {Function} callback + */ + runtime(name: string, callback: ((...args: any[]) => void)): void; + + /** + * @method template + * parsing template string + * @param html + * @param obj + */ + template(html: string, obj?: any): ((obj: any) => string) | string; + + /** + * @method resize + * add event in window resize event + * @param {Function} callback + * @param {Number} ms delay time + */ + resize(callback: ((...args: any[]) => void), ms: number): void; + + /** + * @method index + * + * IndexParser 객체 생성 + * + * @return {KeyParser} + */ + index(): UtilKeyParser; + + /** + * @method chunk + * split array by length + * @param {Array} arr + * @param {Number} len + * @return {Array} + */ + chunk(arr: any[], len: number): any[]; + + /** + * @method typeCheck + * check data type + * @param {String} t type string + * @param {Object} v value object + * @return {Boolean} + */ + typeCheck(typeName: string, value: any): boolean; + + + typeCheckObj(uiObj: any, list: any): void; + + /** + * @method dataToCsv + * + * data 를 csv 로 변환한다. + * + * @param {Array} keys + * @param {Array} dataList + * @param {Number} dataSize + * @return {String} 변환된 csv 문자열 + */ + dataToCsv(keys: string[] , dataList: any[], dataSize: number): string; + + /** + * @method dataToCsv2 + * + * @param {Object} options + * @return {String} + */ + dataToCsv2(options: any): string; + + /** + * @method fileToCsv + * + * file 에서 csv 컨텐츠 로드 + * + * @param {File} file + * @param {Function} callback + */ + fileToCsv(fileText: string, callback: ((data: any) => void)): void; + + /** + * @method csvToBase64 + * + * csv 다운로드 링크로 변환 + * + * @param {String} csv + * @return {String} data uri string + */ + csvToBase64(csv: string): string; + + /** + * @method csvToData + * + * @param {Array} keys + * @param {String} csv + * @param {Number} csvNumber + * @return {Array} + */ + csvToData(keys: string[], csv: string, csvNumber: number): any[]; + + /** + * @method getCsvFields + * + * csv 에서 필드 얻어오기 + * + * @param {Array} fields + * @param {Array} csvFields + * @return {Array} + */ + getCsvFields(fields: string[], csvFields: string[]): string[]; + + /** + * @method svgToBase64 + * + * xml 문자열로 svg datauri 생성 + * + * @param {String} xml + * @return {String} 변환된 data uri 링크 + */ + svgToBase64(xml: string): string; + + /** + * @method dateFormat + * + * implements date format function + * + * yyyy : 4 digits year + * yy : 2 digits year + * y : 1 digit year + * + * @param {Date} date + * @param {String} format date format string + * @param {Boolean} utc + * @return {string} + */ + dateFormat(date: Date, format: string, utc?: boolean): string; + + /** + * @method createId + * + * 유니크 아이디 생성 + * + * @param {String} key prefix string + * @return {String} 생성된 아이디 문자열 + */ + createId(key: string): string; + + /** + * @method btoa + * + * Base64 인코딩 + * + * @return {String} + */ + btoa(input: any): string; + + /** + * @method atob + * + * Base64 디코딩 + * + * @return {Any} + */ + atob(input: string): any; + + /** + * implement async loop without blocking ui + * + * @param {Number} total loop count + * @param {Object} context + * @returns {Function} + */ + timeLoop(total: number, context?: any): ((index: number) => void); + + /** + * @method loop + * + * 최적화된 루프 생성 (5단계로 나눔) + * + * @param {Number} total loop count + * @param {Object} [context=null] + * @return {Function} 최적화된 루프 콜백 (index, groupIndex 2가지 파라미터를 받는다.) + */ + loop(total: number, context?: any): ((index: number, groupIndex: number) => void ); + + /** + * @method loopArray + * + * 배열을 사용해서 최적화된 루프로 생성한다. + * + * + * @param {Array} data 루프로 생성될 배열 + * @param {Object} [context=null] + * @return {Function} 최적화된 루프 콜백 (data, index, groupIndex 3가지 파라미터를 받는다.) + */ + loopArray(data: any[], context?: any): ((data: any, index: number, groupIndex: number) => void ); + + /** + * @method makeIndex + * + * 배열의 키 기반 인덱스를 생성한다. + * + * 개별 값 별로 멀티 인덱스를 생성한다. + * + * @param {Array} data + * @param {String} keyField + * @return {Object} 생성된 인덱스 + */ + makeIndex(data: any[], keyField: string): any; + + /** + * @method startsWith + * Check that it matches the starting string search string. + * + * @param {String} string + * @param {String} searchString + * @param {Number} [position=0] + * @return {Number} position + */ + startsWith(str: string, searchString: string, position?: number): number; + + /** + * @method endsWith + * Check that it matches the end of a string search string. + * + * @param {String} string + * @param {String} searchString + * @return {Number} position + */ + endsWith(str: string, searchString: string, position?: number): number; + + inArray(target: any, list: any[]): number; + + + trim(text: string): string; + + ready: ((...args: any[]) => void); + + param(data: any): string; + + ajax(data: any): void; + + scrollWidth(): number; +} + +interface JuiStatic { + /** + * @method ready + * + * ready 타임에 실행될 callback 정의 + * + * @param {Function} callback + */ + ready(depends?: string[], callback?: (...args: any[]) => void): void; + + /** + * @method defineUI + * + * 사용자가 실제로 사용할 수 있는 UI 클래스를 정의 + * + * @param {String} name 모듈 로드와 상속에 사용될 이름을 정한다. + * @param {Array} depends 'define'이나 'defineUI'로 정의된 클래스나 객체를 인자로 받을 수 있다. + * @param {Function} callback UI 클래스를 해당 콜백 함수 내에서 클래스 형태로 구현하고 리턴해야 한다. + */ + defineUI(name: string, depends: string[], callback: () => void, parent?: string): void; + + /** + * @method define + * + * UI 클래스에서 사용될 클래스를 정의하고, 자유롭게 상속할 수 있는 클래스를 정의 + * + * @param {String} name 모듈 로드와 상속에 사용될 이름을 정한다. + * @param {Array} depends 'define'이나 'defineUI'로 정의된 클래스나 객체를 인자로 받을 수 있다. + * @param {Function} callback UI 클래스를 해당 콜백 함수 내에서 클래스 형태로 구현하고 리턴해야 한다. + * @param {String} parent 상속받을 클래스 + */ + define(name: string, depends: string[], callback: () => void, parent?: string): void; + + /** + * @method redefine + * + * UI 클래스에서 사용될 클래스를 정의하고, 자유롭게 상속할 수 있는 클래스를 정의 + * + * @param {String} name 모듈 로드와 상속에 사용될 이름을 정한다. + * @param {Array} depends 'define'이나 'defineUI'로 정의된 클래스나 객체를 인자로 받을 수 있다. + * @param {Function} callback UI 클래스를 해당 콜백 함수 내에서 클래스 형태로 구현하고 리턴해야 한다. + * @param {String} parent 상속받을 클래스 + */ + redefine(name: string, depends: string[], callback: () => void, parent?: string): void; + + /** + * define과 defineUI로 정의된 클래스 또는 객체를 가져온다. + * + * @param name 가져온 클래스 또는 객체의 이름 + * @return {*} + */ + include(name: string): any; + + /** + * define과 defineUI로 정의된 모든 클래스와 객체를 가져온다. + * + * @return {Array} + */ + includeAll(): any[]; + + /** + * @method add + * Adds a component object created + * + * @param {Object} ui UI instance + */ + add(uiIns: any): void; + + + /** + * @method emit + * Generates a custom event to an applicable component + * + * @param {String} key Selector or UI type + * @param {String} type Event type + * @param {Array} args Event arguments + */ + emit(key: string, type: string, args: any[]): void; + + /** + * @method get + * Gets a component currently created + * + * @param {Integer/String} key + * @returns {Object/Array} UI instance + */ + get(key: number|string): any; + + /** + * @method getAll + * Gets all components currently created + * + * @return {Array} UI instances + */ + getAll(): any[]; + + /** + * @method create + * It is possible to create a component dynamically after the ready point + * + * @param {String} type UI type + * @param {String/DOMElement} selector + * @param {Object} options + * @return {Object} + */ + create(type: string, selector: any, options?: {}): any; +} + +interface UICollection { + destroy(): void; +} + +interface UICore { + + tpl?: any; + + event?: any; + + root?: any; + + /** + * @method emit + * Generates a custom event. The first parameter is the type of a custom event. A function defined as an option or on method is called + * + * @param {String} type Event type + * @param {Function} args Event Arguments + * @return {Mixed} + */ + emit(type: string, args: () => void): any; + + /** + * @method on + * A callback function defined as an on method is run when an emit method is called + * + * @param {String} type Event type + * @param {Function} callback + */ + on(type: string, callback: () => void): void; + + /** + * @method off + * Removes a custom event of an applicable type or callback handler + * + * @param {String} type Event type + */ + off(type: string): void; + + /** + * @method addValid + * Check the parameter type of a UI method and generates an alarm when a wrong value is entered + * + * @param {String} name Method name + * @param {Array} params Parameters + */ + addValid(name: string, params: any[]): void; + + /** + * @method callBefore + * Sets a callback function that is called before a UI method is run + * + * @param {String} name Method name + * @param {Function} callback + * @return {Mixed} + */ + callBefore(name: string, callback: () => void): void; + + /** + * @method callAfter + * Sets a callback function that is called after a UI method is run + * + * @param {String} name Method name + * @param {Function} callback + * @return {Mixed} + */ + callAfter(name: string, callback: () => void): void; + + /** + * @method callDelay + * Sets a callback function and the delay time before/after a UI method is run + * + * @param {String} name Method name + * @param {Function} callback + */ + callDelay(name: string, callObj: () => void): void; + + /** + * @method setTpl + * Dynamically defines the template method of a UI + * + * @param {String} name Template name + * @param {String} html Template markup + */ + setTpl(name: string, html: string): void; + + /** + * @method setOption + * Dynamically defines the options of a UI + * + * @param {String} key + * @param {Mixed} value + */ + setOption(key: string, value: any): void; + + /** + * @method destroy + * Removes all events set in a UI obejct and the DOM element + * + */ + destroy(): void; +} + +//noinspection TypeScriptUnresolvedVariable +export interface UIEvent extends UICore { + + root?: any; + + /** + * @method find + * Get the child element of the root element + * + * @param {String/HTMLElement} Selector + * @returns {*|jQuery} + */ + find(selector: any): JQuery; +} + +export class ColorScale { + domain(color: string, color2: string): this; + ticks(max: number): this; +} + +export interface UtilColor { + /** + * @method format + * + * convert color to format string + * + * // hex + * color.format({ r : 255, g : 255, b : 255 }, 'hex') // #FFFFFF + * + * // rgb + * color.format({ r : 255, g : 255, b : 255 }, 'rgb') // rgba(255, 255, 255, 0.5); + * + * // rgba + * color.format({ r : 255, g : 255, b : 255, a : 0.5 }, 'rgb') // rgba(255, 255, 255, 0.5); + * + * @param {Object} obj obj has r, g, b and a attributes + * @param {"hex"/"rgb"} type format string type + * @returns {*} + */ + format(obj: any, type: string): string; + + /** + * @method scale + * + * get color scale + * + * var c = color.scale().domain('#FF0000', '#00FF00'); + * + * // get middle color + * c(0.5) == #808000 + * + * // get middle color list + * c.ticks(20); // return array , [startColor, ......, endColor ] + * + * @returns {func} scale function + */ + scale(): ColorScale; + + /** + * @method map + * + * create color map + * + * var colorList = color.map(['#352a87', '#0f5cdd', '#00b5a6', '#ffc337', '#fdff00'], count) + * + * @param {Array} color_list + * @param {Number} count a divide number + * @returns {Array} converted color list + */ + map(color_list: string[], count: number): string[]; + + /** + * @method rgb + * + * parse string to rgb color + * + * color.rgb("#FF0000") === { r : 255, g : 0, b : 0 } + * + * color.rgb("rgb(255, 0, 0)") == { r : 255, g : 0, b : } + * + * @param {String} str color string + * @returns {Object} rgb object + */ + rgb(str: string): any; + + /** + * @method HSVtoRGB + * + * convert hsv to rgb + * + * color.HSVtoRGB(0,0,1) === #FFFFF === { r : 255, g : 0, b : 0 } + * + * @param {Number} H hue color number (min : 0, max : 360) + * @param {Number} S Saturation number (min : 0, max : 1) + * @param {Number} V Value number (min : 0, max : 1 ) + * @returns {Object} + */ + HSVtoRGB(H: number, S: number, V: number): any; + + /** + * @method RGBtoHSV + * + * convert rgb to hsv + * + * color.RGBtoHSV(0, 0, 255) === { h : 240, s : 1, v : 1 } === '#FFFF00' + * + * @param {Number} R red color value + * @param {Number} G green color value + * @param {Number} B blue color value + * @return {Object} hsv color code + */ + RGBtoHSV(R: number, G: number, B: number): any; + + /** + * @method lighten + * + * rgb 컬러 밝은 농도로 변환 + * + * @param {String} color RGB color code + * @param {Number} rate 밝은 농도 + * @return {String} + */ + lighten(color: string, rate: number): string; + + /** + * @method darken + * + * rgb 컬러 어두운 농도로 변환 + * + * @param {String} color RGB color code + * @param {Number} rate 어두운 농도 + * @return {String} + */ + darken(color: string, rate: number): string; +} + +interface UtilBase64 { + encode(input: string): string; + decode(input: string): string; +} + +interface UtilKeyParser { + /** + * @method isIndexDepth + * + * @param {String} index + * @return {Boolean} + */ + isIndexDepth(index: string): boolean; + + /** + * @method getIndexList + * + * @param {String} index + * @return {Array} + */ + getIndexList(index: string): boolean; + + /** + * @method changeIndex + * + * + * @param {String} index + * @param {String} targetIndex + * @param {String} rootIndex + * @return {String} + */ + changeIndex(index: string, targetIndex: string, rootIndex: string): string; + + /** + * @method getNextIndex + * + * @param {String} index + * @return {String} + */ + getNextIndex(index: string): string; + + /** + * @method getParentIndex + * + * + * @param {String} index + * @returns {*} + */ + getParentIndex(index: string): string; +} + +interface UtilMath { + /** + * @method rotate + * + * 2d rotate + * + * @param {Number} x + * @param {Number} y + * @param {Number} radian roate 할 radian + * @return {Object} + * @return {Number} return.x 변환된 x + * @return {Number} return.y 변환된 y + * + */ + rotate(x: number, y: number, radian: number): any; + + resize(maxWidth: number, maxHeight: number, objectWidth: number, objectHeight: number): any; + + /** + * @method radian + * + * convert degree to radian + * + * @param {Number} degree + * @return {Number} radian + */ + radian(degree: number): number; + + /** + * @method degree + * + * convert radian to degree + * + * @param {Number} radian + * @return {Number} degree + */ + degree(radian: number): number; + + angle(x1: number, y1: number, x2: number, y2: number): number; + + /** + * @method interpolateNumber + * + * a, b 의 중간값 계산을 위한 callback 함수 만들기 + * + * @param {Number} a first value + * @param {Number} b second value + * @return {Function} + */ + interpolateNumber(a: number, b: number): () => void; + + // 중간값 round 해서 계산하기 + interpolateRound(a: number, b: number): () => void; + + round(num: number, fixed: number): number; + + plus(a: number, b: number): number; + + minus(a: number, b: number): number; + + multi(a: number, b: number): number; + + div(a: number, b: number): number; + + remain(a: number, b: number): number; + + /** + * 특정 구간의 값을 자동으로 계산 + * + * @param {Object} min + * @param {Object} max + * @param {Object} ticks + * @param {Object} isNice + */ + nice(min: number, max: number, ticks: number, isNice: boolean): any; + + matrix(a: T[], b: T[]): T[]; + + matrix3d(a: T[], b: T[]): T[]; + + inverseMatrix3d(a: any[]): any[]; + +} + +export interface UtilScaleOrdinal extends Function { + (x: number): number; + domain(values: any[]): UtilScaleOrdinal; + range(values: any[]): UtilScaleOrdinal; + rangePoints(interval: number, padding?: number): () => void; + rangeBands(interval: number, padding?: number, outerPadding?: number): () => void; + invert(x: number): number; +} + +export type UtilQuickSort = (array: number[], isClone: boolean) => this; diff --git a/jui-core/jui-core-tests.ts b/jui-core/jui-core-tests.ts new file mode 100644 index 0000000000..6cf8a82c98 --- /dev/null +++ b/jui-core/jui-core-tests.ts @@ -0,0 +1,15 @@ +/// + +import {jui, UtilColor, UtilBase} from "./index"; + +jui.ready(["util.color"], function(color: UtilColor) { + console.log(color.rgb("#ff0000")); +}); + +let _ : UtilBase = jui.include("util.base"); + +let str: string = "10"; +console.log(_.typeCheck("string", str)); + +let i: number = 10; +console.log(_.typeCheck("string", i)); diff --git a/jui-core/tsconfig.json b/jui-core/tsconfig.json new file mode 100644 index 0000000000..1971daae6a --- /dev/null +++ b/jui-core/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jui-core-tests.ts" + ] +} diff --git a/jui-core/tslint.json b/jui-core/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/jui-core/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/jui-grid/index.d.ts b/jui-grid/index.d.ts new file mode 100644 index 0000000000..0fee7cc271 --- /dev/null +++ b/jui-grid/index.d.ts @@ -0,0 +1,996 @@ +// Type definitions for jui-grid 2.0 +// Project: https://github.com/juijs/jui-grid +// Definitions by: Jin-Ho Park +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import {UIEvent} from 'jui-core'; + +export interface GridColumn { + (index: number|string): this; + + /** @property {HTMLElement} [element=null] TH element of a specified column */ + element: any; + + /** @property {String} [order="asc"] Column sort state */ + order: "asc"|"desc"; + + /** @property {String} [name=null] Column name */ + name?: string; + + /** @property {Array} data Data from all rows belonging for a specified column */ + data: any[]; + + /** @property {Array} list TD element of all rows belonging to a specified column */ + list: any[]; + + /** @property {Integer} index Column index */ + index: number; + + /** @property {"show"/"hide"/"resize"} [type="show"] The current column state */ + type: "show"|"hide"|"resize"; + + /** @property {Integer} [width=null] Column width */ + width?: number; + + hide(): void; + show(): void; +} + +export interface GridRow { + /** @property {Array} data Data of a specifiedrow. */ + data: any[]; + + /** @property {Integer} seq Data of a sequence. */ + seq: number; + + /** @property {Integer} [rownum=null] The unique number of a child row under the specified parent row if a parent row exists. */ + rownum?: number; + + /** @property {String/Integer} [index=null] Index of a specified row. In the case of a tree structure, a depth is given. */ + index: number|string; + + /** @property {HTMLElement} [element=null] TR element of a specified row. */ + element: any; + + /** @property {Array} list List of TD elements of a specified row. */ + list: any[]; + + /** @property {Object} list List of hidden TD element. */ + hidden: {}; + + /** @property {uix.table.row} parent Variable that refers to the parent row. */ + parent?: GridRow; + + /** @property {Array} children List of child rows. */ + children: any[]; + + /** @property {Integer} [depth=0] The depth of the current row in the case of a tree structure. */ + depth: number; + + /** @property {"open"/"fold"} [type="fold"] State value that indicates whether a child row is shown or hidden. */ + type: "open"|"fold"; + + /** @property {Function} [type="null"] State value that indicates whether a child row is shown or hidden. */ + tpl?: () => void; + + setIndex(rownum: number|string): void; + reload(columns: GridColumn[], seq: any, xssFilter: any): void; + destroy(): void; + isLeaf(): boolean; + fold(): void; + open(): void; + appendChild(row: GridRow): void; + insertChild(rownum: number, row: GridRow, isReload?: any): void; + removeChild(index: number|string): void; + lastChild(): GridRow; + lastChildLeaf(lastRow: GridRow): GridRow|any; + showCell(index: number): void; + hideCell(index: number): void; +} + +export interface GridBase { + appendRow(index: number|string, data?: {}): GridRow; + insertRow(index: number|string, data: {}): GridRow; + updateRow(index: number|string, data: {}): GridRow; + moveRow(index: number|string, targetIndex: number|string): void; + removeRow(index: number|string): void; + openRow(index: number|string): void; + openRowAll(): void; + foldRow(index: number|string): void; + foldRowAll(): void; + removeRows(): void; + sortRows(name: string, isDesc: boolean): void; + appendColumn(tplType: string, dataList: any[]): void; + removeColumn(index: number|string): void; + hideColumn(index: number|string): void; + showColumn(index: number|string): void; + getColumnCount(): number; + getRowCount(): number; + getColumn(index?: number|string): GridColumn|GridColumn[]; + getRow(index?: number|string): GridRow|GridRow[]; + getRowAll(index: number|string): GridRow[]; + getRowParent(index: number|string): GridRow; + setColumn(index: number|string, column: GridColumn): void; + setRow(index: number|string, row: GridRow): void; +} + +export interface GridTable extends UIEvent { + (selector: any, options?: { + tpl?: any, + + event?: any, + /** + * @cfg {Array} [fields=null] + * Sets the name of columns in the order of being displayed on the table screen. + */ + fields?: any[], + + /** + * @cfg {Array} [csv=null] + * Sets the column key shown when converted to a CSV string. + */ + csv?: any[], + + /** + * @cfg {Array} [csvNames=null] + * Sets the name of a column shown when converting to a CSV string, which must be defined in the same order as the CSV option. + */ + csvNames?: any[], + + /** + * @cfg {Array} [csvNumber=null] + * Sets the column key to be changed to a number form when converted to a CSV string. + */ + csvNumber?: any[], + + /** + * @cfg {Array} data + * Sets the initial row list of a table. + */ + data?: any[], + + /** + * @cfg {Boolean/Array} [colshow=false] + * Sets a column index shown when the Show/Hide Column menu is enabled. + */ + colshow?: boolean|any[], + + /** + * @cfg {Boolean} [scroll=false] + * Determines whether to use a table scroll. + */ + scroll?: boolean, + + /** + * @cfg {Integer} [scrollHeight=200] + * Sets the reference height of a body area when using a table scroll. + */ + scrollHeight?: number, + + /** + * @cfg {Integer} [width=0] + * Sets the area of a table. + */ + width?: number, + + /** + * @cfg {Boolean} [expand=false] + * Determines whether to use an extended row area. + */ + expand?: boolean, + + /** + * @cfg {Boolean} [expandEvent=true] + * Sets the Show/Hide state of an extended row area when clicking on a row. + */ + expandEvent?: boolean, + + /** + * @cfg {Boolean|Array} [editRow=false] + * Determines whether to use a modified row area. + */ + editRow?: boolean|any[], + + /** + * @cfg {Boolean} [editEvent=true] + * Sets the Show/Hide state of an extended row area when doubleclicking on a row/cell. + */ + editEvent?: boolean, + + /** + * @cfg {Boolean} [resize=false] + * Determines whether to use the column resizing function. + */ + resize?: boolean, + + /** + * @cfg {Boolean/Array} [sort=false] + * Determines whether to use the table sort function. + */ + sort?: boolean|any[], + + /** + * @cfg {Integer} [sortIndex=null] + * Determines whether to use the table sort function. + */ + sortIndex?: number, + + /** + * @cfg {String} [sortOrder="asc"] + * Determines whether to use the table sort function. + */ + sortOrder?: "asc"|"desc", + + /** + * @cfg {Boolean} [sortEvent=true] + * Determines whether to use the sort function when you click on a column. + */ + sortEvent?: boolean, + + /** + * @cfg {Boolean} [moveRow=false] + * Determines whether to use the move function when you fire row draggable event. + */ + moveRow?: boolean, + + }): this; + + root?: any; + + /** + * @method update + * Updates the list of rows or modifies the row at a specified index. + * + * @param {Array} rows + */ + update(indexOrRows?: any, rows?: any): void; + /** + * @method updateTree + * It is possible to configure a tree table using an object array with the index and data properties. + * + * @param {Array} rows + */ + updateTree(rows: any[]): void; + + /** + * @method append + * Add a row or a child row to at a specified index. + * + * @param {RowObject} row + */ + append(rowOrIndex?: number|any, row?: any): void; + + /** + * @method insert + * Adds a row at a specified index. + * + * @param {Integer} index + * @param {RowObject} row + */ + insert(index: number, dataList: {}): void; + + /** + * @method select + * Adds a selected class to a row at a specified index and gets an instance of the applicable row. + * + * @param {Integer} index + * @return {RowObject} row + */ + select(index: number): GridRow; + + /** + * @method unselect + * Removes a selected class from a selected row and gets an instance of the row in question. + * + * @return {RowObject} row + */ + unselect(): GridRow; + + /** + * @method check + * Add a checked class to a row at a specified index. + * + * @param {Integer} index + */ + check(index: number): void; + + /** + * @method uncheck + * Removes a checked class from a row at a specified index. + * + * @param {Integer} index + */ + uncheck(index: number): void; + + /** + * @method uncheckAll + * Removes checked classes from all rows. + */ + uncheckAll(): void; + + /** + * @method remove + * Remove a row at a specified index. + * + * @param {Integer} index + */ + remove(index: number): void; + + /** + * @method reset + * Removes all rows. + */ + reset(): void; + + /** + * @method move + * Moves a row iat a specified index to the target index. + * + * @param {Integer} index + * @param {Integer} targetIndex + */ + move(index: number, targetIndex: number): void; + + /** + * @method sort + * Moves a row iat a specified index to the target index. + * + * @param {Integer} index + * @param {String} order "asc" or "desc" + */ + sort(index: number, order: string, e?: any): void; + + /** + * @method scroll + * Sets the scroll based on the height of a table. + * + * @param {Integer} height + */ + scroll(height: number): void; + + /** + * @method open + * Shows a child row of a specified index. + * + * @param {Integer} index + */ + open(index: number): void; + + /** + * @method fold + * Hides a child row of a specified index. + * + * @param {Integer} index + */ + fold(index: number): void; + + /** + * @method openAll + * Shows all child rows of a specified index. + */ + openAll(): void; + + /** + * @method foldAll + * Hides all child rows of a specified index. + */ + foldAll(): void; + + /** + * @method resize + * Resets the inner scroll and columns of a table. + */ + resize(): void; + + /** + * @method resizeColumns + * Resets the sizes of all columns of a table. + */ + resizeColumns(): void; + + /** + * @method size + * Gets the size of all the rows of a table. + * + * @return {Integer} size + */ + size(): number; + + /** + * @method count + * Gets the number of trows of a table. + * + * @return {Integer} count + */ + count(): number; + + /** + * @method list + * Gets all the rows of a table. + * + * @return {Array} rows + */ + list(): GridRow[]; + + /** + * @method listData + * Gets the data of all the rows of a table. + * + * @return {Array} datas + */ + listData(): any[]; + + /** + * @method listAll + * Gets all the rows of a table including child rows. + * + * @return {Array} rows + */ + listAll(): GridRow[]; + + /** + * @method listChecked + * Gets all rows in a check state. + * + * @return {Array} rows + */ + listChecked(): GridRow[]; + + /** + * @method listColumn + * Gets all columns. + * + * @return {Array} columns + */ + listColumn(): GridColumn; + + /** + * @method get + * Gets the row at the specified index. + * + * @param {Integer} index + * @return {RowObject} row + */ + get(index: number): GridRow; + + /** + * @method getAll + * Gets all rows of at the specified index including child rows. + * + * @param {Integer} index + * @return {Array} rows + */ + getAll(index: number): GridRow[]; + + /** + * @method getColumn + * Gets the column at the specified index. + * + * @param {"Integer"/"String"} key index or column key + * @return {ColumnObject} column + */ + getColumn(index: number|string): GridColumn; + + /** + * @method showColumn + * Shows the column index (or column name). + * + * @param {"Integer"/"String"} key index or column name + */ + showColumn(index: number|string, e?: any): void; + + /** + * @method hideColumn + * Hides the column index (or column name). + * + * @param {"Integer"/"String"} key index or column name + */ + hideColumn(index: number|string, e?: any): void; + + /** + * @method initColumns + * It is possible to determine the index or name of the column to be shown in an array. + * + * @param {"Integer"/"String"} key index or column name + */ + initColumns(keys: any): void; + + /** + * @method showColumnMenu + * Shows the Show/Hide Column menu at specified coordinates. + * + * @param {Integer} x + * @param {Integer} y + */ + showColumnMenu(x: number, y: number): void; + + /** + * @method hideColumnMenu + * Hides the Show/Hide Column menu. + */ + hideColumnMenu(): void; + + /** + * @method toggleColumnMenu + * Shows or hides the Show/Hide Column menu. + * + * @param {Integer} x + * @param {Integer} y + */ + toggleColumnMenu(x: number, y: number): void; + + /** + * @method showExpand + * Shows the extended row area of a specified index. + * + * @param {Integer} index + */ + showExpand(index: number, obj?: any, e?: any): void; + + /** + * @method hideExpand + * Hides the extended row area of a specified index. + */ + hideExpand(e?: any): void; + + /** + * @method getExpand + * Get a row in which the extended area is currently activated. + * + * @return {RowObject} row + */ + getExpand(): GridRow; + + /** + * @method showEditRow + * Shows the modified row area of a specified index. + * + * @param {Integer} index + */ + showEditRow(index: number, e?: any): void; + + /** + * @method hideEditRow + * Hides the modified row area of a specified index. + */ + hideEditRow(data?: any): void; + + /** + * @method getEditRow + * Get a row in which the modified area is currently activated. + * + * @return {RowObject} row + */ + getEditRow(): GridRow; + + /** + * @method setCsv + * Updates a table using a CVS string. + */ + setCsv(csvOrKey: any, key?: any): void; + + /** + * @method setCsvFile + * Updates a table using a CVS file. + */ + setCsvFile(fileOrKey: any, key?: any): void; + + /** + * @method getCsv + * Gets the data of a table as a CSV string. + * + * @param {Boolean} isTree + * @return {String} csv + */ + getCsv(isTree: boolean): string; + + /** + * @method getCsvBase64 + * Gets the data of a table as a CSV string encoded as base64. + * + * @param {Boolean} isTree + * @return {String} base64 + */ + getCsvBase64(isTree: boolean): string; + + /** + * @method downloadCsv + * Downloads the data of a table as a CSV file. + * + * @param {String} name + * @param {Boolean} isTree + */ + downloadCsv(name: string, isTree: boolean): void; + + /** + * @method activeIndex + * Gets the index of a row that is activated in an extended/modified/selected state. + * + * @return {Integer} index + */ + activeIndex(): number; +} + +export interface GridXTable extends UIEvent { + (selector: any, options?: { + + }): this; + + render(isTree?: boolean): void; + + /** + * @method select + * Adds a selected class to a row at a specified index and gets an instance of the applicable row. + * + * @param {Integer} index + * @return {RowObject} row + */ + select(index: number): GridRow; + + /** + * @method unselect + * Removes a selected class from a selected row and gets an instance of the row in question. + * + * @return {RowObject} row + */ + unselect(): GridRow; + + /** + * @method update + * Updates the list of rows or modifies the row at a specified index. + * + * @param {Array} rows + */ + update(dataList: any[]): void; + + /** + * @method updateTree + * It is possible to configure a tree table using an object array with the index and data properties. + * + * @param {Array} rows + */ + updateTree(tree: any[]): void; + + /** + * @method append + * Add a row or a child row to at a specified index. + * + * @param {RowObject} row + * @param {RowObject} row + */ + append(index: number, data: {}): void; + /** + * @method open + * Shows a child row of a specified index. + * + * @param {Integer} index + */ + open(index: number|string): void; + + /** + * @method fold + * Hides a child row of a specified index. + * + * @param {Integer} index + */ + fold(index: number|string): void; + + /** + * @method openAll + * Shows all child rows of a specified index. + */ + openAll(index: number|string): void; + + /** + * @method foldAll + * Hides all child rows of a specified index. + */ + foldAll(index: number|string): void; + + /** + * @method next + * Changes to the next page. + */ + next(): void; + + /** + * @method page + * Changes to the page of at a specified index. + * + * @param {Integer} index + */ + page(pNo: number): void; + + /** + * @method sort + * Moves a row iat a specified index to the target index. + * + * @param {Integer} index + * @param {String} order "asc" or "desc" + */ + sort(index: number, order: "asc"|"desc", e?: any, isNotLoading?: any): void; + + /** + * @method filter + * Filters columns at a specified to locate rows that contain keywords in the cell value. + * + * @param {Function} callback + */ + filter(callback: (data: any) => void): void; + + /** + * @method rollback + * Returns filtered rows to the original state. + */ + rollback(): void; + + /** + * @method clear + * Remove all row elements. + */ + clear(): void; + + /** + * @method clear + * Remove all data + */ + reset(): void; + + /** + * @method resize + * Resets the inner scroll and columns of a table. + */ + resize(): void; + + /** + * @method scrollWidth + * Sets the scroll based on the width of a table. + * + * @param {Integer} width + */ + scrollWidth(scrollWidth: number, isInit?: boolean): void; + + /** + * @method scrollHeight + * Sets the scroll based on the height of a table. + * + * @param {Integer} height + */ + scrollHeight(h: number): void; + + /** + * @method scrollTop + * Sets the scroll based on the height of a table. + * + * @param {Integer|String} index + * @param {Integer} dist + */ + scrollTop(index: number|string, dist: number): void; + + /** + * @deprecated + * @method height + * Sets the scroll based on the height of a table. + * + * @param {Integer} height + */ + height(h: number): void; + + /** + * @method size + * Gets the size of all the rows of a table. + * + * @return {Integer} size + */ + size(): number; + + /** + * @method count + * Gets the number of trows of a table. + * + * @return {Integer} count + */ + count(): number; + + /** + * @method list + * Gets all the rows of a table. + * + * @return {Array} rows + */ + list(): GridRow[]; + + /** + * @method listColumn + * Gets all columns. + * + * @return {Array} columns + */ + listColumn(): GridColumn[]; + + /** + * @method listData + * Gets the data of all the rows of a table. + * + * @return {Array} datas + */ + listData(): any[]; + + /** + * @method get + * Gets the row at the specified index. + * + * @param {Integer|String} index + * @return {RowObject} row + */ + get(index: number): GridRow; + + getAll(index: number, _result?: any): GridRow[]; + + /** + * @method getColumn + * Gets the column at the specified index. + * + * @param {"Integer"/"String"} key index or column key + * @return {ColumnObject} column + */ + getColumn(index: number|string): GridColumn; + + /** + * @method getData + * Gets the data at the specified index. + * + * @param {"Integer"/"String"} key index + * @return {ColumnObject} data + */ + getData(index: number|string): any; + + /** + * @method showColumn + * Shows the column index (or column name). + * + * @param {"Integer"/"String"} key index or column name + */ + showColumn(index: number|string): void; + + /** + * @method hideColumn + * Hides the column index (or column name). + * + * @param {"Integer"/"String"} key index or column name + */ + hideColumn(index: number|string): void; + + /** + * @method initColumns + * It is possible to determine the index or name of the column to be shown in an array. + * + * @param {"Integer"/"String"} key index or column name + */ + initColumns(keys: number|string): void; + + /** + * @method showColumnMenu + * Shows the Show/Hide Column menu at specified coordinates. + * + * @param {Integer} x + * @param {Integer} y + */ + showColumnMenu(x: number, y: number): void; + + /** + * @method hideColumnMenu + * Hides the Show/Hide Column menu. + */ + hideColumnMenu(): void; + + /** + * @method toggleColumnMenu + * Shows or hides the Show/Hide Column menu. + * + * @param {Integer} x + * @param {Integer} y + */ + toggleColumnMenu(x: number, y: number): void; + + /** + * @method showExpand + * Shows the extended row area of a specified index. + * + * @param {Integer} index + */ + showExpand(index: number, obj: any): void; + + /** + * @method hideExpand + * Hides the extended row area of a specified index. + */ + hideExpand(index: number): void; + + /** + * @method getExpand + * Get a row in which the extended area is currently activated. + * + * @return {RowObject} row + */ + getExpand(): GridRow; + + /** + * @method showLoading + * Shows the loading screen for the specified delay time. + * + * @param {Integer} delay + */ + showLoading(delay: number): void; + + /** + * @method hideLoading + * Hides the loading screen. + */ + hideLoading(): void; + + /** + * @method setCsv + * Updates a table using a CVS string. + */ + setCsv(csv: string): void; + + /** + * @method setCsvFile + * Updates a table using a CVS file. + */ + setCsvFile(file: any): void; + + /** + * @method getCsv + * Gets the data of a table as a CSV string. + * + * @param {Boolean} isTree + * @return {String} csv + */ + getCsv(): string; + + /** + * @method getCsvBase64 + * Gets the data of a table as a CSV string encoded as base64. + * + * @param {Boolean} isTree + * @return {String} base64 + */ + getCsvBase64(): string; + + /** + * @method downloadCsv + * Downloads the data of a table as a CSV file. + * + * @param {String} name + * @param {Boolean} isTree + */ + downloadCsv(name: string): void; + + /** + * @method rowFunc + * Ir is possible to use a function for all row data applicable to the column (or column name) of a specified column (or column name). Currently only SUM and AVG are supported. + * + * @param {"sum"/"svg"} funcType + * @param {Integer} columnIndex + * @param {Function} callback + */ + rowFunc(type: "sum"|"avg", index: number, callback: (data: any) => void): any; + + /** + * @method getPage + * Gets the current page of a table. + * + * @return {Integer} page + */ + getPage(): number; + + /** + * @method activeIndex + * Gets the index of a row that is activated in an extended/modified/selected state. + * + * @return {Integer} index + */ + activeIndex(): number; +} diff --git a/jui-grid/jui-grid-tests.ts b/jui-grid/jui-grid-tests.ts new file mode 100644 index 0000000000..1d29dd059b --- /dev/null +++ b/jui-grid/jui-grid-tests.ts @@ -0,0 +1,182 @@ +/// + +import {jui} from 'jui-core'; +import {GridTable, GridXTable, GridRow} from "./index"; + + +jui.ready([ "grid.table" ], function(table: GridTable) { + let table_1: GridTable = table("#table_1", { + data: [ + { name: "Hong", age: "20", location: "Ilsan" }, + { name: "Jung", age: "30", location: "Seoul" }, + { name: "Park", age: "15", location: "Yeosu" }, + { name: "Kang", age: "32", location: "Seoul" }, + { name: "Song", age: "12", location: "Gwangju" }, + { name: "Yoon", age: "22", location: "Damyang" }, + { name: "Kim", age: "33", location: "Busan" }, + { name: "Hwang", age: "21", location: "Seoul" } + ] + }); + + table_1.scroll(100); +}); + +jui.ready([ "grid.table" ], function(table: GridTable) { + let table_3:GridTable = table("#table_3", { + event: { + expand: function(row: any, e: any): void { + $(row.list[0]).html(""); + }, + expandend: function(row: any, e: any): void { + $(row.list[0]).html(""); + } + }, + expand: true + }); + + table_3.update([ + { name: "Hong", age: "20", location: "Ilsan" }, + { name: "Jung", age: "30", location: "Seoul" }, + { name: "Park", age: "10", location: "Dangjin" } + ]); + + let table_3_submit: Function = function(index: number) { + var name = $(table_3.root).find(".name").val(), + age = $(table_3.root).find(".age").val(), + location = $(table_3.root).find(".location").val(); + + //noinspection TypeScriptValidateTypes + table_3.update(index, { name: name, age: age, location: location }); + table_3.hideExpand(); + } +}); + +jui.ready([ "grid.xtable" ], function(xtable: GridXTable) { + var page = 1; + + let xtable_2: GridXTable = xtable("#xtable_2", { + fields: [ "name", "age", "location" ], + resize: true, + sort: true, + buffer: "page", + bufferCount: 20 + }); + + let xtable_2_submit: Function = function() { + var result: any[] = []; + + for(var i = 0; i < 1000000; i++) { + result.push({ name: "Alvin" + i, age: Math.floor(Math.random() * 100) + 1, location: "LA" }); + } + + page = 1; + xtable_2.update(result); + xtable_2.resize(); + } + + let xtable_2_page: Function = function(no: number) { + page += no; + page = (page < 1) ? 1 : page; + xtable_2.page(page); + } +}); + + +jui.ready([ "grid.xtable" ], function(xtable: GridXTable) { + let xtable_4:GridXTable = xtable("#xtable_4", { + fields: [ "name", "age", "location" ], + data: [ + { name: "Hong", age: "20", location: "Ilsan" }, + { name: "Jung", age: "30", location: "Seoul" }, + { name: "Park", age: "10", location: "Dangjin" } + ], + resize: true, + sort: true, + buffer: "s-page", + bufferCount: 20 + }); + + let xtable_4_submit: Function = function(isMulti: boolean) { + if(isMulti) { + xtable_4.filter(function(data: any) { + if(data.age >= 30 || data.name.indexOf("ng") != -1) { + return true; + } + }); + } else { + xtable_4.filter(function(data: any) { + if(data.location.indexOf("eo") != -1) { + return true; + } + }); + } + } +}); + +jui.ready([ "grid.xtable" ], function(xtable: GridXTable) { + let xtable_6: GridXTable = xtable("#xtable_6", { + fields: [ "name", "age", "location" ], + resize: true, + sort: true, + width: 800, + scrollWidth: 600, + scrollHeight: 400, + rowHeight: 26, + buffer: "vscroll", + tpl: { + row: "", + none: "Data does not exist." + } + }); + + let xtable_6_submit: Function = function() { + var result: any[] = []; + + for(var i = 0; i < 1000000; i++) { + result.push({ name: "Alvin" + i, age: Math.floor(Math.random() * 100) + 1, location: "LA" }); + } + + xtable_6.update(result); + } +}); + +jui.ready([ "grid.xtable" ], function(xtable: GridXTable) { + let xtable_8: GridXTable = xtable("#xtable_8", { + fields: [ "url", "count" ], + resize: true, + buffer: "vscroll", + rowHeight: 27, + scrollHeight: 300, + tpl: { + row: $("#tpl_row").html(), + none: $("#tpl_none").html() + }, + event: { + select: function(row: GridRow, e:any) { + if(row.type == "fold") { + xtable_8.open(row.index); + } else { + xtable_8.fold(row.index); + } + } + } + }); + + xtable_8.updateTree([ + { index: "0", type: "open", data: { url: "/", count: 105 } }, + { index: "0.0", type: "fold", data: { url: "/css", count: 35 } }, + { index: "0.0.0", type: "fold", data: { url: "/index.css", count: 15 } }, + { index: "0.0.1", type: "fold", data: { url: "/layout.css", count: 15 } }, + { index: "0.0.2", type: "fold", data: { url: "/login.css", count: 5 } }, + { index: "0.1", type: "fold", data: { url: "/js", count: 35 } }, + { index: "0.1.0", type: "fold", data: { url: "/index.js", count: 23 } }, + { index: "0.1.1", type: "fold", data: { url: "/jquery.js", count: 12 } }, + { index: "0.2", type: "fold", data: { url: "/img", count: 0 } }, + { index: "0.2.0", type: "fold", data: { url: "logo.ico", count: 0 } }, + { index: "0.3", type: "fold", data: { url: "/main.jsp", count: 10 } }, + { index: "0.4", type: "fold", data: { url: "/login.jsp", count: 10 } }, + { index: "0.5", type: "fold", data: { url: "/sitemap.xml", count: 10 } }, + { index: "0.6", type: "fold", data: { url: "/package.json", count: 5 } } + ]); + +}); diff --git a/jui-grid/tsconfig.json b/jui-grid/tsconfig.json new file mode 100644 index 0000000000..8ae735866e --- /dev/null +++ b/jui-grid/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jui-grid-tests.ts" + ] +} diff --git a/jui-grid/tslint.json b/jui-grid/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/jui-grid/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/jui/index.d.ts b/jui/index.d.ts new file mode 100644 index 0000000000..c1dec57e39 --- /dev/null +++ b/jui/index.d.ts @@ -0,0 +1,1380 @@ +// Type definitions for jui 2.0 +// Project: https://github.com/juijs/jui#readme +// Definitions by: Jin-Ho Park +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import {UIEvent} from 'jui-core'; + +export interface UIAccordion extends UIEvent { + + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {Integer} [index=null] + * Sets an enabled node + */ + index?: number, + + /** + * @cfg {Boolean} [autoFold=false] + * When you click on a node, the node folding + */ + autoFold?: boolean, + + /** + * @cfg {Boolean} [multipanel=false] + * + */ + multipanel?: boolean + }) : this; + + /** + * @method activeIndex + * Gets the index of the currently enabled node + * + * @return {Integer} Index + */ + activeIndex(): number; +} + +export interface UIAutoComplete { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {String/DOMElement} [target=null] + * Designates a target selector when an autofill route is not a target + */ + target?: any, + + /** + * @cfg {Array} words + * Designates words subject to autofill + */ + words?: string[] + }) : this; + + /** + * @method update + * Updates words subject to autofill + * + * @param {Array} words + * + */ + update(newWords: string[]): void; + + /** + * @method close + * Close the active drop-down + * + */ + close(): void; + + /** + * @method list + * Gets filtered words subject to autofill + * + * @return {Array} words + */ + list(): string[]; +} + +export interface UIColorPicker { + (selector: any, options?: { + tpl?: any, + event?: any, + type?: string, + color?: string + }) : this; + + getColor(type: string): string|{}; + + setColor(value: string|{}): void; + +} + + +export interface UICombo { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {Integer} [index=0] + * Determines an initial selection button with a specified index + */ + index?: number, + + /** + * @cfg {String} [value=0] + * Determines an initial selection button with a specified value + */ + value?: string, + + /** + * @cfg {Integer} [width=0] + * Determines the horizontal size of a combo box + */ + width?: number, + + /** + * @cfg {Integer} [height=100] + * Determines an initial selection button with a specified value + */ + height?: number, + + /** + * @cfg {Boolean} [keydown=false] + * It is possible to select a node using the keyboard + */ + keydown?: boolean, + + /** + * @cfg {"top"/"bottom"} [position="bottom"] + * It is possible to determine an initial selection button with a specified value + */ + position?: "top"|"bottom", + + /** + * @cfg {Boolean} [flex=true] + * Drop-down menu is varied by changing the width function + */ + flex?: boolean + }) : this; + + /** + * @method setIndex + * Selects a button of a specified index + * + * @param {Number} index + */ + setIndex(index: number): void; + + /** + * @method setValue + * Selects a button having a specified value + * + * @param {Mixed} value + */ + setValue(value: any): void; + + /** + * @method getData + * Gets the data of the button currently selected + * + * @return {Object} + */ + getData(): {}; + + /** + * @method getValue + * Gets the value of the button currently selected + * + * @return {Mixed} + */ + getValue(): any; + + /** + * @method getText + * Gets the markup text of the button currently selected + * + * @return {String} + */ + getText(): string; + + /** + * @method open + * Shows the element list of a combo box + */ + open(e: any): void; + + /** + * @method fold + * Hides the element list of a combo box + */ + fold(): void; + + /** + * @method reload + * Re-defines a combo box + */ + reload(): void; +} + + +export interface UIDatePicker { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {"daily"/"monthly"/"yearly"} [type="daily"] + * Determines the type of a calendar + */ + type?: "daily"|"monthly"|"yearly", + + /** + * @cfg {String} [titleFormat="yyyy.MM"] + * Title format of a calendar + */ + titleFormat?: string, + + /** + * @cfg {String} [format="yyyy-MM-dd"] + * Format of the date handed over when selecting a specific date + */ + format?: string, + + /** + * @cfg {Date} [date="now"] + * Selects a specific date as a basic + */ + date?: "now"|Date, + + /** + * @cfg {Date} [minDate="null"] + * Selects a specific minimum date + */ + minDate?: Date, + + /** + * @cfg {Date} [maxDate="null"] + * Selects a specific maximum date + */ + maxDate?: Date + }) : this; + + /** + * @method page + * Outputs a calendar that fits the year/month entered + * + * @param {Integer} year + * @param {Integer} month + */ + page(y: number, m: number): void; + + /** + * @method prev + * Outputs a calendar that fits the previous year/month + * + */ + prev(e: any, moveYear?: boolean): void; + + /** + * @method next + * Outputs a calendar that fits the next year/month + * + */ + next(e: any, moveYear?: boolean): void; + + /** + * @method select + * Selects today if there is no value, or selects a date applicable to a timestamp or year/month/date + * + * @param {"year"/"month"/"date"/"timestamp"/"Date"} + */ + select( ...args: any[]): void; + + /** + * @method addTime + * Selects a date corresponding to the time added to the currently selected date + * + * @param {"Integer"/"Date"} time Timestamp or Date + */ + addTime(time: number|Date): void; + + /** + * @method getDate + * Gets the value of the date currently selected + * + * @return {Date} Date object + */ + getDate(): Date; + + /** + * @method getTime + * Gets the timestamp value of the date currently selected + * + * @return {Integer} Timestamp + */ + getTime(): number; + + /** + * @method getFormat + * Gets a date string that fits the format entered + * + * @return {String} format Formatted date string + */ + getFormat(format: string): string; + + /** + * @method reload + * Reloads the datepicker + */ + reload(): void; +} + +export interface UIDropdown { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {Boolean} [close=true] + * Closes the Auto when clicking on the dropdown list + */ + close?: boolean, + + /** + * @cfg {Boolean} [keydown=false] + * It is possible to choose anything on the dropdown list with the arrow keys on the keyboard + */ + keydown?: boolean, + + /** + * @cfg {Integer} [left=0] + * Sets the X coordinate of the dropdown list + */ + left?: number, + + /** + * @cfg {Integer} [top=0] + * Sets the Y coordinate of the dropdown list + */ + top?: number, + + /** + * @cfg {Integer} [width=0] + * Determines the horizontal size of a dropdown list + */ + width?: number, + + /** + * @cfg {Integer} [height=0] + * Determines the vertical size of a dropdown list + */ + height?: number, + + /** + * @cfg {Array} nodes + * Sets a dropdown list to data rather than markup + */ + nodes?: any[] + }): this; + + /** + * @method update + * Changes the dropdown list + * + * @param {Array} nodes Dropdown list + */ + update(nodes: any[]): void; + + /** + * @method hide + * Hides the dropdown + */ + hide(): void; + + /** + * @method show + * Shows a dropdown at the specified coordinates + * + * @param {Integer} x + * @param {Integer} y + */ + show(x: number, y: number): void; + + /** + * @method move + * Moves a dropdown to the specified coordinates + * + * @param {Integer} x + * @param {Integer} y + */ + move(x: number, y: number): void; + + /** + * @method reload + * Reloads the dropdown list + */ + reload(): void; +} + + +export interface UIModal { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {"black"/"gray"} [color="black"] + * Determines the color of a modal + */ + color?: "black"|"gray", + + /** + * @cfg {Float} [opacity=0.4] + * Sets the transparency of a modal + */ + opacity?: number, + + /** + * @cfg {String/DOMElement} [target="body"] + * Sets a selector on which a modal is shown + */ + target?: string|any, + + /** + * @cfg {Integer} [index=0] + * Determines the sequence (index) of a modal + */ + index?: number, + + /** + * @cfg {Boolean} [clone=false] + * Copies an existing modal and shows it + */ + clone?: boolean, + + /** + * @cfg {Boolean} [autoHide=true] + * Automatically hides a modal when clicking on it + */ + autoHide?: boolean + }): this; + + /** + * @method hide + * Hides a modal + */ + hide(): void; + + /** + * @method show + * Shows a modal + */ + show(): void; + + /** + * @method resize + * Re-adjust the location of a modal + */ + resize(): void; +} + + +export interface UINotify { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {"top"/"top-lefet"/"top-right"/"bottom"/"bottom-left"/"bottom-right"} [position="top-right"] + * Designates the location where a notice message is added + */ + position?: "top"|"top-lefet"|"top-right"|"bottom"|"bottom-left"|"bottom-right", + + /** + * @cfg {Integer} [padding=12] + * Determines the margin value of a notice message (the margin value may be in object form rather than a numeric value) + */ + padding?: number, + + /** + * @cfg {Integer} [distance=5] + * Determines each margin value when there are multiple notice messages + */ + distance?: number, + + /** + * @cfg {Integer} [timeout=3000] + * Determines the duration for which a notice message is displayed (the message does not disappear when the value is 0) + */ + timeout?: number, + + /** + * @cfg {Integer} [showDuration=500] + * Determines the duration of an effect when a notice message is shown + */ + showDuration?: number, + + /** + * @cfg {Integer} [hideDuration=500] + * Determines the duration of an effect when a notice message disappears + */ + hideDuration?: number, + + /** + * @cfg {String} [showEasing="swing"] + * Determines an effect when a notice message is shown (see CSS3 specifications) + */ + showEasing?: string, + + /** + * @cfg {String} [hideEasing="linear"] + * Determines an effect when a notice message disappears (see CSS3 specifications) + */ + hideEasing?: string + }): this; + + /** + * @method add + * Adds a notice message. The value passed is the data object shown by the notice template + * + * @param {Object} data + * @param {Integer} timeout + */ + add(data: {}, timeout: number): void; + + /** + * @method reset + * Removes all notice messages that are enabled + */ + reset(): void; +} + +export interface UIPaging { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {Integer} [count=0] + * Total number of data records subject to paging) + */ + count?: number, + + /** + * @cfg {Integer} [pageCount=10] + * Number of data records per page + */ + pageCount?: number, + + /** + * @cfg {Integer} [screenCount=5] + * Number of pages shown on the paging screen + */ + screenCount?: number + }): this; + + /** + * @method reload + * Reloads the number of specified data records, or reloads the initially configured number of data records if there is no parameter + * + * @param {Integer} count Data total count + */ + reload(count: number): void; + + /** + * @method page + * Changes to a specified page number, and gets the currently enabled page number if there is no parameter + * + * @param {Integer} pNo Page number + */ + page(pNo: number): void; + + /** + * @method next + * Changes to the next page + */ + next(): void; + + /** + * @method prev + * Changes to the previous page + */ + prev(): void; + + /** + * @method first + * Changes to the first page + */ + first(): void; + + /** + * @method last + * Changes to the last page + */ + last(): void; +} + +export interface UIProgress { + (selector: any, options?: { + tpl?: any, + event?: any, + type?: "simple" | "flat", // simple or flat + orient?: "horizontal"|"vertical", // or vertical, + min?: number, + max?: number, + value?: number, + striped?: boolean, // or true + animated?: boolean // or true + }): this; + + setAnimated(isAnimated: boolean): void; + setStriped(isStriped: boolean): void; + setValue(v: number): void; + getValue(): number; + +} + +export interface UIProperty { + (selector: any, options?: { + tpl?: any, + event?: any, + sort?: string, // name, group, type + viewport?: string, + items?: any[] + }): this; + + loadItems(newItems: any[]): void; + + addItem(item: {}|any[]): void; + + // remove item by key or title + removeItem(item: {}): void; + + /** + * @method getGroupList + * + * get a list of group's title. + */ + getGroupList(): any[]; + + /** + * @method collapsed + * + * collapse group's children + * + * @param {String} id + */ + collapsed(id: string): void; + + /** + * @method expanded + * + * expand group's children + * + * @param {String} id + */ + expanded(id: string): void; + + /** + * @method getValue + * + * get a list of property's value + * + * @param {String} [key=null] if key is null, value is all properties. + */ + getValue(key?: string): {} | any[]; + + getDefaultValue(): any[]; + + initValue(obj: {}): void; + + /** + * @method getValue + * + * set a list of property's value + * + * @param {Object} obj + */ + setValue(obj: {}): void; + + findRender(key: string): any; + findItem(key: string): any; + updateValue(key: string, value: any): void; + getAllValue(key: string): any; + refreshValue($dom: any, newValue: any): void; +} + +export interface UISelect { + (selector: any, options?: { + tpl?: any, + event?: any, + items?: any[], + placeholder?: string, + align?: 'left'|'right', + valign?: 'top'|'bottom', + multi?: boolean + }): this; + + setValue(value: any|any[]): void; + getValue(): any| any[]; + setSelectedIndex(index: number): void; + getSelectedIndex(): number; + update(data: any[]): void; +} + +export interface UISlider { + (selector: any, options?: { + tpl?: any, + event?: any, + type?: "single"|"double", // or double + orient?: "horizontal"|"vertical", // or vertical, + min?: number, + max?: number, + step?: number, + from?: number, + to?: number, + tooltip?: boolean, + format?: string, + progress?: boolean + + }): this; + + /** + * @method setFromValue + * set FromHandle's value + * + * @param {Number} + */ + setFromValue(value: number): void; + + /** + * @method setToValue + * set ToHandle's value + * + * @param {Number} + */ + setToValue(value: number): void; + + /** + * @method getFromValue + * get FromHandle's value + * + * @return {Number} value + */ + getFromValue(): number; + + /** + * @method getToValue + * get ToHandle's value + * + * @return {Number} value + */ + getToValue(): number; + +} + + +export interface UISplitter { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {String} [splitterClass='ui-splitter'] + * set splitter's class for design + */ + splitterClass?: string, + + /** + * @cfg {String} [hideClass='hide'] + * set splitter's hide class for design + */ + hideClass?: string, + + /** + * @cfg {Number} [barSize=4] + * set splitter's bar size + */ + barSize?: number, + + /** + * @cfg {Object} [barStyle={}] + * set custom splitter bar style + */ + barStyle?: {}, + + /** + * @cfg {"vertical"/"horizontal"} [direction='vertical'] + * set bar's direction + */ + direction?: 'vertical'|'horizontal', + + /** + * @cfg {String/Number} [initSize='50%'] + * set first panel's default width or height + */ + initSize?: string|number, + + /** + * @cfg {Number/Array} [minSize=30] + * set panel's minimum width or height + * + * if minSize is number , minSize is conver to array + * + * minSize[0] is first panel's minimum size + * minSize[1] is second panel's minimum size + * + */ + minSize?: number|number[], + + /** + * @cfg {String} [items=[]] + * + * set items to placed in vertical or horizontal + * + * support max two times + * + */ + items?: any[], + + /** + * @cfg {Boolean} [fixed=false] + * + * if fixed is true, panels can not resize. + * + */ + fixed?: boolean + }): this; + + setDirection(d: 'horizontal' | 'vertical'): void; + + setInitSize(size: number): void; + setHide(index: number): void; + setShow(index: number): void; + toggle(index: number): void; +} + +export interface UISwitch { + (selector: any, options?: { + tpl?: any, + event?: any, + checked?: boolean, + toggleEvent?: string + }): this; + + getValue(): boolean; + + setValue(value: boolean): void; + + toggle(): void; +} + +export interface UITab { + + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {String/DOMElement} [target=""] + * Determines a selector in the area to become the content of a tab + */ + target?: string|any, + + /** + * @cfg {Integer} [index=0] + * Sets an enabled tab + */ + index?: number, + + /** + * @cfg {Boolean} [drag=false] + * Changes the tab location through dragging + */ + drag?: boolean, + + /** + * @cfg {Array} nodes + * Sets a tab list to data rather than markup + */ + nodes?: any[] + }): this; + /** + * @method update + * Changes the tab list + * + * @param {Array} nodes + */ + update(nodes: any[]): void; + + /** + * @method insert + * Adds a tab at a specified index + * + * @param {Integer} index + * @param {Object} node + */ + insert(index: number, node: {}): void; + + /** + * @method append + * Adds a tab to the last node + * + * @param {Object} node + */ + append(node: {}): void; + + /** + * @method prepend + * Adds a tab to the first node + * + * @param {Object} node + */ + prepend(node: {}): void; + + /** + * @method remove + * Removes a tab at a specified index + * + * @param {Integer} index + */ + remove(index: number): void; + + /** + * @method move + * Changes a specified tab to a tab at a target index + * + * @param {Integer} index + * @param {Integer} targetIndex + */ + move(index: number, targetIndex: number): void; + + /** + * @method show + * Enables the tab at a specified index + * + * @param {Integer} index + */ + show(index: number): void; + + /** + * @method enable + * Enables the tab at a specified index + * + * @param {Integer} index + */ + enable(index: number): void; + + /** + * @method disable + * Disables the tab at a specified index + * + * @param {Integer} index + */ + disable(index: number): void; + + /** + * @method activeIndex + * Gets the index of the currently enabled tab + * + * @return {Integer} + */ + activeIndex(): number; +} + +export interface UITooltip { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {String} [color="black"] + * Determines the color of a tooltip + */ + color?: string, + + /** + * @cfg {"top"/"bottom"/"left"/"right"} [position="top"] + * Determines the location where a tooltip is shown + */ + position?: "top"|"bottom"|"left"|"right", + + /** + * @cfg {Integer} [width=150] + * Determines the horizontal size of a tooltip + */ + width?: number, + + /** + * @cfg {"left"/"right"/"center"} [align="left"] + * Determines the alignment state inside a tooltip + */ + align?: "left"|"right"|"center", + + /** + * @cfg {Integer} [delay=0] + * Determines the event time when a tooltip is shown + */ + delay?: number, + + /** + * @cfg {String} [showType="mouseover"] + * Determines the type of event that triggers a tooltip + */ + showType?: string, + + /** + * @cfg {String} [hideType="mouseout"] + * Determines the type of event that hides a tooltip + */ + hideType?: string, + + /** + * @cfg {String} [title=""] + * Sets the content of a tooltip (referring to the title properties in markup) + */ + title?: string, + + }): this; + + /** + * @method update + * Changes the content of a tooltip + * + * @param {String} text + */ + update(newTitle: string): void; +} + +export interface UITreeNode { + /** @property {Array} [data=null] Data of a specifiednode */ + data?: any[]; + + /** @property {HTMLElement} [element=null] LI element of a specified node */ + element?: any; + + /** @property {Integer} [index=null] Index of a specified node */ + index?: number; + + /** @property {Integer} [nodenum=null] Unique number of a specifiede node at the current depth */ + nodenum?: number; + + /** @property {ui.tree.node} [parent=null] Variable that refers to the parent of the current node */ + parent?: UITreeNode; + + /** @property {Array} [children=null] List of child nodes of a specified node */ + children?: UITreeNode[]; + + /** @property {Integer} [depth=0] Depth of a specified node */ + depth?: number; + + /** @property {String} [type='open'] State value that indicates whether a child node is shown or hidden */ + type?: string; +} + +export interface UITreeBase { + appendNode(...args: any[]): UITreeNode; + insertNode(index: string, data: any): UITreeNode; + updateNode(index: string, data: any): UITreeNode; + removeNode(index: string): void; + removeNodes(): void; + openNode(index: string): void; + foldNode(index: string): void; + openNodeAll(index: string): void; + foldNodeAll(index: string): void; + + moveNode(index: string, targetIndex: number): void; + + getNode(index: string): UITreeNode; + + getNodeAll(index: string): UITreeNode[]; + + getNodeParent(index: string): UITreeNode; + + getRoot(): UITreeNode; +} + +export interface UITree { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {NodeObject} [root=null] + * Adds a root node (required). + */ + root?: UITreeNode, + + /** + * @cfg {Boolean} [rootHide=false] + * Hides a root node. + */ + rootHide?: boolean, + + /** + * @cfg {Boolean} [rootFold=false] + * Folds up a root node. + */ + rootFold?: boolean, + + /** + * @cfg {Boolean} [drag=false] + * It is possible to drag the movement of a node. + */ + drag?: boolean, + + /** + * @cfg {Boolean} [dragChild=true] + * It is possible to drag the node movement but the node is not changed to a child node of the target node. + */ + dragChild?: boolean + }): this; + + /** + * @method update + * Changes to the node at a specified index. + * + * @param {String} index + * @param {Array} data + */ + update(index: string, data: any[]): void; + + /** + * @method append + * Adds to a child node at a specified index. + * + * @param {Array/String} param1 index or data + * @param {Array} param2 null or data + */ + append(...args: any[]): void; + + /** + * @method insert + * Adds a node at a specified index. + * + * @param {String} index + * @param {Array} data + */ + insert(index: string, data: any[]): void; + + /** + * @method select + * Adds a node at a specified index. + * + * @param {String} index + * @return {NodeObject} node + */ + select(index: string): UITreeNode; + + /** + * @method unselect + * Removes the 'active' class from a selected node and gets an instance of the specified node. + */ + unselect(): void; + + /** + * @method remove + * Deletes a node at a specified index. + * + * @param {String} index + */ + remove(index: string): void; + /** + * @method reset + * Deletes all child nodes except for a root. + */ + reset(): void; + + /** + * @method move + * Moves a node at a specified index to the target index. + * + * @param {String} index + * @param {String} targetIndex + */ + move(index: string, targetIndex: string): void; + /** + * @method open + * Shows a child node at a specified index. + * + * @param {String} index + */ + open(index: string, e: any): void; + + /** + * @method fold + * Folds up a child node at a specified index. + * + * @param {String} index + */ + fold(index: string, e: any): void; + /** + * @method openAll + * Shows all child nodes at a specified index. + * + * @param {String} index + */ + openAll(index: string): void; + + /** + * @method foldAll + * Folds up all child nodes at a specified index. + * + * @param {String} index + */ + foldAll(index: string): void; + + /** + * @method list + * Return all nodes of the root. + * + * @return {Array} nodes + */ + list(): UITreeNode[]; + + /** + * @method listAll + * Returns all child nodes. + * + * @return {Array} nodes + */ + listAll(): UITreeNode[]; + + /** + * @method listParent + * Returns all parent nodes at a specified index. + * + * @param {String} index + * @return {Array} nodes + */ + listParents(index: string): UITreeNode[]; + + /** + * @method get + * Gets a node at a specified index + * + * @param {String} index + * @return {NodeObject} node + */ + get(index: string): UITreeNode; + + /** + * @method getAll + * Gets all nodes at a specified index including child nodes. + * + * @param {String} index + * @return {Array} nodes + */ + getAll(index: string): UITreeNode[]; + + /** + * @method activeIndex + * Gets the index of a node that is activated in an active state. + * + * @return {Integer} index + */ + activeIndex(): number; +} + +export interface UIWindow { + (selector: any, options?: { + tpl?: any, + event?: any, + /** + * @cfg {Integer} [width=400] + * Determines the horizontal size of a window + */ + width?: number, + + /** + * @cfg {Integer} [height=300] + * Determines the height of a window + */ + height?: number, + + /** + * @cfg {String/Integer} [left="auto"] + * Determines the X coordinate of a window + */ + left?: string|number, + + /** + * @cfg {String/Integer} [top="auto"] + * Determines the Y coordinate of a window + */ + top?: string|number, + + /** + * @cfg {String/Integer} [right="auto"] + * Determines the X coordinate based on the right side of a window + */ + right?: string|number, + + /** + * @cfg {String/Integer} [bottom="auto"] + * Determines the Y coordinate based on the bottom side of a window + */ + bottom?: string|number, + + /** + * @cfg {Boolean} [modal=false] + * Applies a modal UI to a window + */ + modal?: boolean, + + /** + * @cfg {Boolean} [move=true] + * It is possible to move a window + */ + move?: boolean, + + /** + * @cfg {Boolean} [resize=true] + * It is possible to resize a window + */ + resize?: boolean, + + /** + * @cfg {Integer} [modalIndex=0] + * Determines the z-index property of a modal UI + */ + modalIndex?: number + }): this; + + /** + * @method hide + * Hides a window + */ + hide(): void; + + /** + * @method show + * Shows a window at specified coordinates + * + * @param {Integer} x + * @param {Integer} y + */ + show(x: number, y: number): void; + + /** + * @method move + * Moves a window at specified coordinates + * + * @param {Integer} x + * @param {Integer} y + */ + move(x: number, y: number): void; + + /** + * @method update + * Changes the markup in the body area of a window + * + * @param {String} html + */ + update(html: string): void; + + /** + * @method setTitle + * Changes the markup of the title tag in the head area of a window + * + * @param {String} title + */ + setTitle(html: string): void; + + /** + * @method setSize + * Changes the horizontal/vertical size of a window + * + * @param {Integer} width + * @param {Integer} height + */ + setSize(w: number, h: number): void; + + /** + * @method resize + * Designates a scroll area if there is a lot of content in the window body area + */ + resize(): void; + + /** + * @method resizeModal + * Re-adjust the location of a modal window + */ + resizeModal(): void; +} diff --git a/jui/jui-tests.ts b/jui/jui-tests.ts new file mode 100644 index 0000000000..5bee2fdc2e --- /dev/null +++ b/jui/jui-tests.ts @@ -0,0 +1,124 @@ +/// + +import {jui} from 'jui-core'; +import { + UIAccordion, UIAutoComplete, UIColorPicker, UICombo, UIDatePicker, UIDropdown, UIModal, UINotify, + UIPaging, UIProgress, UIProperty, UISelect +} from 'jui'; + +jui.ready([ + 'ui.accordion', + 'ui.autocomplete', + 'ui.colorpicker', + 'ui.combo', + 'ui.datepicker', + 'ui.dropdown', + 'ui.modal', + 'ui.notify', + 'ui.paging', + 'ui.progress', + 'ui.property', + 'ui.select' +], function ( + accordion: UIAccordion, + autocomplete: UIAutoComplete, + colorpicker: UIColorPicker, + combo: UICombo, + datepicker: UIDatePicker, + dropdown: UIDropdown, + modal: UIModal, + notify: UINotify, + paging: UIPaging, + progress: UIProgress, + property: UIProperty, + select: UISelect +) { + let a: UIAccordion = accordion("#test", { + multipanel: false + }); + + console.log(a.activeIndex()); + + let autoComplete: UIAutoComplete = autocomplete("#test", { + words : [] + }); + + autoComplete.update([]); + + let colorPicker: UIColorPicker = colorpicker("#test", { + color: '#FFFF00' + }); + + console.log(colorPicker.getColor('hex')); + + let comboInstance: UICombo = combo("#test", { + keydown: true + }) + + console.log(comboInstance.getValue()); + + let datePicker: UIDatePicker = datepicker("#test", { + type: "daily" + }); + + datePicker.select(Date.now()); + + datePicker.select(2016, 1, 2); + + datePicker.select(new Date()); + + let dropdownInstance: UIDropdown = dropdown("#test", { + width: 100 + }) + + dropdownInstance.update([]); + + dropdownInstance.hide(); + + dropdownInstance.reload(); + + let m : UIModal = modal("#test", {autoHide: true}); + + m.show(); + + let n: UINotify = notify("#test"); + + n.add({ title: "Caution message Send!!!", message: "Feb 15, 2013-12-24 02:24:19", color: 'warning' }, 1000); + n.add({ title: "Caution message Send!!!", message: "Feb 15, 2013-12-24 02:24:19", color: 'success' }, 1000); + n.reset(); + + let p: UIPaging = paging("#test", { count :100, pageCount : 5 }); + + p.first(); + p.last(); + p.next(); + p.prev(); + p.page(10); + + let prog: UIProgress = progress("#test", { striped: true }); + + console.log(prog.getValue()); + + prog.setValue(100); + + let propertyView: UIProperty = property("#test", { + items : [ + { type : 'group', title : 'Sample Category'}, + { type : 'text', title : 'Category Name', key: 'sample-category-name', value : 'test'} + ] + }) + + console.log(propertyView.getValue()); + + let selectInstance: UISelect = select("#test", { + items : [ + { type : 'item', value : '0', text : 'first', html : '
test
', selected : true }, + { type : 'divider' } + ], + multi: true, + placeholder: 'Sample Select' + }); + + console.log(selectInstance.getValue()); + +}); diff --git a/jui/tsconfig.json b/jui/tsconfig.json new file mode 100644 index 0000000000..eb0b75ceb8 --- /dev/null +++ b/jui/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jui-tests.ts" + ] +} diff --git a/jui/tslint.json b/jui/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/jui/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" }