forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
backgrid.d.ts
128 lines (101 loc) · 3.37 KB
/
backgrid.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// Type definitions for Backgrid 0.2.6
// Project: http://backgridjs.com/
// Definitions by: Jeremy Lujan <https://github.com/jlujan/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../backbone/backbone.d.ts" />
declare module Backgrid {
interface GridOptions {
columns: Column[];
collection: Backbone.Collection<Backbone.Model>;
header?: Header;
body?: Body;
row?: Row;
footer?: Footer;
}
class Header extends Backbone.View<Backbone.Model> {
}
class Footer extends Backbone.View<Backbone.Model> {
}
class Row extends Backbone.View<Backbone.Model> {
}
class Command {
moveUp(): boolean;
moveDown(): boolean;
moveLeft(): boolean;
moveRight(): boolean;
save(): boolean;
cancel(): boolean;
passThru(): boolean;
}
class CellFormatter {
fromRaw(rawData: any, model: Backbone.Model);
toRaw(formattedData: any, model: Backbone.Model);
}
class NumberFormatter extends CellFormatter {}
class PercentFormatter extends NumberFormatter {}
class DateTimeFormatter extends CellFormatter {}
class StringFormatter extends CellFormatter {}
class EmailFormatter extends CellFormatter {}
class SelectFormatter extends CellFormatter {}
class CellEditor extends Backbone.View<Backbone.Model>{
initialize(options?: any);
postRender(model: Backbone.Model, column: Backbone.Model);
}
class InputCellEditor extends CellEditor {
render();
saveOrCancel(event: any);
}
class Cell extends Backbone.View<Backbone.Model>{
tagName: string;
formatter: CellFormatter;
editor: InputCellEditor;
enterEditMode();
renderError();
exitEditMode();
remove();
}
class StringCell extends Cell {
}
interface ColumnAttr {
name: string;
cell: string;
headerCell: string;
label: string;
sortable: boolean;
editable: boolean;
renderable: boolean;
formater: string;
}
class Column extends Backbone.Model {
initialize(options?: any);
}
class Body extends Backbone.View<Backbone.Model> {
tagName: string;
initialize(options?: any);
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
moveToNextCell(model: Backbone.Model, cell: Column, command: Command);
refresh(): Body;
remove(): Body;
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
render(): Body;
}
class Grid extends Backbone.View<Backbone.Model> {
body: Backgrid.Body;
className: string;
footer: any;
header: any;
tagName: string;
constructor(options: GridOptions);
initialize(options: any);
getSelectedModels(): Backbone.Model[];
insertColumn(...options: any[]): Grid;
insertRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
remove(): Grid;
removeColumn(...options: any[]): Grid;
removeRow(model: Backbone.Model, collection: Backbone.Collection<Backbone.Model>, options: any);
render(): Grid;
}
}
declare module "backgrid" {
export = Backgrid;
}