@react-querybuilder/antd 8.1.0 → 8.2.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.
@@ -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
 
@@ -145,8 +145,8 @@ function _objectWithoutProperties(e, t) {
145
145
  if (null == e) return {};
146
146
  var o, r, i = _objectWithoutPropertiesLoose(e, t);
147
147
  if (Object.getOwnPropertySymbols) {
148
- var s = Object.getOwnPropertySymbols(e);
149
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
148
+ var n = Object.getOwnPropertySymbols(e);
149
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
150
150
  }
151
151
  return i;
152
152
  }
@@ -154,7 +154,7 @@ function _objectWithoutPropertiesLoose(r, e) {
154
154
  if (null == r) return {};
155
155
  var t = {};
156
156
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
157
- if (e.includes(n)) continue;
157
+ if (-1 !== e.indexOf(n)) continue;
158
158
  t[n] = r[n];
159
159
  }
160
160
  return t;
@@ -221,8 +221,8 @@ function _objectWithoutProperties2(e, t) {
221
221
  if (null == e) return {};
222
222
  var o, r, i = _objectWithoutPropertiesLoose2(e, t);
223
223
  if (Object.getOwnPropertySymbols) {
224
- var s = Object.getOwnPropertySymbols(e);
225
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
224
+ var n = Object.getOwnPropertySymbols(e);
225
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
226
226
  }
227
227
  return i;
228
228
  }
@@ -230,7 +230,7 @@ function _objectWithoutPropertiesLoose2(r, e) {
230
230
  if (null == r) return {};
231
231
  var t = {};
232
232
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
233
- if (e.includes(n)) continue;
233
+ if (-1 !== e.indexOf(n)) continue;
234
234
  t[n] = r[n];
235
235
  }
236
236
  return t;
@@ -294,8 +294,8 @@ function _objectWithoutProperties3(e, t) {
294
294
  if (null == e) return {};
295
295
  var o, r, i = _objectWithoutPropertiesLoose3(e, t);
296
296
  if (Object.getOwnPropertySymbols) {
297
- var s = Object.getOwnPropertySymbols(e);
298
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
297
+ var n = Object.getOwnPropertySymbols(e);
298
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
299
299
  }
300
300
  return i;
301
301
  }
@@ -303,7 +303,7 @@ function _objectWithoutPropertiesLoose3(r, e) {
303
303
  if (null == r) return {};
304
304
  var t = {};
305
305
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
306
- if (e.includes(n)) continue;
306
+ if (-1 !== e.indexOf(n)) continue;
307
307
  t[n] = r[n];
308
308
  }
309
309
  return t;
@@ -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,377 +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 n = Object.getOwnPropertySymbols(e);
651
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(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 (-1 !== e.indexOf(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, 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;
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);
677
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
- 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") {
683
675
  if (type === "text") {
684
- var _t;
685
- if ($[2] !== className || $[3] !== disabled || $[4] !== extraProps || $[5] !== inputTypeCoerced || $[6] !== multiValueHandler || $[7] !== placeHolderText || $[8] !== separator || $[9] !== testID || $[10] !== title || $[11] !== valueAsArray || $[12] !== valueListItemClassName) {
686
- var editors = ["from", "to"].map(function(key, i) {
687
- var _valueAsArray$i2;
688
- if (inputTypeCoerced === "time") {
689
- return jsx5(DatePicker.TimePicker, _objectSpread4({ value: valueAsArray[i] ? dayjs2(valueAsArray[i], "HH:mm:ss") : null, className: valueListItemClassName, disabled, placeholder: placeHolderText, onChange: function onChange(d) {
690
- var _d$format;
691
- return multiValueHandler((_d$format = d === null || d === void 0 ? void 0 : d.format("HH:mm:ss")) !== null && _d$format !== void 0 ? _d$format : "", i);
692
- } }, extraProps), key);
693
- } else {
694
- if (inputTypeCoerced === "number") {
695
- var _valueAsArray$i;
696
- 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) {
697
- return multiValueHandler(v, i);
698
- } }, extraProps), key);
699
- }
700
- }
701
- 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) {
702
- 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);
703
682
  } }, extraProps), key);
