@react-querybuilder/antd 6.6.0-alpha.0 → 7.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/cjs/react-querybuilder_antd.cjs.development.d.ts +11 -4
- package/dist/cjs/react-querybuilder_antd.cjs.development.js +145 -94
- package/dist/cjs/react-querybuilder_antd.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_antd.cjs.production.d.ts +11 -4
- package/dist/cjs/react-querybuilder_antd.cjs.production.js +1 -1
- package/dist/cjs/react-querybuilder_antd.cjs.production.js.map +1 -1
- package/dist/react-querybuilder_antd.d.mts +11 -4
- package/dist/react-querybuilder_antd.legacy-esm.d.mts +11 -4
- package/dist/react-querybuilder_antd.legacy-esm.js +121 -70
- package/dist/react-querybuilder_antd.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_antd.mjs +120 -70
- package/dist/react-querybuilder_antd.mjs.map +1 -1
- package/dist/react-querybuilder_antd.production.d.mts +11 -4
- package/dist/react-querybuilder_antd.production.mjs +1 -1
- package/dist/react-querybuilder_antd.production.mjs.map +1 -1
- package/package.json +14 -14
package/README.md
CHANGED
|
@@ -9,9 +9,8 @@ To see them in action, check out the [`react-querybuilder` demo](https://react-q
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npm i
|
|
13
|
-
# OR
|
|
14
|
-
yarn add react-querybuilder @react-querybuilder/antd @ant-design/icons antd
|
|
12
|
+
npm i react-querybuilder @react-querybuilder/antd @ant-design/icons antd
|
|
13
|
+
# OR yarn add / pnpm add / bun add
|
|
15
14
|
```
|
|
16
15
|
|
|
17
16
|
## Usage
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_querybuilder from 'react-querybuilder';
|
|
2
|
-
import { ActionWithRulesProps, DragHandleProps, NotToggleProps, ValueEditorProps, VersatileSelectorProps, Controls } from 'react-querybuilder';
|
|
2
|
+
import { ActionWithRulesProps, DragHandleProps, NotToggleProps, ShiftActionsProps, ValueEditorProps, VersatileSelectorProps, Controls } from 'react-querybuilder';
|
|
3
3
|
import { Button, Switch, Select } from 'antd';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { ComponentPropsWithoutRef, ComponentPropsWithRef } from 'react';
|
|
@@ -14,7 +14,9 @@ declare const AntDActionElement: {
|
|
|
14
14
|
displayName: string;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
type AntDDragHandleProps = DragHandleProps &
|
|
17
|
+
type AntDDragHandleProps = DragHandleProps & {
|
|
18
|
+
label?: any;
|
|
19
|
+
} & ComponentPropsWithRef<typeof HolderOutlined>;
|
|
18
20
|
declare const AntDDragHandle: React.ForwardRefExoticComponent<Omit<AntDDragHandleProps, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
19
21
|
|
|
20
22
|
type AntDNotToggleProps = NotToggleProps & ComponentPropsWithoutRef<typeof Switch>;
|
|
@@ -23,6 +25,11 @@ declare const AntDNotToggle: {
|
|
|
23
25
|
displayName: string;
|
|
24
26
|
};
|
|
25
27
|
|
|
28
|
+
declare const AntDShiftActions: {
|
|
29
|
+
({ path, disabled, className, titles, testID, lastInGroup, schema: { combinators, dispatchQuery, getQuery }, }: ShiftActionsProps): React.JSX.Element;
|
|
30
|
+
displayName: string;
|
|
31
|
+
};
|
|
32
|
+
|
|
26
33
|
declare const AntDValueEditor: {
|
|
27
34
|
({ fieldData, operator, value, handleOnChange, title, className, type, inputType, values, listsAsArrays, parseNumbers, separator, valueSource: _vs, disabled, testID, selectorComponent: SelectorComponent, ...props }: ValueEditorProps): React.JSX.Element | null;
|
|
28
35
|
displayName: string;
|
|
@@ -30,11 +37,11 @@ declare const AntDValueEditor: {
|
|
|
30
37
|
|
|
31
38
|
type AntDValueSelectorProps = VersatileSelectorProps & Omit<ComponentPropsWithoutRef<typeof Select>, 'onChange' | 'defaultValue'>;
|
|
32
39
|
declare const AntDValueSelector: {
|
|
33
|
-
({ className, handleOnChange, options, value, title, disabled, multiple, listsAsArrays, testID: _testID, rules: _rules, level: _level, path: _path, context: _context, validation: _validation, operator: _operator, field: _field, fieldData: _fieldData, schema: _schema, ...extraProps }: AntDValueSelectorProps): React.JSX.Element;
|
|
40
|
+
({ className, handleOnChange, options, value, title, disabled, multiple, listsAsArrays, testID: _testID, rule: _rule, rules: _rules, level: _level, path: _path, context: _context, validation: _validation, operator: _operator, field: _field, fieldData: _fieldData, schema: _schema, ...extraProps }: AntDValueSelectorProps): React.JSX.Element;
|
|
34
41
|
displayName: string;
|
|
35
42
|
};
|
|
36
43
|
|
|
37
44
|
declare const antdControlElements: Partial<Controls>;
|
|
38
45
|
declare const QueryBuilderAntD: react_querybuilder.QueryBuilderContextProvider<Record<string, any>>;
|
|
39
46
|
|
|
40
|
-
export { AntDActionElement, AntDActionProps, AntDDragHandle, AntDDragHandleProps, AntDNotToggle, AntDNotToggleProps, AntDValueEditor, AntDValueSelector, AntDValueSelectorProps, QueryBuilderAntD, antdControlElements };
|
|
47
|
+
export { AntDActionElement, AntDActionProps, AntDDragHandle, AntDDragHandleProps, AntDNotToggle, AntDNotToggleProps, AntDShiftActions, AntDValueEditor, AntDValueSelector, AntDValueSelectorProps, QueryBuilderAntD, antdControlElements };
|
|
@@ -60,9 +60,9 @@ var require_dayjs_min = __commonJS({
|
|
|
60
60
|
return void 0 === t2;
|
|
61
61
|
} }, g = "en", D = {};
|
|
62
62
|
D[g] = M;
|
|
63
|
-
var p = function(t2) {
|
|
64
|
-
return t2 instanceof
|
|
65
|
-
},
|
|
63
|
+
var p = "$isDayjsObject", S = function(t2) {
|
|
64
|
+
return t2 instanceof _ || !(!t2 || !t2[p]);
|
|
65
|
+
}, w = function t2(e2, n2, r2) {
|
|
66
66
|
var i2;
|
|
67
67
|
if (!e2)
|
|
68
68
|
return g;
|
|
@@ -77,18 +77,18 @@ var require_dayjs_min = __commonJS({
|
|
|
77
77
|
D[a2] = e2, i2 = a2;
|
|
78
78
|
}
|
|
79
79
|
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
80
|
-
},
|
|
81
|
-
if (
|
|
80
|
+
}, O = function(t2, e2) {
|
|
81
|
+
if (S(t2))
|
|
82
82
|
return t2.clone();
|
|
83
83
|
var n2 = "object" == typeof e2 ? e2 : {};
|
|
84
|
-
return n2.date = t2, n2.args = arguments, new
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
return
|
|
84
|
+
return n2.date = t2, n2.args = arguments, new _(n2);
|
|
85
|
+
}, b = v;
|
|
86
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
87
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
88
88
|
};
|
|
89
|
-
var
|
|
89
|
+
var _ = function() {
|
|
90
90
|
function M2(t2) {
|
|
91
|
-
this.$L =
|
|
91
|
+
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
|
92
92
|
}
|
|
93
93
|
var m2 = M2.prototype;
|
|
94
94
|
return m2.parse = function(t2) {
|
|
@@ -96,7 +96,7 @@ var require_dayjs_min = __commonJS({
|
|
|
96
96
|
var e2 = t3.date, n2 = t3.utc;
|
|
97
97
|
if (null === e2)
|
|
98
98
|
return /* @__PURE__ */ new Date(NaN);
|
|
99
|
-
if (
|
|
99
|
+
if (b.u(e2))
|
|
100
100
|
return /* @__PURE__ */ new Date();
|
|
101
101
|
if (e2 instanceof Date)
|
|
102
102
|
return new Date(e2);
|
|
@@ -108,33 +108,33 @@ var require_dayjs_min = __commonJS({
|
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
return new Date(e2);
|
|
111
|
-
}(t2), this
|
|
111
|
+
}(t2), this.init();
|
|
112
112
|
}, m2.init = function() {
|
|
113
113
|
var t2 = this.$d;
|
|
114
114
|
this.$y = t2.getFullYear(), this.$M = t2.getMonth(), this.$D = t2.getDate(), this.$W = t2.getDay(), this.$H = t2.getHours(), this.$m = t2.getMinutes(), this.$s = t2.getSeconds(), this.$ms = t2.getMilliseconds();
|
|
115
115
|
}, m2.$utils = function() {
|
|
116
|
-
return
|
|
116
|
+
return b;
|
|
117
117
|
}, m2.isValid = function() {
|
|
118
118
|
return !(this.$d.toString() === l);
|
|
119
119
|
}, m2.isSame = function(t2, e2) {
|
|
120
|
-
var n2 =
|
|
120
|
+
var n2 = O(t2);
|
|
121
121
|
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
122
122
|
}, m2.isAfter = function(t2, e2) {
|
|
123
|
-
return
|
|
123
|
+
return O(t2) < this.startOf(e2);
|
|
124
124
|
}, m2.isBefore = function(t2, e2) {
|
|
125
|
-
return this.endOf(e2) <
|
|
125
|
+
return this.endOf(e2) < O(t2);
|
|
126
126
|
}, m2.$g = function(t2, e2, n2) {
|
|
127
|
-
return
|
|
127
|
+
return b.u(t2) ? this[e2] : this.set(n2, t2);
|
|
128
128
|
}, m2.unix = function() {
|
|
129
129
|
return Math.floor(this.valueOf() / 1e3);
|
|
130
130
|
}, m2.valueOf = function() {
|
|
131
131
|
return this.$d.getTime();
|
|
132
132
|
}, m2.startOf = function(t2, e2) {
|
|
133
|
-
var n2 = this, r2 = !!
|
|
134
|
-
var i2 =
|
|
133
|
+
var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
|
|
134
|
+
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
135
135
|
return r2 ? i2 : i2.endOf(a);
|
|
136
136
|
}, $2 = function(t3, e3) {
|
|
137
|
-
return
|
|
137
|
+
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
138
138
|
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
139
139
|
switch (f2) {
|
|
140
140
|
case h:
|
|
@@ -159,7 +159,7 @@ var require_dayjs_min = __commonJS({
|
|
|
159
159
|
}, m2.endOf = function(t2) {
|
|
160
160
|
return this.startOf(t2, false);
|
|
161
161
|
}, m2.$set = function(t2, e2) {
|
|
162
|
-
var n2, o2 =
|
|
162
|
+
var n2, o2 = b.p(t2), f2 = "set" + (this.$u ? "UTC" : ""), l2 = (n2 = {}, n2[a] = f2 + "Date", n2[d] = f2 + "Date", n2[c] = f2 + "Month", n2[h] = f2 + "FullYear", n2[u] = f2 + "Hours", n2[s] = f2 + "Minutes", n2[i] = f2 + "Seconds", n2[r] = f2 + "Milliseconds", n2)[o2], $2 = o2 === a ? this.$D + (e2 - this.$W) : e2;
|
|
163
163
|
if (o2 === c || o2 === h) {
|
|
164
164
|
var y2 = this.clone().set(d, 1);
|
|
165
165
|
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
@@ -169,13 +169,13 @@ var require_dayjs_min = __commonJS({
|
|
|
169
169
|
}, m2.set = function(t2, e2) {
|
|
170
170
|
return this.clone().$set(t2, e2);
|
|
171
171
|
}, m2.get = function(t2) {
|
|
172
|
-
return this[
|
|
172
|
+
return this[b.p(t2)]();
|
|
173
173
|
}, m2.add = function(r2, f2) {
|
|
174
174
|
var d2, l2 = this;
|
|
175
175
|
r2 = Number(r2);
|
|
176
|
-
var $2 =
|
|
177
|
-
var e2 =
|
|
178
|
-
return
|
|
176
|
+
var $2 = b.p(f2), y2 = function(t2) {
|
|
177
|
+
var e2 = O(l2);
|
|
178
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
179
179
|
};
|
|
180
180
|
if ($2 === c)
|
|
181
181
|
return this.set(c, this.$M + r2);
|
|
@@ -186,17 +186,17 @@ var require_dayjs_min = __commonJS({
|
|
|
186
186
|
if ($2 === o)
|
|
187
187
|
return y2(7);
|
|
188
188
|
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
189
|
-
return
|
|
189
|
+
return b.w(m3, this);
|
|
190
190
|
}, m2.subtract = function(t2, e2) {
|
|
191
191
|
return this.add(-1 * t2, e2);
|
|
192
192
|
}, m2.format = function(t2) {
|
|
193
193
|
var e2 = this, n2 = this.$locale();
|
|
194
194
|
if (!this.isValid())
|
|
195
195
|
return n2.invalidDate || l;
|
|
196
|
-
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 =
|
|
196
|
+
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 = b.z(this), s2 = this.$H, u2 = this.$m, a2 = this.$M, o2 = n2.weekdays, c2 = n2.months, f2 = n2.meridiem, h2 = function(t3, n3, i3, s3) {
|
|
197
197
|
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
198
198
|
}, d2 = function(t3) {
|
|
199
|
-
return
|
|
199
|
+
return b.s(s2 % 12 || 12, t3, "0");
|
|
200
200
|
}, $2 = f2 || function(t3, e3, n3) {
|
|
201
201
|
var r3 = t3 < 12 ? "AM" : "PM";
|
|
202
202
|
return n3 ? r3.toLowerCase() : r3;
|
|
@@ -207,11 +207,11 @@ var require_dayjs_min = __commonJS({
|
|
|
207
207
|
case "YY":
|
|
208
208
|
return String(e2.$y).slice(-2);
|
|
209
209
|
case "YYYY":
|
|
210
|
-
return
|
|
210
|
+
return b.s(e2.$y, 4, "0");
|
|
211
211
|
case "M":
|
|
212
212
|
return a2 + 1;
|
|
213
213
|
case "MM":
|
|
214
|
-
return
|
|
214
|
+
return b.s(a2 + 1, 2, "0");
|
|
215
215
|
case "MMM":
|
|
216
216
|
return h2(n2.monthsShort, a2, c2, 3);
|
|
217
217
|
case "MMMM":
|
|
@@ -219,7 +219,7 @@ var require_dayjs_min = __commonJS({
|
|
|
219
219
|
case "D":
|
|
220
220
|
return e2.$D;
|
|
221
221
|
case "DD":
|
|
222
|
-
return
|
|
222
|
+
return b.s(e2.$D, 2, "0");
|
|
223
223
|
case "d":
|
|
224
224
|
return String(e2.$W);
|
|
225
225
|
case "dd":
|
|
@@ -231,7 +231,7 @@ var require_dayjs_min = __commonJS({
|
|
|
231
231
|
case "H":
|
|
232
232
|
return String(s2);
|
|
233
233
|
case "HH":
|
|
234
|
-
return
|
|
234
|
+
return b.s(s2, 2, "0");
|
|
235
235
|
case "h":
|
|
236
236
|
return d2(1);
|
|
237
237
|
case "hh":
|
|
@@ -243,13 +243,13 @@ var require_dayjs_min = __commonJS({
|
|
|
243
243
|
case "m":
|
|
244
244
|
return String(u2);
|
|
245
245
|
case "mm":
|
|
246
|
-
return
|
|
246
|
+
return b.s(u2, 2, "0");
|
|
247
247
|
case "s":
|
|
248
248
|
return String(e2.$s);
|
|
249
249
|
case "ss":
|
|
250
|
-
return
|
|
250
|
+
return b.s(e2.$s, 2, "0");
|
|
251
251
|
case "SSS":
|
|
252
|
-
return
|
|
252
|
+
return b.s(e2.$ms, 3, "0");
|
|
253
253
|
case "Z":
|
|
254
254
|
return i2;
|
|
255
255
|
}
|
|
@@ -259,8 +259,8 @@ var require_dayjs_min = __commonJS({
|
|
|
259
259
|
}, m2.utcOffset = function() {
|
|
260
260
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
261
261
|
}, m2.diff = function(r2, d2, l2) {
|
|
262
|
-
var $2, y2 = this, M3 =
|
|
263
|
-
return
|
|
262
|
+
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
263
|
+
return b.m(y2, m3);
|
|
264
264
|
};
|
|
265
265
|
switch (M3) {
|
|
266
266
|
case h:
|
|
@@ -290,7 +290,7 @@ var require_dayjs_min = __commonJS({
|
|
|
290
290
|
default:
|
|
291
291
|
$2 = g2;
|
|
292
292
|
}
|
|
293
|
-
return l2 ? $2 :
|
|
293
|
+
return l2 ? $2 : b.a($2);
|
|
294
294
|
}, m2.daysInMonth = function() {
|
|
295
295
|
return this.endOf(c).$D;
|
|
296
296
|
}, m2.$locale = function() {
|
|
@@ -298,10 +298,10 @@ var require_dayjs_min = __commonJS({
|
|
|
298
298
|
}, m2.locale = function(t2, e2) {
|
|
299
299
|
if (!t2)
|
|
300
300
|
return this.$L;
|
|
301
|
-
var n2 = this.clone(), r2 =
|
|
301
|
+
var n2 = this.clone(), r2 = w(t2, e2, true);
|
|
302
302
|
return r2 && (n2.$L = r2), n2;
|
|
303
303
|
}, m2.clone = function() {
|
|
304
|
-
return
|
|
304
|
+
return b.w(this.$d, this);
|
|
305
305
|
}, m2.toDate = function() {
|
|
306
306
|
return new Date(this.valueOf());
|
|
307
307
|
}, m2.toJSON = function() {
|
|
@@ -311,16 +311,16 @@ var require_dayjs_min = __commonJS({
|
|
|
311
311
|
}, m2.toString = function() {
|
|
312
312
|
return this.$d.toUTCString();
|
|
313
313
|
}, M2;
|
|
314
|
-
}(),
|
|
315
|
-
return
|
|
316
|
-
|
|
314
|
+
}(), k = _.prototype;
|
|
315
|
+
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
|
|
316
|
+
k[t2[1]] = function(e2) {
|
|
317
317
|
return this.$g(e2, t2[0], t2[1]);
|
|
318
318
|
};
|
|
319
|
-
}),
|
|
320
|
-
return t2.$i || (t2(e2,
|
|
321
|
-
},
|
|
322
|
-
return
|
|
323
|
-
},
|
|
319
|
+
}), O.extend = function(t2, e2) {
|
|
320
|
+
return t2.$i || (t2(e2, _, O), t2.$i = true), O;
|
|
321
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
322
|
+
return O(1e3 * t2);
|
|
323
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
324
324
|
});
|
|
325
325
|
}
|
|
326
326
|
});
|
|
@@ -338,9 +338,9 @@ var require_interopRequireDefault = __commonJS({
|
|
|
338
338
|
}
|
|
339
339
|
});
|
|
340
340
|
|
|
341
|
-
// ../../node_modules/rc-util/lib/warning.js
|
|
341
|
+
// ../../node_modules/rc-picker/node_modules/rc-util/lib/warning.js
|
|
342
342
|
var require_warning = __commonJS({
|
|
343
|
-
"../../node_modules/rc-util/lib/warning.js"(exports) {
|
|
343
|
+
"../../node_modules/rc-picker/node_modules/rc-util/lib/warning.js"(exports) {
|
|
344
344
|
"use strict";
|
|
345
345
|
Object.defineProperty(exports, "__esModule", {
|
|
346
346
|
value: true
|
|
@@ -976,13 +976,14 @@ __export(src_exports, {
|
|
|
976
976
|
AntDActionElement: () => AntDActionElement,
|
|
977
977
|
AntDDragHandle: () => AntDDragHandle,
|
|
978
978
|
AntDNotToggle: () => AntDNotToggle,
|
|
979
|
+
AntDShiftActions: () => AntDShiftActions,
|
|
979
980
|
AntDValueEditor: () => AntDValueEditor,
|
|
980
981
|
AntDValueSelector: () => AntDValueSelector,
|
|
981
982
|
QueryBuilderAntD: () => QueryBuilderAntD,
|
|
982
983
|
antdControlElements: () => antdControlElements
|
|
983
984
|
});
|
|
984
985
|
module.exports = __toCommonJS(src_exports);
|
|
985
|
-
var
|
|
986
|
+
var import_react_querybuilder5 = require("react-querybuilder");
|
|
986
987
|
|
|
987
988
|
// src/AntDActionElement.tsx
|
|
988
989
|
var import_antd = require("antd");
|
|
@@ -1074,24 +1075,71 @@ var AntDNotToggle = ({
|
|
|
1074
1075
|
);
|
|
1075
1076
|
AntDNotToggle.displayName = "AntDNotToggle";
|
|
1076
1077
|
|
|
1078
|
+
// src/AntDShiftActions.tsx
|
|
1079
|
+
var import_icons2 = require("@ant-design/icons");
|
|
1080
|
+
var import_antd3 = require("antd");
|
|
1081
|
+
var React4 = __toESM(require("react"));
|
|
1082
|
+
var import_react_querybuilder = require("react-querybuilder");
|
|
1083
|
+
var AntDShiftActions = ({
|
|
1084
|
+
path,
|
|
1085
|
+
disabled,
|
|
1086
|
+
className,
|
|
1087
|
+
// labels, // Labels are hard-coded in this component
|
|
1088
|
+
titles,
|
|
1089
|
+
testID,
|
|
1090
|
+
lastInGroup,
|
|
1091
|
+
schema: { combinators, dispatchQuery, getQuery }
|
|
1092
|
+
}) => {
|
|
1093
|
+
const { shiftUp, shiftUpDisabled, shiftDown, shiftDownDisabled } = (0, import_react_querybuilder.useShiftActions)({
|
|
1094
|
+
combinators,
|
|
1095
|
+
disabled,
|
|
1096
|
+
dispatchQuery,
|
|
1097
|
+
getQuery,
|
|
1098
|
+
lastInGroup,
|
|
1099
|
+
path
|
|
1100
|
+
});
|
|
1101
|
+
return /* @__PURE__ */ React4.createElement("div", { "data-testid": testID, className }, /* @__PURE__ */ React4.createElement(
|
|
1102
|
+
import_antd3.Button,
|
|
1103
|
+
{
|
|
1104
|
+
type: "primary",
|
|
1105
|
+
size: "small",
|
|
1106
|
+
title: titles?.shiftUp,
|
|
1107
|
+
onClick: shiftUp,
|
|
1108
|
+
disabled: shiftUpDisabled
|
|
1109
|
+
},
|
|
1110
|
+
/* @__PURE__ */ React4.createElement(import_icons2.CaretUpOutlined, null)
|
|
1111
|
+
), /* @__PURE__ */ React4.createElement(
|
|
1112
|
+
import_antd3.Button,
|
|
1113
|
+
{
|
|
1114
|
+
type: "primary",
|
|
1115
|
+
size: "small",
|
|
1116
|
+
title: titles?.shiftDown,
|
|
1117
|
+
onClick: shiftDown,
|
|
1118
|
+
disabled: shiftDownDisabled
|
|
1119
|
+
},
|
|
1120
|
+
/* @__PURE__ */ React4.createElement(import_icons2.CaretDownOutlined, null)
|
|
1121
|
+
));
|
|
1122
|
+
};
|
|
1123
|
+
AntDShiftActions.displayName = "AntDShiftActions";
|
|
1124
|
+
|
|
1077
1125
|
// src/AntDValueEditor.tsx
|
|
1078
|
-
var
|
|
1126
|
+
var import_antd6 = require("antd");
|
|
1079
1127
|
var import_dayjs = __toESM(require_dayjs_min());
|
|
1080
1128
|
var import_dayjs2 = __toESM(require_dayjs());
|
|
1129
|
+
var React7 = __toESM(require("react"));
|
|
1130
|
+
var import_react_querybuilder4 = require("react-querybuilder");
|
|
1131
|
+
|
|
1132
|
+
// src/AntDValueSelector.tsx
|
|
1133
|
+
var import_antd5 = require("antd");
|
|
1081
1134
|
var React6 = __toESM(require("react"));
|
|
1082
1135
|
var import_react_querybuilder3 = require("react-querybuilder");
|
|
1083
1136
|
|
|
1084
|
-
// src/
|
|
1137
|
+
// src/utils.tsx
|
|
1085
1138
|
var import_antd4 = require("antd");
|
|
1086
1139
|
var React5 = __toESM(require("react"));
|
|
1087
1140
|
var import_react_querybuilder2 = require("react-querybuilder");
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
var import_antd3 = require("antd");
|
|
1091
|
-
var React4 = __toESM(require("react"));
|
|
1092
|
-
var import_react_querybuilder = require("react-querybuilder");
|
|
1093
|
-
var { OptGroup, Option } = import_antd3.Select;
|
|
1094
|
-
var toOptions = (arr) => (0, import_react_querybuilder.isOptionGroupArray)(arr) ? arr.map((og) => /* @__PURE__ */ React4.createElement(OptGroup, { key: og.label, label: og.label }, og.options.map((opt) => /* @__PURE__ */ React4.createElement(Option, { key: opt.name, value: opt.name }, opt.label)))) : Array.isArray(arr) ? arr.map((opt) => /* @__PURE__ */ React4.createElement(Option, { key: opt.name, value: opt.name }, opt.label)) : (
|
|
1141
|
+
var { OptGroup, Option } = import_antd4.Select;
|
|
1142
|
+
var toOptions = (arr) => (0, import_react_querybuilder2.isOptionGroupArray)(arr) ? arr.map((og) => /* @__PURE__ */ React5.createElement(OptGroup, { key: og.label, label: og.label }, og.options.map((opt) => /* @__PURE__ */ React5.createElement(Option, { key: opt.name, value: opt.name }, opt.label)))) : Array.isArray(arr) ? arr.map((opt) => /* @__PURE__ */ React5.createElement(Option, { key: opt.name, value: opt.name }, opt.label)) : (
|
|
1095
1143
|
/* istanbul ignore next */
|
|
1096
1144
|
null
|
|
1097
1145
|
);
|
|
@@ -1108,6 +1156,7 @@ var AntDValueSelector = ({
|
|
|
1108
1156
|
listsAsArrays,
|
|
1109
1157
|
// Props that should not be in extraProps
|
|
1110
1158
|
testID: _testID,
|
|
1159
|
+
rule: _rule,
|
|
1111
1160
|
rules: _rules,
|
|
1112
1161
|
level: _level,
|
|
1113
1162
|
path: _path,
|
|
@@ -1119,10 +1168,10 @@ var AntDValueSelector = ({
|
|
|
1119
1168
|
schema: _schema,
|
|
1120
1169
|
...extraProps
|
|
1121
1170
|
}) => {
|
|
1122
|
-
const { onChange, val } = (0,
|
|
1171
|
+
const { onChange, val } = (0, import_react_querybuilder3.useValueSelector)({ handleOnChange, listsAsArrays, multiple, value });
|
|
1123
1172
|
const modeObj = multiple ? { mode: "multiple" } : {};
|
|
1124
|
-
return /* @__PURE__ */
|
|
1125
|
-
|
|
1173
|
+
return /* @__PURE__ */ React6.createElement("span", { title, className }, /* @__PURE__ */ React6.createElement(
|
|
1174
|
+
import_antd5.Select,
|
|
1126
1175
|
{
|
|
1127
1176
|
...modeObj,
|
|
1128
1177
|
popupMatchSelectWidth: false,
|
|
@@ -1137,7 +1186,7 @@ var AntDValueSelector = ({
|
|
|
1137
1186
|
AntDValueSelector.displayName = "AntDValueSelector";
|
|
1138
1187
|
|
|
1139
1188
|
// src/AntDValueEditor.tsx
|
|
1140
|
-
var DatePicker =
|
|
1189
|
+
var DatePicker = import_antd6.DatePicker.generatePicker(import_dayjs2.default);
|
|
1141
1190
|
var AntDValueEditor = ({
|
|
1142
1191
|
fieldData,
|
|
1143
1192
|
operator,
|
|
@@ -1157,7 +1206,7 @@ var AntDValueEditor = ({
|
|
|
1157
1206
|
selectorComponent: SelectorComponent = AntDValueSelector,
|
|
1158
1207
|
...props
|
|
1159
1208
|
}) => {
|
|
1160
|
-
const { valueAsArray, multiValueHandler } = (0,
|
|
1209
|
+
const { valueAsArray, multiValueHandler } = (0, import_react_querybuilder4.useValueEditor)({
|
|
1161
1210
|
handleOnChange,
|
|
1162
1211
|
inputType,
|
|
1163
1212
|
operator,
|
|
@@ -1177,51 +1226,51 @@ var AntDValueEditor = ({
|
|
|
1177
1226
|
const editors = ["from", "to"].map((key, i) => {
|
|
1178
1227
|
if (type === "text") {
|
|
1179
1228
|
if (inputTypeCoerced === "time") {
|
|
1180
|
-
return /* @__PURE__ */
|
|
1181
|
-
|
|
1229
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1230
|
+
import_antd6.TimePicker,
|
|
1182
1231
|
{
|
|
1183
1232
|
key,
|
|
1184
1233
|
value: valueAsArray[i] ? (0, import_dayjs.default)(valueAsArray[i], "HH:mm:ss") : null,
|
|
1185
|
-
className:
|
|
1234
|
+
className: import_react_querybuilder4.standardClassnames.valueListItem,
|
|
1186
1235
|
disabled,
|
|
1187
1236
|
placeholder: placeHolderText,
|
|
1188
1237
|
onChange: (d) => multiValueHandler(d?.format("HH:mm:ss") ?? "", i)
|
|
1189
1238
|
}
|
|
1190
1239
|
);
|
|
1191
1240
|
}
|
|
1192
|
-
return /* @__PURE__ */
|
|
1193
|
-
|
|
1241
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1242
|
+
import_antd6.Input,
|
|
1194
1243
|
{
|
|
1195
1244
|
key,
|
|
1196
1245
|
type: inputTypeCoerced,
|
|
1197
1246
|
value: valueAsArray[i] ?? "",
|
|
1198
|
-
className:
|
|
1247
|
+
className: import_react_querybuilder4.standardClassnames.valueListItem,
|
|
1199
1248
|
disabled,
|
|
1200
1249
|
placeholder: placeHolderText,
|
|
1201
1250
|
onChange: (e) => multiValueHandler(e.target.value, i)
|
|
1202
1251
|
}
|
|
1203
1252
|
);
|
|
1204
1253
|
}
|
|
1205
|
-
return /* @__PURE__ */
|
|
1254
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1206
1255
|
SelectorComponent,
|
|
1207
1256
|
{
|
|
1208
1257
|
...props,
|
|
1209
1258
|
key,
|
|
1210
|
-
className:
|
|
1259
|
+
className: import_react_querybuilder4.standardClassnames.valueListItem,
|
|
1211
1260
|
handleOnChange: (v) => multiValueHandler(v, i),
|
|
1212
1261
|
disabled,
|
|
1213
|
-
value: valueAsArray[i] ?? (0,
|
|
1262
|
+
value: valueAsArray[i] ?? (0, import_react_querybuilder4.getFirstOption)(values),
|
|
1214
1263
|
options: values,
|
|
1215
1264
|
listsAsArrays
|
|
1216
1265
|
}
|
|
1217
1266
|
);
|
|
1218
1267
|
});
|
|
1219
|
-
return /* @__PURE__ */
|
|
1268
|
+
return /* @__PURE__ */ React7.createElement("span", { "data-testid": testID, className, title }, editors[0], separator, editors[1]);
|
|
1220
1269
|
}
|
|
1221
1270
|
switch (type) {
|
|
1222
1271
|
case "select":
|
|
1223
1272
|
case "multiselect":
|
|
1224
|
-
return /* @__PURE__ */
|
|
1273
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1225
1274
|
SelectorComponent,
|
|
1226
1275
|
{
|
|
1227
1276
|
...props,
|
|
@@ -1236,8 +1285,8 @@ var AntDValueEditor = ({
|
|
|
1236
1285
|
}
|
|
1237
1286
|
);
|
|
1238
1287
|
case "textarea":
|
|
1239
|
-
return /* @__PURE__ */
|
|
1240
|
-
|
|
1288
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1289
|
+
import_antd6.Input.TextArea,
|
|
1241
1290
|
{
|
|
1242
1291
|
value,
|
|
1243
1292
|
title,
|
|
@@ -1248,8 +1297,8 @@ var AntDValueEditor = ({
|
|
|
1248
1297
|
}
|
|
1249
1298
|
);
|
|
1250
1299
|
case "switch":
|
|
1251
|
-
return /* @__PURE__ */
|
|
1252
|
-
|
|
1300
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1301
|
+
import_antd6.Switch,
|
|
1253
1302
|
{
|
|
1254
1303
|
checked: !!value,
|
|
1255
1304
|
title,
|
|
@@ -1259,8 +1308,8 @@ var AntDValueEditor = ({
|
|
|
1259
1308
|
}
|
|
1260
1309
|
);
|
|
1261
1310
|
case "checkbox":
|
|
1262
|
-
return /* @__PURE__ */
|
|
1263
|
-
|
|
1311
|
+
return /* @__PURE__ */ React7.createElement("span", { title, className }, /* @__PURE__ */ React7.createElement(
|
|
1312
|
+
import_antd6.Checkbox,
|
|
1264
1313
|
{
|
|
1265
1314
|
type: "checkbox",
|
|
1266
1315
|
disabled,
|
|
@@ -1269,8 +1318,8 @@ var AntDValueEditor = ({
|
|
|
1269
1318
|
}
|
|
1270
1319
|
));
|
|
1271
1320
|
case "radio":
|
|
1272
|
-
return /* @__PURE__ */
|
|
1273
|
-
|
|
1321
|
+
return /* @__PURE__ */ React7.createElement("span", { className, title }, values.map((v) => /* @__PURE__ */ React7.createElement(
|
|
1322
|
+
import_antd6.Radio,
|
|
1274
1323
|
{
|
|
1275
1324
|
key: v.name,
|
|
1276
1325
|
value: v.name,
|
|
@@ -1284,10 +1333,10 @@ var AntDValueEditor = ({
|
|
|
1284
1333
|
switch (inputTypeCoerced) {
|
|
1285
1334
|
case "date":
|
|
1286
1335
|
case "datetime-local":
|
|
1287
|
-
return operator === "between" || operator === "notBetween" ? /* @__PURE__ */
|
|
1336
|
+
return operator === "between" || operator === "notBetween" ? /* @__PURE__ */ React7.createElement(
|
|
1288
1337
|
DatePicker.RangePicker,
|
|
1289
1338
|
{
|
|
1290
|
-
value: (0,
|
|
1339
|
+
value: (0, import_react_querybuilder4.toArray)(value)?.length >= 2 ? (0, import_react_querybuilder4.toArray)(value).map((v) => (0, import_dayjs.default)(v)) : void 0,
|
|
1291
1340
|
showTime: inputTypeCoerced === "datetime-local",
|
|
1292
1341
|
className,
|
|
1293
1342
|
disabled,
|
|
@@ -1301,7 +1350,7 @@ var AntDValueEditor = ({
|
|
|
1301
1350
|
}
|
|
1302
1351
|
)
|
|
1303
1352
|
}
|
|
1304
|
-
) : /* @__PURE__ */
|
|
1353
|
+
) : /* @__PURE__ */ React7.createElement(
|
|
1305
1354
|
DatePicker,
|
|
1306
1355
|
{
|
|
1307
1356
|
value: value ? (0, import_dayjs.default)(value) : null,
|
|
@@ -1313,8 +1362,8 @@ var AntDValueEditor = ({
|
|
|
1313
1362
|
}
|
|
1314
1363
|
);
|
|
1315
1364
|
case "time":
|
|
1316
|
-
return /* @__PURE__ */
|
|
1317
|
-
|
|
1365
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1366
|
+
import_antd6.TimePicker,
|
|
1318
1367
|
{
|
|
1319
1368
|
value: value ? (0, import_dayjs.default)(value, "HH:mm:ss") : null,
|
|
1320
1369
|
className,
|
|
@@ -1324,8 +1373,8 @@ var AntDValueEditor = ({
|
|
|
1324
1373
|
}
|
|
1325
1374
|
);
|
|
1326
1375
|
}
|
|
1327
|
-
return /* @__PURE__ */
|
|
1328
|
-
|
|
1376
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1377
|
+
import_antd6.Input,
|
|
1329
1378
|
{
|
|
1330
1379
|
type: inputTypeCoerced,
|
|
1331
1380
|
value,
|
|
@@ -1355,9 +1404,10 @@ var antdControlElements = {
|
|
|
1355
1404
|
removeRuleAction: AntDActionElement,
|
|
1356
1405
|
valueEditor: AntDValueEditor,
|
|
1357
1406
|
dragHandle: AntDDragHandle,
|
|
1358
|
-
valueSourceSelector: AntDValueSelector
|
|
1407
|
+
valueSourceSelector: AntDValueSelector,
|
|
1408
|
+
shiftActions: AntDShiftActions
|
|
1359
1409
|
};
|
|
1360
|
-
var QueryBuilderAntD = (0,
|
|
1410
|
+
var QueryBuilderAntD = (0, import_react_querybuilder5.getCompatContextProvider)({
|
|
1361
1411
|
key: "antd",
|
|
1362
1412
|
controlElements: antdControlElements
|
|
1363
1413
|
});
|
|
@@ -1366,6 +1416,7 @@ var QueryBuilderAntD = (0, import_react_querybuilder4.getCompatContextProvider)(
|
|
|
1366
1416
|
AntDActionElement,
|
|
1367
1417
|
AntDDragHandle,
|
|
1368
1418
|
AntDNotToggle,
|
|
1419
|
+
AntDShiftActions,
|
|
1369
1420
|
AntDValueEditor,
|
|
1370
1421
|
AntDValueSelector,
|
|
1371
1422
|
QueryBuilderAntD,
|