added type definitions for gijgo 1.8.2

This commit is contained in:
Atanas Atanasov
2018-03-09 18:04:20 +02:00
parent fe94393d6a
commit 1dc108cc75

298
types/gijgo/index.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for Gijgo v0.6.2
// Type definitions for Gijgo v1.8.2
// Project: http://gijgo.com
// Definitions by: Atanas Atanasov <https://github.com/atatanasov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -10,23 +10,28 @@ declare module Gijgo {
interface GridPager {
limit?: number;
sizes?: Array<number>;
leftControls?: any;
rightControls?: any;
leftControls?: Array<any>;
rightControls?: Array<any>;
}
interface GridColumn {
align?: string;
cssClass?: string;
decimalDigits?: number;
editField?: string;
editor?: any;
events?: any;
field?: string;
filter?: any;
filterable?: boolean;
format?: string;
headerCssClass?: string;
hidden?: boolean;
icon?: string;
minWidth?: number;
mode?: string;
priority?: number;
renderer?: any;
sortable?: boolean;
stopPropagation?: boolean;
title?: string;
@@ -36,11 +41,13 @@ declare module Gijgo {
width?: number;
}
interface GridDefaultParams {
interface GridParamNames {
direction?: string;
limit?: string;
page?: string;
sortBy?: string;
groupBy?: string;
groupByDirection?: string;
}
interface GridMapping {
@@ -48,24 +55,62 @@ declare module Gijgo {
totalRecordsField?: string;
}
interface GridIcons {
expandRow?: string;
collapseRow?: string;
expandGroup?: string;
collapseGroup?: string;
}
interface GridGrouping {
groupBy: string;
}
interface GridHeaderFilter {
type: string;
}
interface GridInlineEditing {
mode?: string;
managementColumn?: boolean;
}
interface GridOptimisticPersistence {
localStorage: Array<string>;
sessionStorage: Array<string>;
}
interface GridSettings<Entity> {
//Configuration options
autoGenerateColumns?: boolean;
autoLoad?: boolean;
columnReorder?: boolean;
columns?: Array<GridColumn>;
dataSource?: any;
defaultColumnSettings?: GridColumn;
defaultParams?: GridDefaultParams;
detailTemplate?: string;
fixedHeader?: boolean;
fontSize?: string;
mapping?: string;
grouping?: GridGrouping;
headerFilter?: GridHeaderFilter;
icons?: GridIcons;
iconsLibrary?: string;
inlineEditing?: GridInlineEditing;
keepExpandedRows?: boolean;
locale?: string;
mapping?: any;
minWidth?: number;
notFoundText?: string;
optimisticPersistence?: GridOptimisticPersistence;
orderNumberField?: string;
pager?: GridPager;
paramNames?: GridParamNames;
primaryKey?: string;
resizableColumns?: boolean;
resizeCheckInterval?: number;
responsive?: boolean;
rowReorder?: boolean;
rowReorderColumn?: string;
selectionMethod?: string;
selectionType?: string;
showHiddenColumnsAsDetails?: boolean;
@@ -83,14 +128,16 @@ declare module Gijgo {
columnShow?: (e: any, column: GridColumn) => any;
dataBinding?: (e: any, records: Array<Entity>) => any;
dataBound?: (e: any, records: Array<Entity>, totalRecords: number) => any;
dataFiltered?: (e: any, records: Array<Entity>) => any;
destroying?: (e: any) => any;
detailCollapse?: (e: any, detailWrapper: JQuery, record: Entity) => any;
detailExpand?: (e: any, detailWrapper: JQuery, record: Entity) => any;
detailCollapse?: (e: any, detailWrapper: JQuery, id: string) => any;
detailExpand?: (e: any, detailWrapper: JQuery, id: string) => any;
initialized?: (e: any) => any;
pageChanging?: (e: any, newPage: number) => any;
pageSizeChange?: (e: any, newPage: number) => any;
resize?: (e: any, newWidth: number, oldWidth: number) => any;
rowDataBound?: (e: any, $row: JQuery, id: string, record: Entity) => any;
rowDataChanged?: (e: any, id: string, record: Entity) => any;
rowRemoving?: (e: any, $row: JQuery, id: string, record: Entity) => any;
rowSelect?: (e: any, $row: JQuery, id: string, record: Entity) => any;
rowUnselect?: (e: any, $row: JQuery, id: string, record: Entity) => any;
@@ -98,17 +145,23 @@ declare module Gijgo {
interface Grid<Entity, Params> extends JQuery {
addRow(record: Entity): Grid<Entity, Params>;
cancel(id: string): Grid<Entity, Params>;
clear(showNotFoundText?: boolean): Grid<Entity, Params>;
collapseAll(): Grid<Entity, Params>;
count(): number;
destroy(keepTableTag?: boolean, keepWrapperTag?: boolean): void;
downloadCSV(filename?: string, includeAllRecords?: boolean): Grid<Entity, Params>;
edit(id: string): Grid<Entity, Params>;
expandAll(): Grid<Entity, Params>;
//get(position: number): Entity; //TODO: rename to getByPosition to avoid conflicts with jquery.get
getAll(): Array<Entity>;
getById(id: string): Entity;
getChanges(): Array<Entity>;
getCSV(includeAllRecords?: boolean): string;
getSelected(): string;
getSelections(): Array<string>;
hideColumn(field: string): Grid<Entity, Params>;
makeResponsive(): void;
makeResponsive(): Grid<Entity, Params>;
reload(params?: Params): Grid<Entity, Params>;
removeRow(id: string): Grid<Entity, Params>;
render(response: any): Grid<Entity, Params>;
@@ -117,22 +170,25 @@ declare module Gijgo {
showColumn(field: string): Grid<Entity, Params>;
title(text: any): any;
unSelectAll(): Grid<Entity, Params>;
update(id: string): Grid<Entity, Params>;
updateRow(id: string, record: Entity): Grid<Entity, Params>;
}
//Dialog
// Dialog
interface DialogSettings {
//Configuration options
autoOpen?: boolean;
closeButtonInHeader?: boolean;
closeOnEscape?: boolean;
draggable?: boolean;
height?: number | string;
locale?: string;
maxHeight?: number;
maxWidth?: number;
minHeight?: number;
minWidth?: number;
modal?: boolean;
resizable?: boolean;
scrollable?: boolean;
title?: string;
uiLibrary?: string;
width?: number;
@@ -153,9 +209,217 @@ declare module Gijgo {
interface Dialog extends JQuery {
close(): Dialog;
content(constent: string): string | Dialog;
destroy(keepHtml: boolean): void;
isOpen(): boolean;
open(): Dialog;
}
// Checkbox
interface CheckboxSettings {
uiLibrary?: string;
iconsLibrary?: string;
//Events
change?: (e: any, state: string) => any;
}
interface Checkbox extends JQuery {
//toggle(): Checkbox;
state(value: string): string | Checkbox;
destroy(): void;
}
// DatePicker
interface DatePickerIcons {
rightIcon?: string;
}
interface DatePickerSettings {
showOtherMonths?: boolean;
selectOtherMonths?: boolean;
width?: number;
minDate?: Date | string | Function;
maxDate?: Date | string | Function;
format?: string;
value?: string;
uiLibrary?: string;
iconsLibrary?: string;
weekStartDay?: number;
disableDates?: Array<any> | Function;
disableDaysOfWeek?: Array<number>;
calendarWeeks?: boolean;
keyboardNavigation?: boolean;
locale?: string;
icons?: DatePickerIcons;
//Events
change?: (e: any) => any;
open?: (e: any) => any;
close?: (e: any) => any;
}
interface DatePicker extends JQuery {
close(): DatePicker;
destroy(): void;
open(): DatePicker;
value(value: string): string | DatePicker;
}
// DropDown
interface DropDownIcons {
dropdown?: string;
}
interface DropDownSettings {
dataSource?: any;
textField?: string;
valueField?: string;
selectedField?: string;
width?: number;
maxHeight?: any;
uiLibrary?: string;
iconsLibrary?: string;
icons?: DropDownIcons;
//Events
change?: (e: any) => any;
dataBound?: (e: any) => any;
}
interface DropDown extends JQuery {
value(value: string): string | DropDown;
destroy(): void;
}
// Editor
interface EditorSettings {
height?: number | string;
width?: number | string;
uiLibrary?: string;
iconsLibrary?: string;
locale?: string;
//Events
changing?: (e: any) => any;
changed?: (e: any) => any;
}
interface Editor extends JQuery {
content(html: string): string | Editor;
destroy(): void;
}
// TimePicker
interface TimePickerSettings {
width?: number;
modal?: boolean;
header?: boolean;
footer?: boolean;
format?: string;
uiLibrary?: string;
value?: string;
mode?: string;
locale?: string;
//Events
change?: (e: any) => any;
open?: (e: any) => any;
close?: (e: any) => any;
}
interface TimePicker extends JQuery {
close(): TimePicker;
destroy(): void;
open(): TimePicker;
value(value: string): string | TimePicker;
}
// Tree
interface TreeIcons {
expand?: string;
collapse?: string;
}
interface TreeParamNames {
parentId?: string;
}
interface TreeSettings {
autoLoad?: boolean;
selectionType?: string;
cascadeSelection?: boolean;
dataSource?: any;
primaryKey?: string;
textField?: string;
childrenField?: string;
hasChildrenField?: string;
imageCssClassField?: string;
imageUrlField?: string;
imageHtmlField?: string;
disabledField?: string;
width?: number;
border?: boolean;
uiLibrary?: string;
iconsLibrary?: string;
icons?: TreeIcons;
checkboxes?: boolean;
checkedField?: string;
cascadeCheck?: boolean;
dragAndDrop?: boolean;
paramNames: TreeParamNames;
lazyLoading?: boolean;
//Events
initialized?: (e: any) => any;
dataBinding?: (e: any) => any;
dataBound?: (e: any) => any;
select?: (e: any, node: any, id: string) => any;
unselect?: (e: any, node: any, id: string) => any;
expand?: (e: any, node: any, id: string) => any;
collapse?: (e: any, node: any, id: string) => any;
enable?: (e: any, node: any, id: string) => any;
disable?: (e: any, node: any, id: string) => any;
destroying?: (e: any) => any;
nodeDataBound?: (e: any, node: any, id: string) => any;
checkboxChange?: (e: any, node: any, record: any, state: string) => any;
nodeDrop?: (e: any, id: string, parentId: string, orderNumber: number) => any;
}
interface Tree extends JQuery {
reload(params: any): any;
render(response: any): any;
addNode(data: any, parentNode: any, position: number): Tree;
removeNode(node: any): Tree;
destroy(): void;
expand(node: any, cascade: boolean): Tree;
collapse(node: any, cascade: boolean) : Tree;
expandAll(): Tree;
collapseAll() : Tree;
getDataById(id: string) : any;
getDataByText(text: string) : any;
getNodeById(id: string) : any;
getNodeByText(id: string) : any;
getAll(): Array<any>;
//select(node: any) : Tree;
unselect(node: any) : Tree;
selectAll() : Tree;
unselectAll() : Tree;
getSelections() : Array<string>;
getChildren(node: any, cascade: boolean) : Array<any>;
enable(node: any, cascade: boolean) : Tree;
disable(node: any, cascade: boolean) : Tree;
enableAll() : Tree;
disableAll() : Tree;
getCheckedNodes() : Array<string>;
checkAll() : Tree;
uncheckAll(): Tree;
check(node: any) : Tree;
uncheck(node: any) : Tree;
}
}
@@ -165,4 +429,16 @@ interface JQuery {
grid<Entity, Params>(settings: Gijgo.GridSettings<Entity>): Gijgo.Grid<Entity, Params>;
dialog(settings: Gijgo.DialogSettings): Gijgo.Dialog;
checkbox(settings: Gijgo.CheckboxSettings): Gijgo.Checkbox;
datepicker(settings: Gijgo.DatePickerSettings): Gijgo.DatePicker;
dropdown(settings: Gijgo.DropDownSettings): Gijgo.DropDown;
editor(settings: Gijgo.EditorSettings): Gijgo.Editor;
timepicker(settings: Gijgo.TimePickerSettings): Gijgo.TimePicker;
tree(settings: Gijgo.TreeSettings): Gijgo.Tree;
}