@react-querybuilder/antd 8.0.0 → 8.1.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.
@@ -87,7 +87,7 @@ var require_warning = __commonJS({
87
87
  });
88
88
 
89
89
  // src/index.tsx
90
- import { jsx as jsx8 } from "react/jsx-runtime";
90
+ import { jsx as jsx7 } from "react/jsx-runtime";
91
91
  import { CloseOutlined, CopyOutlined, DownOutlined, LockOutlined, UnlockOutlined, UpOutlined } from "@ant-design/icons";
92
92
  import { getCompatContextProvider } from "react-querybuilder";
93
93
 
@@ -323,24 +323,6 @@ var AntDShiftActions = function AntDShiftActions2(_ref) {
323
323
  return /* @__PURE__ */ jsxs("div", { "data-testid": testID, className, children: [/* @__PURE__ */ jsx4(Button2, { type: "primary", size: "small", title: titles === null || titles === void 0 ? void 0 : titles.shiftUp, onClick: shiftUp, disabled: disabled || shiftUpDisabled, children: labels === null || labels === void 0 ? void 0 : labels.shiftUp }), /* @__PURE__ */ jsx4(Button2, { type: "primary", size: "small", title: titles === null || titles === void 0 ? void 0 : titles.shiftDown, onClick: shiftDown, disabled: disabled || shiftDownDisabled, children: labels === null || labels === void 0 ? void 0 : labels.shiftDown })] });
324
324
  };
325
325
 
326
- // ../../utils/react-compiler/react-compiler-runtime.ts
327
- import * as React from "react";
328
- var $empty = Symbol["for"]("react.memo_cache_sentinel");
329
- function c(size) {
330
- return React.useMemo(
331
- function() {
332
- var $ = Array.from({ length: size });
333
- for (var ii = 0; ii < size; ii++) {
334
- $[ii] = $empty;
335
- }
336
- $[$empty] = true;
337
- return $;
338
- },
339
- // eslint-disable-next-line react-hooks/exhaustive-deps
340
- []
341
- );
342
- }
343
-
344
326
  // src/AntDValueEditor.tsx
345
327
  import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
346
328
  import { Checkbox, Input, InputNumber, Radio, Switch as Switch2 } from "antd";
@@ -622,6 +604,7 @@ function _typeof4(o) {
622
604
  return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
623
605
  }, _typeof4(o);
624
606
  }
607
+ var _excluded4 = ["fieldData", "operator", "value", "handleOnChange", "title", "className", "type", "values", "listsAsArrays", "separator", "valueSource", "disabled", "testID", "selectorComponent", "extraProps", "inputType", "parseNumbers"];
625
608
  function ownKeys4(e, r) {
626
609
  var t = Object.keys(e);
627
610
  if (Object.getOwnPropertySymbols) {
@@ -660,378 +643,145 @@ function _toPrimitive4(t, r) {
660
643
  }
661
644
  return ("string" === r ? String : Number)(t);
662
645
  }
646
+ function _objectWithoutProperties4(e, t) {
647
+ if (null == e) return {};
648
+ var o, r, i = _objectWithoutPropertiesLoose4(e, t);
649
+ if (Object.getOwnPropertySymbols) {
650
+ var s = Object.getOwnPropertySymbols(e);
651
+ for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
652
+ }
653
+ return i;
654
+ }
655
+ function _objectWithoutPropertiesLoose4(r, e) {
656
+ if (null == r) return {};
657
+ var t = {};
658
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
659
+ if (e.includes(n)) continue;
660
+ t[n] = r[n];
661
+ }
662
+ return t;
663
+ }
663
664
  var DatePicker = generatePicker(dayjs_default);
