@react-querybuilder/antd 7.0.0-alpha.0 → 7.0.0-alpha.2
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 +1 -1
- package/dist/cjs/react-querybuilder_antd.cjs.development.d.ts +116 -22
- package/dist/cjs/react-querybuilder_antd.cjs.development.js +99 -82
- package/dist/cjs/react-querybuilder_antd.cjs.development.js.map +1 -1
- package/dist/cjs/react-querybuilder_antd.cjs.production.d.ts +116 -22
- 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 +116 -22
- package/dist/react-querybuilder_antd.legacy-esm.d.mts +116 -22
- package/dist/react-querybuilder_antd.legacy-esm.js +97 -79
- package/dist/react-querybuilder_antd.legacy-esm.js.map +1 -1
- package/dist/react-querybuilder_antd.mjs +94 -76
- package/dist/react-querybuilder_antd.mjs.map +1 -1
- package/dist/react-querybuilder_antd.production.d.mts +116 -22
- package/dist/react-querybuilder_antd.production.mjs +1 -1
- package/dist/react-querybuilder_antd.production.mjs.map +1 -1
- package/package.json +10 -10
|
@@ -959,12 +959,20 @@ var require_dayjs = __commonJS({
|
|
|
959
959
|
}
|
|
960
960
|
}
|
|
961
961
|
};
|
|
962
|
-
var _default = generateConfig;
|
|
963
|
-
exports.default = _default;
|
|
962
|
+
var _default = exports.default = generateConfig;
|
|
964
963
|
}
|
|
965
964
|
});
|
|
966
965
|
|
|
967
|
-
// src/index.
|
|
966
|
+
// src/index.tsx
|
|
967
|
+
import {
|
|
968
|
+
CloseOutlined,
|
|
969
|
+
CopyOutlined,
|
|
970
|
+
DownOutlined,
|
|
971
|
+
LockOutlined,
|
|
972
|
+
UnlockOutlined,
|
|
973
|
+
UpOutlined
|
|
974
|
+
} from "@ant-design/icons";
|
|
975
|
+
import * as React8 from "react";
|
|
968
976
|
import { getCompatContextProvider } from "react-querybuilder";
|
|
969
977
|
|
|
970
978
|
// src/AntDActionElement.tsx
|
|
@@ -1058,63 +1066,48 @@ var AntDNotToggle = ({
|
|
|
1058
1066
|
AntDNotToggle.displayName = "AntDNotToggle";
|
|
1059
1067
|
|
|
1060
1068
|
// src/AntDShiftActions.tsx
|
|
1061
|
-
import { CaretDownOutlined, CaretUpOutlined } from "@ant-design/icons";
|
|
1062
1069
|
import { Button as Button2 } from "antd";
|
|
1063
1070
|
import * as React4 from "react";
|
|
1064
|
-
import { useShiftActions } from "react-querybuilder";
|
|
1065
1071
|
var AntDShiftActions = ({
|
|
1066
|
-
|
|
1072
|
+
shiftUp,
|
|
1073
|
+
shiftDown,
|
|
1074
|
+
shiftUpDisabled,
|
|
1075
|
+
shiftDownDisabled,
|
|
1067
1076
|
disabled,
|
|
1068
1077
|
className,
|
|
1069
|
-
|
|
1078
|
+
labels,
|
|
1070
1079
|
titles,
|
|
1071
|
-
testID
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
), /* @__PURE__ */ React4.createElement(
|
|
1094
|
-
Button2,
|
|
1095
|
-
{
|
|
1096
|
-
type: "primary",
|
|
1097
|
-
size: "small",
|
|
1098
|
-
title: titles?.shiftDown,
|
|
1099
|
-
onClick: shiftDown,
|
|
1100
|
-
disabled: shiftDownDisabled
|
|
1101
|
-
},
|
|
1102
|
-
/* @__PURE__ */ React4.createElement(CaretDownOutlined, null)
|
|
1103
|
-
));
|
|
1104
|
-
};
|
|
1080
|
+
testID
|
|
1081
|
+
}) => /* @__PURE__ */ React4.createElement("div", { "data-testid": testID, className }, /* @__PURE__ */ React4.createElement(
|
|
1082
|
+
Button2,
|
|
1083
|
+
{
|
|
1084
|
+
type: "primary",
|
|
1085
|
+
size: "small",
|
|
1086
|
+
title: titles?.shiftUp,
|
|
1087
|
+
onClick: shiftUp,
|
|
1088
|
+
disabled: disabled || shiftUpDisabled
|
|
1089
|
+
},
|
|
1090
|
+
labels?.shiftUp
|
|
1091
|
+
), /* @__PURE__ */ React4.createElement(
|
|
1092
|
+
Button2,
|
|
1093
|
+
{
|
|
1094
|
+
type: "primary",
|
|
1095
|
+
size: "small",
|
|
1096
|
+
title: titles?.shiftDown,
|
|
1097
|
+
onClick: shiftDown,
|
|
1098
|
+
disabled: disabled || shiftDownDisabled
|
|
1099
|
+
},
|
|
1100
|
+
labels?.shiftDown
|
|
1101
|
+
));
|
|
1105
1102
|
AntDShiftActions.displayName = "AntDShiftActions";
|
|
1106
1103
|
|
|
1107
1104
|
// src/AntDValueEditor.tsx
|
|
1108
1105
|
var import_dayjs = __toESM(require_dayjs_min());
|
|
1109
1106
|
var import_dayjs2 = __toESM(require_dayjs());
|
|
1110
|
-
import {
|
|
1107
|
+
import { Checkbox, Input, Radio, Switch as Switch2 } from "antd";
|
|
1108
|
+
import generatePicker from "antd/es/date-picker/generatePicker/index.js";
|
|
1111
1109
|
import * as React7 from "react";
|
|
1112
|
-
import {
|
|
1113
|
-
getFirstOption,
|
|
1114
|
-
standardClassnames,
|
|
1115
|
-
toArray,
|
|
1116
|
-
useValueEditor
|
|
1117
|
-
} from "react-querybuilder";
|
|
1110
|
+
import { getFirstOption, joinWith, standardClassnames, useValueEditor } from "react-querybuilder";
|
|
1118
1111
|
|
|
1119
1112
|
// src/AntDValueSelector.tsx
|
|
1120
1113
|
import { Select as Select2 } from "antd";
|
|
@@ -1173,7 +1166,7 @@ var AntDValueSelector = ({
|
|
|
1173
1166
|
AntDValueSelector.displayName = "AntDValueSelector";
|
|
1174
1167
|
|
|
1175
1168
|
// src/AntDValueEditor.tsx
|
|
1176
|
-
var DatePicker =
|
|
1169
|
+
var DatePicker = generatePicker(import_dayjs2.default);
|
|
1177
1170
|
var AntDValueEditor = ({
|
|
1178
1171
|
fieldData,
|
|
1179
1172
|
operator,
|
|
@@ -1214,7 +1207,7 @@ var AntDValueEditor = ({
|
|
|
1214
1207
|
if (type === "text") {
|
|
1215
1208
|
if (inputTypeCoerced === "time") {
|
|
1216
1209
|
return /* @__PURE__ */ React7.createElement(
|
|
1217
|
-
TimePicker,
|
|
1210
|
+
DatePicker.TimePicker,
|
|
1218
1211
|
{
|
|
1219
1212
|
key,
|
|
1220
1213
|
value: valueAsArray[i] ? (0, import_dayjs.default)(valueAsArray[i], "HH:mm:ss") : null,
|
|
@@ -1319,28 +1312,36 @@ var AntDValueEditor = ({
|
|
|
1319
1312
|
}
|
|
1320
1313
|
switch (inputTypeCoerced) {
|
|
1321
1314
|
case "date":
|
|
1322
|
-
case "datetime-local":
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
(
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1315
|
+
case "datetime-local": {
|
|
1316
|
+
if (operator === "between" || operator === "notBetween") {
|
|
1317
|
+
const dayjsArray = valueAsArray.slice(0, 2).map(import_dayjs.default);
|
|
1318
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1319
|
+
DatePicker.RangePicker,
|
|
1320
|
+
{
|
|
1321
|
+
value: dayjsArray.every((d) => d.isValid()) ? dayjsArray : void 0,
|
|
1322
|
+
showTime: inputTypeCoerced === "datetime-local",
|
|
1323
|
+
className,
|
|
1324
|
+
disabled,
|
|
1325
|
+
placeholder: [placeHolderText, placeHolderText],
|
|
1326
|
+
onChange: (
|
|
1327
|
+
/* istanbul ignore next */
|
|
1328
|
+
(dates) => {
|
|
1329
|
+
const timeFormat = inputTypeCoerced === "datetime-local" ? "THH:mm:ss" : "";
|
|
1330
|
+
const format = `YYYY-MM-DD${timeFormat}`;
|
|
1331
|
+
const dateArray = dates?.map((d) => d?.isValid() ? d.format(format) : void 0);
|
|
1332
|
+
handleOnChange(
|
|
1333
|
+
dateArray ? listsAsArrays ? dateArray : joinWith(dateArray, ",") : dates
|
|
1334
|
+
);
|
|
1335
|
+
}
|
|
1336
|
+
)
|
|
1337
|
+
}
|
|
1338
|
+
);
|
|
1339
|
+
}
|
|
1340
|
+
const dateValue = (0, import_dayjs.default)(value);
|
|
1341
|
+
return /* @__PURE__ */ React7.createElement(
|
|
1341
1342
|
DatePicker,
|
|
1342
1343
|
{
|
|
1343
|
-
value:
|
|
1344
|
+
value: dateValue.isValid() ? dateValue : void 0,
|
|
1344
1345
|
showTime: inputTypeCoerced === "datetime-local",
|
|
1345
1346
|
className,
|
|
1346
1347
|
disabled,
|
|
@@ -1348,17 +1349,20 @@ var AntDValueEditor = ({
|
|
|
1348
1349
|
onChange: (_d, dateString) => handleOnChange(dateString)
|
|
1349
1350
|
}
|
|
1350
1351
|
);
|
|
1351
|
-
|
|
1352
|
+
}
|
|
1353
|
+
case "time": {
|
|
1354
|
+
const dateValue = (0, import_dayjs.default)(value, "HH:mm:ss");
|
|
1352
1355
|
return /* @__PURE__ */ React7.createElement(
|
|
1353
|
-
TimePicker,
|
|
1356
|
+
DatePicker.TimePicker,
|
|
1354
1357
|
{
|
|
1355
|
-
value:
|
|
1358
|
+
value: dateValue.isValid() ? dateValue : void 0,
|
|
1356
1359
|
className,
|
|
1357
1360
|
disabled,
|
|
1358
1361
|
placeholder: placeHolderText,
|
|
1359
1362
|
onChange: (d) => handleOnChange(d?.format("HH:mm:ss") ?? "")
|
|
1360
1363
|
}
|
|
1361
1364
|
);
|
|
1365
|
+
}
|
|
1362
1366
|
}
|
|
1363
1367
|
return /* @__PURE__ */ React7.createElement(
|
|
1364
1368
|
Input,
|
|
@@ -1375,7 +1379,7 @@ var AntDValueEditor = ({
|
|
|
1375
1379
|
};
|
|
1376
1380
|
AntDValueEditor.displayName = "AntDValueEditor";
|
|
1377
1381
|
|
|
1378
|
-
// src/index.
|
|
1382
|
+
// src/index.tsx
|
|
1379
1383
|
var antdControlElements = {
|
|
1380
1384
|
addGroupAction: AntDActionElement,
|
|
1381
1385
|
addRuleAction: AntDActionElement,
|
|
@@ -1394,9 +1398,22 @@ var antdControlElements = {
|
|
|
1394
1398
|
valueSourceSelector: AntDValueSelector,
|
|
1395
1399
|
shiftActions: AntDShiftActions
|
|
1396
1400
|
};
|
|
1401
|
+
var antdTranslations = {
|
|
1402
|
+
removeGroup: { label: /* @__PURE__ */ React8.createElement(CloseOutlined, null) },
|
|
1403
|
+
removeRule: { label: /* @__PURE__ */ React8.createElement(CloseOutlined, null) },
|
|
1404
|
+
cloneRule: { label: /* @__PURE__ */ React8.createElement(CopyOutlined, null) },
|
|
1405
|
+
cloneRuleGroup: { label: /* @__PURE__ */ React8.createElement(CopyOutlined, null) },
|
|
1406
|
+
lockGroup: { label: /* @__PURE__ */ React8.createElement(UnlockOutlined, null) },
|
|
1407
|
+
lockRule: { label: /* @__PURE__ */ React8.createElement(UnlockOutlined, null) },
|
|
1408
|
+
lockGroupDisabled: { label: /* @__PURE__ */ React8.createElement(LockOutlined, null) },
|
|
1409
|
+
lockRuleDisabled: { label: /* @__PURE__ */ React8.createElement(LockOutlined, null) },
|
|
1410
|
+
shiftActionUp: { label: /* @__PURE__ */ React8.createElement(UpOutlined, null) },
|
|
1411
|
+
shiftActionDown: { label: /* @__PURE__ */ React8.createElement(DownOutlined, null) }
|
|
1412
|
+
};
|
|
1397
1413
|
var QueryBuilderAntD = getCompatContextProvider({
|
|
1398
1414
|
key: "antd",
|
|
1399
|
-
controlElements: antdControlElements
|
|
1415
|
+
controlElements: antdControlElements,
|
|
1416
|
+
translations: antdTranslations
|
|
1400
1417
|
});
|
|
1401
1418
|
export {
|
|
1402
1419
|
AntDActionElement,
|
|
@@ -1406,6 +1423,7 @@ export {
|
|
|
1406
1423
|
AntDValueEditor,
|
|
1407
1424
|
AntDValueSelector,
|
|
1408
1425
|
QueryBuilderAntD,
|
|
1409
|
-
antdControlElements
|
|
1426
|
+
antdControlElements,
|
|
1427
|
+
antdTranslations
|
|
1410
1428
|
};
|
|
1411
1429
|
//# sourceMappingURL=react-querybuilder_antd.mjs.map
|