704
- });
705
- _t = jsxs2("span", { "data-testid": testID, className, title, children: [editors[0], separator, editors[1]] });
706
- $[2] = className;
707
- $[3] = disabled;
708
- $[4] = extraProps;
709
- $[5] = inputTypeCoerced;
710
- $[6] = multiValueHandler;
711
- $[7] = placeHolderText;
712
- $[8] = separator;
713
- $[9] = testID;
714
- $[10] = title;
715
- $[11] = valueAsArray;
716
- $[12] = valueListItemClassName;
717
- $[13] = _t;
718
- } else {
719
- _t = $[13];
720
- }
721
- return _t;
722
- }
723
- var _t2;
724
- if ($[14] !== allProps) {
725
- _t2 = jsx5(ValueEditor, _objectSpread4(_objectSpread4({}, allProps), {}, { skipHook: true }));
726
- $[14] = allProps;
727
- $[15] = _t2;
728
- } else {
729
- _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]] });
730
694
  }
731
- return _t2;
695
+ return /* @__PURE__ */ jsx5(ValueEditor, _objectSpread4(_objectSpread4({}, allProps), {}, { skipHook: true }));
732
696
  }
733
697
  switch (type) {
734
- case "select": {
735
- }
736
- case "multiselect": {
737
- var _t3;
738
- if ($[16] !== allProps) {
739
- _t3 = jsx5(ValueEditor, _objectSpread4(_objectSpread4({}, allProps), {}, { skipHook: true }));
740
- $[16] = allProps;
741
- $[17] = _t3;
742
- } else {
743
- _t3 = $[17];
744
- }
745
- return _t3;
746
- }
747
- case "textarea": {
748
- var _t4;
749
- if ($[18] !== handleOnChange) {
750
- _t4 = function _t42(e_2) {
751
- return handleOnChange(e_2.target.value);
752
- };
753
- $[18] = handleOnChange;
754
- $[19] = _t4;
755
- } else {
756
- _t4 = $[19];
757
- }
758
- var _t5;
759
- if ($[20] !== className || $[21] !== disabled || $[22] !== extraProps || $[23] !== placeHolderText || $[24] !== _t4 || $[25] !== title || $[26] !== value) {
760
- _t5 = jsx5(Input.TextArea, _objectSpread4({ value, title, className, disabled, placeholder: placeHolderText, onChange: _t4 }, extraProps));
761
- $[20] = className;
762
- $[21] = disabled;
763
- $[22] = extraProps;
764
- $[23] = placeHolderText;
765
- $[24] = _t4;
766
- $[25] = title;
767
- $[26] = value;
768
- $[27] = _t5;
769
- } else {
770
- _t5 = $[27];
771
- }
772
- return _t5;
773
- }
774
- case "switch": {
775
- var _t6 = !!value;
776
- var _t7;
777
- if ($[28] !== handleOnChange) {
778
- _t7 = function _t72(v_1) {
779
- return handleOnChange(v_1);
780
- };
781
- $[28] = handleOnChange;
782
- $[29] = _t7;
783
- } else {
784
- _t7 = $[29];
785
- }
786
- var t4;
787
- if ($[30] !== className || $[31] !== disabled || $[32] !== extraProps || $[33] !== _t6 || $[34] !== _t7 || $[35] !== title) {
788
- t4 = jsx5(Switch2, _objectSpread4({ checked: _t6, title, className, disabled, onChange: _t7 }, extraProps));
789
- $[30] = className;
790
- $[31] = disabled;
791
- $[32] = extraProps;
792
- $[33] = _t6;
793
- $[34] = _t7;
794
- $[35] = title;
795
- $[36] = t4;
796
- } else {
797
- t4 = $[36];
798
- }
799
- return t4;
800
- }
801
- case "checkbox": {
802
- var _t8;
803
- if ($[37] !== handleOnChange) {
804
- _t8 = function _t82(e_1) {
805
- return handleOnChange(e_1.target.checked);
806
- };
807
- $[37] = handleOnChange;
808
- $[38] = _t8;
809
- } else {
810
- _t8 = $[38];
811
- }
812
- var _t9 = !!value;
813
- var _t10;
814
- if ($[39] !== className || $[40] !== disabled || $[41] !== extraProps || $[42] !== _t8 || $[43] !== _t9 || $[44] !== title) {
815
- _t10 = jsx5("span", { title, className, children: jsx5(Checkbox, _objectSpread4({ type: "checkbox", disabled, onChange: _t8, checked: _t9 }, extraProps)) });
816
- $[39] = className;
817
- $[40] = disabled;
818
- $[41] = extraProps;
819
- $[42] = _t8;
820
- $[43] = _t9;
821
- $[44] = title;
822
- $[45] = _t10;
823
- } else {
824
- _t10 = $[45];
825
- }
826
- return _t10;
827
- }
828
- case "radio": {
829
- var _t11;
830
- if ($[46] !== className || $[47] !== disabled || $[48] !== extraProps || $[49] !== handleOnChange || $[50] !== title || $[51] !== value || $[52] !== values) {
831
- var _t12;
832
- if ($[54] !== disabled || $[55] !== extraProps || $[56] !== handleOnChange || $[57] !== value) {
833
- _t12 = function _t122(v_0) {
834
- return jsx5(Radio, _objectSpread4(_objectSpread4({ value: v_0.name, checked: value === v_0.name, disabled, onChange: function onChange(e_0) {
835
- return handleOnChange(e_0.target.value);
836
- } }, extraProps), {}, { children: v_0.label }), v_0.name);
837
- };
838
- $[54] = disabled;
839
- $[55] = extraProps;
840
- $[56] = handleOnChange;
841
- $[57] = value;
842
- $[58] = _t12;
843
- } else {
844
- _t12 = $[58];
845
- }
846
- _t11 = jsx5("span", { className, title, children: values.map(_t12) });
847
- $[46] = className;
848
- $[47] = disabled;
849
- $[48] = extraProps;
850
- $[49] = handleOnChange;
851
- $[50] = title;
852
- $[51] = value;
853
- $[52] = values;
854
- $[53] = _t11;
855
- } else {
856
- _t11 = $[53];
857
- }
858
- return _t11;
859
- }
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
+ }) });
860
719
  }
