@box/metadata-filter 1.52.4 → 1.54.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/index.js +58 -59
- package/dist/chunks/metadata-float-field.module.js +4 -6
- package/dist/chunks/types.js +2 -2
- package/dist/chunks/types2.js +2 -2
- package/dist/chunks/use-float-validation.js +13 -13
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/date-conversion-utils.js +34 -35
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.js +52 -52
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-relative.js +92 -92
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/use-date-validation.js +22 -22
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/use-integer-validation.js +2 -2
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.js +19 -19
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/handlers.js +12 -12
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/utils.js +30 -33
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.js +54 -54
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +36 -39
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/utils.js +11 -11
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js +55 -55
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/utils.js +12 -12
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +52 -52
- package/dist/esm/lib/components/metadata-filter-fields/field-processing-utils.js +10 -10
- package/dist/esm/lib/components/metadata-filter-fields/is-modified-utils.js +9 -13
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.js +67 -67
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields.js +53 -53
- package/dist/i18n/en-x-pseudo.js +54 -54
- package/dist/i18n/en-x-pseudo.properties +54 -54
- package/dist/styles/metadata-date-field.css +1 -1
- package/dist/styles/metadata-float-field.css +1 -1
- package/package.json +7 -7
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { DateI18nProvider as xe, Text as Ae, Radio as i, Select as p, DatePicker as
|
|
1
|
+
import { DateI18nProvider as xe, Text as Ae, Radio as i, Select as p, DatePicker as ne } from "@box/blueprint-web";
|
|
2
2
|
import Le from "clsx";
|
|
3
3
|
import { useFormikContext as Ie, getIn as O, Field as oe } from "formik";
|
|
4
4
|
import { useState as x, useRef as A, useCallback as Ne, useEffect as ie, useMemo as ce } from "react";
|
|
5
5
|
import { useIntl as ke } from "react-intl";
|
|
6
6
|
import { R as c } from "../../../../../../chunks/types.js";
|
|
7
7
|
import { DEFAULT_MAX_DATE as ue } from "./constants.js";
|
|
8
|
-
import { getRelativeFromToValues as Ee,
|
|
8
|
+
import { getRelativeFromToValues as Ee, getCustomFromToValues as me, convertToFormikValueRanged as de } from "./date-conversion-utils.js";
|
|
9
9
|
import { s as f } from "../../../../../../chunks/metadata-date-field.module.js";
|
|
10
10
|
import { E as G } from "../../../../../../chunks/types2.js";
|
|
11
11
|
import { useDateValidation as Pe } from "./use-date-validation.js";
|
|
12
12
|
import { getDynamicMaxMinValue as fe } from "./utils.js";
|
|
13
|
-
import
|
|
14
|
-
import { jsx as
|
|
13
|
+
import l from "../../../../messages.js";
|
|
14
|
+
import { jsx as t, jsxs as L } from "react/jsx-runtime";
|
|
15
15
|
const ve = {
|
|
16
|
-
next:
|
|
17
|
-
past:
|
|
18
|
-
olderThan:
|
|
16
|
+
next: l.nextDaysAmt,
|
|
17
|
+
past: l.pastDaysAmt,
|
|
18
|
+
olderThan: l.olderThanDaysAmt
|
|
19
19
|
}, $e = [1, 3, 15, 45, 60, 120, 365], ge = (u) => u in ve || u === "today" || u === "customRange", Ye = ({
|
|
20
20
|
customDateFilterOptions: u,
|
|
21
21
|
disableForm: C,
|
|
@@ -28,193 +28,193 @@ const ve = {
|
|
|
28
28
|
const [X, I] = x(c.FROM), [_, N] = x(!1), m = `${h}.value.range.gt`, d = `${h}.value.range.lt`, H = `${h}.value.relativeType`, k = `${h}.value.relativeDays`, q = `${h}.value.customType`, E = `${h}.value.customDays`, {
|
|
29
29
|
values: F,
|
|
30
30
|
setFieldTouched: pe,
|
|
31
|
-
setFieldValue:
|
|
31
|
+
setFieldValue: n
|
|
32
32
|
} = Ie(), {
|
|
33
33
|
validateDates: z,
|
|
34
|
-
fromDatePickerValue:
|
|
35
|
-
toDatePickerValue:
|
|
34
|
+
fromDatePickerValue: y,
|
|
35
|
+
toDatePickerValue: T,
|
|
36
36
|
fromErrorType: J,
|
|
37
37
|
toErrorType: K
|
|
38
|
-
} = Pe(F, m, d, j, !0),
|
|
38
|
+
} = Pe(F, m, d, j, !0), s = ke(), g = O(F, H), v = O(F, q), Fe = y || T;
|
|
39
39
|
let P = "anyTime", $ = "anyTime";
|
|
40
40
|
ge(g) ? P = g : v ? $ = v : Fe && (P = "customRange", $ = "customRange");
|
|
41
|
-
const [D, Q] = x(P), W = A(g), Y = A(v), S = O(F, k), Z = O(F, E), [w, ee] = x($), V = A(
|
|
42
|
-
clearDatePickerAriaLabel:
|
|
43
|
-
nextMonthAriaLabel:
|
|
44
|
-
openCalendarDropdownAriaLabel:
|
|
45
|
-
previousMonthAriaLabel:
|
|
46
|
-
},
|
|
47
|
-
|
|
48
|
-
},
|
|
49
|
-
const a =
|
|
50
|
-
V.current = e,
|
|
41
|
+
const [D, Q] = x(P), W = A(g), Y = A(v), S = O(F, k), Z = O(F, E), [w, ee] = x($), V = A(y), M = A(T), ae = {
|
|
42
|
+
clearDatePickerAriaLabel: s.formatMessage(l.clearSelectedDate),
|
|
43
|
+
nextMonthAriaLabel: s.formatMessage(l.switchToNextMonth),
|
|
44
|
+
openCalendarDropdownAriaLabel: s.formatMessage(l.openCalendar),
|
|
45
|
+
previousMonthAriaLabel: s.formatMessage(l.switchToNextMonth)
|
|
46
|
+
}, ye = () => {
|
|
47
|
+
n(m, void 0), n(d, void 0), V.current = void 0, M.current = void 0;
|
|
48
|
+
}, Te = (e) => {
|
|
49
|
+
const a = de(e, c.FROM);
|
|
50
|
+
V.current = e, n(m, a), I(c.FROM);
|
|
51
51
|
}, De = (e) => {
|
|
52
|
-
const a =
|
|
53
|
-
M.current = e,
|
|
52
|
+
const a = de(e, c.TO);
|
|
53
|
+
M.current = e, n(d, a), I(c.TO);
|
|
54
54
|
}, te = (e) => {
|
|
55
55
|
const a = e === c.FROM ? m : d;
|
|
56
56
|
pe(a, !0), I(e);
|
|
57
57
|
}, Ve = (e) => {
|
|
58
58
|
let a;
|
|
59
|
-
ge(e) && (a = e), e === "customRange" && (V.current = void 0, M.current = void 0),
|
|
59
|
+
ge(e) && (a = e), e === "customRange" && (V.current = void 0, M.current = void 0), n(H, a), Q(e), n(k, void 0), N(!0);
|
|
60
60
|
}, Me = (e) => {
|
|
61
|
-
|
|
62
|
-
const a = u.find((
|
|
61
|
+
n(q, e), ee(e), n(E, void 0), ye();
|
|
62
|
+
const a = u.find((r) => r.name === e);
|
|
63
63
|
if (a && a.type === "text") {
|
|
64
64
|
const {
|
|
65
|
-
from:
|
|
65
|
+
from: r,
|
|
66
66
|
to: o
|
|
67
|
-
} =
|
|
68
|
-
|
|
67
|
+
} = me(a.from, a.to);
|
|
68
|
+
n(m, r), n(d, o);
|
|
69
69
|
}
|
|
70
70
|
}, le = Ne(() => {
|
|
71
71
|
const {
|
|
72
72
|
from: e,
|
|
73
73
|
to: a
|
|
74
74
|
} = Ee(D, S);
|
|
75
|
-
|
|
76
|
-
}, [m, S, D,
|
|
75
|
+
n(m, e), n(d, a);
|
|
76
|
+
}, [m, S, D, n, d]);
|
|
77
77
|
ie(() => {
|
|
78
78
|
_ && (le(), N(!1));
|
|
79
79
|
}, [_, le]), ie(() => {
|
|
80
80
|
const e = W.current !== g, a = Y.current !== v;
|
|
81
81
|
(e || a) && (Q(g ?? "anyTime"), ee(v), W.current = g, Y.current = v);
|
|
82
82
|
}, [g, v]);
|
|
83
|
-
const Re = ce(() => fe(
|
|
83
|
+
const Re = ce(() => fe(T, ue), [T]), Ce = ce(() => fe(y), [y]), re = (e, a, r) => !!(a === G.MAX && e === G.OVERLAPPING || e === G.OVERLAPPING && r), B = (e) => {
|
|
84
84
|
if (e !== D)
|
|
85
85
|
return null;
|
|
86
86
|
const a = (o) => {
|
|
87
87
|
const R = ve[e];
|
|
88
88
|
return {
|
|
89
89
|
value: String(o),
|
|
90
|
-
label:
|
|
90
|
+
label: s.formatMessage(R, {
|
|
91
91
|
count: o
|
|
92
92
|
})
|
|
93
93
|
};
|
|
94
|
-
},
|
|
95
|
-
return /* @__PURE__ */
|
|
94
|
+
}, r = $e.map(a);
|
|
95
|
+
return /* @__PURE__ */ t(p, {
|
|
96
96
|
className: f.dateSelect,
|
|
97
97
|
defaultValue: S === void 0 ? "" : String(S),
|
|
98
|
-
label:
|
|
98
|
+
label: s.formatMessage(l.relativeDaysSelectLabel),
|
|
99
99
|
onValueChange: (o) => {
|
|
100
|
-
|
|
100
|
+
n(k, Number(o)), N(!0);
|
|
101
101
|
},
|
|
102
|
-
placeholder:
|
|
103
|
-
children: /* @__PURE__ */
|
|
102
|
+
placeholder: s.formatMessage(l.selectValuePlaceholder),
|
|
103
|
+
children: /* @__PURE__ */ t(p.Content, {
|
|
104
104
|
container: b,
|
|
105
|
-
children:
|
|
105
|
+
children: r?.map((o) => /* @__PURE__ */ t(p.Option, {
|
|
106
106
|
text: o.label,
|
|
107
107
|
value: o.value,
|
|
108
108
|
children: o.label
|
|
109
109
|
}, o.value))
|
|
110
110
|
})
|
|
111
111
|
});
|
|
112
|
-
}, be = (e, a) => e !== w ? null : /* @__PURE__ */
|
|
112
|
+
}, be = (e, a) => e !== w ? null : /* @__PURE__ */ t(p, {
|
|
113
113
|
className: f.dateSelect,
|
|
114
114
|
defaultValue: Z === void 0 ? "" : String(Z),
|
|
115
|
-
label:
|
|
116
|
-
onValueChange: (
|
|
117
|
-
const o = a.find((R) => R.name ===
|
|
115
|
+
label: s.formatMessage(l.relativeDaysSelectLabel),
|
|
116
|
+
onValueChange: (r) => {
|
|
117
|
+
const o = a.find((R) => R.name === r);
|
|
118
118
|
if (o) {
|
|
119
119
|
const {
|
|
120
120
|
from: R,
|
|
121
121
|
to: Oe
|
|
122
|
-
} =
|
|
123
|
-
|
|
122
|
+
} = me(o.from, o.to);
|
|
123
|
+
n(m, R), n(d, Oe), n(E, o.name);
|
|
124
124
|
}
|
|
125
125
|
},
|
|
126
|
-
placeholder:
|
|
127
|
-
children: /* @__PURE__ */
|
|
126
|
+
placeholder: s.formatMessage(l.selectValuePlaceholder),
|
|
127
|
+
children: /* @__PURE__ */ t(p.Content, {
|
|
128
128
|
container: b,
|
|
129
|
-
children: a.map((
|
|
130
|
-
text:
|
|
131
|
-
value:
|
|
132
|
-
children:
|
|
133
|
-
},
|
|
129
|
+
children: a.map((r) => /* @__PURE__ */ t(p.Option, {
|
|
130
|
+
text: r.name,
|
|
131
|
+
value: r.name,
|
|
132
|
+
children: r.name
|
|
133
|
+
}, r.name))
|
|
134
134
|
})
|
|
135
135
|
}), Se = () => /* @__PURE__ */ L(i.Group, {
|
|
136
136
|
disabled: C,
|
|
137
137
|
loop: !1,
|
|
138
138
|
onValueChange: Me,
|
|
139
139
|
value: w,
|
|
140
|
-
children: [/* @__PURE__ */
|
|
141
|
-
label:
|
|
140
|
+
children: [/* @__PURE__ */ t(i.Item, {
|
|
141
|
+
label: s.formatMessage(l.relativeDateFilterAnyTime),
|
|
142
142
|
value: "anyTime"
|
|
143
143
|
}), u.map((e) => {
|
|
144
144
|
if (e.type === "text")
|
|
145
|
-
return /* @__PURE__ */
|
|
145
|
+
return /* @__PURE__ */ t(i.Item, {
|
|
146
146
|
label: e.name,
|
|
147
147
|
value: e.name
|
|
148
148
|
}, e.name);
|
|
149
149
|
const {
|
|
150
150
|
name: a,
|
|
151
|
-
options:
|
|
151
|
+
options: r
|
|
152
152
|
} = e;
|
|
153
|
-
return /* @__PURE__ */
|
|
154
|
-
description:
|
|
153
|
+
return /* @__PURE__ */ t(i.Item, {
|
|
154
|
+
description: r ? be(a, r) : void 0,
|
|
155
155
|
label: a,
|
|
156
156
|
value: a
|
|
157
157
|
}, a);
|
|
158
|
-
}), /* @__PURE__ */
|
|
159
|
-
description:
|
|
160
|
-
label:
|
|
158
|
+
}), /* @__PURE__ */ t(i.Item, {
|
|
159
|
+
description: se(),
|
|
160
|
+
label: s.formatMessage(l.relativeDateFilterCustomRange),
|
|
161
161
|
value: "customRange"
|
|
162
162
|
})]
|
|
163
|
-
}),
|
|
163
|
+
}), se = () => !u && D !== "customRange" || u && w !== "customRange" ? null : /* @__PURE__ */ L("div", {
|
|
164
164
|
className: Le(f.rangeInputsContainer, f.verticalLayout, f.dateSelect),
|
|
165
|
-
children: [/* @__PURE__ */
|
|
165
|
+
children: [/* @__PURE__ */ t(oe, {
|
|
166
166
|
name: m,
|
|
167
167
|
validate: (e) => z(V.current, M.current, c.FROM),
|
|
168
168
|
children: ({
|
|
169
169
|
field: e,
|
|
170
170
|
meta: a
|
|
171
|
-
}) => /* @__PURE__ */
|
|
171
|
+
}) => /* @__PURE__ */ t("div", {
|
|
172
172
|
className: f.inputContainer,
|
|
173
|
-
children: /* @__PURE__ */
|
|
173
|
+
children: /* @__PURE__ */ t(ne, {
|
|
174
174
|
...e,
|
|
175
175
|
...ae,
|
|
176
|
-
calendarAriaLabel:
|
|
176
|
+
calendarAriaLabel: s.formatMessage(l.selectStartDate),
|
|
177
177
|
error: re(J, K, X !== c.FROM) ? void 0 : a.error,
|
|
178
178
|
isDisabled: C,
|
|
179
|
-
label:
|
|
179
|
+
label: s.formatMessage(l.fieldStartDateLabel),
|
|
180
180
|
maxValue: Re,
|
|
181
181
|
onBlur: () => te(c.FROM),
|
|
182
|
-
onChange: (
|
|
182
|
+
onChange: (r) => Te(r),
|
|
183
183
|
portalElement: b,
|
|
184
|
-
value:
|
|
184
|
+
value: y
|
|
185
185
|
})
|
|
186
186
|
})
|
|
187
|
-
}), /* @__PURE__ */
|
|
187
|
+
}), /* @__PURE__ */ t(oe, {
|
|
188
188
|
name: d,
|
|
189
189
|
validate: (e) => z(V.current, M.current, c.TO),
|
|
190
190
|
children: ({
|
|
191
191
|
field: e,
|
|
192
192
|
meta: a
|
|
193
|
-
}) => /* @__PURE__ */
|
|
193
|
+
}) => /* @__PURE__ */ t("div", {
|
|
194
194
|
className: f.inputContainer,
|
|
195
|
-
children: /* @__PURE__ */
|
|
195
|
+
children: /* @__PURE__ */ t(ne, {
|
|
196
196
|
...e,
|
|
197
197
|
...ae,
|
|
198
|
-
calendarAriaLabel:
|
|
198
|
+
calendarAriaLabel: s.formatMessage(l.selectEndDate),
|
|
199
199
|
error: re(K, J, X !== c.TO) ? void 0 : a.error,
|
|
200
200
|
isDisabled: C,
|
|
201
|
-
label:
|
|
201
|
+
label: s.formatMessage(l.fieldEndDateLabel),
|
|
202
202
|
maxValue: ue,
|
|
203
203
|
minValue: Ce,
|
|
204
204
|
onBlur: () => te(c.TO),
|
|
205
|
-
onChange: (
|
|
205
|
+
onChange: (r) => De(r),
|
|
206
206
|
portalElement: b,
|
|
207
|
-
value:
|
|
207
|
+
value: T
|
|
208
208
|
})
|
|
209
209
|
})
|
|
210
210
|
})]
|
|
211
211
|
});
|
|
212
|
-
return /* @__PURE__ */
|
|
212
|
+
return /* @__PURE__ */ t(xe, {
|
|
213
213
|
locale: j,
|
|
214
214
|
children: /* @__PURE__ */ L("div", {
|
|
215
215
|
className: f.container,
|
|
216
216
|
"data-testid": `${U}-field`,
|
|
217
|
-
children: [!he && /* @__PURE__ */
|
|
217
|
+
children: [!he && /* @__PURE__ */ t(Ae, {
|
|
218
218
|
as: "span",
|
|
219
219
|
className: f.rangeFieldLabel,
|
|
220
220
|
color: "textOnLightSecondary",
|
|
@@ -225,27 +225,27 @@ const ve = {
|
|
|
225
225
|
loop: !1,
|
|
226
226
|
onValueChange: Ve,
|
|
227
227
|
value: D,
|
|
228
|
-
children: [/* @__PURE__ */
|
|
229
|
-
label:
|
|
228
|
+
children: [/* @__PURE__ */ t(i.Item, {
|
|
229
|
+
label: s.formatMessage(l.relativeDateFilterAnyTime),
|
|
230
230
|
value: "anyTime"
|
|
231
|
-
}), /* @__PURE__ */
|
|
232
|
-
label:
|
|
231
|
+
}), /* @__PURE__ */ t(i.Item, {
|
|
232
|
+
label: s.formatMessage(l.relativeDateFilterToday),
|
|
233
233
|
value: "today"
|
|
234
|
-
}), /* @__PURE__ */
|
|
234
|
+
}), /* @__PURE__ */ t(i.Item, {
|
|
235
235
|
description: B("next"),
|
|
236
|
-
label:
|
|
236
|
+
label: s.formatMessage(l.relativeDateFilterNext),
|
|
237
237
|
value: "next"
|
|
238
|
-
}), /* @__PURE__ */
|
|
238
|
+
}), /* @__PURE__ */ t(i.Item, {
|
|
239
239
|
description: B("past"),
|
|
240
|
-
label:
|
|
240
|
+
label: s.formatMessage(l.relativeDateFilterPast),
|
|
241
241
|
value: "past"
|
|
242
|
-
}), /* @__PURE__ */
|
|
242
|
+
}), /* @__PURE__ */ t(i.Item, {
|
|
243
243
|
description: B("olderThan"),
|
|
244
|
-
label:
|
|
244
|
+
label: s.formatMessage(l.relativeDateFilterOlderThan),
|
|
245
245
|
value: "olderThan"
|
|
246
|
-
}), /* @__PURE__ */
|
|
247
|
-
description:
|
|
248
|
-
label:
|
|
246
|
+
}), /* @__PURE__ */ t(i.Item, {
|
|
247
|
+
description: se(),
|
|
248
|
+
label: s.formatMessage(l.relativeDateFilterCustomRange),
|
|
249
249
|
value: "customRange"
|
|
250
250
|
})]
|
|
251
251
|
})]
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { getIn as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { useIntl as
|
|
4
|
-
import { R as
|
|
5
|
-
import { DEFAULT_MAX_DATE as
|
|
6
|
-
import { convertToDatePickerValue as
|
|
7
|
-
import { E as
|
|
8
|
-
import { useDateInternationalization as
|
|
9
|
-
import
|
|
10
|
-
const B = (
|
|
1
|
+
import { getIn as p } from "formik";
|
|
2
|
+
import { useMemo as E, useState as c } from "react";
|
|
3
|
+
import { useIntl as X } from "react-intl";
|
|
4
|
+
import { R as V } from "../../../../../../chunks/types.js";
|
|
5
|
+
import { DEFAULT_MAX_DATE as D } from "./constants.js";
|
|
6
|
+
import { convertToDatePickerValue as M } from "./date-conversion-utils.js";
|
|
7
|
+
import { E as d } from "../../../../../../chunks/types2.js";
|
|
8
|
+
import { useDateInternationalization as _ } from "./use-date-internationalization.js";
|
|
9
|
+
import m from "../../../../messages.js";
|
|
10
|
+
const B = (i, F, A, R, t) => {
|
|
11
11
|
const {
|
|
12
12
|
formatCalendarDate: a
|
|
13
|
-
} =
|
|
13
|
+
} = _(R), n = X(), l = p(i, F), f = p(i, A), I = E(() => M(l, t), [t, l]), T = E(() => M(f, t), [t, f]), [g, v] = c(null), [y, O] = c(null), s = (r, o) => r === V.FROM ? v(o) : O(o);
|
|
14
14
|
return {
|
|
15
15
|
validateDates: (r, o, e) => {
|
|
16
|
-
const
|
|
17
|
-
if ((
|
|
18
|
-
return
|
|
19
|
-
date: a(
|
|
16
|
+
const u = e === V.FROM;
|
|
17
|
+
if ((u ? r : o)?.compare(D) > 0)
|
|
18
|
+
return s(e, d.MAX), n.formatMessage(m.beforeDateValidationError, {
|
|
19
|
+
date: a(D)
|
|
20
20
|
});
|
|
21
21
|
if (r && o && r.compare(o) > 0)
|
|
22
|
-
return
|
|
22
|
+
return s(e, d.OVERLAPPING), u ? n.formatMessage(m.beforeDateValidationError, {
|
|
23
23
|
date: a(o)
|
|
24
|
-
}) :
|
|
24
|
+
}) : n.formatMessage(m.afterDateValidationError, {
|
|
25
25
|
date: a(r)
|
|
26
26
|
});
|
|
27
|
-
|
|
27
|
+
s(e, null);
|
|
28
28
|
},
|
|
29
|
-
fromDatePickerValue:
|
|
30
|
-
toDatePickerValue:
|
|
31
|
-
fromErrorType:
|
|
32
|
-
toErrorType:
|
|
29
|
+
fromDatePickerValue: I,
|
|
30
|
+
toDatePickerValue: T,
|
|
31
|
+
fromErrorType: g,
|
|
32
|
+
toErrorType: y
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
35
|
export {
|
|
@@ -2,7 +2,7 @@ import { useState as n } from "react";
|
|
|
2
2
|
import { useIntl as m } from "react-intl";
|
|
3
3
|
import s from "../../../../messages.js";
|
|
4
4
|
import { E as i } from "../../../../../../chunks/types2.js";
|
|
5
|
-
const a = (r) => r
|
|
5
|
+
const a = (r) => r?.length ? /^[-+]?\d+$/.test(r.trim()) : !0, d = () => {
|
|
6
6
|
const r = m(), [o, t] = n(null);
|
|
7
7
|
return {
|
|
8
8
|
validatePositiveInteger: (e) => {
|
|
@@ -17,5 +17,5 @@ const a = (r) => r != null && r.length ? /^[-+]?\d+$/.test(r.trim()) : !0, c = (
|
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
19
|
a as isIntegerOrBlank,
|
|
20
|
-
|
|
20
|
+
d as useIntegerValidation
|
|
21
21
|
};
|
|
@@ -4,45 +4,45 @@ import { useIntl as V, FormattedMessage as x } from "react-intl";
|
|
|
4
4
|
import i from "../../../../messages.js";
|
|
5
5
|
import { jsx as t, jsxs as C } from "react/jsx-runtime";
|
|
6
6
|
const O = ({
|
|
7
|
-
disableForm:
|
|
7
|
+
disableForm: u,
|
|
8
8
|
fieldNamePrefix: s,
|
|
9
|
-
label:
|
|
10
|
-
portalElement:
|
|
11
|
-
hasAccordion:
|
|
12
|
-
placeholder:
|
|
9
|
+
label: r,
|
|
10
|
+
portalElement: m,
|
|
11
|
+
hasAccordion: h,
|
|
12
|
+
placeholder: p
|
|
13
13
|
}) => {
|
|
14
14
|
const {
|
|
15
|
-
setFieldValue:
|
|
16
|
-
values:
|
|
17
|
-
} = E(),
|
|
15
|
+
setFieldValue: d,
|
|
16
|
+
values: v
|
|
17
|
+
} = E(), g = V(), n = `${s}.value.enum[0]`, f = F(v, `${s}.options`, []).map(({
|
|
18
18
|
key: a
|
|
19
|
-
}) => a),
|
|
19
|
+
}) => a), c = p || g.formatMessage(i.selectValuePlaceholder);
|
|
20
20
|
return /* @__PURE__ */ t("div", {
|
|
21
|
-
"data-testid": `${
|
|
21
|
+
"data-testid": `${r}-field`,
|
|
22
22
|
children: /* @__PURE__ */ t(M, {
|
|
23
|
-
name:
|
|
23
|
+
name: n,
|
|
24
24
|
children: ({
|
|
25
25
|
field: a
|
|
26
26
|
}) => /* @__PURE__ */ t(l, {
|
|
27
27
|
"data-target-id": `Select-${s}`,
|
|
28
|
-
disabled:
|
|
29
|
-
hideLabel:
|
|
30
|
-
label:
|
|
28
|
+
disabled: u,
|
|
29
|
+
hideLabel: h,
|
|
30
|
+
label: r,
|
|
31
31
|
onValueChange: (e) => {
|
|
32
|
-
e === o ?
|
|
32
|
+
e === o ? d(n, "") : d(n, e);
|
|
33
33
|
},
|
|
34
|
-
placeholder:
|
|
34
|
+
placeholder: c,
|
|
35
35
|
...a,
|
|
36
36
|
value: a.value === o ? "" : a.value,
|
|
37
37
|
children: /* @__PURE__ */ C(l.Content, {
|
|
38
|
-
container:
|
|
38
|
+
container: m,
|
|
39
39
|
children: [/* @__PURE__ */ t(l.Option, {
|
|
40
|
-
text:
|
|
40
|
+
text: c,
|
|
41
41
|
value: o,
|
|
42
42
|
children: /* @__PURE__ */ t(x, {
|
|
43
43
|
...i.selectValuePlaceholder
|
|
44
44
|
})
|
|
45
|
-
}),
|
|
45
|
+
}), f?.map((e) => /* @__PURE__ */ t(l.Option, {
|
|
46
46
|
text: e,
|
|
47
47
|
value: e,
|
|
48
48
|
children: e
|
package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/handlers.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { R as
|
|
2
|
-
import { createFieldValue as
|
|
3
|
-
const
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
},
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
1
|
+
import { R as l } from "../../../../../../chunks/types.js";
|
|
2
|
+
import { createFieldValue as i } from "./utils.js";
|
|
3
|
+
const d = (n, o, a) => (t, e, r, s) => {
|
|
4
|
+
a?.(t), o?.(n, t);
|
|
5
|
+
const V = i(t === "isBlank" || t === "isNotBlank" ? "" : e, t === "isBlank" || t === "isNotBlank" ? "" : r, t, !0);
|
|
6
|
+
s.setFieldValue(n, V);
|
|
7
|
+
}, k = (n, o, a, t) => (e, r, s) => {
|
|
8
|
+
a(t);
|
|
9
|
+
const c = i(t === l.FROM ? e : r, t === l.TO ? e : r, o, !0);
|
|
10
|
+
s.setFieldValue(n, c);
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
d as createAdvancedFilterOptionHandler,
|
|
14
|
+
k as createInputChangeHandler
|
|
15
15
|
};
|
package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/utils.js
CHANGED
|
@@ -1,63 +1,60 @@
|
|
|
1
|
-
let
|
|
1
|
+
let t = /* @__PURE__ */ (function(r) {
|
|
2
2
|
return r.EQUALS = "equals", r.GREATER_THAN = "greaterThanOrEqual", r.LESS_THAN = "lessThanOrEqual", r.BETWEEN = "between", r.IS_BLANK = "isBlank", r.IS_NOT_BLANK = "isNotBlank", r;
|
|
3
|
-
}({});
|
|
4
|
-
const
|
|
5
|
-
let
|
|
3
|
+
})({});
|
|
4
|
+
const L = (r, e) => r && e?.some(([N]) => N === r) ? r : t.EQUALS;
|
|
5
|
+
let E = /* @__PURE__ */ (function(r) {
|
|
6
6
|
return r.BOTH = "both", r.SINGLE = "single", r.NONE = "none", r;
|
|
7
|
-
}({});
|
|
8
|
-
const
|
|
7
|
+
})({});
|
|
8
|
+
const _ = (r) => r === t.IS_BLANK || r === t.IS_NOT_BLANK ? E.NONE : r === t.BETWEEN ? E.BOTH : [t.EQUALS, t.GREATER_THAN, t.LESS_THAN].includes(r) ? E.SINGLE : E.NONE, g = (r) => r.lt && !r.gt ? {
|
|
9
9
|
from: r.lt,
|
|
10
10
|
to: ""
|
|
11
11
|
} : {
|
|
12
12
|
from: r.gt || "",
|
|
13
13
|
to: r.lt || ""
|
|
14
|
-
},
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
};
|
|
23
|
-
}, T = (r) => typeof r == "object" && r !== null, _ = (r) => T(r) && "advancedFilterOption" in r && "value" in r && typeof r.advancedFilterOption == "string", B = (r, t) => {
|
|
24
|
-
if (!T(r))
|
|
14
|
+
}, f = (r) => r.advancedFilterOption === t.LESS_THAN ? {
|
|
15
|
+
from: r.value?.range?.lt || "",
|
|
16
|
+
to: ""
|
|
17
|
+
} : {
|
|
18
|
+
from: r.value?.range?.gt || "",
|
|
19
|
+
to: r.value?.range?.lt || ""
|
|
20
|
+
}, S = (r) => typeof r == "object" && r !== null, T = (r) => S(r) && "advancedFilterOption" in r && "value" in r && typeof r.advancedFilterOption == "string", A = (r, e) => {
|
|
21
|
+
if (!S(r))
|
|
25
22
|
return {
|
|
26
23
|
from: "",
|
|
27
24
|
to: ""
|
|
28
25
|
};
|
|
29
26
|
const n = r;
|
|
30
|
-
return n.range && !
|
|
27
|
+
return n.range && !e ? g(n.range) : e && T(r) ? f(r) : n.range ? g(n.range) : {
|
|
31
28
|
from: "",
|
|
32
29
|
to: ""
|
|
33
30
|
};
|
|
34
|
-
},
|
|
35
|
-
if (
|
|
36
|
-
if (n ===
|
|
31
|
+
}, B = (r, e, n, N) => {
|
|
32
|
+
if (N) {
|
|
33
|
+
if (n === t.IS_BLANK || n === t.IS_NOT_BLANK)
|
|
37
34
|
return {
|
|
38
35
|
value: {
|
|
39
36
|
range: {}
|
|
40
37
|
},
|
|
41
38
|
advancedFilterOption: n
|
|
42
39
|
};
|
|
43
|
-
const
|
|
44
|
-
return r && (n ===
|
|
40
|
+
const s = {};
|
|
41
|
+
return r && (n === t.LESS_THAN ? s.lt = r : s.gt = r), e && n === t.BETWEEN && (s.lt = e), {
|
|
45
42
|
value: {
|
|
46
|
-
range:
|
|
43
|
+
range: s
|
|
47
44
|
},
|
|
48
45
|
advancedFilterOption: n
|
|
49
46
|
};
|
|
50
47
|
}
|
|
51
|
-
const
|
|
52
|
-
return r && (
|
|
53
|
-
range:
|
|
48
|
+
const u = {};
|
|
49
|
+
return r && (u.gt = r), e && (u.lt = e), {
|
|
50
|
+
range: u
|
|
54
51
|
};
|
|
55
52
|
};
|
|
56
53
|
export {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
t as FloatAdvancedFilterOption,
|
|
55
|
+
E as FloatInputDisplayState,
|
|
56
|
+
B as createFieldValue,
|
|
57
|
+
L as getInitialAdvancedFilterValue,
|
|
58
|
+
_ as getInputDisplayState,
|
|
59
|
+
A as getInputValues
|
|
63
60
|
};
|