@box/metadata-filter 1.81.3 → 1.81.4
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/advanced-filter-select.js +60 -0
- package/dist/chunks/metadata-date-field.module.js +10 -12
- package/dist/chunks/metadata-filter.js +47 -0
- package/dist/chunks/metadata-float-field-advanced.js +79 -97
- package/dist/chunks/metadata-taxonomy-field-advanced.js +92 -0
- package/dist/chunks/types.js +6 -9
- package/dist/chunks/types2.js +4 -6
- package/dist/chunks/use-float-validation.js +21 -28
- package/dist/esm/index.js +11 -23
- package/dist/esm/lib/components/metadata-filter-fields/components/constants.js +2 -6
- package/dist/esm/lib/components/metadata-filter-fields/components/index.js +6 -13
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/constants.js +2 -4
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/date-conversion-utils.js +48 -68
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.js +166 -186
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-relative.js +237 -257
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field.js +88 -128
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/use-date-internationalization.js +10 -12
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/use-date-validation.js +24 -36
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/use-integer-validation.js +14 -19
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/utils.js +8 -11
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.js +38 -57
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/handlers.js +12 -15
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field-advanced.js +2 -17
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field.js +67 -100
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/use-float-validation.js +2 -9
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/utils.js +44 -57
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.js +71 -91
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +35 -65
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/utils.js +12 -20
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js +63 -77
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/utils.js +7 -15
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field-advanced.js +2 -113
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +45 -68
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/utils.js +8 -15
- package/dist/esm/lib/components/metadata-filter-fields/components/shared/advanced-filter-select.js +2 -11
- package/dist/esm/lib/components/metadata-filter-fields/components/shared/index.js +2 -4
- package/dist/esm/lib/components/metadata-filter-fields/field-processing-utils.js +26 -28
- package/dist/esm/lib/components/metadata-filter-fields/filter-field-types.js +26 -55
- package/dist/esm/lib/components/metadata-filter-fields/is-modified-utils.js +84 -94
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.js +60 -87
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields.js +58 -84
- package/dist/esm/lib/components/metadata-template-selector/index.js +0 -1
- package/dist/esm/lib/components/metadata-template-selector/metadata-template-selector.js +32 -44
- package/dist/esm/lib/defaults.js +31 -40
- package/dist/esm/lib/mappers.js +17 -23
- package/dist/esm/lib/messages.js +218 -220
- package/dist/esm/lib/metadata-filter.js +3 -82
- package/dist/styles/advanced-filter-select.css +1 -0
- package/dist/styles/metadata-date-field.css +1 -1
- package/dist/styles/metadata-filter.css +1 -1
- package/dist/styles/metadata-float-field-advanced.css +1 -1
- package/package.json +7 -7
- package/dist/chunks/index.js +0 -82
- package/dist/styles/index.css +0 -1
|
@@ -1,130 +1,90 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { useState as W, useRef as y, useMemo as E } from "react";
|
|
4
|
-
import { useIntl as Y } from "react-intl";
|
|
1
|
+
import { n as e } from "../../../../../../chunks/types.js";
|
|
2
|
+
import { convertToFormikValueRanged as t } from "./date-conversion-utils.js";
|
|
5
3
|
import n from "../../../../messages.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
onBlur: () => k(a.FROM),
|
|
92
|
-
onChange: (s) => z(s),
|
|
93
|
-
portalElement: O,
|
|
94
|
-
value: u
|
|
95
|
-
})
|
|
96
|
-
})
|
|
97
|
-
}), /* @__PURE__ */ r(P, {
|
|
98
|
-
name: c,
|
|
99
|
-
validate: (e) => V(g.current, D.current, a.TO),
|
|
100
|
-
children: ({
|
|
101
|
-
field: e,
|
|
102
|
-
meta: t
|
|
103
|
-
}) => /* @__PURE__ */ r("div", {
|
|
104
|
-
className: l.inputContainer,
|
|
105
|
-
children: /* @__PURE__ */ r(N, {
|
|
106
|
-
...e,
|
|
107
|
-
...C,
|
|
108
|
-
calendarAriaLabel: o.formatMessage(n.selectToDate),
|
|
109
|
-
dataTargetId: `DatePicker-${d}_to`,
|
|
110
|
-
error: x(A, b, L !== a.TO) ? void 0 : t.error,
|
|
111
|
-
isDisabled: i,
|
|
112
|
-
label: X || o.formatMessage(n.fieldToLabel),
|
|
113
|
-
maxValue: I,
|
|
114
|
-
minValue: q,
|
|
115
|
-
onBlur: () => k(a.TO),
|
|
116
|
-
onChange: (s) => H(s),
|
|
117
|
-
portalElement: O,
|
|
118
|
-
value: f
|
|
119
|
-
})
|
|
120
|
-
})
|
|
121
|
-
})]
|
|
122
|
-
})
|
|
123
|
-
})]
|
|
124
|
-
});
|
|
125
|
-
};
|
|
126
|
-
export {
|
|
127
|
-
De as MetadataDateField,
|
|
128
|
-
te as MetadataDateFieldNonRelative,
|
|
129
|
-
De as default
|
|
4
|
+
import { DEFAULT_MAX_DATE as r } from "./constants.js";
|
|
5
|
+
import { t as i } from "../../../../../../chunks/metadata-date-field.module.js";
|
|
6
|
+
import { t as a } from "../../../../../../chunks/types2.js";
|
|
7
|
+
import { useDateValidation as o } from "./use-date-validation.js";
|
|
8
|
+
import { getDynamicMaxMinValue as s } from "./utils.js";
|
|
9
|
+
import { MetadataDateFieldAdvanced as c } from "./metadata-date-field-advanced.js";
|
|
10
|
+
import { MetadataDateFieldRelative as l } from "./metadata-date-field-relative.js";
|
|
11
|
+
import { DateI18nProvider as u, DatePicker as d, Text as f } from "@box/blueprint-web";
|
|
12
|
+
import { Field as p, useFormikContext as m } from "formik";
|
|
13
|
+
import { useMemo as h, useRef as g, useState as _ } from "react";
|
|
14
|
+
import { useIntl as v } from "react-intl";
|
|
15
|
+
import { jsx as y, jsxs as b } from "react/jsx-runtime";
|
|
16
|
+
var x = ({ canUseRelativeDates: e, isAdvancedFilterEnabled: t, ...n }) => y(t ? c : e ? l : S, { ...n }), S = ({ customFieldLabels: c = [], direction: l = "horizontal", disableForm: x, fieldNamePrefix: S, label: C, locale: w, portalElement: T, hasAccordion: E }) => {
|
|
17
|
+
let [D, O] = _(e.FROM), k = `${S}.value.range.gt`, A = `${S}.value.range.lt`, { values: j, setFieldTouched: M, setFieldValue: N } = m(), { validateDates: P, fromDatePickerValue: F, toDatePickerValue: I, fromErrorType: L, toErrorType: R } = o(j, k, A, w, !0), z = v(), B = g(F), V = g(I), H = {
|
|
18
|
+
clearDatePickerAriaLabel: z.formatMessage(n.clearSelectedDate),
|
|
19
|
+
nextMonthAriaLabel: z.formatMessage(n.switchToNextMonth),
|
|
20
|
+
openCalendarDropdownAriaLabel: z.formatMessage(n.openCalendar),
|
|
21
|
+
previousMonthAriaLabel: z.formatMessage(n.switchToNextMonth)
|
|
22
|
+
}, [U, W] = c, G = (n) => {
|
|
23
|
+
let r = t(n, e.FROM);
|
|
24
|
+
B.current = n, N(k, r), O(e.FROM);
|
|
25
|
+
}, K = (n) => {
|
|
26
|
+
let r = t(n, e.TO);
|
|
27
|
+
V.current = n, N(A, r), O(e.TO);
|
|
28
|
+
}, q = (t) => {
|
|
29
|
+
M(t === e.FROM ? k : A, !0), O(t);
|
|
30
|
+
}, J = h(() => s(I, r), [I]), Y = h(() => s(F), [F]), X = (e, t, n) => !!(t === a.MAX && e === a.OVERLAPPING || e === a.OVERLAPPING && n);
|
|
31
|
+
return /* @__PURE__ */ b("div", {
|
|
32
|
+
className: i.container,
|
|
33
|
+
"data-testid": `${C}-field`,
|
|
34
|
+
children: [!E && /* @__PURE__ */ y(f, {
|
|
35
|
+
as: "span",
|
|
36
|
+
className: i.rangeFieldLabel,
|
|
37
|
+
color: "textOnLightSecondary",
|
|
38
|
+
variant: "bodyDefaultBold",
|
|
39
|
+
children: C
|
|
40
|
+
}), /* @__PURE__ */ y(u, {
|
|
41
|
+
locale: w,
|
|
42
|
+
children: /* @__PURE__ */ b("div", {
|
|
43
|
+
className: `${i.rangeInputsContainer} ${l === "vertical" ? i.verticalLayout : ""}`,
|
|
44
|
+
children: [/* @__PURE__ */ y(p, {
|
|
45
|
+
name: k,
|
|
46
|
+
validate: (t) => P(B.current, V.current, e.FROM),
|
|
47
|
+
children: ({ field: t, meta: r }) => /* @__PURE__ */ y("div", {
|
|
48
|
+
className: i.inputContainer,
|
|
49
|
+
children: /* @__PURE__ */ y(d, {
|
|
50
|
+
...t,
|
|
51
|
+
...H,
|
|
52
|
+
calendarAriaLabel: z.formatMessage(n.selectFromDate),
|
|
53
|
+
dataTargetId: `DatePicker-${S}_from`,
|
|
54
|
+
error: X(L, R, D !== e.FROM) ? void 0 : r.error,
|
|
55
|
+
isDisabled: x,
|
|
56
|
+
label: U || z.formatMessage(n.fieldFromLabel),
|
|
57
|
+
maxValue: J,
|
|
58
|
+
onBlur: () => q(e.FROM),
|
|
59
|
+
onChange: (e) => G(e),
|
|
60
|
+
portalElement: T,
|
|
61
|
+
value: F
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
}), /* @__PURE__ */ y(p, {
|
|
65
|
+
name: A,
|
|
66
|
+
validate: (t) => P(B.current, V.current, e.TO),
|
|
67
|
+
children: ({ field: t, meta: a }) => /* @__PURE__ */ y("div", {
|
|
68
|
+
className: i.inputContainer,
|
|
69
|
+
children: /* @__PURE__ */ y(d, {
|
|
70
|
+
...t,
|
|
71
|
+
...H,
|
|
72
|
+
calendarAriaLabel: z.formatMessage(n.selectToDate),
|
|
73
|
+
dataTargetId: `DatePicker-${S}_to`,
|
|
74
|
+
error: X(R, L, D !== e.TO) ? void 0 : a.error,
|
|
75
|
+
isDisabled: x,
|
|
76
|
+
label: W || z.formatMessage(n.fieldToLabel),
|
|
77
|
+
maxValue: r,
|
|
78
|
+
minValue: Y,
|
|
79
|
+
onBlur: () => q(e.TO),
|
|
80
|
+
onChange: (e) => K(e),
|
|
81
|
+
portalElement: T,
|
|
82
|
+
value: I
|
|
83
|
+
})
|
|
84
|
+
})
|
|
85
|
+
})]
|
|
86
|
+
})
|
|
87
|
+
})]
|
|
88
|
+
});
|
|
130
89
|
};
|
|
90
|
+
export { x as MetadataDateField, x as default, S as MetadataDateFieldNonRelative };
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { DateFormatter as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
};
|
|
11
|
-
export {
|
|
12
|
-
D as useDateInternationalization
|
|
1
|
+
import { DateFormatter as e, getLocalTimeZone as t } from "@box/blueprint-web";
|
|
2
|
+
import { useMemo as n } from "react";
|
|
3
|
+
var r = (r) => {
|
|
4
|
+
let i = n(() => new e(r), [r]), a = t();
|
|
5
|
+
return {
|
|
6
|
+
locale: r,
|
|
7
|
+
localTimezone: a,
|
|
8
|
+
formatCalendarDate: (e) => i.format(e.toDate(a))
|
|
9
|
+
};
|
|
13
10
|
};
|
|
11
|
+
export { r as useDateInternationalization };
|
|
@@ -1,37 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}) : n.formatMessage(m.afterDateValidationError, {
|
|
25
|
-
date: a(r)
|
|
26
|
-
});
|
|
27
|
-
s(e, null);
|
|
28
|
-
},
|
|
29
|
-
fromDatePickerValue: I,
|
|
30
|
-
toDatePickerValue: T,
|
|
31
|
-
fromErrorType: g,
|
|
32
|
-
toErrorType: y
|
|
33
|
-
};
|
|
34
|
-
};
|
|
35
|
-
export {
|
|
36
|
-
B as useDateValidation
|
|
1
|
+
import { n as e } from "../../../../../../chunks/types.js";
|
|
2
|
+
import { convertToDatePickerValue as t } from "./date-conversion-utils.js";
|
|
3
|
+
import n from "../../../../messages.js";
|
|
4
|
+
import { DEFAULT_MAX_DATE as r } from "./constants.js";
|
|
5
|
+
import { t as i } from "../../../../../../chunks/types2.js";
|
|
6
|
+
import { useDateInternationalization as a } from "./use-date-internationalization.js";
|
|
7
|
+
import { getIn as o } from "formik";
|
|
8
|
+
import { useMemo as s, useState as c } from "react";
|
|
9
|
+
import { useIntl as l } from "react-intl";
|
|
10
|
+
var u = (u, d, f, p, m) => {
|
|
11
|
+
let { formatCalendarDate: h } = a(p), g = l(), _ = o(u, d), v = o(u, f), y = s(() => t(_, m), [m, _]), b = s(() => t(v, m), [m, v]), [x, S] = c(null), [C, w] = c(null), T = (t, n) => t === e.FROM ? S(n) : w(n);
|
|
12
|
+
return {
|
|
13
|
+
validateDates: (t, a, o) => {
|
|
14
|
+
let s = o === e.FROM;
|
|
15
|
+
if ((s ? t : a)?.compare(r) > 0) return T(o, i.MAX), g.formatMessage(n.beforeDateValidationError, { date: h(r) });
|
|
16
|
+
if (t && a && t.compare(a) > 0) return T(o, i.OVERLAPPING), s ? g.formatMessage(n.beforeDateValidationError, { date: h(a) }) : g.formatMessage(n.afterDateValidationError, { date: h(t) });
|
|
17
|
+
T(o, null);
|
|
18
|
+
},
|
|
19
|
+
fromDatePickerValue: y,
|
|
20
|
+
toDatePickerValue: b,
|
|
21
|
+
fromErrorType: x,
|
|
22
|
+
toErrorType: C
|
|
23
|
+
};
|
|
37
24
|
};
|
|
25
|
+
export { u as useDateValidation };
|
|
@@ -1,21 +1,16 @@
|
|
|
1
|
+
import e from "../../../../messages.js";
|
|
2
|
+
import { t } from "../../../../../../chunks/types2.js";
|
|
1
3
|
import { useState as n } from "react";
|
|
2
|
-
import { useIntl as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
t(null);
|
|
14
|
-
},
|
|
15
|
-
errorType: o
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
a as isIntegerOrBlank,
|
|
20
|
-
d as useIntegerValidation
|
|
4
|
+
import { useIntl as r } from "react-intl";
|
|
5
|
+
var i = (e) => e?.length ? /^[-+]?\d+$/.test(e.trim()) : !0, a = () => {
|
|
6
|
+
let a = r(), [o, s] = n(null);
|
|
7
|
+
return {
|
|
8
|
+
validatePositiveInteger: (n) => {
|
|
9
|
+
if (!i(n)) return s(t.INVALID), a.formatMessage(e.mustBeANumber);
|
|
10
|
+
if (n && parseInt(n, 10) <= 0) return s(t.INVALID), a.formatMessage(e.mustBePositiveNumber);
|
|
11
|
+
s(null);
|
|
12
|
+
},
|
|
13
|
+
errorType: o
|
|
14
|
+
};
|
|
21
15
|
};
|
|
16
|
+
export { i as isIntegerOrBlank, a as useIntegerValidation };
|
package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/utils.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import { DEFAULT_MAX_DATE as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
export {
|
|
10
|
-
s as getDynamicMaxMinValue,
|
|
11
|
-
n as processRelativeDaysInput
|
|
1
|
+
import { DEFAULT_MAX_DATE as e } from "./constants.js";
|
|
2
|
+
var t = (t, n) => t ? t.compare(e) > 0 ? e : t : n, n = (e) => {
|
|
3
|
+
let t = Number(e), n = !isNaN(t) && t > 0 && /^\d+$/.test(e.trim());
|
|
4
|
+
return {
|
|
5
|
+
valueToStore: n ? t : e,
|
|
6
|
+
shouldTriggerUpdate: n
|
|
7
|
+
};
|
|
12
8
|
};
|
|
9
|
+
export { t as getDynamicMaxMinValue, n as processRelativeDaysInput };
|
|
@@ -1,58 +1,39 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { jsx as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
container: m,
|
|
39
|
-
children: [/* @__PURE__ */ t(l.Option, {
|
|
40
|
-
text: c,
|
|
41
|
-
value: o,
|
|
42
|
-
children: /* @__PURE__ */ t(x, {
|
|
43
|
-
...i.selectValuePlaceholder
|
|
44
|
-
})
|
|
45
|
-
}), f?.map((e) => /* @__PURE__ */ t(l.Option, {
|
|
46
|
-
text: e,
|
|
47
|
-
value: e,
|
|
48
|
-
children: e
|
|
49
|
-
}, e))]
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
});
|
|
54
|
-
};
|
|
55
|
-
export {
|
|
56
|
-
O as MetadataEnumField,
|
|
57
|
-
O as default
|
|
1
|
+
import e from "../../../../messages.js";
|
|
2
|
+
import { SELECT_EMPTY_VALUE as t, Select as n } from "@box/blueprint-web";
|
|
3
|
+
import { Field as r, getIn as i, useFormikContext as a } from "formik";
|
|
4
|
+
import { FormattedMessage as o, useIntl as s } from "react-intl";
|
|
5
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
|
+
var u = ({ disableForm: u, fieldNamePrefix: d, label: f, portalElement: p, hasAccordion: m, placeholder: h }) => {
|
|
7
|
+
let { setFieldValue: g, values: _ } = a(), v = s(), y = `${d}.value.enum[0]`, b = i(_, `${d}.options`, []).map(({ key: e }) => e), x = h || v.formatMessage(e.selectValuePlaceholder);
|
|
8
|
+
return /* @__PURE__ */ c("div", {
|
|
9
|
+
"data-testid": `${f}-field`,
|
|
10
|
+
children: /* @__PURE__ */ c(r, {
|
|
11
|
+
name: y,
|
|
12
|
+
children: ({ field: r }) => /* @__PURE__ */ c(n, {
|
|
13
|
+
"data-target-id": `Select-${d}`,
|
|
14
|
+
disabled: u,
|
|
15
|
+
hideLabel: m,
|
|
16
|
+
label: f,
|
|
17
|
+
onValueChange: (e) => {
|
|
18
|
+
e === t ? g(y, "") : g(y, e);
|
|
19
|
+
},
|
|
20
|
+
placeholder: x,
|
|
21
|
+
...r,
|
|
22
|
+
value: r.value === t ? "" : r.value,
|
|
23
|
+
children: /* @__PURE__ */ l(n.Content, {
|
|
24
|
+
container: p,
|
|
25
|
+
children: [/* @__PURE__ */ c(n.Option, {
|
|
26
|
+
text: x,
|
|
27
|
+
value: t,
|
|
28
|
+
children: /* @__PURE__ */ c(o, { ...e.selectValuePlaceholder })
|
|
29
|
+
}), b?.map((e) => /* @__PURE__ */ c(n.Option, {
|
|
30
|
+
text: e,
|
|
31
|
+
value: e,
|
|
32
|
+
children: e
|
|
33
|
+
}, e))]
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
58
38
|
};
|
|
39
|
+
export { u as MetadataEnumField, u as default };
|
package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/handlers.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { createFieldValue as
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
export {
|
|
14
|
-
F as createAdvancedFilterOptionHandler,
|
|
15
|
-
k as createInputChangeHandler
|
|
1
|
+
import { n as e } from "../../../../../../chunks/types.js";
|
|
2
|
+
import { createFieldValue as t } from "./utils.js";
|
|
3
|
+
var n = (e, n, r) => (i, a, o, s) => {
|
|
4
|
+
let c = i;
|
|
5
|
+
r?.(c), n?.(e, c);
|
|
6
|
+
let l = t(i === "isBlank" || i === "isNotBlank" ? "" : a, i === "isBlank" || i === "isNotBlank" ? "" : o, i, !0);
|
|
7
|
+
s.setFieldValue(e, l);
|
|
8
|
+
}, r = (n, r, i, a) => (o, s, c) => {
|
|
9
|
+
i(a);
|
|
10
|
+
let l = t(a === e.FROM ? o : s, a === e.TO ? o : s, r, !0);
|
|
11
|
+
c.setFieldValue(n, l);
|
|
16
12
|
};
|
|
13
|
+
export { n as createAdvancedFilterOptionHandler, r as createInputChangeHandler };
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
import "react";
|
|
4
|
-
import "react-intl";
|
|
5
|
-
import "../../../../messages.js";
|
|
6
|
-
import "../../../../../../chunks/types.js";
|
|
7
|
-
import "../constants.js";
|
|
8
|
-
import "./handlers.js";
|
|
9
|
-
import { M as c, M as n } from "../../../../../../chunks/metadata-float-field-advanced.js";
|
|
10
|
-
import "../../../../../../chunks/use-float-validation.js";
|
|
11
|
-
import "./utils.js";
|
|
12
|
-
import "react/jsx-runtime";
|
|
13
|
-
import "../../../../../../chunks/index.js";
|
|
14
|
-
export {
|
|
15
|
-
c as MetadataFloatFieldAdvanced,
|
|
16
|
-
n as default
|
|
17
|
-
};
|
|
1
|
+
import { t as e } from "../../../../../../chunks/metadata-float-field-advanced.js";
|
|
2
|
+
export { e as MetadataFloatFieldAdvanced, e as default };
|