861
720
  switch (inputTypeCoerced) {
862
- case "date": {
863
- }
721
+ case "date":
864
722
  case "datetime-local": {
865
723
  if (operator === "between" || operator === "notBetween") {
866
- var _t13;
867
- if ($[59] !== className || $[60] !== disabled || $[61] !== extraProps || $[62] !== handleOnChange || $[63] !== inputTypeCoerced || $[64] !== listsAsArrays || $[65] !== placeHolderText || $[66] !== valueAsArray) {
868
- var dayjsArray = valueAsArray.slice(0, 2).map(_temp);
869
- var _t14;
870
- if ($[68] !== handleOnChange || $[69] !== inputTypeCoerced || $[70] !== listsAsArrays) {
871
- _t14 = function _t142(dates) {
872
- var timeFormat = inputTypeCoerced === "datetime-local" ? "THH:mm:ss" : "";
873
- var format2 = "YYYY-MM-DD".concat(timeFormat);
874
- var dateArray = dates === null || dates === void 0 ? void 0 : dates.map(function(d_2) {
875
- return d_2 !== null && d_2 !== void 0 && d_2.isValid() ? d_2.format(format2) : void 0;
876
- });
877
- handleOnChange(dateArray ? listsAsArrays ? dateArray : joinWith(dateArray, ",") : dates);
878
- };
879
- $[68] = handleOnChange;
880
- $[69] = inputTypeCoerced;
881
- $[70] = listsAsArrays;
882
- $[71] = _t14;
883
- } else {
884
- _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);
885
738
  }
886
- _t13 = jsx5(DatePicker.RangePicker, _objectSpread4({ value: dayjsArray.every(_temp2) ? dayjsArray : void 0, showTime: inputTypeCoerced === "datetime-local", className, disabled, placeholder: [placeHolderText, placeHolderText], onChange: _t14 }, extraProps));
887
- $[59] = className;
888
- $[60] = disabled;
889
- $[61] = extraProps;
890
- $[62] = handleOnChange;
891
- $[63] = inputTypeCoerced;
892
- $[64] = listsAsArrays;
893
- $[65] = placeHolderText;
894
- $[66] = valueAsArray;
895
- $[67] = _t13;
896
- } else {
897
- _t13 = $[67];
898
- }
899
- return _t13;
900
- }
901
- var _t15;
902
- if ($[72] !== className || $[73] !== disabled || $[74] !== extraProps || $[75] !== handleOnChange || $[76] !== inputTypeCoerced || $[77] !== placeHolderText || $[78] !== value) {
903
- var dateValue_0 = dayjs2(value);
904
- var _t16;
905
- if ($[80] !== handleOnChange) {
906
- _t16 = function _t162(_d, dateString) {
907
- return handleOnChange(dateString);
908
- };
909
- $[80] = handleOnChange;
910
- $[81] = _t16;
911
- } else {
912
- _t16 = $[81];
913
- }
914
- _t15 = jsx5(DatePicker, _objectSpread4({ value: dateValue_0.isValid() ? dateValue_0 : void 0, showTime: inputTypeCoerced === "datetime-local", className, disabled, placeholder: placeHolderText, onChange: _t16 }, extraProps));
915
- $[72] = className;
916
- $[73] = disabled;
917
- $[74] = extraProps;
918
- $[75] = handleOnChange;
919
- $[76] = inputTypeCoerced;
920
- $[77] = placeHolderText;
921
- $[78] = value;
922
- $[79] = _t15;
923
- } else {
924
- _t15 = $[79];
739
+ ) }, extraProps));
925
740
  }
