@box/metadata-filter 1.62.4 → 1.63.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/chunks/types.js +6 -3
- package/dist/esm/index.js +13 -12
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.js +128 -128
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/handlers.js +10 -9
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field-advanced.js +32 -32
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.js +53 -51
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js +54 -52
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field-advanced.js +114 -0
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/utils.js +15 -0
- package/dist/esm/lib/components/metadata-filter-fields/field-processing-utils.js +23 -13
- package/dist/esm/lib/components/metadata-filter-fields/filter-field-types.js +18 -17
- package/dist/esm/lib/components/metadata-filter-fields/is-modified-utils.js +58 -47
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.js +27 -25
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields.js +31 -29
- package/dist/esm/lib/defaults.js +10 -8
- package/dist/esm/lib/metadata-filter.js +28 -26
- package/dist/styles/metadata-taxonomy-field-advanced.css +1 -0
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-float-field/handlers.d.ts +2 -2
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field-advanced.d.ts +3 -0
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/types.d.ts +6 -0
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/utils.d.ts +12 -0
- package/dist/types/lib/components/metadata-filter-fields/field-processing-utils.d.ts +6 -4
- package/dist/types/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/metadata-filter-fields.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/types.d.ts +9 -8
- package/dist/types/lib/metadata-filter.d.ts +1 -1
- package/dist/types/lib/test-utils/sample-data.d.ts +5 -4
- package/dist/types/lib/types.d.ts +50 -8
- package/package.json +1 -1
package/dist/chunks/types.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
let
|
|
2
|
-
return
|
|
1
|
+
let _ = /* @__PURE__ */ (function(A) {
|
|
2
|
+
return A[A.TO = 0] = "TO", A[A.FROM = 1] = "FROM", A;
|
|
3
|
+
})({}), N = /* @__PURE__ */ (function(A) {
|
|
4
|
+
return A.MATCH_EXACTLY = "matchExactly", A.STARTS_WITH = "startsWith", A.CONTAINS = "contains", A.IS_NOT = "isNot", A.IS_BLANK = "isBlank", A.IS_NOT_BLANK = "isNotBlank", A.SELECT_FILTER_TYPE = "selectFilterType", A.TODAY = "today", A.NEXT = "next", A.PAST = "past", A.OLDER_THAN = "olderThan", A.CUSTOM_RANGE = "customRange", A.EQUALS = "equals", A.GREATER_THAN_OR_EQUAL = "greaterThanOrEqual", A.LESS_THAN_OR_EQUAL = "lessThanOrEqual", A.BETWEEN = "between", A.MATCH_ANY = "matchAny", A.MATCH_ALL = "matchAll", A.IS_NOT_ANY = "isNotAny", A.MATCH_AT_OR_WITHIN = "matchAtOrWithin", A.IS_NOT_AT_OR_WITHIN = "isNotAtOrWithin", A;
|
|
3
5
|
})({});
|
|
4
6
|
export {
|
|
5
|
-
|
|
7
|
+
N as F,
|
|
8
|
+
_ as R
|
|
6
9
|
};
|
package/dist/esm/index.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
export * from "@box/combobox-with-api";
|
|
2
2
|
import { getRelativeFromToValues as o } from "./lib/components/metadata-filter-fields/components/metadata-date-field/date-conversion-utils.js";
|
|
3
3
|
import { defaultInitialValues as l, defaultMetadataValueMap as d } from "./lib/defaults.js";
|
|
4
|
-
import { MetadataFilter as
|
|
5
|
-
import { R as
|
|
6
|
-
import { MetadataDateField as M, MetadataDateFieldNonRelative as
|
|
7
|
-
import { MetadataEnumField as
|
|
4
|
+
import { MetadataFilter as p } from "./lib/metadata-filter.js";
|
|
5
|
+
import { F as m, R as F } from "../chunks/types.js";
|
|
6
|
+
import { MetadataDateField as M, MetadataDateFieldNonRelative as u } from "./lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field.js";
|
|
7
|
+
import { MetadataEnumField as s } from "./lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.js";
|
|
8
8
|
import { MetadataFloatField as g } from "./lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field.js";
|
|
9
|
-
import { MetadataMultiSelectField as
|
|
10
|
-
import { MetadataStringField as
|
|
9
|
+
import { MetadataMultiSelectField as T } from "./lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.js";
|
|
10
|
+
import { MetadataStringField as v } from "./lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js";
|
|
11
11
|
export {
|
|
12
|
+
m as FilterKeyTypes,
|
|
12
13
|
M as MetadataDateField,
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
u as MetadataDateFieldNonRelative,
|
|
15
|
+
s as MetadataEnumField,
|
|
16
|
+
p as MetadataFilter,
|
|
16
17
|
g as MetadataFloatField,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
T as MetadataMultiSelectField,
|
|
19
|
+
v as MetadataStringField,
|
|
20
|
+
F as RangeLabelType,
|
|
20
21
|
l as defaultInitialValues,
|
|
21
22
|
d as defaultMetadataValueMap,
|
|
22
23
|
o as getRelativeFromToValues
|
|
@@ -1,187 +1,187 @@
|
|
|
1
|
-
import { DateI18nProvider as
|
|
2
|
-
import
|
|
3
|
-
import { useFormikContext as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import { R as
|
|
7
|
-
import { DEFAULT_MAX_DATE as
|
|
8
|
-
import { getRelativeFromToValues as
|
|
1
|
+
import { DateI18nProvider as me, DatePicker as H, TextInput as fe } from "@box/blueprint-web";
|
|
2
|
+
import ve from "clsx";
|
|
3
|
+
import { useFormikContext as Te, getIn as pe, Field as I } from "formik";
|
|
4
|
+
import { useState as N, useRef as X, useCallback as T, useEffect as he, useMemo as j } from "react";
|
|
5
|
+
import { useIntl as Fe } from "react-intl";
|
|
6
|
+
import { F as r, R as n } from "../../../../../../chunks/types.js";
|
|
7
|
+
import { DEFAULT_MAX_DATE as q } from "./constants.js";
|
|
8
|
+
import { getRelativeFromToValues as z, convertToFormikValueRanged as J } from "./date-conversion-utils.js";
|
|
9
9
|
import { s as p } from "../../../../../../chunks/metadata-date-field.module.js";
|
|
10
|
-
import { E as
|
|
11
|
-
import { useDateValidation as
|
|
12
|
-
import { useIntegerValidation as
|
|
10
|
+
import { E as S } from "../../../../../../chunks/types2.js";
|
|
11
|
+
import { useDateValidation as De } from "./use-date-validation.js";
|
|
12
|
+
import { useIntegerValidation as ge } from "./use-integer-validation.js";
|
|
13
13
|
import { processRelativeDaysInput as Me, getDynamicMaxMinValue as Q } from "./utils.js";
|
|
14
|
-
import
|
|
15
|
-
import { jsx as
|
|
16
|
-
import { A as
|
|
17
|
-
const
|
|
14
|
+
import c from "../../../../messages.js";
|
|
15
|
+
import { jsx as l, jsxs as W } from "react/jsx-runtime";
|
|
16
|
+
import { A as Oe } from "../../../../../../chunks/index.js";
|
|
17
|
+
const Ke = ({
|
|
18
18
|
disableForm: h,
|
|
19
|
-
fieldNamePrefix:
|
|
20
|
-
label:
|
|
21
|
-
locale:
|
|
19
|
+
fieldNamePrefix: u,
|
|
20
|
+
label: _,
|
|
21
|
+
locale: y,
|
|
22
22
|
portalElement: M,
|
|
23
|
-
filterOptionsMap:
|
|
24
|
-
onAdvancedFilterOptionChange:
|
|
25
|
-
fieldAdvancedFilterOptions:
|
|
26
|
-
hasAccordion:
|
|
27
|
-
isModified:
|
|
23
|
+
filterOptionsMap: Z,
|
|
24
|
+
onAdvancedFilterOptionChange: F,
|
|
25
|
+
fieldAdvancedFilterOptions: C,
|
|
26
|
+
hasAccordion: ee,
|
|
27
|
+
isModified: ae
|
|
28
28
|
}) => {
|
|
29
|
-
const
|
|
30
|
-
values:
|
|
29
|
+
const O = `${u}.value.advancedFilterOption`, m = `${u}.value.relativeDays`, o = `${u}.value.range.gt`, s = `${u}.value.range.lt`, {
|
|
30
|
+
values: b,
|
|
31
31
|
setFieldValue: t,
|
|
32
|
-
setFieldTouched:
|
|
33
|
-
} =
|
|
34
|
-
validateDates:
|
|
35
|
-
fromDatePickerValue:
|
|
36
|
-
toDatePickerValue:
|
|
37
|
-
fromErrorType:
|
|
38
|
-
toErrorType:
|
|
39
|
-
} =
|
|
40
|
-
validatePositiveInteger:
|
|
41
|
-
} =
|
|
42
|
-
clearDatePickerAriaLabel:
|
|
43
|
-
nextMonthAriaLabel:
|
|
44
|
-
openCalendarDropdownAriaLabel:
|
|
45
|
-
previousMonthAriaLabel:
|
|
46
|
-
},
|
|
47
|
-
if (
|
|
32
|
+
setFieldTouched: k
|
|
33
|
+
} = Te(), {
|
|
34
|
+
validateDates: P,
|
|
35
|
+
fromDatePickerValue: D,
|
|
36
|
+
toDatePickerValue: g,
|
|
37
|
+
fromErrorType: B,
|
|
38
|
+
toErrorType: U
|
|
39
|
+
} = De(b, o, s, y, !0), {
|
|
40
|
+
validatePositiveInteger: te
|
|
41
|
+
} = ge(), i = Fe(), [f, re] = N(C || r.SELECT_FILTER_TYPE), [x, E] = N(!1), v = pe(b, m), [Y, L] = N(n.FROM), A = X(D), R = X(g), K = {
|
|
42
|
+
clearDatePickerAriaLabel: i.formatMessage(c.clearSelectedDate),
|
|
43
|
+
nextMonthAriaLabel: i.formatMessage(c.switchToNextMonth),
|
|
44
|
+
openCalendarDropdownAriaLabel: i.formatMessage(c.openCalendar),
|
|
45
|
+
previousMonthAriaLabel: i.formatMessage(c.switchToNextMonth)
|
|
46
|
+
}, $ = T(() => {
|
|
47
|
+
if (f === r.TODAY) {
|
|
48
48
|
const {
|
|
49
49
|
from: e,
|
|
50
50
|
to: a
|
|
51
|
-
} =
|
|
52
|
-
t(
|
|
53
|
-
} else if (
|
|
54
|
-
const e = typeof
|
|
51
|
+
} = z("today", void 0);
|
|
52
|
+
t(o, e), t(s, a);
|
|
53
|
+
} else if (v !== void 0) {
|
|
54
|
+
const e = typeof v == "string" ? Number(v) : v;
|
|
55
55
|
if (!isNaN(e) && e > 0) {
|
|
56
|
-
const a =
|
|
57
|
-
if ([
|
|
56
|
+
const a = f;
|
|
57
|
+
if ([r.NEXT, r.PAST, r.OLDER_THAN].includes(a)) {
|
|
58
58
|
const {
|
|
59
|
-
from:
|
|
60
|
-
to:
|
|
61
|
-
} =
|
|
62
|
-
t(
|
|
59
|
+
from: d,
|
|
60
|
+
to: V
|
|
61
|
+
} = z(a, e);
|
|
62
|
+
t(o, d), t(s, V);
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
|
-
}, [
|
|
66
|
+
}, [f, v, o, s, t]);
|
|
67
67
|
he(() => {
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
const
|
|
68
|
+
x && ($(), E(!1));
|
|
69
|
+
}, [x, $]);
|
|
70
|
+
const oe = T((e) => {
|
|
71
71
|
const a = e;
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
t(
|
|
75
|
-
},
|
|
76
|
-
t(
|
|
72
|
+
re(a), t(O, a), F && F(u, a);
|
|
73
|
+
const d = () => {
|
|
74
|
+
t(m, void 0), t(o, void 0), t(s, void 0);
|
|
75
|
+
}, V = () => {
|
|
76
|
+
t(o, void 0), t(s, void 0);
|
|
77
77
|
};
|
|
78
|
-
[
|
|
79
|
-
}, [
|
|
78
|
+
[r.IS_BLANK, r.IS_NOT_BLANK, r.SELECT_FILTER_TYPE].includes(a) || !a || a === r.CUSTOM_RANGE ? d() : a === r.TODAY ? (t(m, void 0), E(!0)) : V();
|
|
79
|
+
}, [u, F, t, O, m, o, s]), se = T((e) => {
|
|
80
80
|
const {
|
|
81
81
|
valueToStore: a,
|
|
82
|
-
shouldTriggerUpdate:
|
|
82
|
+
shouldTriggerUpdate: d
|
|
83
83
|
} = Me(e);
|
|
84
|
-
t(
|
|
85
|
-
}, [t,
|
|
86
|
-
const a =
|
|
87
|
-
|
|
88
|
-
}, [t,
|
|
89
|
-
const a =
|
|
90
|
-
|
|
91
|
-
}, [t,
|
|
92
|
-
const a = e ===
|
|
93
|
-
|
|
94
|
-
}, [
|
|
95
|
-
className:
|
|
96
|
-
children: [/* @__PURE__ */
|
|
97
|
-
name:
|
|
98
|
-
validate: (e) =>
|
|
84
|
+
t(m, a), d && E(!0);
|
|
85
|
+
}, [t, m]), ne = T((e) => {
|
|
86
|
+
const a = J(e, n.FROM);
|
|
87
|
+
A.current = e, t(o, a), L(n.FROM);
|
|
88
|
+
}, [t, o]), le = T((e) => {
|
|
89
|
+
const a = J(e, n.TO);
|
|
90
|
+
R.current = e, t(s, a), L(n.TO);
|
|
91
|
+
}, [t, s]), w = T((e) => {
|
|
92
|
+
const a = e === n.FROM ? o : s;
|
|
93
|
+
k(a, !0), L(e);
|
|
94
|
+
}, [k, o, s]), ie = j(() => Q(g, q), [g]), ce = j(() => Q(D), [D]), G = (e, a, d) => !!(a === S.MAX && e === S.OVERLAPPING || e === S.OVERLAPPING && d), de = [r.IS_BLANK, r.IS_NOT_BLANK, r.SELECT_FILTER_TYPE, r.TODAY], ue = () => !f || de.includes(f) ? null : f === r.CUSTOM_RANGE ? /* @__PURE__ */ W("div", {
|
|
95
|
+
className: ve(p.rangeInputsContainer, p.verticalLayout),
|
|
96
|
+
children: [/* @__PURE__ */ l(I, {
|
|
97
|
+
name: o,
|
|
98
|
+
validate: (e) => P(A.current, R.current, n.FROM),
|
|
99
99
|
children: ({
|
|
100
100
|
field: e,
|
|
101
101
|
meta: a
|
|
102
|
-
}) => /* @__PURE__ */
|
|
102
|
+
}) => /* @__PURE__ */ l("div", {
|
|
103
103
|
className: p.datePicker,
|
|
104
|
-
children: /* @__PURE__ */
|
|
104
|
+
children: /* @__PURE__ */ l(H, {
|
|
105
105
|
...e,
|
|
106
|
-
|
|
107
|
-
calendarAriaLabel:
|
|
108
|
-
error: !G(
|
|
106
|
+
...K,
|
|
107
|
+
calendarAriaLabel: i.formatMessage(c.selectStartDate),
|
|
108
|
+
error: !G(B, U, Y !== n.FROM) && a.error,
|
|
109
109
|
isDisabled: h,
|
|
110
|
-
label:
|
|
111
|
-
maxValue:
|
|
112
|
-
onBlur: () =>
|
|
113
|
-
onChange:
|
|
110
|
+
label: i.formatMessage(c.afterDate),
|
|
111
|
+
maxValue: ie,
|
|
112
|
+
onBlur: () => w(n.FROM),
|
|
113
|
+
onChange: ne,
|
|
114
114
|
portalElement: M,
|
|
115
|
-
value:
|
|
115
|
+
value: D
|
|
116
116
|
})
|
|
117
117
|
})
|
|
118
|
-
}), /* @__PURE__ */
|
|
119
|
-
name:
|
|
120
|
-
validate: (e) =>
|
|
118
|
+
}), /* @__PURE__ */ l(I, {
|
|
119
|
+
name: s,
|
|
120
|
+
validate: (e) => P(A.current, R.current, n.TO),
|
|
121
121
|
children: ({
|
|
122
122
|
field: e,
|
|
123
123
|
meta: a
|
|
124
|
-
}) => /* @__PURE__ */
|
|
124
|
+
}) => /* @__PURE__ */ l("div", {
|
|
125
125
|
className: p.datePicker,
|
|
126
|
-
children: /* @__PURE__ */
|
|
126
|
+
children: /* @__PURE__ */ l(H, {
|
|
127
127
|
...e,
|
|
128
|
-
|
|
129
|
-
calendarAriaLabel:
|
|
130
|
-
error: !G(
|
|
128
|
+
...K,
|
|
129
|
+
calendarAriaLabel: i.formatMessage(c.selectEndDate),
|
|
130
|
+
error: !G(U, B, Y !== n.TO) && a.error,
|
|
131
131
|
isDisabled: h,
|
|
132
|
-
label:
|
|
133
|
-
maxValue:
|
|
134
|
-
minValue:
|
|
135
|
-
onBlur: () =>
|
|
136
|
-
onChange:
|
|
132
|
+
label: i.formatMessage(c.beforeDate),
|
|
133
|
+
maxValue: q,
|
|
134
|
+
minValue: ce,
|
|
135
|
+
onBlur: () => w(n.TO),
|
|
136
|
+
onChange: le,
|
|
137
137
|
portalElement: M,
|
|
138
|
-
value:
|
|
138
|
+
value: g
|
|
139
139
|
})
|
|
140
140
|
})
|
|
141
141
|
})]
|
|
142
|
-
}) : /* @__PURE__ */
|
|
143
|
-
name:
|
|
144
|
-
validate: (e) =>
|
|
142
|
+
}) : /* @__PURE__ */ l(I, {
|
|
143
|
+
name: m,
|
|
144
|
+
validate: (e) => te(e?.toString() || ""),
|
|
145
145
|
children: ({
|
|
146
146
|
field: e,
|
|
147
147
|
meta: a
|
|
148
|
-
}) => /* @__PURE__ */
|
|
148
|
+
}) => /* @__PURE__ */ l("div", {
|
|
149
149
|
className: p.daysInputContainer,
|
|
150
|
-
children: /* @__PURE__ */
|
|
150
|
+
children: /* @__PURE__ */ l(fe, {
|
|
151
151
|
...e,
|
|
152
152
|
disabled: h,
|
|
153
153
|
error: a.touched && a.error,
|
|
154
154
|
hideLabel: !0,
|
|
155
|
-
label:
|
|
156
|
-
onChange: (
|
|
157
|
-
placeholder:
|
|
158
|
-
value:
|
|
155
|
+
label: i.formatMessage(c.relativeDaysSelectLabel),
|
|
156
|
+
onChange: (d) => se(d.target.value),
|
|
157
|
+
placeholder: i.formatMessage(c.numberOfDays),
|
|
158
|
+
value: v?.toString() || ""
|
|
159
159
|
})
|
|
160
160
|
})
|
|
161
161
|
});
|
|
162
|
-
return /* @__PURE__ */
|
|
163
|
-
locale:
|
|
162
|
+
return /* @__PURE__ */ l(me, {
|
|
163
|
+
locale: y,
|
|
164
164
|
children: /* @__PURE__ */ W("div", {
|
|
165
165
|
className: p.advancedDateContainer,
|
|
166
|
-
"data-testid": `${
|
|
167
|
-
children: [/* @__PURE__ */
|
|
168
|
-
advancedFilterFieldName:
|
|
166
|
+
"data-testid": `${_}-advanced-field`,
|
|
167
|
+
children: [/* @__PURE__ */ l(Oe, {
|
|
168
|
+
advancedFilterFieldName: O,
|
|
169
169
|
disableForm: h,
|
|
170
|
-
fieldAdvancedFilterOptions:
|
|
171
|
-
fieldNamePrefix:
|
|
172
|
-
filterOptionsMap:
|
|
173
|
-
isModified:
|
|
174
|
-
label:
|
|
175
|
-
onAdvancedFilterOptionChange:
|
|
176
|
-
onValueChange:
|
|
170
|
+
fieldAdvancedFilterOptions: C,
|
|
171
|
+
fieldNamePrefix: u,
|
|
172
|
+
filterOptionsMap: Z,
|
|
173
|
+
isModified: ae,
|
|
174
|
+
label: _,
|
|
175
|
+
onAdvancedFilterOptionChange: F,
|
|
176
|
+
onValueChange: oe,
|
|
177
177
|
portalElement: M,
|
|
178
|
-
showLabel: !
|
|
179
|
-
value:
|
|
180
|
-
}),
|
|
178
|
+
showLabel: !ee,
|
|
179
|
+
value: f
|
|
180
|
+
}), ue()]
|
|
181
181
|
})
|
|
182
182
|
});
|
|
183
183
|
};
|
|
184
184
|
export {
|
|
185
|
-
|
|
186
|
-
|
|
185
|
+
Ke as MetadataDateFieldAdvanced,
|
|
186
|
+
Ke as default
|
|
187
187
|
};
|
package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/handlers.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { R as l } from "../../../../../../chunks/types.js";
|
|
2
2
|
import { createFieldValue as i } from "./utils.js";
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
const F = (e, a, s) => (t, n, o, c) => {
|
|
4
|
+
const r = t;
|
|
5
|
+
s?.(r), a?.(e, r);
|
|
6
|
+
const V = i(t === "isBlank" || t === "isNotBlank" ? "" : n, t === "isBlank" || t === "isNotBlank" ? "" : o, t, !0);
|
|
7
|
+
c.setFieldValue(e, V);
|
|
8
|
+
}, k = (e, a, s, t) => (n, o, c) => {
|
|
9
|
+
s(t);
|
|
10
|
+
const r = i(t === l.FROM ? n : o, t === l.TO ? n : o, a, !0);
|
|
11
|
+
c.setFieldValue(e, r);
|
|
11
12
|
};
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
+
F as createAdvancedFilterOptionHandler,
|
|
14
15
|
k as createInputChangeHandler
|
|
15
16
|
};
|
|
@@ -3,68 +3,68 @@ import { Field as k } from "formik";
|
|
|
3
3
|
import { useState as S, useCallback as F } from "react";
|
|
4
4
|
import { useIntl as G } from "react-intl";
|
|
5
5
|
import u from "../../../../messages.js";
|
|
6
|
-
import { R as d } from "../../../../../../chunks/types.js";
|
|
6
|
+
import { R as d, F as K } from "../../../../../../chunks/types.js";
|
|
7
7
|
import { fieldDefaultProps as b } from "../constants.js";
|
|
8
|
-
import { createAdvancedFilterOptionHandler as Q, createInputChangeHandler as
|
|
8
|
+
import { createAdvancedFilterOptionHandler as Q, createInputChangeHandler as y } from "./handlers.js";
|
|
9
9
|
import { s as c } from "../../../../../../chunks/metadata-float-field.module.js";
|
|
10
10
|
import { u as U } from "../../../../../../chunks/use-float-validation.js";
|
|
11
|
-
import {
|
|
12
|
-
import { jsx as n, jsxs as
|
|
13
|
-
import { A as
|
|
11
|
+
import { getInputValues as V, getInputDisplayState as q, FloatInputDisplayState as I } from "./utils.js";
|
|
12
|
+
import { jsx as n, jsxs as E, Fragment as z } from "react/jsx-runtime";
|
|
13
|
+
import { A as J } from "../../../../../../chunks/index.js";
|
|
14
14
|
const ie = ({
|
|
15
15
|
label: m,
|
|
16
16
|
fieldNamePrefix: C,
|
|
17
17
|
disableForm: p,
|
|
18
18
|
onAdvancedFilterOptionChange: h,
|
|
19
19
|
fieldAdvancedFilterOptions: O,
|
|
20
|
-
filterOptionsMap:
|
|
21
|
-
hasAccordion:
|
|
22
|
-
isModified:
|
|
20
|
+
filterOptionsMap: R,
|
|
21
|
+
hasAccordion: w,
|
|
22
|
+
isModified: x
|
|
23
23
|
}) => {
|
|
24
|
-
const
|
|
24
|
+
const l = G(), o = `${C}.value.enum[0]`, [A, T] = S(d.FROM), [s, L] = S(O || K.EQUALS), {
|
|
25
25
|
validateFloats: f
|
|
26
|
-
} = U(), D = F((
|
|
26
|
+
} = U(), D = F((r, t, a, e) => Q(o, h, L)(r, t, a, e), [o, h, L]), H = F((r, t, a) => y(o, s, T, d.FROM)(r, t, a), [o, s]), P = F((r, t, a) => y(o, s, T, d.TO)(r, t, a), [o, s]);
|
|
27
27
|
return /* @__PURE__ */ n("div", {
|
|
28
28
|
className: c.advancedFilterContainer,
|
|
29
29
|
"data-testid": `${m}-field`,
|
|
30
30
|
children: /* @__PURE__ */ n(k, {
|
|
31
31
|
name: o,
|
|
32
|
-
validate: (
|
|
33
|
-
const t =
|
|
34
|
-
return f(t.from, t.to,
|
|
32
|
+
validate: (r) => {
|
|
33
|
+
const t = V(r, !0);
|
|
34
|
+
return f(t.from, t.to, A, !0);
|
|
35
35
|
},
|
|
36
36
|
children: ({
|
|
37
|
-
field:
|
|
37
|
+
field: r,
|
|
38
38
|
meta: t,
|
|
39
|
-
form:
|
|
39
|
+
form: a
|
|
40
40
|
}) => {
|
|
41
|
-
const e =
|
|
42
|
-
return /* @__PURE__ */
|
|
43
|
-
children: [/* @__PURE__ */ n(
|
|
41
|
+
const e = V(r.value, !0), g = q(s), j = g !== I.NONE, M = g === I.SINGLE, v = g === I.BOTH, B = f(e.from, e.to, d.FROM, !0), $ = f(e.from, e.to, d.TO, !0);
|
|
42
|
+
return /* @__PURE__ */ E(z, {
|
|
43
|
+
children: [/* @__PURE__ */ n(J, {
|
|
44
44
|
disableForm: p,
|
|
45
45
|
fieldAdvancedFilterOptions: O,
|
|
46
46
|
fieldNamePrefix: C,
|
|
47
|
-
filterOptionsMap:
|
|
48
|
-
isModified:
|
|
47
|
+
filterOptionsMap: R,
|
|
48
|
+
isModified: x,
|
|
49
49
|
label: m,
|
|
50
50
|
onAdvancedFilterOptionChange: h,
|
|
51
|
-
onValueChange: (i) => D(i, e.from, e.to,
|
|
52
|
-
showLabel: !
|
|
53
|
-
value:
|
|
54
|
-
}), j && /* @__PURE__ */
|
|
51
|
+
onValueChange: (i) => D(i, e.from, e.to, a),
|
|
52
|
+
showLabel: !w,
|
|
53
|
+
value: s
|
|
54
|
+
}), j && /* @__PURE__ */ E("div", {
|
|
55
55
|
className: c.rangeInputsContainer,
|
|
56
|
-
children: [(
|
|
56
|
+
children: [(M || v) && /* @__PURE__ */ n("div", {
|
|
57
57
|
className: c.inputContainer,
|
|
58
58
|
children: /* @__PURE__ */ n(N, {
|
|
59
59
|
...b,
|
|
60
60
|
disabled: p,
|
|
61
|
-
error:
|
|
61
|
+
error: M ? t.error : B,
|
|
62
62
|
hideLabel: !0,
|
|
63
|
-
label:
|
|
63
|
+
label: l.formatMessage(u.fieldFromLabel, {
|
|
64
64
|
label: m
|
|
65
65
|
}),
|
|
66
|
-
onChange: (i) => H(i.currentTarget.value, e.to,
|
|
67
|
-
placeholder: v ?
|
|
66
|
+
onChange: (i) => H(i.currentTarget.value, e.to, a),
|
|
67
|
+
placeholder: v ? l.formatMessage(u.minValuePlaceholder) : l.formatMessage(u.enterNumberPlaceholder),
|
|
68
68
|
value: e.from
|
|
69
69
|
})
|
|
70
70
|
}), v && /* @__PURE__ */ n("div", {
|
|
@@ -74,11 +74,11 @@ const ie = ({
|
|
|
74
74
|
disabled: p,
|
|
75
75
|
error: $,
|
|
76
76
|
hideLabel: !0,
|
|
77
|
-
label:
|
|
77
|
+
label: l.formatMessage(u.fieldToLabel, {
|
|
78
78
|
label: m
|
|
79
79
|
}),
|
|
80
|
-
onChange: (i) => P(i.currentTarget.value, e.from,
|
|
81
|
-
placeholder:
|
|
80
|
+
onChange: (i) => P(i.currentTarget.value, e.from, a),
|
|
81
|
+
placeholder: l.formatMessage(u.maxValuePlaceholder),
|
|
82
82
|
value: e.to
|
|
83
83
|
})
|
|
84
84
|
})]
|