Skip to content

Commit 6dc2213

Browse files
authored
🤖 Merge PR DefinitelyTyped#74246 [tabulator-tables] align validator and EditorParams typings with actual Tabulator behavior by @Trash0101
1 parent b45ba95 commit 6dc2213

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

‎types/tabulator-tables/index.d.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,7 +1253,14 @@ export interface ColumnDefinition extends ColumnLayout, CellCallbacks {
12531253
*
12541254
* Validators can be applied by using the validator property in a columns definition object (see Define Columns for more details).
12551255
*/
1256-
validator?: StandardValidatorType | StandardValidatorType[] | Validator | Validator[] | string | undefined;
1256+
validator?:
1257+
| StandardValidatorType
1258+
| StandardValidatorType[]
1259+
| Validator
1260+
| Validator[]
1261+
| string
1262+
| undefined
1263+
| ((cell: CellComponent, value: any) => boolean);
12571264

12581265
/**
12591266
* Mutators are used to alter data as it is parsed into For example if you wanted to convert a numeric column into a boolean based on its value, before the data is used to build the table.
@@ -1657,7 +1664,7 @@ export type Editor =
16571664
onRendered: EmptyCallback,
16581665
success: ValueBooleanCallback,
16591666
cancel: ValueVoidCallback,
1660-
editorParams: {},
1667+
editorParams: Record<string, unknown>,
16611668
) => HTMLElement | false);
16621669

16631670
export type EditorParams =
@@ -1669,7 +1676,7 @@ export type EditorParams =
16691676
| DateParams
16701677
| TimeParams
16711678
| DateTimeEditorParams
1672-
| ((cell: CellComponent) => {});
1679+
| ((cell: CellComponent) => Record<string, unknown>);
16731680

16741681
export type ScrollToRowPosition = "top" | "center" | "bottom" | "nearest";
16751682
export type PopupPosition = ColumnDefinitionAlign | "top" | "bottom";

‎types/tabulator-tables/tabulator-tables-tests.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ colDef.validator = {
385385
};
386386
colDef.validator = "float";
387387
colDef.validator = { type: "float", parameters: {} };
388+
colDef.validator = (cell, value) => true;
388389

389390
let validators: Validator[] = [
390391
{ type: "integer", parameters: {} },

0 commit comments

Comments
 (0)