926
- 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));
927
745
  }
928
746
  case "time": {
929
- var _t17;
930
- if ($[82] !== className || $[83] !== disabled || $[84] !== extraProps || $[85] !== handleOnChange || $[86] !== placeHolderText || $[87] !== value) {
931
- var dateValue = dayjs2(value, "HH:mm:ss");
932
- var _t18;
933
- if ($[89] !== handleOnChange) {
934
- _t18 = function _t182(d_0) {
935
- var _d_0$format;
936
- 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 : "");
937
- };
938
- $[89] = handleOnChange;
939
- $[90] = _t18;
940
- } else {
941
- _t18 = $[90];
942
- }
943
- _t17 = jsx5(DatePicker.TimePicker, _objectSpread4({ value: dateValue.isValid() ? dateValue : void 0, className, disabled, placeholder: placeHolderText, onChange: _t18 }, extraProps));
944
- $[82] = className;
945
- $[83] = disabled;
946
- $[84] = extraProps;
947
- $[85] = handleOnChange;
948
- $[86] = placeHolderText;
949
- $[87] = value;
950
- $[88] = _t17;
951
- } else {
952
- _t17 = $[88];
953
- }
954
- 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));
955
752
  }
956
753
  case "number": {
957
- var _t19;
958
- if ($[91] !== className || $[92] !== disabled || $[93] !== extraProps || $[94] !== handleOnChange || $[95] !== inputTypeCoerced || $[96] !== placeHolderText || $[97] !== title || $[98] !== value) {
959
- _t19 = jsx5(InputNumber, _objectSpread4({ type: inputTypeCoerced, value, title, className, disabled, placeholder: placeHolderText, onChange: handleOnChange }, extraProps));
960
- $[91] = className;
961
- $[92] = disabled;
962
- $[93] = extraProps;
963
- $[94] = handleOnChange;
964
- $[95] = inputTypeCoerced;
965
- $[96] = placeHolderText;
966
- $[97] = title;
967
- $[98] = value;
968
- $[99] = _t19;
969
- } else {
970
- _t19 = $[99];
971
- }
972
- return _t19;
754
+ return /* @__PURE__ */ jsx5(InputNumber, _objectSpread4({ type: inputTypeCoerced, value, title, className, disabled, placeholder: placeHolderText, onChange: handleOnChange }, extraProps));
973
755
  }