664
665
  var AntDValueEditor = function AntDValueEditor2(allProps) {
665
666
  var _fieldData$placeholde;
666
- var $ = c(111);
667
- var fieldData = allProps.fieldData, operator = allProps.operator, value = allProps.value, handleOnChange = allProps.handleOnChange, title = allProps.title, className = allProps.className, type = allProps.type, inputType = allProps.inputType, t0 = allProps.values, listsAsArrays = allProps.listsAsArrays, separator = allProps.separator, disabled = allProps.disabled, testID = allProps.testID, extraProps = allProps.extraProps;
668
- var t1;
669
- if ($[0] !== t0) {
670
- t1 = t0 === void 0 ? [] : t0;
671
- $[0] = t0;
672
- $[1] = t1;
673
- } else {
674
- t1 = $[1];
675
- }
676
- var values = t1;
677
- var _useValueEditor = useValueEditor(allProps), valueAsArray = _useValueEditor.valueAsArray, multiValueHandler = _useValueEditor.multiValueHandler, valueListItemClassName = _useValueEditor.valueListItemClassName;
667
+ var fieldData = allProps.fieldData, operator = allProps.operator, value = allProps.value, handleOnChange = allProps.handleOnChange, title = allProps.title, className = allProps.className, type = allProps.type, _allProps$values = allProps.values, values = _allProps$values === void 0 ? [] : _allProps$values, listsAsArrays = allProps.listsAsArrays, separator = allProps.separator, _vs = allProps.valueSource, disabled = allProps.disabled, testID = allProps.testID, _allProps$selectorCom = allProps.selectorComponent, SelectorComponent = _allProps$selectorCom === void 0 ? allProps.schema.controls.valueSelector : _allProps$selectorCom, extraProps = allProps.extraProps, _inputType = allProps.inputType, _parseNumbers = allProps.parseNumbers, propsForValueSelector = _objectWithoutProperties4(allProps, _excluded4);
668
+ var _useValueEditor = useValueEditor(allProps), valueAsArray = _useValueEditor.valueAsArray, multiValueHandler = _useValueEditor.multiValueHandler, valueListItemClassName = _useValueEditor.valueListItemClassName, inputTypeCoerced = _useValueEditor.inputTypeCoerced;
678
669
  if (operator === "null" || operator === "notNull") {
679
670
  return null;
680
671
  }
681
672
  var placeHolderText = (_fieldData$placeholde = fieldData === null || fieldData === void 0 ? void 0 : fieldData.placeholder) !== null && _fieldData$placeholde !== void 0 ? _fieldData$placeholde : "";
682
- var inputTypeCoerced = ["in", "notIn"].includes(operator) ? "text" : inputType || "text";
683
- if ((operator === "between" || operator === "notBetween") && (type === "select" || type === "text") && inputTypeCoerced !== "date" && inputTypeCoerced !== "datetime-local") {
673
+ if ((operator === "between" || operator === "notBetween") && (type === "select" || type === "text") && // Date ranges are handled differently in AntD--see below
674
+ inputTypeCoerced !== "date" && inputTypeCoerced !== "datetime-local") {
684
675
  if (type === "text") {
685
- var _t;
686
- if ($[2] !== inputTypeCoerced || $[3] !== valueAsArray || $[4] !== valueListItemClassName || $[5] !== disabled || $[6] !== placeHolderText || $[7] !== multiValueHandler || $[8] !== extraProps || $[9] !== separator || $[10] !== testID || $[11] !== className || $[12] !== title) {
687
- var editors = ["from", "to"].map(function(key, i) {
688
- var _valueAsArray$i2;
689
- if (inputTypeCoerced === "time") {
690
- return jsx5(DatePicker.TimePicker, _objectSpread4({ value: valueAsArray[i] ? dayjs2(valueAsArray[i], "HH:mm:ss") : null, className: valueListItemClassName, disabled, placeholder: placeHolderText, onChange: function onChange(d) {
691
- var _d$format;
692
- return multiValueHandler((_d$format = d === null || d === void 0 ? void 0 : d.format("HH:mm:ss")) !== null && _d$format !== void 0 ? _d$format : "", i);
693
- } }, extraProps), key);
694
- } else {
695
- if (inputTypeCoerced === "number") {
696
- var _valueAsArray$i;
697
- return jsx5(InputNumber, _objectSpread4({ type: inputTypeCoerced, value: (_valueAsArray$i = valueAsArray[i]) !== null && _valueAsArray$i !== void 0 ? _valueAsArray$i : "", className: valueListItemClassName, disabled, placeholder: placeHolderText, onChange: function onChange(v) {
698
- return multiValueHandler(v, i);
699
- } }, extraProps), key);
700
- }
701
- }
702
- return jsx5(Input, _objectSpread4({ type: inputTypeCoerced, value: (_valueAsArray$i2 = valueAsArray[i]) !== null && _valueAsArray$i2 !== void 0 ? _valueAsArray$i2 : "", className: valueListItemClassName, disabled, placeholder: placeHolderText, onChange: function onChange(e) {
703
- return multiValueHandler(e.target.value, i);
676
+ var editors = ["from", "to"].map(function(key, i) {
677
+ var _valueAsArray$i2;
678
+ if (inputTypeCoerced === "time") {
679
+ return /* @__PURE__ */ jsx5(DatePicker.TimePicker, _objectSpread4({ value: valueAsArray[i] ? dayjs2(valueAsArray[i], "HH:mm:ss") : null, className: valueListItemClassName, disabled, placeholder: placeHolderText, onChange: function onChange(d) {
680
+ var _d$format;
681
+ return multiValueHandler((_d$format = d === null || d === void 0 ? void 0 : d.format("HH:mm:ss")) !== null && _d$format !== void 0 ? _d$format : "", i);
704
682
  } }, extraProps), key);
705
- });
706
- _t = jsxs2("span", { "data-testid": testID, className, title, children: [editors[0], separator, editors[1]] });
707
- $[2] = inputTypeCoerced;
708
- $[3] = valueAsArray;
709
- $[4] = valueListItemClassName;
710
- $[5] = disabled;
711
- $[6] = placeHolderText;
712
- $[7] = multiValueHandler;
713
- $[8] = extraProps;
714
- $[9] = separator;
715
- $[10] = testID;
716
- $[11] = className;
717
- $[12] = title;
718
- $[13] = _t;
719
- } else {
720
- _t = $[13];
721
- }
722
- return _t;
723
- }
724
- var _t2;
725
- if ($[14] !== allProps) {
726
- _t2 = jsx5(ValueEditor, _objectSpread4(_objectSpread4({}, allProps), {}, { skipHook: true }));
727
- $[14] = allProps;
728
- $[15] = _t2;
729
- } else {
730
- _t2 = $[15];
683
+ } else if (inputTypeCoerced === "number") {
684
+ var _valueAsArray$i;
685
+ return /* @__PURE__ */ jsx5(InputNumber, _objectSpread4({ type: inputTypeCoerced, value: (_valueAsArray$i = valueAsArray[i]) !== null && _valueAsArray$i !== void 0 ? _valueAsArray$i : "", className: valueListItemClassName, disabled, placeholder: placeHolderText, onChange: function onChange(v) {
686
+ return multiValueHandler(v, i);
687
+ } }, extraProps), key);
688
+ }
689
+ return /* @__PURE__ */ jsx5(Input, _objectSpread4({ type: inputTypeCoerced, value: (_valueAsArray$i2 = valueAsArray[i]) !== null && _valueAsArray$i2 !== void 0 ? _valueAsArray$i2 : "", className: valueListItemClassName, disabled, placeholder: placeHolderText, onChange: function onChange(e) {
690
+ return multiValueHandler(e.target.value, i);
691
+ } }, extraProps), key);
692
+ });
693
+ return /* @__PURE__ */ jsxs2("span", { "data-testid": testID, className, title, children: [editors[0], separator, editors[1]] });
731
694
  }
732
- return _t2;
695
+ return /* @__PURE__ */ jsx5(ValueEditor, _objectSpread4(_objectSpread4({}, allProps), {}, { skipHook: true }));
733
696
  }
734
697
  switch (type) {
735
- case "select": {
736
- }
737
- case "multiselect": {
738
- var _t3;
739
- if ($[16] !== allProps) {
740
- _t3 = jsx5(ValueEditor, _objectSpread4(_objectSpread4({}, allProps), {}, { skipHook: true }));
741
- $[16] = allProps;
742
- $[17] = _t3;
743
- } else {
744
- _t3 = $[17];
745
- }
746
- return _t3;
747
- }
748
- case "textarea": {
749
- var _t4;
750
- if ($[18] !== handleOnChange) {
751
- _t4 = function _t42(e_2) {
752
- return handleOnChange(e_2.target.value);
753
- };
754
- $[18] = handleOnChange;
755
- $[19] = _t4;
756
- } else {
757
- _t4 = $[19];
758
- }
759
- var _t5;
760
- if ($[20] !== value || $[21] !== title || $[22] !== className || $[23] !== disabled || $[24] !== placeHolderText || $[25] !== _t4 || $[26] !== extraProps) {
761
- _t5 = jsx5(Input.TextArea, _objectSpread4({ value, title, className, disabled, placeholder: placeHolderText, onChange: _t4 }, extraProps));
762
- $[20] = value;
763
- $[21] = title;
764
- $[22] = className;
765
- $[23] = disabled;
766
- $[24] = placeHolderText;
767
- $[25] = _t4;
768
- $[26] = extraProps;
769
- $[27] = _t5;
770
- } else {
771
- _t5 = $[27];
772
- }
773
- return _t5;
774
- }
775
- case "switch": {
776
- var _t6 = !!value;
777
- var _t7;
778
- if ($[28] !== handleOnChange) {
779
- _t7 = function _t72(v_1) {
780
- return handleOnChange(v_1);
781
- };
782
- $[28] = handleOnChange;
783
- $[29] = _t7;
784
- } else {
785
- _t7 = $[29];
786
- }
787
- var t4;
788
- if ($[30] !== _t6 || $[31] !== title || $[32] !== className || $[33] !== disabled || $[34] !== _t7 || $[35] !== extraProps) {
789
- t4 = jsx5(Switch2, _objectSpread4({ checked: _t6, title, className, disabled, onChange: _t7 }, extraProps));
790
- $[30] = _t6;
791
- $[31] = title;
792
- $[32] = className;
793
- $[33] = disabled;
794
- $[34] = _t7;
795
- $[35] = extraProps;
796
- $[36] = t4;
797
- } else {
798
- t4 = $[36];
799
- }
800
- return t4;
801
- }
802
- case "checkbox": {
803
- var _t8;
804
- if ($[37] !== handleOnChange) {
805
- _t8 = function _t82(e_1) {
806
- return handleOnChange(e_1.target.checked);
807
- };
808
- $[37] = handleOnChange;
809
- $[38] = _t8;
810
- } else {
811
- _t8 = $[38];
812
- }
813
- var _t9 = !!value;
814
- var _t10;
815
- if ($[39] !== disabled || $[40] !== _t8 || $[41] !== _t9 || $[42] !== extraProps || $[43] !== title || $[44] !== className) {
816
- _t10 = jsx5("span", { title, className, children: jsx5(Checkbox, _objectSpread4({ type: "checkbox", disabled, onChange: _t8, checked: _t9 }, extraProps)) });
817
- $[39] = disabled;
818
- $[40] = _t8;
819
- $[41] = _t9;
820
- $[42] = extraProps;
821
- $[43] = title;
822
- $[44] = className;
823
- $[45] = _t10;
824
- } else {
825
- _t10 = $[45];
826
- }
827
- return _t10;
828
- }
829
- case "radio": {
830
- var _t11;
831
- if ($[46] !== value || $[47] !== disabled || $[48] !== handleOnChange || $[49] !== extraProps || $[50] !== values || $[51] !== className || $[52] !== title) {
832
- var _t12;
833
- if ($[54] !== value || $[55] !== disabled || $[56] !== handleOnChange || $[57] !== extraProps) {
834
- _t12 = function _t122(v_0) {
835
- return jsx5(Radio, _objectSpread4(_objectSpread4({ value: v_0.name, checked: value === v_0.name, disabled, onChange: function onChange(e_0) {
836
- return handleOnChange(e_0.target.value);
837
- } }, extraProps), {}, { children: v_0.label }), v_0.name);
838
- };
839
- $[54] = value;
840
- $[55] = disabled;
841
- $[56] = handleOnChange;
842
- $[57] = extraProps;
843
- $[58] = _t12;
844
- } else {
845
- _t12 = $[58];
846
- }
847
- _t11 = jsx5("span", { className, title, children: values.map(_t12) });
848
- $[46] = value;
849
- $[47] = disabled;
850
- $[48] = handleOnChange;
851
- $[49] = extraProps;
852
- $[50] = values;
853
- $[51] = className;
854
- $[52] = title;
855
- $[53] = _t11;
856
- } else {
857
- _t11 = $[53];
858
- }
859
- return _t11;
860
- }
698
+ case "select":
699
+ case "multiselect":
700
+ return /* @__PURE__ */ jsx5(SelectorComponent, _objectSpread4(_objectSpread4({}, propsForValueSelector), {}, { className, title, value, disabled, listsAsArrays, multiple: type === "multiselect", handleOnChange, options: values }, extraProps));
701
+ case "textarea":
702
+ return /* @__PURE__ */ jsx5(Input.TextArea, _objectSpread4({ value, title, className, disabled, placeholder: placeHolderText, onChange: function onChange(e_2) {
703
+ return handleOnChange(e_2.target.value);
704
+ } }, extraProps));
705
+ case "switch":
706
+ return /* @__PURE__ */ jsx5(Switch2, _objectSpread4({ checked: !!value, title, className, disabled, onChange: function onChange(v_1) {
707
+ return handleOnChange(v_1);
708
+ } }, extraProps));
709
+ case "checkbox":
710
+ return /* @__PURE__ */ jsx5("span", { title, className, children: /* @__PURE__ */ jsx5(Checkbox, _objectSpread4({ type: "checkbox", disabled, onChange: function onChange(e_1) {
711
+ return handleOnChange(e_1.target.checked);
712
+ }, checked: !!value }, extraProps)) });
713
+ case "radio":
714
+ return /* @__PURE__ */ jsx5("span", { className, title, children: values.map(function(v_0) {
715
+ return /* @__PURE__ */ jsx5(Radio, _objectSpread4(_objectSpread4({ value: v_0.name, checked: value === v_0.name, disabled, onChange: function onChange(e_0) {
716
+ return handleOnChange(e_0.target.value);
717
+ } }, extraProps), {}, { children: v_0.label }), v_0.name);
718
+ }) });
861
719
  }
862
720
  switch (inputTypeCoerced) {
863
- case "date": {
864
- }
721
+ case "date":
865
722
  case "datetime-local": {
866
723
  if (operator === "between" || operator === "notBetween") {
867
- var _t13;
868
- if ($[59] !== valueAsArray || $[60] !== inputTypeCoerced || $[61] !== placeHolderText || $[62] !== handleOnChange || $[63] !== listsAsArrays || $[64] !== className || $[65] !== disabled || $[66] !== extraProps) {
869
- var dayjsArray = valueAsArray.slice(0, 2).map(_temp);
870
- var _t14;
871
- if ($[68] !== inputTypeCoerced || $[69] !== handleOnChange || $[70] !== listsAsArrays) {
872
- _t14 = function _t142(dates) {
873
- var timeFormat = inputTypeCoerced === "datetime-local" ? "THH:mm:ss" : "";
874
- var format2 = "YYYY-MM-DD".concat(timeFormat);
875
- var dateArray = dates === null || dates === void 0 ? void 0 : dates.map(function(d_2) {
876
- return d_2 !== null && d_2 !== void 0 && d_2.isValid() ? d_2.format(format2) : void 0;
877
- });
878
- handleOnChange(dateArray ? listsAsArrays ? dateArray : joinWith(dateArray, ",") : dates);
879
- };
880
- $[68] = inputTypeCoerced;
881
- $[69] = handleOnChange;
882
- $[70] = listsAsArrays;
883
- $[71] = _t14;
884
- } else {
885
- _t14 = $[71];
724
+ var dayjsArray = valueAsArray.slice(0, 2).map(function(v_2) {
725
+ return dayjs2(v_2);
726
+ });
727
+ return /* @__PURE__ */ jsx5(DatePicker.RangePicker, _objectSpread4({ value: dayjsArray.every(function(d_1) {
728
+ return d_1.isValid();
729
+ }) ? dayjsArray : void 0, showTime: inputTypeCoerced === "datetime-local", className, disabled, placeholder: [placeHolderText, placeHolderText], onChange: (
730
+ /* istanbul ignore next */
731
+ function onChange(dates) {
732
+ var timeFormat = inputTypeCoerced === "datetime-local" ? "THH:mm:ss" : "";
733
+ var format2 = "YYYY-MM-DD".concat(timeFormat);
734
+ var dateArray = dates === null || dates === void 0 ? void 0 : dates.map(function(d_2) {
735
+ return d_2 !== null && d_2 !== void 0 && d_2.isValid() ? d_2.format(format2) : void 0;
736
+ });
737
+ handleOnChange(dateArray ? listsAsArrays ? dateArray : joinWith(dateArray, ",") : dates);
886
738
  }
887
- _t13 = jsx5(DatePicker.RangePicker, _objectSpread4({ value: dayjsArray.every(_temp2) ? dayjsArray : void 0, showTime: inputTypeCoerced === "datetime-local", className, disabled, placeholder: [placeHolderText, placeHolderText], onChange: _t14 }, extraProps));
888
- $[59] = valueAsArray;
889
- $[60] = inputTypeCoerced;
890
- $[61] = placeHolderText;
891
- $[62] = handleOnChange;
892
- $[63] = listsAsArrays;
893
- $[64] = className;
894
- $[65] = disabled;
895
- $[66] = extraProps;
896
- $[67] = _t13;
897
- } else {
898
- _t13 = $[67];
899
- }
900
- return _t13;
901
- }
902
- var _t15;
903
- if ($[72] !== value || $[73] !== inputTypeCoerced || $[74] !== handleOnChange || $[75] !== className || $[76] !== disabled || $[77] !== placeHolderText || $[78] !== extraProps) {
904
- var dateValue_0 = dayjs2(value);
905
- var _t16;
906
- if ($[80] !== handleOnChange) {
907
- _t16 = function _t162(_d, dateString) {
908
- return handleOnChange(dateString);
909
- };
910
- $[80] = handleOnChange;
911
- $[81] = _t16;
912
- } else {
913
- _t16 = $[81];
914
- }
915
- _t15 = jsx5(DatePicker, _objectSpread4({ value: dateValue_0.isValid() ? dateValue_0 : void 0, showTime: inputTypeCoerced === "datetime-local", className, disabled, placeholder: placeHolderText, onChange: _t16 }, extraProps));
916
- $[72] = value;
917
- $[73] = inputTypeCoerced;
918
- $[74] = handleOnChange;
919
- $[75] = className;
920
- $[76] = disabled;
921
- $[77] = placeHolderText;
922
- $[78] = extraProps;
923
- $[79] = _t15;
924
- } else {
925
- _t15 = $[79];
739
+ ) }, extraProps));
926
740
  }
927
- return _t15;
741
+ var dateValue_0 = dayjs2(value);
742
+ return /* @__PURE__ */ jsx5(DatePicker, _objectSpread4({ value: dateValue_0.isValid() ? dateValue_0 : void 0, showTime: inputTypeCoerced === "datetime-local", className, disabled, placeholder: placeHolderText, onChange: function onChange(_d, dateString) {
743
+ return handleOnChange(dateString);
744
+ } }, extraProps));
928
745
  }
929
746
  case "time": {
930
- var _t17;
931
- if ($[82] !== value || $[83] !== handleOnChange || $[84] !== className || $[85] !== disabled || $[86] !== placeHolderText || $[87] !== extraProps) {
932
- var dateValue = dayjs2(value, "HH:mm:ss");
933
- var _t18;
934
- if ($[89] !== handleOnChange) {
935
- _t18 = function _t182(d_0) {
936
- var _d_0$format;
937
- return handleOnChange((_d_0$format = d_0 === null || d_0 === void 0 ? void 0 : d_0.format("HH:mm:ss")) !== null && _d_0$format !== void 0 ? _d_0$format : "");
938
- };
939
- $[89] = handleOnChange;
940
- $[90] = _t18;
941
- } else {
942
- _t18 = $[90];
943
- }
944
- _t17 = jsx5(DatePicker.TimePicker, _objectSpread4({ value: dateValue.isValid() ? dateValue : void 0, className, disabled, placeholder: placeHolderText, onChange: _t18 }, extraProps));
945
- $[82] = value;
946
- $[83] = handleOnChange;
947
- $[84] = className;
948
- $[85] = disabled;
949
- $[86] = placeHolderText;
950
- $[87] = extraProps;
951
- $[88] = _t17;
952
- } else {
953
- _t17 = $[88];
954
- }
955
- return _t17;
747
+ var dateValue = dayjs2(value, "HH:mm:ss");
748
+ return /* @__PURE__ */ jsx5(DatePicker.TimePicker, _objectSpread4({ value: dateValue.isValid() ? dateValue : void 0, className, disabled, placeholder: placeHolderText, onChange: function onChange(d_0) {
749
+ var _d_0$format;
750
+ return handleOnChange((_d_0$format = d_0 === null || d_0 === void 0 ? void 0 : d_0.format("HH:mm:ss")) !== null && _d_0$format !== void 0 ? _d_0$format : "");
751
+ } }, extraProps));
956
752
  }
957
753
  case "number": {
958
- var _t19;
959
- if ($[91] !== inputTypeCoerced || $[92] !== value || $[93] !== title || $[94] !== className || $[95] !== disabled || $[96] !== placeHolderText || $[97] !== handleOnChange || $[98] !== extraProps) {
960
- _t19 = jsx5(InputNumber, _objectSpread4({ type: inputTypeCoerced, value, title, className, disabled, placeholder: placeHolderText, onChange: handleOnChange }, extraProps));
961
- $[91] = inputTypeCoerced;
962
- $[92] = value;
963
- $[93] = title;
964
- $[94] = className;
965
- $[95] = disabled;
966
- $[96] = placeHolderText;
967
- $[97] = handleOnChange;
968
- $[98] = extraProps;
969
- $[99] = _t19;
970
- } else {
971
- _t19 = $[99];
972
- }
973
- return _t19;
754
+ return /* @__PURE__ */ jsx5(InputNumber, _objectSpread4({ type: inputTypeCoerced, value, title, className, disabled, placeholder: placeHolderText, onChange: handleOnChange }, extraProps));
974
755
  }
975
756
  }
976
- var t2;
977
- if ($[100] !== handleOnChange) {
978
- t2 = function t22(e_3) {
979
- return handleOnChange(e_3.target.value);
980
- };
981
- $[100] = handleOnChange;
982
- $[101] = t2;
983
- } else {
984
- t2 = $[101];
985
- }
986
- var t3;
987
- if ($[102] !== inputTypeCoerced || $[103] !== value || $[104] !== title || $[105] !== className || $[106] !== disabled || $[107] !== placeHolderText || $[108] !== t2 || $[109] !== extraProps) {
988
- t3 = jsx5(Input, _objectSpread4({ type: inputTypeCoerced, value, title, className, disabled, placeholder: placeHolderText, onChange: t2 }, extraProps));
989
- $[102] = inputTypeCoerced;
990
- $[103] = value;
991
- $[104] = title;
992
- $[105] = className;
993
- $[106] = disabled;
994
- $[107] = placeHolderText;
995
- $[108] = t2;
996
- $[109] = extraProps;
997
- $[110] = t3;
998
- } else {
999
- t3 = $[110];
1000
- }
1001
- return t3;
757
+ return /* @__PURE__ */ jsx5(Input, _objectSpread4({ type: inputTypeCoerced, value, title, className, disabled, placeholder: placeHolderText, onChange: function onChange(e_3) {
758
+ return handleOnChange(e_3.target.value);
759
+ } }, extraProps));
1002
760
  };
1003
- function _temp(v_2) {
1004
- return dayjs2(v_2);
1005
- }
1006
- function _temp2(d_1) {
1007
- return d_1.isValid();
761
+
762
+ // ../../utils/react-compiler/react-compiler-runtime.ts
763
+ import * as React from "react";
764
+ var $empty = Symbol["for"]("react.memo_cache_sentinel");
765
+ function c(size) {
766
+ return React.useMemo(
767
+ function() {
768
+ var $ = Array.from({ length: size });
769
+ for (var ii = 0; ii < size; ii++) {
770
+ $[ii] = $empty;
771
+ }
772
+ $[$empty] = true;
773
+ return $;
774
+ },
775
+ // eslint-disable-next-line react-hooks/exhaustive-deps
776
+ []
777
+ );
1008
778
  }
1009
779
 
1010
780
  // src/AntDValueSelector.tsx
1011
- import { jsx as jsx7 } from "react/jsx-runtime";
1012
- import { Select as Select2 } from "antd";
1013
- import { useValueSelector } from "react-querybuilder";
1014
-
1015
- // src/utils.tsx
1016
781
  import { jsx as jsx6 } from "react/jsx-runtime";
1017
782
  import { Select } from "antd";
1018
- import { isOptionGroupArray } from "react-querybuilder";
1019
- var OptGroup = Select.OptGroup;
1020
- var Option = Select.Option;
1021
- var toOptions = function toOptions2(arr) {
1022
- return isOptionGroupArray(arr) ? arr.map(function(og) {
1023
- return /* @__PURE__ */ jsx6(OptGroup, { label: og.label, children: og.options.map(function(opt) {
1024
- return /* @__PURE__ */ jsx6(Option, { value: opt.name, children: opt.label }, opt.name);
1025
- }) }, og.label);
1026
- }) : Array.isArray(arr) ? arr.map(function(opt) {
1027
- return /* @__PURE__ */ jsx6(Option, { value: opt.name, children: opt.label }, opt.name);
1028
- }) : (
1029
- /* istanbul ignore next */
1030
- null
1031
- );
1032
- };
1033
-
1034
- // src/AntDValueSelector.tsx
783
+ import * as React2 from "react";
784
+ import { joinWith as joinWith2, useValueSelector } from "react-querybuilder";
1035
785
  function _typeof5(o) {
1036
786
  "@babel/helpers - typeof";
1037
787
  return _typeof5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
@@ -1040,7 +790,7 @@ function _typeof5(o) {
1040
790
  return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
1041
791
  }, _typeof5(o);
1042
792
  }
1043
- var _excluded4 = ["className", "handleOnChange", "options", "value", "title", "disabled", "multiple", "listsAsArrays", "testID", "rule", "rules", "level", "path", "context", "validation", "operator", "field", "fieldData", "schema"];
793
+ var _excluded5 = ["className", "handleOnChange", "options", "value", "title", "disabled", "multiple", "listsAsArrays", "testID", "rule", "rules", "level", "path", "context", "validation", "operator", "field", "fieldData", "schema"];
1044
794
  function ownKeys5(e, r) {
1045
795
  var t = Object.keys(e);
1046
796
  if (Object.getOwnPropertySymbols) {
@@ -1079,16 +829,16 @@ function _toPrimitive5(t, r) {
1079
829
  }
1080
830
  return ("string" === r ? String : Number)(t);
1081
831
  }
1082
- function _objectWithoutProperties4(e, t) {
832
+ function _objectWithoutProperties5(e, t) {
1083
833
  if (null == e) return {};
1084
- var o, r, i = _objectWithoutPropertiesLoose4(e, t);
834
+ var o, r, i = _objectWithoutPropertiesLoose5(e, t);
1085
835
  if (Object.getOwnPropertySymbols) {
1086
836
  var s = Object.getOwnPropertySymbols(e);
1087
837
  for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
1088
838
  }
1089
839
  return i;
1090
840
  }
1091
- function _objectWithoutPropertiesLoose4(r, e) {
841
+ function _objectWithoutPropertiesLoose5(r, e) {
1092
842
  if (null == r) return {};
1093
843
  var t = {};
1094
844
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
@@ -1098,82 +848,110 @@ function _objectWithoutPropertiesLoose4(r, e) {
1098
848
  return t;
1099
849
  }
1100
850
  var AntDValueSelector = function AntDValueSelector2(t0) {
1101
- var $ = c(24);
851
+ var $ = c(32);
852
+ var className;
853
+ var disabled;
854
+ var extraProps;
1102
855
  var handleOnChange;
1103
856
  var listsAsArrays;
1104
857
  var multiple;
1105
- var value;
1106
858
  var options;
1107
- var disabled;
1108
- var extraProps;
1109
859
  var title;
1110
- var className;
860
+ var value;
1111
861
  if ($[0] !== t0) {
1112
- var _t = t0.className, _t2 = t0.handleOnChange, t3 = t0.options, t4 = t0.value, t5 = t0.title, t6 = t0.disabled, t7 = t0.multiple, t8 = t0.listsAsArrays, _testID = t0.testID, _rule = t0.rule, _rules = t0.rules, _level = t0.level, _path = t0.path, _context = t0.context, _validation = t0.validation, _operator = t0.operator, _field = t0.field, _fieldData = t0.fieldData, _schema = t0.schema, t9 = _objectWithoutProperties4(t0, _excluded4);
862
+ var _t = t0.className, _t2 = t0.handleOnChange, _t3 = t0.options, _t4 = t0.value, _t5 = t0.title, t6 = t0.disabled, t7 = t0.multiple, t8 = t0.listsAsArrays, _testID = t0.testID, _rule = t0.rule, _rules = t0.rules, _level = t0.level, _path = t0.path, _context = t0.context, _validation = t0.validation, _operator = t0.operator, _field = t0.field, _fieldData = t0.fieldData, _schema = t0.schema, t9 = _objectWithoutProperties5(t0, _excluded5);
1113
863
  className = _t;
1114
864
  handleOnChange = _t2;
1115
- options = t3;
1116
- value = t4;
1117
- title = t5;
865
+ options = _t3;
866
+ value = _t4;
867
+ title = _t5;
1118
868
  disabled = t6;
1119
869
  multiple = t7;
1120
870
  listsAsArrays = t8;
1121
871
  extraProps = t9;
1122
872
  $[0] = t0;
1123
- $[1] = handleOnChange;
1124
- $[2] = listsAsArrays;
1125
- $[3] = multiple;
1126
- $[4] = value;
1127
- $[5] = options;
1128
- $[6] = disabled;
1129
- $[7] = extraProps;
873
+ $[1] = className;
874
+ $[2] = disabled;
875
+ $[3] = extraProps;
876
+ $[4] = handleOnChange;
877
+ $[5] = listsAsArrays;
878
+ $[6] = multiple;
879
+ $[7] = options;
1130
880
  $[8] = title;
1131
- $[9] = className;
881
+ $[9] = value;
1132
882
  } else {
1133
- handleOnChange = $[1];
1134
- listsAsArrays = $[2];
1135
- multiple = $[3];
1136
- value = $[4];
1137
- options = $[5];
1138
- disabled = $[6];
1139
- extraProps = $[7];
883
+ className = $[1];
884
+ disabled = $[2];
885
+ extraProps = $[3];
886
+ handleOnChange = $[4];
887
+ listsAsArrays = $[5];
888
+ multiple = $[6];
889
+ options = $[7];
1140
890
  title = $[8];
1141
- className = $[9];
891
+ value = $[9];
1142
892
  }
1143
893
  var t1;
1144
- if ($[10] !== handleOnChange || $[11] !== listsAsArrays || $[12] !== multiple || $[13] !== value) {
1145
- t1 = { handleOnChange, listsAsArrays, multiple, value };
894
+ if ($[10] !== handleOnChange || $[11] !== value) {
895
+ t1 = { handleOnChange, listsAsArrays: false, multiple: false, value };
1146
896
  $[10] = handleOnChange;
1147
- $[11] = listsAsArrays;
1148
- $[12] = multiple;
1149
- $[13] = value;
1150
- $[14] = t1;
897
+ $[11] = value;
898
+ $[12] = t1;
1151
899
  } else {
1152
- t1 = $[14];
900
+ t1 = $[12];
1153
901
  }
1154
- var _useValueSelector = useValueSelector(t1), onChange = _useValueSelector.onChange, val = _useValueSelector.val;
1155
- var t2;
1156
- if ($[15] !== multiple || $[16] !== options || $[17] !== disabled || $[18] !== val || $[19] !== onChange || $[20] !== extraProps || $[21] !== title || $[22] !== className) {
1157
- var modeObj = multiple ? { mode: "multiple" } : {};
1158
- t2 = jsx7("span", { title, className, children: jsx7(Select2, _objectSpread5(_objectSpread5(_objectSpread5({}, modeObj), {}, { popupMatchSelectWidth: false, disabled, value: val, onChange }, extraProps), {}, { children: toOptions(options) })) });
1159
- $[15] = multiple;
1160
- $[16] = options;
1161
- $[17] = disabled;
1162
- $[18] = val;
1163
- $[19] = onChange;
1164
- $[20] = extraProps;
1165
- $[21] = title;
1166
- $[22] = className;
1167
- $[23] = t2;
902
+ var _useValueSelector = useValueSelector(t1), onChangeNoArrays = _useValueSelector.onChange;
903
+ var t2 = multiple || listsAsArrays;
904
+ var t3;
905
+ if ($[13] !== handleOnChange || $[14] !== multiple || $[15] !== t2 || $[16] !== value) {
906
+ t3 = { handleOnChange, listsAsArrays: t2, multiple, value };
907
+ $[13] = handleOnChange;
908
+ $[14] = multiple;
909
+ $[15] = t2;
910
+ $[16] = value;
911
+ $[17] = t3;
912
+ } else {
913
+ t3 = $[17];
914
+ }
915
+ var _useValueSelector2 = useValueSelector(t3), onChangeNormal = _useValueSelector2.onChange, val = _useValueSelector2.val;
916
+ var t4;
917
+ if ($[18] !== listsAsArrays || $[19] !== multiple || $[20] !== onChangeNoArrays || $[21] !== onChangeNormal) {
918
+ t4 = function t42(v) {
919
+ if (multiple && !listsAsArrays && Array.isArray(v)) {
920
+ onChangeNoArrays(joinWith2(v));
921
+ } else {
922
+ onChangeNormal(v);
923
+ }
924
+ };
925
+ $[18] = listsAsArrays;
926
+ $[19] = multiple;
927
+ $[20] = onChangeNoArrays;
928
+ $[21] = onChangeNormal;
929
+ $[22] = t4;
930
+ } else {
931
+ t4 = $[22];
932
+ }
933
+ var onChange = t4;
934
+ var t5;
935
+ if ($[23] !== className || $[24] !== disabled || $[25] !== extraProps || $[26] !== multiple || $[27] !== onChange || $[28] !== options || $[29] !== title || $[30] !== val) {
936
+ t5 = jsx6(Select, _objectSpread5(_objectSpread5({}, multiple ? { mode: "multiple", allowClear: true } : {}), {}, { title, className, popupMatchSelectWidth: false, disabled, value: val, onChange, optionFilterProp: "label", options }, extraProps));
937
+ $[23] = className;
938
+ $[24] = disabled;
939
+ $[25] = extraProps;
940
+ $[26] = multiple;
941
+ $[27] = onChange;
942
+ $[28] = options;
943
+ $[29] = title;
944
+ $[30] = val;
945
+ $[31] = t5;
1168
946
  } else {
1169
- t2 = $[23];
947
+ t5 = $[31];
1170
948
  }
1171
- return t2;
949
+ return t5;
1172
950
  };
1173
951
 
1174
952
  // src/index.tsx
1175
953
  var antdControlElements = { actionElement: AntDActionElement, dragHandle: AntDDragHandle, notToggle: AntDNotToggle, shiftActions: AntDShiftActions, valueEditor: AntDValueEditor, valueSelector: AntDValueSelector };
1176
- var antdTranslations = { removeGroup: { label: /* @__PURE__ */ jsx8(CloseOutlined, {}) }, removeRule: { label: /* @__PURE__ */ jsx8(CloseOutlined, {}) }, cloneRule: { label: /* @__PURE__ */ jsx8(CopyOutlined, {}) }, cloneRuleGroup: { label: /* @__PURE__ */ jsx8(CopyOutlined, {}) }, lockGroup: { label: /* @__PURE__ */ jsx8(UnlockOutlined, {}) }, lockRule: { label: /* @__PURE__ */ jsx8(UnlockOutlined, {}) }, lockGroupDisabled: { label: /* @__PURE__ */ jsx8(LockOutlined, {}) }, lockRuleDisabled: { label: /* @__PURE__ */ jsx8(LockOutlined, {}) }, shiftActionUp: { label: /* @__PURE__ */ jsx8(UpOutlined, {}) }, shiftActionDown: { label: /* @__PURE__ */ jsx8(DownOutlined, {}) } };
954
+ var antdTranslations = { removeGroup: { label: /* @__PURE__ */ jsx7(CloseOutlined, {}) }, removeRule: { label: /* @__PURE__ */ jsx7(CloseOutlined, {}) }, cloneRule: { label: /* @__PURE__ */ jsx7(CopyOutlined, {}) }, cloneRuleGroup: { label: /* @__PURE__ */ jsx7(CopyOutlined, {}) }, lockGroup: { label: /* @__PURE__ */ jsx7(UnlockOutlined, {}) }, lockRule: { label: /* @__PURE__ */ jsx7(UnlockOutlined, {}) }, lockGroupDisabled: { label: /* @__PURE__ */ jsx7(LockOutlined, {}) }, lockRuleDisabled: { label: /* @__PURE__ */ jsx7(LockOutlined, {}) }, shiftActionUp: { label: /* @__PURE__ */ jsx7(UpOutlined, {}) }, shiftActionDown: { label: /* @__PURE__ */ jsx7(DownOutlined, {}) } };
1177
955
  var QueryBuilderAntD = getCompatContextProvider({ controlElements: antdControlElements, translations: antdTranslations });
1178
956
  export {
1179
957
  AntDActionElement,