-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathtypes.ts
73 lines (61 loc) · 1.58 KB
/
types.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
import Vue, { Component } from 'vue';
import { SortableOptions } from 'sortablejs';
export interface Rule {
identifier: string,
value: any,
}
export interface RuleSet {
operatorIdentifier: string,
children: Array<RuleSet | Rule>,
}
export interface OperatorDefinition {
identifier: string,
name: string,
}
export interface RuleDefinition {
identifier: string,
name: string,
component: Component | string,
initialValue?: any,
}
export interface QueryBuilderConfig {
operators: OperatorDefinition[],
rules: RuleDefinition[],
maxDepth?: number,
colors?: string[],
dragging?: SortableOptions,
}
export interface GroupOperatorSlotProps {
currentOperator: string,
operators: OperatorDefinition[],
updateCurrentOperator: (newOperator: string) => void,
}
export interface GroupCtrlSlotProps {
maxDepthExeeded: boolean,
rules: RuleDefinition[],
addRule: (newRule: string) => void,
newGroup: () => void,
}
export interface RuleSlotProps {
ruleComponent: Component | string,
ruleData: any,
ruleIdentifier: string,
updateRuleData: (newData: any) => void,
}
export const QueryBuilderGroupSym = Symbol('QueryBuilderGroup');
export interface QueryBuilderGroup extends Vue {
selectedOperator: string,
depth: number,
trap: ((position: number, newChild: RuleSet | Rule) => void) | null,
children: Array<RuleSet | Rule>,
type: Symbol,
}
export interface ComponentRegistration {
component: QueryBuilderGroup,
ev: RuleSet,
adding: boolean,
affectedIdx: number,
}
export interface MergeTrap {
registerSortUpdate(update: ComponentRegistration): void,
}