Skip to content

Commit 182ca4f

Browse files
committed
Dev: Update types
1 parent 297216c commit 182ca4f

26 files changed

+660
-21
lines changed

types/Editor.d.ts

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,33 @@ export default class Editor {
132132
error: {
133133
system: string;
134134
};
135+
field: {
136+
autocomplete: {
137+
noResults: string;
138+
placeholder: string;
139+
};
140+
tags: {
141+
addButton: string;
142+
inputPlaceholder: string;
143+
noResults: string;
144+
placeholder: string;
145+
};
146+
upload: {
147+
choose: string;
148+
clear: string;
149+
dragDrop: string;
150+
noFile: string;
151+
processing: string;
152+
uploading: string;
153+
};
154+
uploadMany: {
155+
choose: string;
156+
dragDrop: string;
157+
noFiles: string;
158+
processing: string;
159+
uploading: string;
160+
};
161+
};
135162
multi: {
136163
info: string;
137164
noMulti: string;
@@ -221,6 +248,7 @@ export default class Editor {
221248
files: typeof publicApi.files;
222249
get: typeof publicApi.get;
223250
hide: typeof publicApi.hide;
251+
i18n: typeof publicApi.i18n;
224252
ids: typeof publicApi.ids;
225253
inError: typeof publicApi.inError;
226254
inline: typeof publicApi.inline;
@@ -260,7 +288,6 @@ export default class Editor {
260288
processing: HTMLElement;
261289
wrapper: HTMLElement;
262290
};
263-
protected i18n: typeof Editor.defaults.i18n;
264291
protected _actionClass: typeof privateApi._actionClass;
265292
protected _ajax: typeof privateApi._ajax;
266293
protected _animate: typeof privateApi._animate;
@@ -272,6 +299,7 @@ export default class Editor {
272299
protected _crudArgs: typeof privateApi._crudArgs;
273300
protected _dataSource: typeof privateApi._dataSource;
274301
protected _displayReorder: typeof privateApi._displayReorder;
302+
protected _drawTitle: typeof privateApi._drawTitle;
275303
protected _edit: typeof privateApi._edit;
276304
protected _event: typeof privateApi._event;
277305
protected _eventName: typeof privateApi._eventName;
@@ -327,6 +355,33 @@ export default class Editor {
327355
error: {
328356
system: string;
329357
};
358+
field: {
359+
autocomplete: {
360+
noResults: string;
361+
placeholder: string;
362+
};
363+
tags: {
364+
addButton: string;
365+
inputPlaceholder: string;
366+
noResults: string;
367+
placeholder: string;
368+
};
369+
upload: {
370+
choose: string;
371+
clear: string;
372+
dragDrop: string;
373+
noFile: string;
374+
processing: string;
375+
uploading: string;
376+
};
377+
uploadMany: {
378+
choose: string;
379+
dragDrop: string;
380+
noFiles: string;
381+
processing: string;
382+
uploading: string;
383+
};
384+
};
330385
multi: {
331386
info: string;
332387
noMulti: string;

types/core/api-static.d.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { IUploadConf } from '../ext/fieldTypes/shared';
12
/**
23
* Common error message emitter. This method is not (yet) publicly documented on
34
* the Editor site. It might be in future.
@@ -38,7 +39,7 @@ export declare function pairs(data: any, props: any, fn: any): void;
3839
* @param {function} completeCallback Callback function for once the file has
3940
* been uploaded
4041
*/
41-
export declare function upload(editor: any, conf: any, files: any, progressCallback: any, completeCallback: any): void;
42+
export declare function upload(editor: any, conf: IUploadConf, files: any, progressCallback: any, completeCallback: any): void;
4243
/**
4344
* CommonJS factory function pass through. Matches DataTables.
4445
* @param {*} root Window

types/core/api.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,17 @@ export declare function get(this: Editor, names?: string[]): {
456456
* @returns Editor instance
457457
*/
458458
export declare function hide(this: Editor, names?: any, animate?: any): Editor;
459+
/**
460+
* Look up a translation string from Editor's i18n strings
461+
*
462+
* @param this Editor instance
463+
* @param user User defined string from a configuration variable. This will be used
464+
* if it is not null / undefined.
465+
* @param token Token name to get
466+
* @param def Default string if no token
467+
* @returns Looked up translation string
468+
*/
469+
export declare function i18n(this: Editor, user: string | null, token: string, def?: string): string;
459470
/**
460471
* Get the ids of the rows being edited
461472
*

types/core/private.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ export declare function _dataSource(this: Editor, name: any, ...args: any[]): an
106106
* @private
107107
*/
108108
export declare function _displayReorder(this: Editor, includeFields?: any): void;
109+
/**
110+
* Display the title in the form header, taking into account nested editing
111+
*/
112+
export declare function _drawTitle(): void;
109113
/**
110114
* Generic editing handler. This can be called by the three editing modes (main,
111115
* bubble and inline) to configure Editor for a row edit, and fire the required

types/ext/dropdown.d.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/// <reference types="jquery" />
2+
/// <reference types="datatables.net" />
3+
declare type TRender = (data: any, val: any) => string;
4+
interface IOptions {
5+
ajax: string | null;
6+
ajaxData: object;
7+
escapeHtml: boolean;
8+
i18n: {
9+
inputPlaceholder?: string;
10+
noResults?: string;
11+
title?: string;
12+
placeholder?: string;
13+
};
14+
options: any[];
15+
renderer: TRender;
16+
search: boolean | null;
17+
select: (val: string) => void;
18+
}
19+
export default class DropDown {
20+
static defaults: IOptions;
21+
static classes: {};
22+
private c;
23+
private s;
24+
private dom;
25+
constructor(host: HTMLElement | JQuery<HTMLElement>, options: Partial<IOptions>);
26+
attachTo(el: string): void;
27+
asyncLabels(source: Array<{
28+
value: any;
29+
}>, cb: (item: any, label: string) => void): void;
30+
blur(input: HTMLElement): DropDown;
31+
destroy(): void;
32+
filter(val: string): DropDown;
33+
/**
34+
* Get the label for a specific value (not async - if unknown in the current
35+
* data set, will return `null`)
36+
*
37+
* @param val Value to lookup
38+
* @returns Label if found, null if not found
39+
*/
40+
label(val: any): any | null;
41+
focus(): this;
42+
hide(): DropDown;
43+
host(el: any): this;
44+
options(): any[];
45+
options(options: any[]): DropDown[];
46+
show(below?: HTMLElement): DropDown;
47+
private _listView;
48+
private _position;
49+
private _renderer;
50+
}
51+
export {};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/// <reference types="jquery" />
2+
/// <reference types="datatables.net" />
3+
import Dropdown from '../../ext/dropdown';
4+
import { IOptions } from '../../field/defaults';
5+
import { IFieldType } from '../../model/fieldType';
6+
export interface IAutoCompleteConf extends IOptions {
7+
ajax?: true | string;
8+
attr?: {
9+
[key: string]: string | number;
10+
};
11+
display?: (data: any, value: any) => string;
12+
escapeLabelHtml?: boolean;
13+
i18n?: {
14+
noResults?: string;
15+
placeholder?: string;
16+
title?: string;
17+
};
18+
options?: any[];
19+
_input: JQuery<HTMLElement>;
20+
_dropdown: Dropdown;
21+
_selected: boolean;
22+
}
23+
declare const autocomplete: IFieldType;
24+
export default autocomplete;

types/ext/fieldTypes/checkbox.d.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
declare const checkbox: import("../../model/fieldType").IFieldType & {
2+
canReturnSubmit(conf: any, node: any): true;
3+
disable(conf: any): void;
4+
enable(conf: any): void;
5+
get(conf: any): any;
6+
set(conf: any, val: any): void;
7+
} & {
8+
_addOptions(conf: any, opts: any, append?: boolean): void;
9+
create(conf: any): any;
10+
disable(conf: any): void;
11+
enable(conf: any): void;
12+
get(conf: any): string | any[];
13+
set(conf: any, val: any): void;
14+
update(conf: any, options: any, append: any): void;
15+
};
16+
export default checkbox;
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/// <reference types="jquery" />
2+
/// <reference types="datatables.net" />
3+
declare const datatable: import("../../model/fieldType").IFieldType & {
4+
canReturnSubmit(conf: any, node: any): true;
5+
disable(conf: any): void;
6+
enable(conf: any): void;
7+
get(conf: any): any;
8+
set(conf: any, val: any): void;
9+
} & {
10+
_addOptions(conf: any, options: any, append?: boolean): void;
11+
_jumpToFirst(conf: any, editor: any): void;
12+
create(conf: any): {
13+
input: JQuery<HTMLElement>;
14+
side: JQuery<HTMLElement>;
15+
};
16+
disable(conf: any): void;
17+
dt(conf: any): any;
18+
enable(conf: any): void;
19+
get(conf: any): any;
20+
set(conf: any, val: any, localUpdate: any): void;
21+
tableClass: string;
22+
update(conf: any, options: any, append: any): void;
23+
};
24+
export default datatable;

types/ext/fieldTypes/datetime.d.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
declare const _default: import("../../model/fieldType").IFieldType & {
2+
canReturnSubmit(conf: any, node: any): true;
3+
disable(conf: any): void;
4+
enable(conf: any): void;
5+
get(conf: any): any;
6+
set(conf: any, val: any): void;
7+
} & {
8+
create(conf: any): any;
9+
destroy(conf: any): void;
10+
errorMessage(conf: any, msg: any): void;
11+
get(conf: any): any;
12+
maxDate(conf: any, max: any): void;
13+
minDate(conf: any, min: any): void;
14+
owns(conf: any, node: any): any;
15+
set(conf: any, val: any): void;
16+
};
17+
export default _default;

types/ext/fieldTypes/hidden.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
declare const _default: {
2+
create(conf: any): any;
3+
get(conf: any): any;
4+
set(conf: any, val: any): void;
5+
};
6+
export default _default;

0 commit comments

Comments
 (0)