974
756
  }
975
- var t2;
976
- if ($[100] !== handleOnChange) {
977
- t2 = function t22(e_3) {
978
- return handleOnChange(e_3.target.value);
979
- };
980
- $[100] = handleOnChange;
981
- $[101] = t2;
982
- } else {
983
- t2 = $[101];
984
- }
985
- var t3;
986
- if ($[102] !== className || $[103] !== disabled || $[104] !== extraProps || $[105] !== inputTypeCoerced || $[106] !== placeHolderText || $[107] !== t2 || $[108] !== title || $[109] !== value) {
987
- t3 = jsx5(Input, _objectSpread4({ type: inputTypeCoerced, value, title, className, disabled, placeholder: placeHolderText, onChange: t2 }, extraProps));
988
- $[102] = className;
989
- $[103] = disabled;
990
- $[104] = extraProps;
991
- $[105] = inputTypeCoerced;
992
- $[106] = placeHolderText;
993
- $[107] = t2;
994
- $[108] = title;
995
- $[109] = value;
996
- $[110] = t3;
997
- } else {
998
- t3 = $[110];
999
- }
1000
- 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));
1001
760
  };
1002
- function _temp(v_2) {
1003
- return dayjs2(v_2);
1004
- }
1005
- function _temp2(d_1) {
1006
- 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
+ );
1007
778
  }
1008
779
 
1009
780
  // src/AntDValueSelector.tsx
1010
- import { jsx as jsx7 } from "react/jsx-runtime";
1011
- import { Select as Select2 } from "antd";
1012
- import { useValueSelector } from "react-querybuilder";
1013
-
1014
- // src/utils.tsx
1015
781
  import { jsx as jsx6 } from "react/jsx-runtime";
1016
782
  import { Select } from "antd";
1017
- import { isOptionGroupArray } from "react-querybuilder";
1018
- var OptGroup = Select.OptGroup;
1019
- var Option = Select.Option;
1020
- var toOptions = function toOptions2(arr) {
1021
- return isOptionGroupArray(arr) ? arr.map(function(og) {
1022
- return /* @__PURE__ */ jsx6(OptGroup, { label: og.label, children: og.options.map(function(opt) {
1023
- return /* @__PURE__ */ jsx6(Option, { value: opt.name, children: opt.label }, opt.name);
1024
- }) }, og.label);
1025
- }) : Array.isArray(arr) ? arr.map(function(opt) {
1026
- return /* @__PURE__ */ jsx6(Option, { value: opt.name, children: opt.label }, opt.name);
1027
- }) : (
1028
- /* istanbul ignore next */
1029
- null
1030
- );
1031
- };
1032
-
1033
- // src/AntDValueSelector.tsx
783
+ import * as React2 from "react";
784
+ import { joinWith as joinWith2, useValueSelector } from "react-querybuilder";
1034
785
  function _typeof5(o) {
1035
786
  "@babel/helpers - typeof";
1036
787
  return _typeof5 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o2) {
@@ -1039,7 +790,7 @@ function _typeof5(o) {
1039
790
  return o2 && "function" == typeof Symbol && o2.constructor === Symbol && o2 !== Symbol.prototype ? "symbol" : typeof o2;
1040
791
  }, _typeof5(o);
1041
792
  }
