-
-
Notifications
You must be signed in to change notification settings - Fork 503
/
Copy pathconfig.tsx
141 lines (132 loc) · 3.13 KB
/
config.tsx
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
import React from "react";
import {
BasicFuncs, Widgets, Fields, Config, Settings, Funcs,
} from "@react-awesome-query-builder/ui";
import { MuiConfig } from "@react-awesome-query-builder/mui";
import { getCaseValueWidgetConfig } from "./spel_concat";
import InputAdornment from "@mui/material/InputAdornment";
export default (): Config => {
const InitialConfig = MuiConfig;
const widgets: Widgets = {
...InitialConfig.widgets,
case_value: getCaseValueWidgetConfig(InitialConfig),
};
const fields: Fields = {
text: {
label: "Text",
type: "text",
valueSources: ["value", "field"],
excludeOperators: ["proximity"]
},
qty: {
label: "Qty",
type: "number",
valueSources: ["value"],
fieldSettings: {
min: 0,
max: 1000,
},
preferWidgets: ["number"]
},
discount: {
label: "Discount",
type: "number",
valueSources: ["value"],
fieldSettings: {
min: 0,
max: 100,
step: 5,
},
preferWidgets: ["slider", "rangeslider"],
widgets: {
slider: {
widgetProps: {
customProps: {
input: {
InputProps: {
endAdornment: <InputAdornment position="end">%</InputAdornment>
}
}
}
}
}
}
},
price: {
label: "Price",
type: "number",
valueSources: ["value"],
fieldSettings: {
min: 10,
max: 100
},
preferWidgets: ["slider", "rangeslider"],
isSpelVariable: true
},
color: {
label: "Color",
type: "select",
valueSources: ["value"],
fieldSettings: {
listValues: [
{ value: "yellow", title: "Yellow" },
{ value: "blue", title: "Blue" },
{ value: "green", title: "Green" },
{ value: "orange", title: "Orange" }
]
}
},
is_promotion: {
label: "Promotoion",
type: "boolean",
operators: ["equal"],
valueSources: ["value"],
mainWidgetProps: {
hideOperator: true,
operatorInlineLabel: "is",
}
},
};
const settings: Settings = {
...InitialConfig.settings,
caseValueField: {
// type: "case_value", // >> Uncomment to see deprecated using of SpelConcatPart ("./spel_concat.tsx")
type: "select",
valueSources: ["value"],
fieldSettings: {
listValues: [{
value: "Hot",
title: "Hot"
}, {
value: "In stock",
title: "In stock"
}, {
value: "other",
title: "other"
}],
},
mainWidgetProps: {
valueLabel: "Then",
valuePlaceholder: "Then",
},
},
maxNumberOfCases: 5,
canRegroupCases: true,
maxNesting: 3,
canLeaveEmptyCase: false,
showErrorMessage: true,
};
const funcs: Funcs = {
LOWER: BasicFuncs.LOWER,
UPPER: BasicFuncs.UPPER,
LINEAR_REGRESSION: BasicFuncs.LINEAR_REGRESSION,
};
const config: Config = {
...InitialConfig,
funcs,
widgets,
fields,
settings
};
return config;
};