/
settings.d.ts
210 lines (204 loc) · 8.08 KB
/
settings.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import { PikadayOptions } from 'pikaday';
import Core from './core';
import { Events } from './pluginHooks';
import {
CellValue,
ColumnDataGetterSetterFunction,
LabelOptions,
NumericFormatOptions,
RowObject,
SelectOptionsObject,
SimpleCellCoords,
} from './common';
import CellCoords from './3rdparty/walkontable/src/cell/coords';
import { Settings as AutoColumnSizeSettings } from './plugins/autoColumnSize';
import { Settings as AutofillSettings } from './plugins/autofill';
import { Settings as AutoRowSizeSettings } from './plugins/autoRowSize';
import { Settings as CollapsibleColumnsSettings } from './plugins/collapsibleColumns';
import { Settings as ColumnSortingSettings } from './plugins/columnSorting';
import { Settings as ColumnSummarySettings } from './plugins/columnSummary';
import { Settings as CommentsSettings, CommentObject } from './plugins/comments';
import { Settings as ContextMenuSettings } from './plugins/contextMenu';
import { Settings as CopyPasteSettings } from './plugins/copyPaste';
import { Settings as CustomBordersSettings } from './plugins/customBorders';
import { Settings as DropdownMenuSettings } from './plugins/dropdownMenu';
import { Settings as FormulasSettings } from './plugins/formulas';
import { Settings as HiddenColumnsSettings } from './plugins/hiddenColumns';
import { Settings as HiddenRowsSettings } from './plugins/hiddenRows';
import { Settings as MergeCellsSettings } from './plugins/mergeCells';
import { Settings as MultiColumnSortingSettings } from './plugins/multiColumnSorting';
import { Settings as NestedHeadersSettings } from './plugins/nestedHeaders';
import { Settings as SearchSettings } from './plugins/search';
import { EditorType, BaseEditor } from './editors';
import { RendererType } from './renderers';
import { BaseRenderer } from './renderers/base';
import { ValidatorType } from './validators';
import { BaseValidator } from './validators/base';
import { CellType } from './cellTypes';
/**
* Additional cell-specific meta data.
*/
export interface CellMeta extends ColumnSettings {
valid?: boolean;
comment?: CommentObject;
isSearchResult?: boolean;
hidden?: boolean;
skipRowOnPaste?: boolean;
}
/**
* A rendered cell object with computed properties.
*/
export interface CellProperties extends CellMeta {
row: number;
col: number;
instance: Core;
visualRow: number;
visualCol: number;
prop: string | number;
}
/**
* @package
* Omit properties K from T
*/
export type Omit<T, K extends keyof T> = Pick<T, ({ [P in keyof T]: P } & { [P in K]: never } & { [x: string]: never, [x: number]: never })[keyof T]>;
/**
* Column settings inherit grid settings but overload the meaning of `data` to be specific to each column.
*/
export interface ColumnSettings extends Omit<GridSettings, "data"> {
data?: string | number | ColumnDataGetterSetterFunction;
/**
* Column and cell meta data is extensible, developers can add any properties they want.
*/
[key: string]: any;
}
export interface CellSettings extends CellMeta {
row: number;
col: number;
}
/**
* Base table settings that will cascade to columns and cells.
*/
export interface GridSettings extends Events {
activeHeaderClassName?: string;
allowEmpty?: boolean;
allowHtml?: boolean;
allowInsertColumn?: boolean;
allowInsertRow?: boolean;
allowInvalid?: boolean;
allowRemoveColumn?: boolean;
allowRemoveRow?: boolean;
autoColumnSize?: AutoColumnSizeSettings;
autoRowSize?: AutoRowSizeSettings;
autoWrapCol?: boolean;
autoWrapRow?: boolean;
bindRowsWithHeaders?: boolean | 'loose' | 'strict';
cell?: CellSettings[];
cells?: (this: CellProperties, row: number, column: number, prop: string | number) => CellMeta;
checkedTemplate?: boolean | string | number;
className?: string | string[];
colHeaders?: boolean | string[] | ((index: number) => string);
collapsibleColumns?: CollapsibleColumnsSettings;
columnHeaderHeight?: number | Array<number | undefined>;
columns?: ColumnSettings[] | ((index: number) => ColumnSettings);
columnSorting?: ColumnSortingSettings;
columnSummary?: ColumnSummarySettings;
colWidths?: number | string | number[] | string[] | undefined[] | Array<number | string | undefined> | ((index: number) => string | number | undefined);
commentedCellClassName?: string;
comments?: CommentsSettings;
contextMenu?: ContextMenuSettings;
copyable?: boolean;
copyPaste?: CopyPasteSettings;
correctFormat?: boolean;
currentColClassName?: string;
currentHeaderClassName?: string;
currentRowClassName?: string;
customBorders?: CustomBordersSettings;
data?: CellValue[][] | RowObject[];
dataSchema?: RowObject | CellValue[] | ((row: number) => RowObject | CellValue[]);
dateFormat?: string;
datePickerConfig?: PikadayOptions;
defaultDate?: string;
disableVisualSelection?: boolean | 'current' | 'area' | 'header' | Array<'current' | 'area' | 'header'>;
dragToScroll?: boolean;
dropdownMenu?: DropdownMenuSettings;
editor?: EditorType | typeof BaseEditor | boolean | string;
enterBeginsEditing?: boolean;
enterMoves?: CellCoords | SimpleCellCoords | ((event: KeyboardEvent) => CellCoords | SimpleCellCoords);
fillHandle?: AutofillSettings;
filter?: boolean;
filteringCaseSensitive?: boolean;
filters?: boolean;
fixedColumnsLeft?: number;
fixedColumnsStart?: number;
fixedRowsBottom?: number;
fixedRowsTop?: number;
formulas?: FormulasSettings;
fragmentSelection?: boolean | 'cell';
height?: number | string | (() => number | string);
hiddenColumns?: HiddenColumnsSettings;
hiddenRows?: HiddenRowsSettings;
invalidCellClassName?: string;
isEmptyCol?: (this: Core, col: number) => boolean;
isEmptyRow?: (this: Core, row: number) => boolean;
label?: LabelOptions;
language?: string;
layoutDirection?: 'ltr' | 'rtl' | 'inherit';
licenseKey?: string | 'non-commercial-and-evaluation';
manualColumnFreeze?: boolean;
manualColumnMove?: boolean | number[];
manualColumnResize?: boolean | number[];
manualRowMove?: boolean | number[];
manualRowResize?: boolean | number[];
maxCols?: number;
maxRows?: number;
mergeCells?: MergeCellsSettings;
minCols?: number;
minRows?: number;
minSpareCols?: number;
minSpareRows?: number;
multiColumnSorting?: MultiColumnSortingSettings;
nestedHeaders?: NestedHeadersSettings;
nestedRows?: boolean;
noWordWrapClassName?: string;
numericFormat?: NumericFormatOptions;
observeDOMVisibility?: boolean;
outsideClickDeselects?: boolean | ((target: HTMLElement) => boolean);
persistentState?: boolean;
placeholder?: string;
placeholderCellClassName?: string;
preventOverflow?: boolean | 'vertical' | 'horizontal';
preventWheel?: boolean;
readOnly?: boolean;
readOnlyCellClassName?: string;
renderAllRows?: boolean;
renderer?: RendererType | string | BaseRenderer;
rowHeaders?: boolean | string[] | ((index: number) => string);
rowHeaderWidth?: number | number[];
rowHeights?: number | string | number[] | string[] | undefined[] | Array<number | string | undefined> | ((index: number) => string | number | undefined);
search?: SearchSettings;
selectionMode?: 'single' | 'range' | 'multiple';
selectOptions?: string[] | SelectOptionsObject | ((visualRow: number, visualColumn: number, prop: string | number) => string[] | SelectOptionsObject);
skipColumnOnPaste?: boolean;
skipRowOnPaste?: boolean;
sortByRelevance?: boolean;
source?: string[] | number[] | ((this: CellProperties, query: string, callback: (items: string[]) => void) => void);
startCols?: number;
startRows?: number;
stretchH?: 'none' | 'all' | 'last';
strict?: boolean;
tableClassName?: string | string[];
tabMoves?: CellCoords | SimpleCellCoords | ((event: KeyboardEvent) => CellCoords | SimpleCellCoords);
title?: string;
trimDropdown?: boolean;
trimRows?: boolean | number[];
trimWhitespace?: boolean;
type?: CellType | string;
uncheckedTemplate?: boolean | string | number;
undo?: boolean;
validator?: BaseValidator | RegExp | ValidatorType | string;
viewportColumnRenderingOffset?: number | 'auto';
viewportRowRenderingOffset?: number | 'auto';
visibleRows?: number;
width?: number | string | (() => number | string);
wordWrap?: boolean;
}