Skip to content

Commit 674e30d

Browse files
committed
Expose TS typings
1 parent 67d83f2 commit 674e30d

File tree

2 files changed

+50
-0
lines changed

2 files changed

+50
-0
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"browser": "dist/query-builder.common.js",
2020
"jsdelivr": "dist/query-builder.umd.min.js",
2121
"unpkg": "dist/query-builder.umd.min.js",
22+
"types": "./types/index.d.ts",
2223
"dependencies": {
2324
"@types/sortablejs": "^1.10.2",
2425
"core-js": "^3.3.2",

types/index.d.ts

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
import Vue, { Component } from 'vue';
2+
import { SortableOptions } from 'sortablejs';
3+
4+
export interface Rule {
5+
identifier: string,
6+
value: any,
7+
}
8+
9+
export interface RuleSet {
10+
operatorIdentifier: string,
11+
children: Array<RuleSet | Rule>,
12+
}
13+
14+
export interface OperatorDefinition {
15+
identifier: string,
16+
name: string,
17+
}
18+
19+
export interface RuleDefinition {
20+
identifier: string,
21+
name: string,
22+
component: Component | string,
23+
initialValue?: any,
24+
}
25+
26+
export interface QueryBuilderConfig {
27+
operators: OperatorDefinition[],
28+
rules: RuleDefinition[],
29+
colors?: string[],
30+
dragging?: SortableOptions,
31+
}
32+
33+
export interface GroupOperatorSlotProps {
34+
currentOperator: string,
35+
operators: OperatorDefinition[],
36+
updateCurrentOperator: (newOperator: string) => void,
37+
}
38+
39+
export interface GroupCtrlSlotProps {
40+
rules: RuleDefinition[],
41+
addRule: (newRule: string) => void,
42+
newGroup: () => void,
43+
}
44+
45+
export interface RuleSlotProps {
46+
ruleComponent: Component | string,
47+
ruleData: any,
48+
updateRuleData: (newData: any) => void,
49+
}

0 commit comments

Comments
 (0)