@react-querybuilder/antd 6.6.0-alpha.0 → 7.0.0-alpha.1
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 +119 -18
- package/dist/cjs/react-querybuilder_antd.cjs.development.js +198 -120
- package/dist/cjs/react-querybuilder_antd.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_antd.cjs.production.d.ts +119 -18
- 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 +119 -18
- package/dist/react-querybuilder_antd.legacy-esm.d.mts +119 -18
- package/dist/react-querybuilder_antd.legacy-esm.js +188 -109
- package/dist/react-querybuilder_antd.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_antd.mjs +184 -106
- package/dist/react-querybuilder_antd.mjs.map +1 -1
- package/dist/react-querybuilder_antd.production.d.mts +119 -18
- package/dist/react-querybuilder_antd.production.mjs +1 -1
- package/dist/react-querybuilder_antd.production.mjs.map +1 -1
- package/package.json +14 -14
|
@@ -83,9 +83,9 @@ var require_dayjs_min = __commonJS({
|
|
|
83
83
|
return void 0 === t2;
|
|
84
84
|
} }, g = "en", D = {};
|
|
85
85
|
D[g] = M;
|
|
86
|
-
var p = function(t2) {
|
|
87
|
-
return t2 instanceof
|
|
88
|
-
},
|
|
86
|
+
var p = "$isDayjsObject", S = function(t2) {
|
|
87
|
+
return t2 instanceof _ || !(!t2 || !t2[p]);
|
|
88
|
+
}, w = function t2(e2, n2, r2) {
|
|
89
89
|
var i2;
|
|
90
90
|
if (!e2)
|
|
91
91
|
return g;
|
|
@@ -100,18 +100,18 @@ var require_dayjs_min = __commonJS({
|
|
|
100
100
|
D[a2] = e2, i2 = a2;
|
|
101
101
|
}
|
|
102
102
|
return !r2 && i2 && (g = i2), i2 || !r2 && g;
|
|
103
|
-
},
|
|
104
|
-
if (
|
|
103
|
+
}, O = function(t2, e2) {
|
|
104
|
+
if (S(t2))
|
|
105
105
|
return t2.clone();
|
|
106
106
|
var n2 = "object" == typeof e2 ? e2 : {};
|
|
107
|
-
return n2.date = t2, n2.args = arguments, new
|
|
108
|
-
},
|
|
109
|
-
|
|
110
|
-
return
|
|
107
|
+
return n2.date = t2, n2.args = arguments, new _(n2);
|
|
108
|
+
}, b = v;
|
|
109
|
+
b.l = w, b.i = S, b.w = function(t2, e2) {
|
|
110
|
+
return O(t2, { locale: e2.$L, utc: e2.$u, x: e2.$x, $offset: e2.$offset });
|
|
111
111
|
};
|
|
112
|
-
var
|
|
112
|
+
var _ = function() {
|
|
113
113
|
function M2(t2) {
|
|
114
|
-
this.$L =
|
|
114
|
+
this.$L = w(t2.locale, null, true), this.parse(t2), this.$x = this.$x || t2.x || {}, this[p] = true;
|
|
115
115
|
}
|
|
116
116
|
var m2 = M2.prototype;
|
|
117
117
|
return m2.parse = function(t2) {
|
|
@@ -119,7 +119,7 @@ var require_dayjs_min = __commonJS({
|
|
|
119
119
|
var e2 = t3.date, n2 = t3.utc;
|
|
120
120
|
if (null === e2)
|
|
121
121
|
return /* @__PURE__ */ new Date(NaN);
|
|
122
|
-
if (
|
|
122
|
+
if (b.u(e2))
|
|
123
123
|
return /* @__PURE__ */ new Date();
|
|
124
124
|
if (e2 instanceof Date)
|
|
125
125
|
return new Date(e2);
|
|
@@ -131,33 +131,33 @@ var require_dayjs_min = __commonJS({
|
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
return new Date(e2);
|
|
134
|
-
}(t2), this
|
|
134
|
+
}(t2), this.init();
|
|
135
135
|
}, m2.init = function() {
|
|
136
136
|
var t2 = this.$d;
|
|
137
137
|
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();
|
|
138
138
|
}, m2.$utils = function() {
|
|
139
|
-
return
|
|
139
|
+
return b;
|
|
140
140
|
}, m2.isValid = function() {
|
|
141
141
|
return !(this.$d.toString() === l);
|
|
142
142
|
}, m2.isSame = function(t2, e2) {
|
|
143
|
-
var n2 =
|
|
143
|
+
var n2 = O(t2);
|
|
144
144
|
return this.startOf(e2) <= n2 && n2 <= this.endOf(e2);
|
|
145
145
|
}, m2.isAfter = function(t2, e2) {
|
|
146
|
-
return
|
|
146
|
+
return O(t2) < this.startOf(e2);
|
|
147
147
|
}, m2.isBefore = function(t2, e2) {
|
|
148
|
-
return this.endOf(e2) <
|
|
148
|
+
return this.endOf(e2) < O(t2);
|
|
149
149
|
}, m2.$g = function(t2, e2, n2) {
|
|
150
|
-
return
|
|
150
|
+
return b.u(t2) ? this[e2] : this.set(n2, t2);
|
|
151
151
|
}, m2.unix = function() {
|
|
152
152
|
return Math.floor(this.valueOf() / 1e3);
|
|
153
153
|
}, m2.valueOf = function() {
|
|
154
154
|
return this.$d.getTime();
|
|
155
155
|
}, m2.startOf = function(t2, e2) {
|
|
156
|
-
var n2 = this, r2 = !!
|
|
157
|
-
var i2 =
|
|
156
|
+
var n2 = this, r2 = !!b.u(e2) || e2, f2 = b.p(t2), l2 = function(t3, e3) {
|
|
157
|
+
var i2 = b.w(n2.$u ? Date.UTC(n2.$y, e3, t3) : new Date(n2.$y, e3, t3), n2);
|
|
158
158
|
return r2 ? i2 : i2.endOf(a);
|
|
159
159
|
}, $2 = function(t3, e3) {
|
|
160
|
-
return
|
|
160
|
+
return b.w(n2.toDate()[t3].apply(n2.toDate("s"), (r2 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e3)), n2);
|
|
161
161
|
}, y2 = this.$W, M3 = this.$M, m3 = this.$D, v2 = "set" + (this.$u ? "UTC" : "");
|
|
162
162
|
switch (f2) {
|
|
163
163
|
case h:
|
|
@@ -182,7 +182,7 @@ var require_dayjs_min = __commonJS({
|
|
|
182
182
|
}, m2.endOf = function(t2) {
|
|
183
183
|
return this.startOf(t2, false);
|
|
184
184
|
}, m2.$set = function(t2, e2) {
|
|
185
|
-
var n2, o2 =
|
|
185
|
+
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;
|
|
186
186
|
if (o2 === c || o2 === h) {
|
|
187
187
|
var y2 = this.clone().set(d, 1);
|
|
188
188
|
y2.$d[l2]($2), y2.init(), this.$d = y2.set(d, Math.min(this.$D, y2.daysInMonth())).$d;
|
|
@@ -192,13 +192,13 @@ var require_dayjs_min = __commonJS({
|
|
|
192
192
|
}, m2.set = function(t2, e2) {
|
|
193
193
|
return this.clone().$set(t2, e2);
|
|
194
194
|
}, m2.get = function(t2) {
|
|
195
|
-
return this[
|
|
195
|
+
return this[b.p(t2)]();
|
|
196
196
|
}, m2.add = function(r2, f2) {
|
|
197
197
|
var d2, l2 = this;
|
|
198
198
|
r2 = Number(r2);
|
|
199
|
-
var $2 =
|
|
200
|
-
var e2 =
|
|
201
|
-
return
|
|
199
|
+
var $2 = b.p(f2), y2 = function(t2) {
|
|
200
|
+
var e2 = O(l2);
|
|
201
|
+
return b.w(e2.date(e2.date() + Math.round(t2 * r2)), l2);
|
|
202
202
|
};
|
|
203
203
|
if ($2 === c)
|
|
204
204
|
return this.set(c, this.$M + r2);
|
|
@@ -209,17 +209,17 @@ var require_dayjs_min = __commonJS({
|
|
|
209
209
|
if ($2 === o)
|
|
210
210
|
return y2(7);
|
|
211
211
|
var M3 = (d2 = {}, d2[s] = e, d2[u] = n, d2[i] = t, d2)[$2] || 1, m3 = this.$d.getTime() + r2 * M3;
|
|
212
|
-
return
|
|
212
|
+
return b.w(m3, this);
|
|
213
213
|
}, m2.subtract = function(t2, e2) {
|
|
214
214
|
return this.add(-1 * t2, e2);
|
|
215
215
|
}, m2.format = function(t2) {
|
|
216
216
|
var e2 = this, n2 = this.$locale();
|
|
217
217
|
if (!this.isValid())
|
|
218
218
|
return n2.invalidDate || l;
|
|
219
|
-
var r2 = t2 || "YYYY-MM-DDTHH:mm:ssZ", i2 =
|
|
219
|
+
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) {
|
|
220
220
|
return t3 && (t3[n3] || t3(e2, r2)) || i3[n3].slice(0, s3);
|
|
221
221
|
}, d2 = function(t3) {
|
|
222
|
-
return
|
|
222
|
+
return b.s(s2 % 12 || 12, t3, "0");
|
|
223
223
|
}, $2 = f2 || function(t3, e3, n3) {
|
|
224
224
|
var r3 = t3 < 12 ? "AM" : "PM";
|
|
225
225
|
return n3 ? r3.toLowerCase() : r3;
|
|
@@ -230,11 +230,11 @@ var require_dayjs_min = __commonJS({
|
|
|
230
230
|
case "YY":
|
|
231
231
|
return String(e2.$y).slice(-2);
|
|
232
232
|
case "YYYY":
|
|
233
|
-
return
|
|
233
|
+
return b.s(e2.$y, 4, "0");
|
|
234
234
|
case "M":
|
|
235
235
|
return a2 + 1;
|
|
236
236
|
case "MM":
|
|
237
|
-
return
|
|
237
|
+
return b.s(a2 + 1, 2, "0");
|
|
238
238
|
case "MMM":
|
|
239
239
|
return h2(n2.monthsShort, a2, c2, 3);
|
|
240
240
|
case "MMMM":
|
|
@@ -242,7 +242,7 @@ var require_dayjs_min = __commonJS({
|
|
|
242
242
|
case "D":
|
|
243
243
|
return e2.$D;
|
|
244
244
|
case "DD":
|
|
245
|
-
return
|
|
245
|
+
return b.s(e2.$D, 2, "0");
|
|
246
246
|
case "d":
|
|
247
247
|
return String(e2.$W);
|
|
248
248
|
case "dd":
|
|
@@ -254,7 +254,7 @@ var require_dayjs_min = __commonJS({
|
|
|
254
254
|
case "H":
|
|
255
255
|
return String(s2);
|
|
256
256
|
case "HH":
|
|
257
|
-
return
|
|
257
|
+
return b.s(s2, 2, "0");
|
|
258
258
|
case "h":
|
|
259
259
|
return d2(1);
|
|
260
260
|
case "hh":
|
|
@@ -266,13 +266,13 @@ var require_dayjs_min = __commonJS({
|
|
|
266
266
|
case "m":
|
|
267
267
|
return String(u2);
|
|
268
268
|
case "mm":
|
|
269
|
-
return
|
|
269
|
+
return b.s(u2, 2, "0");
|
|
270
270
|
case "s":
|
|
271
271
|
return String(e2.$s);
|
|
272
272
|
case "ss":
|
|
273
|
-
return
|
|
273
|
+
return b.s(e2.$s, 2, "0");
|
|
274
274
|
case "SSS":
|
|
275
|
-
return
|
|
275
|
+
return b.s(e2.$ms, 3, "0");
|
|
276
276
|
case "Z":
|
|
277
277
|
return i2;
|
|
278
278
|
}
|
|
@@ -282,8 +282,8 @@ var require_dayjs_min = __commonJS({
|
|
|
282
282
|
}, m2.utcOffset = function() {
|
|
283
283
|
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
284
284
|
}, m2.diff = function(r2, d2, l2) {
|
|
285
|
-
var $2, y2 = this, M3 =
|
|
286
|
-
return
|
|
285
|
+
var $2, y2 = this, M3 = b.p(d2), m3 = O(r2), v2 = (m3.utcOffset() - this.utcOffset()) * e, g2 = this - m3, D2 = function() {
|
|
286
|
+
return b.m(y2, m3);
|
|
287
287
|
};
|
|
288
288
|
switch (M3) {
|
|
289
289
|
case h:
|
|
@@ -313,7 +313,7 @@ var require_dayjs_min = __commonJS({
|
|
|
313
313
|
default:
|
|
314
314
|
$2 = g2;
|
|
315
315
|
}
|
|
316
|
-
return l2 ? $2 :
|
|
316
|
+
return l2 ? $2 : b.a($2);
|
|
317
317
|
}, m2.daysInMonth = function() {
|
|
318
318
|
return this.endOf(c).$D;
|
|
319
319
|
}, m2.$locale = function() {
|
|
@@ -321,10 +321,10 @@ var require_dayjs_min = __commonJS({
|
|
|
321
321
|
}, m2.locale = function(t2, e2) {
|
|
322
322
|
if (!t2)
|
|
323
323
|
return this.$L;
|
|
324
|
-
var n2 = this.clone(), r2 =
|
|
324
|
+
var n2 = this.clone(), r2 = w(t2, e2, true);
|
|
325
325
|
return r2 && (n2.$L = r2), n2;
|
|
326
326
|
}, m2.clone = function() {
|
|
327
|
-
return
|
|
327
|
+
return b.w(this.$d, this);
|
|
328
328
|
}, m2.toDate = function() {
|
|
329
329
|
return new Date(this.valueOf());
|
|
330
330
|
}, m2.toJSON = function() {
|
|
@@ -334,16 +334,16 @@ var require_dayjs_min = __commonJS({
|
|
|
334
334
|
}, m2.toString = function() {
|
|
335
335
|
return this.$d.toUTCString();
|
|
336
336
|
}, M2;
|
|
337
|
-
}(),
|
|
338
|
-
return
|
|
339
|
-
|
|
337
|
+
}(), k = _.prototype;
|
|
338
|
+
return O.prototype = k, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", c], ["$y", h], ["$D", d]].forEach(function(t2) {
|
|
339
|
+
k[t2[1]] = function(e2) {
|
|
340
340
|
return this.$g(e2, t2[0], t2[1]);
|
|
341
341
|
};
|
|
342
|
-
}),
|
|
343
|
-
return t2.$i || (t2(e2,
|
|
344
|
-
},
|
|
345
|
-
return
|
|
346
|
-
},
|
|
342
|
+
}), O.extend = function(t2, e2) {
|
|
343
|
+
return t2.$i || (t2(e2, _, O), t2.$i = true), O;
|
|
344
|
+
}, O.locale = w, O.isDayjs = S, O.unix = function(t2) {
|
|
345
|
+
return O(1e3 * t2);
|
|
346
|
+
}, O.en = D[g], O.Ls = D, O.p = {}, O;
|
|
347
347
|
});
|
|
348
348
|
}
|
|
349
349
|
});
|
|
@@ -361,9 +361,9 @@ var require_interopRequireDefault = __commonJS({
|
|
|
361
361
|
}
|
|
362
362
|
});
|
|
363
363
|
|
|
364
|
-
// ../../node_modules/rc-util/lib/warning.js
|
|
364
|
+
// ../../node_modules/rc-picker/node_modules/rc-util/lib/warning.js
|
|
365
365
|
var require_warning = __commonJS({
|
|
366
|
-
"../../node_modules/rc-util/lib/warning.js"(exports) {
|
|
366
|
+
"../../node_modules/rc-picker/node_modules/rc-util/lib/warning.js"(exports) {
|
|
367
367
|
"use strict";
|
|
368
368
|
Object.defineProperty(exports, "__esModule", {
|
|
369
369
|
value: true
|
|
@@ -988,12 +988,20 @@ var require_dayjs = __commonJS({
|
|
|
988
988
|
}
|
|
989
989
|
}
|
|
990
990
|
};
|
|
991
|
-
var _default = generateConfig;
|
|
992
|
-
exports.default = _default;
|
|
991
|
+
var _default = exports.default = generateConfig;
|
|
993
992
|
}
|
|
994
993
|
});
|
|
995
994
|
|
|
996
|
-
// src/index.
|
|
995
|
+
// src/index.tsx
|
|
996
|
+
import {
|
|
997
|
+
CloseOutlined,
|
|
998
|
+
CopyOutlined,
|
|
999
|
+
DownOutlined,
|
|
1000
|
+
LockOutlined,
|
|
1001
|
+
UnlockOutlined,
|
|
1002
|
+
UpOutlined
|
|
1003
|
+
} from "@ant-design/icons";
|
|
1004
|
+
import * as React8 from "react";
|
|
997
1005
|
import { getCompatContextProvider } from "react-querybuilder";
|
|
998
1006
|
|
|
999
1007
|
// src/AntDActionElement.tsx
|
|
@@ -1130,29 +1138,71 @@ var AntDNotToggle = (_a) => {
|
|
|
1130
1138
|
};
|
|
1131
1139
|
AntDNotToggle.displayName = "AntDNotToggle";
|
|
1132
1140
|
|
|
1141
|
+
// src/AntDShiftActions.tsx
|
|
1142
|
+
import { Button as Button2 } from "antd";
|
|
1143
|
+
import * as React4 from "react";
|
|
1144
|
+
import { useShiftActions } from "react-querybuilder";
|
|
1145
|
+
var AntDShiftActions = ({
|
|
1146
|
+
path,
|
|
1147
|
+
disabled,
|
|
1148
|
+
className,
|
|
1149
|
+
labels,
|
|
1150
|
+
titles,
|
|
1151
|
+
testID,
|
|
1152
|
+
lastInGroup,
|
|
1153
|
+
schema: { combinators, dispatchQuery, getQuery }
|
|
1154
|
+
}) => {
|
|
1155
|
+
const { shiftUp, shiftUpDisabled, shiftDown, shiftDownDisabled } = useShiftActions({
|
|
1156
|
+
combinators,
|
|
1157
|
+
disabled,
|
|
1158
|
+
dispatchQuery,
|
|
1159
|
+
getQuery,
|
|
1160
|
+
lastInGroup,
|
|
1161
|
+
path
|
|
1162
|
+
});
|
|
1163
|
+
return /* @__PURE__ */ React4.createElement("div", { "data-testid": testID, className }, /* @__PURE__ */ React4.createElement(
|
|
1164
|
+
Button2,
|
|
1165
|
+
{
|
|
1166
|
+
type: "primary",
|
|
1167
|
+
size: "small",
|
|
1168
|
+
title: titles == null ? void 0 : titles.shiftUp,
|
|
1169
|
+
onClick: shiftUp,
|
|
1170
|
+
disabled: shiftUpDisabled
|
|
1171
|
+
},
|
|
1172
|
+
labels == null ? void 0 : labels.shiftUp
|
|
1173
|
+
), /* @__PURE__ */ React4.createElement(
|
|
1174
|
+
Button2,
|
|
1175
|
+
{
|
|
1176
|
+
type: "primary",
|
|
1177
|
+
size: "small",
|
|
1178
|
+
title: titles == null ? void 0 : titles.shiftDown,
|
|
1179
|
+
onClick: shiftDown,
|
|
1180
|
+
disabled: shiftDownDisabled
|
|
1181
|
+
},
|
|
1182
|
+
labels == null ? void 0 : labels.shiftDown
|
|
1183
|
+
));
|
|
1184
|
+
};
|
|
1185
|
+
AntDShiftActions.displayName = "AntDShiftActions";
|
|
1186
|
+
|
|
1133
1187
|
// src/AntDValueEditor.tsx
|
|
1134
1188
|
var import_dayjs = __toESM(require_dayjs_min());
|
|
1135
1189
|
var import_dayjs2 = __toESM(require_dayjs());
|
|
1136
|
-
import {
|
|
1137
|
-
import
|
|
1138
|
-
import
|
|
1139
|
-
|
|
1140
|
-
standardClassnames,
|
|
1141
|
-
toArray,
|
|
1142
|
-
useValueEditor
|
|
1143
|
-
} from "react-querybuilder";
|
|
1190
|
+
import { Checkbox, Input, Radio, Switch as Switch2 } from "antd";
|
|
1191
|
+
import generatePicker from "antd/es/date-picker/generatePicker/index.js";
|
|
1192
|
+
import * as React7 from "react";
|
|
1193
|
+
import { getFirstOption, joinWith, standardClassnames, useValueEditor } from "react-querybuilder";
|
|
1144
1194
|
|
|
1145
1195
|
// src/AntDValueSelector.tsx
|
|
1146
1196
|
import { Select as Select2 } from "antd";
|
|
1147
|
-
import * as
|
|
1197
|
+
import * as React6 from "react";
|
|
1148
1198
|
import { useValueSelector } from "react-querybuilder";
|
|
1149
1199
|
|
|
1150
1200
|
// src/utils.tsx
|
|
1151
1201
|
import { Select } from "antd";
|
|
1152
|
-
import * as
|
|
1202
|
+
import * as React5 from "react";
|
|
1153
1203
|
import { isOptionGroupArray } from "react-querybuilder";
|
|
1154
1204
|
var { OptGroup, Option } = Select;
|
|
1155
|
-
var toOptions = (arr) => isOptionGroupArray(arr) ? arr.map((og) => /* @__PURE__ */
|
|
1205
|
+
var toOptions = (arr) => 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)) : (
|
|
1156
1206
|
/* istanbul ignore next */
|
|
1157
1207
|
null
|
|
1158
1208
|
);
|
|
@@ -1169,6 +1219,7 @@ var AntDValueSelector = (_a) => {
|
|
|
1169
1219
|
multiple,
|
|
1170
1220
|
listsAsArrays,
|
|
1171
1221
|
testID: _testID,
|
|
1222
|
+
rule: _rule,
|
|
1172
1223
|
rules: _rules,
|
|
1173
1224
|
level: _level,
|
|
1174
1225
|
path: _path,
|
|
@@ -1189,6 +1240,7 @@ var AntDValueSelector = (_a) => {
|
|
|
1189
1240
|
"listsAsArrays",
|
|
1190
1241
|
// Props that should not be in extraProps
|
|
1191
1242
|
"testID",
|
|
1243
|
+
"rule",
|
|
1192
1244
|
"rules",
|
|
1193
1245
|
"level",
|
|
1194
1246
|
"path",
|
|
@@ -1201,7 +1253,7 @@ var AntDValueSelector = (_a) => {
|
|
|
1201
1253
|
]);
|
|
1202
1254
|
const { onChange, val } = useValueSelector({ handleOnChange, listsAsArrays, multiple, value });
|
|
1203
1255
|
const modeObj = multiple ? { mode: "multiple" } : {};
|
|
1204
|
-
return /* @__PURE__ */
|
|
1256
|
+
return /* @__PURE__ */ React6.createElement("span", { title, className }, /* @__PURE__ */ React6.createElement(
|
|
1205
1257
|
Select2,
|
|
1206
1258
|
__spreadValues(__spreadProps(__spreadValues({}, modeObj), {
|
|
1207
1259
|
popupMatchSelectWidth: false,
|
|
@@ -1215,7 +1267,7 @@ var AntDValueSelector = (_a) => {
|
|
|
1215
1267
|
AntDValueSelector.displayName = "AntDValueSelector";
|
|
1216
1268
|
|
|
1217
1269
|
// src/AntDValueEditor.tsx
|
|
1218
|
-
var DatePicker =
|
|
1270
|
+
var DatePicker = generatePicker(import_dayjs2.default);
|
|
1219
1271
|
var AntDValueEditor = (_a) => {
|
|
1220
1272
|
var _b = _a, {
|
|
1221
1273
|
fieldData,
|
|
@@ -1252,7 +1304,7 @@ var AntDValueEditor = (_a) => {
|
|
|
1252
1304
|
"testID",
|
|
1253
1305
|
"selectorComponent"
|
|
1254
1306
|
]);
|
|
1255
|
-
var _a2
|
|
1307
|
+
var _a2;
|
|
1256
1308
|
const { valueAsArray, multiValueHandler } = useValueEditor({
|
|
1257
1309
|
handleOnChange,
|
|
1258
1310
|
inputType,
|
|
@@ -1271,11 +1323,11 @@ var AntDValueEditor = (_a) => {
|
|
|
1271
1323
|
if ((operator === "between" || operator === "notBetween") && (type === "select" || type === "text") && // Date ranges are handled differently in AntD--see below
|
|
1272
1324
|
inputTypeCoerced !== "date" && inputTypeCoerced !== "datetime-local") {
|
|
1273
1325
|
const editors = ["from", "to"].map((key, i) => {
|
|
1274
|
-
var _a3,
|
|
1326
|
+
var _a3, _b2;
|
|
1275
1327
|
if (type === "text") {
|
|
1276
1328
|
if (inputTypeCoerced === "time") {
|
|
1277
|
-
return /* @__PURE__ */
|
|
1278
|
-
TimePicker,
|
|
1329
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1330
|
+
DatePicker.TimePicker,
|
|
1279
1331
|
{
|
|
1280
1332
|
key,
|
|
1281
1333
|
value: valueAsArray[i] ? (0, import_dayjs.default)(valueAsArray[i], "HH:mm:ss") : null,
|
|
@@ -1289,7 +1341,7 @@ var AntDValueEditor = (_a) => {
|
|
|
1289
1341
|
}
|
|
1290
1342
|
);
|
|
1291
1343
|
}
|
|
1292
|
-
return /* @__PURE__ */
|
|
1344
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1293
1345
|
Input,
|
|
1294
1346
|
{
|
|
1295
1347
|
key,
|
|
@@ -1302,25 +1354,25 @@ var AntDValueEditor = (_a) => {
|
|
|
1302
1354
|
}
|
|
1303
1355
|
);
|
|
1304
1356
|
}
|
|
1305
|
-
return /* @__PURE__ */
|
|
1357
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1306
1358
|
SelectorComponent,
|
|
1307
1359
|
__spreadProps(__spreadValues({}, props), {
|
|
1308
1360
|
key,
|
|
1309
1361
|
className: standardClassnames.valueListItem,
|
|
1310
1362
|
handleOnChange: (v) => multiValueHandler(v, i),
|
|
1311
1363
|
disabled,
|
|
1312
|
-
value: (
|
|
1364
|
+
value: (_b2 = valueAsArray[i]) != null ? _b2 : getFirstOption(values),
|
|
1313
1365
|
options: values,
|
|
1314
1366
|
listsAsArrays
|
|
1315
1367
|
})
|
|
1316
1368
|
);
|
|
1317
1369
|
});
|
|
1318
|
-
return /* @__PURE__ */
|
|
1370
|
+
return /* @__PURE__ */ React7.createElement("span", { "data-testid": testID, className, title }, editors[0], separator, editors[1]);
|
|
1319
1371
|
}
|
|
1320
1372
|
switch (type) {
|
|
1321
1373
|
case "select":
|
|
1322
1374
|
case "multiselect":
|
|
1323
|
-
return /* @__PURE__ */
|
|
1375
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1324
1376
|
SelectorComponent,
|
|
1325
1377
|
__spreadProps(__spreadValues({}, props), {
|
|
1326
1378
|
className,
|
|
@@ -1334,7 +1386,7 @@ var AntDValueEditor = (_a) => {
|
|
|
1334
1386
|
})
|
|
1335
1387
|
);
|
|
1336
1388
|
case "textarea":
|
|
1337
|
-
return /* @__PURE__ */
|
|
1389
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1338
1390
|
Input.TextArea,
|
|
1339
1391
|
{
|
|
1340
1392
|
value,
|
|
@@ -1346,7 +1398,7 @@ var AntDValueEditor = (_a) => {
|
|
|
1346
1398
|
}
|
|
1347
1399
|
);
|
|
1348
1400
|
case "switch":
|
|
1349
|
-
return /* @__PURE__ */
|
|
1401
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1350
1402
|
Switch2,
|
|
1351
1403
|
{
|
|
1352
1404
|
checked: !!value,
|
|
@@ -1357,7 +1409,7 @@ var AntDValueEditor = (_a) => {
|
|
|
1357
1409
|
}
|
|
1358
1410
|
);
|
|
1359
1411
|
case "checkbox":
|
|
1360
|
-
return /* @__PURE__ */
|
|
1412
|
+
return /* @__PURE__ */ React7.createElement("span", { title, className }, /* @__PURE__ */ React7.createElement(
|
|
1361
1413
|
Checkbox,
|
|
1362
1414
|
{
|
|
1363
1415
|
type: "checkbox",
|
|
@@ -1367,7 +1419,7 @@ var AntDValueEditor = (_a) => {
|
|
|
1367
1419
|
}
|
|
1368
1420
|
));
|
|
1369
1421
|
case "radio":
|
|
1370
|
-
return /* @__PURE__ */
|
|
1422
|
+
return /* @__PURE__ */ React7.createElement("span", { className, title }, values.map((v) => /* @__PURE__ */ React7.createElement(
|
|
1371
1423
|
Radio,
|
|
1372
1424
|
{
|
|
1373
1425
|
key: v.name,
|
|
@@ -1381,28 +1433,36 @@ var AntDValueEditor = (_a) => {
|
|
|
1381
1433
|
}
|
|
1382
1434
|
switch (inputTypeCoerced) {
|
|
1383
1435
|
case "date":
|
|
1384
|
-
case "datetime-local":
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
(
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1436
|
+
case "datetime-local": {
|
|
1437
|
+
if (operator === "between" || operator === "notBetween") {
|
|
1438
|
+
const dayjsArray = valueAsArray.slice(0, 2).map(import_dayjs.default);
|
|
1439
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1440
|
+
DatePicker.RangePicker,
|
|
1441
|
+
{
|
|
1442
|
+
value: dayjsArray.every((d) => d.isValid()) ? dayjsArray : void 0,
|
|
1443
|
+
showTime: inputTypeCoerced === "datetime-local",
|
|
1444
|
+
className,
|
|
1445
|
+
disabled,
|
|
1446
|
+
placeholder: [placeHolderText, placeHolderText],
|
|
1447
|
+
onChange: (
|
|
1448
|
+
/* istanbul ignore next */
|
|
1449
|
+
(dates) => {
|
|
1450
|
+
const timeFormat = inputTypeCoerced === "datetime-local" ? "THH:mm:ss" : "";
|
|
1451
|
+
const format = `YYYY-MM-DD${timeFormat}`;
|
|
1452
|
+
const dateArray = dates == null ? void 0 : dates.map((d) => (d == null ? void 0 : d.isValid()) ? d.format(format) : void 0);
|
|
1453
|
+
handleOnChange(
|
|
1454
|
+
dateArray ? listsAsArrays ? dateArray : joinWith(dateArray, ",") : dates
|
|
1455
|
+
);
|
|
1456
|
+
}
|
|
1457
|
+
)
|
|
1458
|
+
}
|
|
1459
|
+
);
|
|
1460
|
+
}
|
|
1461
|
+
const dateValue = (0, import_dayjs.default)(value);
|
|
1462
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1403
1463
|
DatePicker,
|
|
1404
1464
|
{
|
|
1405
|
-
value:
|
|
1465
|
+
value: dateValue.isValid() ? dateValue : void 0,
|
|
1406
1466
|
showTime: inputTypeCoerced === "datetime-local",
|
|
1407
1467
|
className,
|
|
1408
1468
|
disabled,
|
|
@@ -1410,11 +1470,13 @@ var AntDValueEditor = (_a) => {
|
|
|
1410
1470
|
onChange: (_d, dateString) => handleOnChange(dateString)
|
|
1411
1471
|
}
|
|
1412
1472
|
);
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1473
|
+
}
|
|
1474
|
+
case "time": {
|
|
1475
|
+
const dateValue = (0, import_dayjs.default)(value, "HH:mm:ss");
|
|
1476
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1477
|
+
DatePicker.TimePicker,
|
|
1416
1478
|
{
|
|
1417
|
-
value:
|
|
1479
|
+
value: dateValue.isValid() ? dateValue : void 0,
|
|
1418
1480
|
className,
|
|
1419
1481
|
disabled,
|
|
1420
1482
|
placeholder: placeHolderText,
|
|
@@ -1424,8 +1486,9 @@ var AntDValueEditor = (_a) => {
|
|
|
1424
1486
|
}
|
|
1425
1487
|
}
|
|
1426
1488
|
);
|
|
1489
|
+
}
|
|
1427
1490
|
}
|
|
1428
|
-
return /* @__PURE__ */
|
|
1491
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1429
1492
|
Input,
|
|
1430
1493
|
{
|
|
1431
1494
|
type: inputTypeCoerced,
|
|
@@ -1440,7 +1503,7 @@ var AntDValueEditor = (_a) => {
|
|
|
1440
1503
|
};
|
|
1441
1504
|
AntDValueEditor.displayName = "AntDValueEditor";
|
|
1442
1505
|
|
|
1443
|
-
// src/index.
|
|
1506
|
+
// src/index.tsx
|
|
1444
1507
|
var antdControlElements = {
|
|
1445
1508
|
addGroupAction: AntDActionElement,
|
|
1446
1509
|
addRuleAction: AntDActionElement,
|
|
@@ -1456,19 +1519,35 @@ var antdControlElements = {
|
|
|
1456
1519
|
removeRuleAction: AntDActionElement,
|
|
1457
1520
|
valueEditor: AntDValueEditor,
|
|
1458
1521
|
dragHandle: AntDDragHandle,
|
|
1459
|
-
valueSourceSelector: AntDValueSelector
|
|
1522
|
+
valueSourceSelector: AntDValueSelector,
|
|
1523
|
+
shiftActions: AntDShiftActions
|
|
1524
|
+
};
|
|
1525
|
+
var antdTranslations = {
|
|
1526
|
+
removeGroup: { label: /* @__PURE__ */ React8.createElement(CloseOutlined, null) },
|
|
1527
|
+
removeRule: { label: /* @__PURE__ */ React8.createElement(CloseOutlined, null) },
|
|
1528
|
+
cloneRule: { label: /* @__PURE__ */ React8.createElement(CopyOutlined, null) },
|
|
1529
|
+
cloneRuleGroup: { label: /* @__PURE__ */ React8.createElement(CopyOutlined, null) },
|
|
1530
|
+
lockGroup: { label: /* @__PURE__ */ React8.createElement(UnlockOutlined, null) },
|
|
1531
|
+
lockRule: { label: /* @__PURE__ */ React8.createElement(UnlockOutlined, null) },
|
|
1532
|
+
lockGroupDisabled: { label: /* @__PURE__ */ React8.createElement(LockOutlined, null) },
|
|
1533
|
+
lockRuleDisabled: { label: /* @__PURE__ */ React8.createElement(LockOutlined, null) },
|
|
1534
|
+
shiftActionUp: { label: /* @__PURE__ */ React8.createElement(UpOutlined, null) },
|
|
1535
|
+
shiftActionDown: { label: /* @__PURE__ */ React8.createElement(DownOutlined, null) }
|
|
1460
1536
|
};
|
|
1461
1537
|
var QueryBuilderAntD = getCompatContextProvider({
|
|
1462
1538
|
key: "antd",
|
|
1463
|
-
controlElements: antdControlElements
|
|
1539
|
+
controlElements: antdControlElements,
|
|
1540
|
+
translations: antdTranslations
|
|
1464
1541
|
});
|
|
1465
1542
|
export {
|
|
1466
1543
|
AntDActionElement,
|
|
1467
1544
|
AntDDragHandle,
|
|
1468
1545
|
AntDNotToggle,
|
|
1546
|
+
AntDShiftActions,
|
|
1469
1547
|
AntDValueEditor,
|
|
1470
1548
|
AntDValueSelector,
|
|
1471
1549
|
QueryBuilderAntD,
|
|
1472
|
-
antdControlElements
|
|
1550
|
+
antdControlElements,
|
|
1551
|
+
antdTranslations
|
|
1473
1552
|
};
|
|
1474
1553
|
//# sourceMappingURL=react-querybuilder_antd.legacy-esm.js.map
|