1042
- 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"];
1043
794
  function ownKeys5(e, r) {
1044
795
  var t = Object.keys(e);
1045
796
  if (Object.getOwnPropertySymbols) {
@@ -1078,26 +829,26 @@ function _toPrimitive5(t, r) {
1078
829
  }
1079
830
  return ("string" === r ? String : Number)(t);
1080
831
  }
1081
- function _objectWithoutProperties4(e, t) {
832
+ function _objectWithoutProperties5(e, t) {
1082
833
  if (null == e) return {};
1083
- var o, r, i = _objectWithoutPropertiesLoose4(e, t);
834
+ var o, r, i = _objectWithoutPropertiesLoose5(e, t);
1084
835
  if (Object.getOwnPropertySymbols) {
1085
- var s = Object.getOwnPropertySymbols(e);
1086
- for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
836
+ var n = Object.getOwnPropertySymbols(e);
837
+ for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
1087
838
  }
1088
839
  return i;
1089
840
  }
1090
- function _objectWithoutPropertiesLoose4(r, e) {
841
+ function _objectWithoutPropertiesLoose5(r, e) {
1091
842
  if (null == r) return {};
1092
843
  var t = {};
1093
844
  for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
1094
- if (e.includes(n)) continue;
845
+ if (-1 !== e.indexOf(n)) continue;
1095
846
  t[n] = r[n];
1096
847
  }
1097
848
  return t;
1098
849
  }
1099
850
  var AntDValueSelector = function AntDValueSelector2(t0) {
1100
- var $ = c(24);
851
+ var $ = c(32);
1101
852
  var className;
1102
853
  var disabled;
1103
854
  var extraProps;
@@ -1108,12 +859,12 @@ var AntDValueSelector = function AntDValueSelector2(t0) {
1108
859
  var title;
1109
860
  var value;
1110
861
  if ($[0] !== t0) {
1111
- 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);
1112
863
  className = _t;
1113
864
  handleOnChange = _t2;
1114
- options = t3;
1115
- value = t4;
1116
- title = t5;
865
+ options = _t3;
866
+ value = _t4;
867
+ title = _t5;
1117
868
  disabled = t6;
1118
869
  multiple = t7;
1119
870
  listsAsArrays = t8;
@@ -1140,39 +891,67 @@ var AntDValueSelector = function AntDValueSelector2(t0) {
1140
891
  value = $[9];
1141
892
  }
1142
893
  var t1;
1143
- if ($[10] !== handleOnChange || $[11] !== listsAsArrays || $[12] !== multiple || $[13] !== value) {
1144
- t1 = { handleOnChange, listsAsArrays, multiple, value };
894
+ if ($[10] !== handleOnChange || $[11] !== value) {
895
+ t1 = { handleOnChange, listsAsArrays: false, multiple: false, value };
1145
896
  $[10] = handleOnChange;
1146
- $[11] = listsAsArrays;
1147
- $[12] = multiple;
1148
- $[13] = value;
1149
- $[14] = t1;
897
+ $[11] = value;
898
+ $[12] = t1;
1150
899
  } else {
1151
- t1 = $[14];
900
+ t1 = $[12];
1152
901
  }
1153
- var _useValueSelector = useValueSelector(t1), onChange = _useValueSelector.onChange, val = _useValueSelector.val;
1154
- var t2;
1155
- if ($[15] !== className || $[16] !== disabled || $[17] !== extraProps || $[18] !== multiple || $[19] !== onChange || $[20] !== options || $[21] !== title || $[22] !== val) {
1156
- var modeObj = multiple ? { mode: "multiple" } : {};
1157
- t2 = jsx7("span", { title, className, children: jsx7(Select2, _objectSpread5(_objectSpread5(_objectSpread5({}, modeObj), {}, { popupMatchSelectWidth: false, disabled, value: val, onChange }, extraProps), {}, { children: toOptions(options) })) });
1158
- $[15] = className;
1159
- $[16] = disabled;
1160
- $[17] = extraProps;
1161
- $[18] = multiple;
1162
- $[19] = onChange;
1163
- $[20] = options;
1164
- $[21] = title;
1165
- $[22] = val;
1166
- $[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;
1167
946
  } else {
1168
- t2 = $[23];
947
+ t5 = $[31];
1169
948
  }
1170
- return t2;
949
+ return t5;
1171
950
  };
1172
951
 
1173
952
  // src/index.tsx
1174
953
  var antdControlElements = { actionElement: AntDActionElement, dragHandle: AntDDragHandle, notToggle: AntDNotToggle, shiftActions: AntDShiftActions, valueEditor: AntDValueEditor, valueSelector: AntDValueSelector };
1175
- 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, {}) } };
1176
955
  var QueryBuilderAntD = getCompatContextProvider({ controlElements: antdControlElements, translations: antdTranslations });
1177
956
  export {
1178
957
  AntDActionElement,