@react-querybuilder/antd 4.3.1 → 4.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,37 +1,7 @@
1
- var __defProp = Object.defineProperty;
2
- var __defProps = Object.defineProperties;
3
- var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
- var __spreadValues = (a, b) => {
9
- for (var prop in b || (b = {}))
10
- if (__hasOwnProp.call(b, prop))
11
- __defNormalProp(a, prop, b[prop]);
12
- if (__getOwnPropSymbols)
13
- for (var prop of __getOwnPropSymbols(b)) {
14
- if (__propIsEnum.call(b, prop))
15
- __defNormalProp(a, prop, b[prop]);
16
- }
17
- return a;
18
- };
19
- var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
1
  import { Button, Switch, Select, Radio, Checkbox, Input, TimePicker, DatePicker } from "antd";
33
2
  import require$$0, { forwardRef, useMemo, useEffect } from "react";
34
3
  import { HolderOutlined } from "@ant-design/icons";
4
+ import { isOptionGroupArray } from "react-querybuilder";
35
5
  var jsxRuntime = { exports: {} };
36
6
  var reactJsxRuntime_production_min = {};
37
7
  /**
@@ -63,102 +33,70 @@ reactJsxRuntime_production_min.jsxs = q;
63
33
  jsxRuntime.exports = reactJsxRuntime_production_min;
64
34
  }
65
35
  const jsx = jsxRuntime.exports.jsx;
66
- const AntDActionElement = (_a) => {
67
- var _b = _a, {
68
- className,
69
- handleOnClick,
70
- label,
71
- title,
72
- disabled,
73
- disabledTranslation,
74
- testID: _testID,
75
- rules: _rules,
76
- level: _level,
77
- path: _path,
78
- context: _context,
79
- validation: _validation
80
- } = _b, extraProps = __objRest(_b, [
81
- "className",
82
- "handleOnClick",
83
- "label",
84
- "title",
85
- "disabled",
86
- "disabledTranslation",
87
- "testID",
88
- "rules",
89
- "level",
90
- "path",
91
- "context",
92
- "validation"
93
- ]);
94
- return /* @__PURE__ */ jsx(Button, __spreadProps(__spreadValues({
95
- type: "primary",
96
- className,
97
- title: disabledTranslation && disabled ? disabledTranslation.title : title,
98
- onClick: (e) => handleOnClick(e),
99
- disabled: disabled && !disabledTranslation
100
- }, extraProps), {
101
- children: disabledTranslation && disabled ? disabledTranslation.label : label
102
- }));
103
- };
104
- AntDActionElement.displayName = "AntDActionElement";
105
- const AntDDragHandle = forwardRef((_c, dragRef) => {
106
- var _d = _c, {
107
- className,
108
- title,
109
- testID: _testID,
110
- ref: _ref,
111
- level: _level,
112
- path: _path,
113
- label: _label,
114
- disabled: _disabled,
115
- context: _context,
116
- validation: _validation
117
- } = _d, extraProps = __objRest(_d, [
118
- "className",
119
- "title",
120
- "testID",
121
- "ref",
122
- "level",
123
- "path",
124
- "label",
125
- "disabled",
126
- "context",
127
- "validation"
128
- ]);
129
- return /* @__PURE__ */ jsx(HolderOutlined, __spreadValues({
130
- ref: dragRef,
131
- className,
132
- title
133
- }, extraProps));
36
+ const AntDActionElement = ({
37
+ className,
38
+ handleOnClick,
39
+ label,
40
+ title,
41
+ disabled,
42
+ disabledTranslation,
43
+ testID: _testID,
44
+ rules: _rules,
45
+ level: _level,
46
+ path: _path,
47
+ context: _context,
48
+ validation: _validation,
49
+ ...extraProps
50
+ }) => /* @__PURE__ */ jsx(Button, {
51
+ type: "primary",
52
+ className,
53
+ title: disabledTranslation && disabled ? disabledTranslation.title : title,
54
+ onClick: (e) => handleOnClick(e),
55
+ disabled: disabled && !disabledTranslation,
56
+ ...extraProps,
57
+ children: disabledTranslation && disabled ? disabledTranslation.label : label
134
58
  });
59
+ AntDActionElement.displayName = "AntDActionElement";
60
+ const AntDDragHandle = forwardRef(({
61
+ className,
62
+ title,
63
+ testID: _testID,
64
+ level: _level,
65
+ path: _path,
66
+ label: _label,
67
+ disabled: _disabled,
68
+ context: _context,
69
+ validation: _validation,
70
+ ...extraProps
71
+ }, dragRef) => /* @__PURE__ */ jsx(HolderOutlined, {
72
+ ref: dragRef,
73
+ className,
74
+ title,
75
+ ...extraProps
76
+ }));
135
77
  AntDDragHandle.displayName = "AntDDragHandle";
136
- const AntDNotToggle = (_e) => {
137
- var _f = _e, {
138
- className,
139
- handleOnChange,
140
- label,
141
- checked,
142
- title,
143
- disabled
144
- } = _f, extraProps = __objRest(_f, [
145
- "className",
146
- "handleOnChange",
147
- "label",
148
- "checked",
149
- "title",
150
- "disabled"
151
- ]);
152
- return /* @__PURE__ */ jsx(Switch, __spreadValues({
153
- title,
154
- className,
155
- onChange: (v) => handleOnChange(v),
156
- checked: !!checked,
157
- disabled,
158
- checkedChildren: label,
159
- unCheckedChildren: "="
160
- }, extraProps));
161
- };
78
+ const AntDNotToggle = ({
79
+ className,
80
+ handleOnChange,
81
+ label,
82
+ checked,
83
+ title,
84
+ disabled,
85
+ path: _path,
86
+ context: _context,
87
+ validation: _validation,
88
+ testID: _testID,
89
+ ...extraProps
90
+ }) => /* @__PURE__ */ jsx(Switch, {
91
+ title,
92
+ className,
93
+ onChange: (v) => handleOnChange(v),
94
+ checked: !!checked,
95
+ disabled,
96
+ checkedChildren: label,
97
+ unCheckedChildren: "=",
98
+ ...extraProps
99
+ });
162
100
  AntDNotToggle.displayName = "AntDNotToggle";
163
101
  //! moment.js
164
102
  //! version : 2.29.3
@@ -3857,7 +3795,6 @@ const {
3857
3795
  OptGroup,
3858
3796
  Option
3859
3797
  } = Select;
3860
- const isOptionGroupArray = (arr) => Array.isArray(arr) && arr.length > 0 && "options" in arr[0];
3861
3798
  const toOptions = (arr) => isOptionGroupArray(arr) ? arr.map((og) => /* @__PURE__ */ jsx(OptGroup, {
3862
3799
  label: og.label,
3863
3800
  children: og.options.map((opt) => /* @__PURE__ */ jsx(Option, {
@@ -3868,42 +3805,25 @@ const toOptions = (arr) => isOptionGroupArray(arr) ? arr.map((og) => /* @__PURE_
3868
3805
  value: opt.name,
3869
3806
  children: opt.label
3870
3807
  }, opt.name)) : null;
3871
- const AntDValueSelector = (_g) => {
3872
- var _h = _g, {
3873
- className,
3874
- handleOnChange,
3875
- options,
3876
- value,
3877
- title,
3878
- disabled,
3879
- multiple,
3880
- testID: _testID,
3881
- rules: _rules,
3882
- level: _level,
3883
- path: _path,
3884
- context: _context,
3885
- validation: _validation,
3886
- operator: _operator,
3887
- field: _field,
3888
- fieldData: _fieldData
3889
- } = _h, extraProps = __objRest(_h, [
3890
- "className",
3891
- "handleOnChange",
3892
- "options",
3893
- "value",
3894
- "title",
3895
- "disabled",
3896
- "multiple",
3897
- "testID",
3898
- "rules",
3899
- "level",
3900
- "path",
3901
- "context",
3902
- "validation",
3903
- "operator",
3904
- "field",
3905
- "fieldData"
3906
- ]);
3808
+ const AntDValueSelector = ({
3809
+ className,
3810
+ handleOnChange,
3811
+ options,
3812
+ value,
3813
+ title,
3814
+ disabled,
3815
+ multiple,
3816
+ testID: _testID,
3817
+ rules: _rules,
3818
+ level: _level,
3819
+ path: _path,
3820
+ context: _context,
3821
+ validation: _validation,
3822
+ operator: _operator,
3823
+ field: _field,
3824
+ fieldData: _fieldData,
3825
+ ...extraProps
3826
+ }) => {
3907
3827
  const onChange = useMemo(() => {
3908
3828
  if (multiple) {
3909
3829
  return (v) => handleOnChange(Array.isArray(v) ? v.join(",") : v);
@@ -3917,43 +3837,32 @@ const AntDValueSelector = (_g) => {
3917
3837
  return /* @__PURE__ */ jsx("span", {
3918
3838
  title,
3919
3839
  className,
3920
- children: /* @__PURE__ */ jsx(Select, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, modeObj), {
3840
+ children: /* @__PURE__ */ jsx(Select, {
3841
+ ...modeObj,
3921
3842
  dropdownMatchSelectWidth: false,
3922
3843
  disabled,
3923
3844
  value: val,
3924
- onChange
3925
- }), extraProps), {
3845
+ onChange,
3846
+ ...extraProps,
3926
3847
  children: toOptions(options)
3927
- }))
3848
+ })
3928
3849
  });
3929
3850
  };
3930
3851
  AntDValueSelector.displayName = "AntDValueSelector";
3931
- const AntDValueEditor = (_i) => {
3932
- var _j = _i, {
3933
- fieldData,
3934
- operator,
3935
- value,
3936
- handleOnChange,
3937
- title,
3938
- className,
3939
- type,
3940
- inputType,
3941
- values,
3942
- valueSource: _vs,
3943
- disabled
3944
- } = _j, props = __objRest(_j, [
3945
- "fieldData",
3946
- "operator",
3947
- "value",
3948
- "handleOnChange",
3949
- "title",
3950
- "className",
3951
- "type",
3952
- "inputType",
3953
- "values",
3954
- "valueSource",
3955
- "disabled"
3956
- ]);
3852
+ const AntDValueEditor = ({
3853
+ fieldData,
3854
+ operator,
3855
+ value,
3856
+ handleOnChange,
3857
+ title,
3858
+ className,
3859
+ type,
3860
+ inputType,
3861
+ values,
3862
+ valueSource: _vs,
3863
+ disabled,
3864
+ ...props
3865
+ }) => {
3957
3866
  var _a;
3958
3867
  useEffect(() => {
3959
3868
  if (inputType === "number" && !["between", "notBetween", "in", "notIn"].includes(operator) && typeof value === "string" && value.includes(",")) {
@@ -3968,7 +3877,8 @@ const AntDValueEditor = (_i) => {
3968
3877
  switch (type) {
3969
3878
  case "select":
3970
3879
  case "multiselect":
3971
- return /* @__PURE__ */ jsx(AntDValueSelector, __spreadProps(__spreadValues({}, props), {
3880
+ return /* @__PURE__ */ jsx(AntDValueSelector, {
3881
+ ...props,
3972
3882
  className,
3973
3883
  handleOnChange,
3974
3884
  options: values,
@@ -3976,7 +3886,7 @@ const AntDValueEditor = (_i) => {
3976
3886
  title,
3977
3887
  disabled,
3978
3888
  multiple: type === "multiselect"
3979
- }));
3889
+ });
3980
3890
  case "textarea":
3981
3891
  return /* @__PURE__ */ jsx(Input.TextArea, {
3982
3892
  value,