@box/metadata-filter 1.25.3 → 1.26.1
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/use-float-validation.js +21 -18
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.js +37 -36
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-relative.js +42 -41
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field.js +34 -33
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.js +21 -19
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field-advanced.js +30 -29
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field.js +20 -19
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.js +35 -34
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.js +25 -23
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.js +47 -46
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.js +40 -38
- package/dist/esm/lib/components/metadata-filter-fields/field-processing-utils.js +19 -0
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.js +82 -0
- package/dist/esm/lib/components/metadata-filter-fields/metadata-filter-fields.js +52 -43
- package/dist/esm/lib/messages.js +8 -0
- package/dist/esm/lib/metadata-filter.js +45 -42
- package/dist/i18n/bn-IN.js +2 -0
- package/dist/i18n/da-DK.js +2 -0
- package/dist/i18n/de-DE.js +2 -0
- package/dist/i18n/en-AU.js +2 -0
- package/dist/i18n/en-CA.js +2 -0
- package/dist/i18n/en-GB.js +2 -0
- package/dist/i18n/en-US.js +2 -0
- package/dist/i18n/en-US.properties +4 -0
- package/dist/i18n/en-x-pseudo.js +2 -0
- package/dist/i18n/es-419.js +2 -0
- package/dist/i18n/es-ES.js +2 -0
- package/dist/i18n/fi-FI.js +2 -0
- package/dist/i18n/fr-CA.js +2 -0
- package/dist/i18n/fr-FR.js +2 -0
- package/dist/i18n/hi-IN.js +2 -0
- package/dist/i18n/it-IT.js +2 -0
- package/dist/i18n/ja-JP.js +2 -0
- package/dist/i18n/json/src/lib/messages.json +1 -1
- package/dist/i18n/ko-KR.js +2 -0
- package/dist/i18n/nb-NO.js +2 -0
- package/dist/i18n/nl-NL.js +2 -0
- package/dist/i18n/pl-PL.js +2 -0
- package/dist/i18n/pt-BR.js +2 -0
- package/dist/i18n/ru-RU.js +2 -0
- package/dist/i18n/sv-SE.js +2 -0
- package/dist/i18n/tr-TR.js +2 -0
- package/dist/i18n/zh-CN.js +2 -0
- package/dist/i18n/zh-TW.js +2 -0
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-advanced.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field-relative.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-date-field/metadata-date-field.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-enum-field/metadata-enum-field.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field-advanced.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-float-field/metadata-float-field.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-string-field/metadata-string-field.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/metadata-taxonomy-field.d.ts +1 -1
- package/dist/types/lib/components/metadata-filter-fields/field-processing-utils.d.ts +26 -0
- package/dist/types/lib/components/metadata-filter-fields/metadata-filter-fields-accordion.d.ts +3 -0
- package/dist/types/lib/components/metadata-filter-fields/types.d.ts +2 -0
- package/dist/types/lib/messages.d.ts +10 -0
- package/dist/types/lib/metadata-filter.d.ts +1 -1
- package/dist/types/lib/types.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1,66 +1,67 @@
|
|
|
1
1
|
import { TextInput as N } from "@box/blueprint-web";
|
|
2
|
-
import { Field as
|
|
2
|
+
import { Field as $ } from "formik";
|
|
3
3
|
import { useState as S, useCallback as F } from "react";
|
|
4
|
-
import { useIntl as
|
|
4
|
+
import { useIntl as k } from "react-intl";
|
|
5
5
|
import u from "../../../../messages.js";
|
|
6
6
|
import { R as d } from "../../../../../../chunks/types.js";
|
|
7
7
|
import { fieldDefaultProps as b } from "../constants.js";
|
|
8
|
-
import { createAdvancedFilterOptionHandler as
|
|
8
|
+
import { createAdvancedFilterOptionHandler as G, createInputChangeHandler as V } from "./handlers.js";
|
|
9
9
|
import { s as c } from "../../../../../../chunks/metadata-float-field.module.js";
|
|
10
|
-
import { u as
|
|
11
|
-
import { FloatAdvancedFilterOption as
|
|
12
|
-
import { jsx as n, jsxs as A, Fragment as
|
|
13
|
-
import { A as
|
|
14
|
-
const
|
|
10
|
+
import { u as Q } from "../../../../../../chunks/use-float-validation.js";
|
|
11
|
+
import { FloatAdvancedFilterOption as U, getInputValues as y, getInputDisplayState as q, FloatInputDisplayState as I } from "./utils.js";
|
|
12
|
+
import { jsx as n, jsxs as A, Fragment as z } from "react/jsx-runtime";
|
|
13
|
+
import { A as J } from "../../../../../../chunks/index.js";
|
|
14
|
+
const se = ({
|
|
15
15
|
label: m,
|
|
16
16
|
fieldNamePrefix: C,
|
|
17
17
|
disableForm: p,
|
|
18
18
|
onAdvancedFilterOptionChange: h,
|
|
19
19
|
fieldAdvancedFilterOptions: O,
|
|
20
|
-
filterOptionsMap: E
|
|
20
|
+
filterOptionsMap: E,
|
|
21
|
+
hasAccordion: R
|
|
21
22
|
}) => {
|
|
22
|
-
const s =
|
|
23
|
+
const s = k(), o = `${C}.value.enum[0]`, [w, L] = S(d.FROM), [l, M] = S(O || U.EQUALS), {
|
|
23
24
|
validateFloats: f
|
|
24
|
-
} =
|
|
25
|
+
} = Q(), x = F((a, t, r, e) => G(o, h, M)(a, t, r, e), [o, h, M]), D = F((a, t, r) => V(o, l, L, d.FROM)(a, t, r), [o, l]), H = F((a, t, r) => V(o, l, L, d.TO)(a, t, r), [o, l]);
|
|
25
26
|
return /* @__PURE__ */ n("div", {
|
|
26
27
|
className: c.advancedFilterContainer,
|
|
27
28
|
"data-testid": `${m}-field`,
|
|
28
|
-
children: /* @__PURE__ */ n(
|
|
29
|
+
children: /* @__PURE__ */ n($, {
|
|
29
30
|
name: o,
|
|
30
|
-
validate: (
|
|
31
|
-
const t = y(
|
|
32
|
-
return f(t.from, t.to,
|
|
31
|
+
validate: (a) => {
|
|
32
|
+
const t = y(a, !0);
|
|
33
|
+
return f(t.from, t.to, w, !0);
|
|
33
34
|
},
|
|
34
35
|
children: ({
|
|
35
|
-
field:
|
|
36
|
+
field: a,
|
|
36
37
|
meta: t,
|
|
37
|
-
form:
|
|
38
|
+
form: r
|
|
38
39
|
}) => {
|
|
39
|
-
const e = y(
|
|
40
|
-
return /* @__PURE__ */ A(
|
|
41
|
-
children: [/* @__PURE__ */ n(
|
|
40
|
+
const e = y(a.value, !0), g = q(l), P = g !== I.NONE, T = g === I.SINGLE, v = g === I.BOTH, j = f(e.from, e.to, d.FROM, !0), B = f(e.from, e.to, d.TO, !0);
|
|
41
|
+
return /* @__PURE__ */ A(z, {
|
|
42
|
+
children: [/* @__PURE__ */ n(J, {
|
|
42
43
|
disableForm: p,
|
|
43
44
|
fieldAdvancedFilterOptions: O,
|
|
44
45
|
fieldNamePrefix: C,
|
|
45
46
|
filterOptionsMap: E,
|
|
46
47
|
label: m,
|
|
47
48
|
onAdvancedFilterOptionChange: h,
|
|
48
|
-
onValueChange: (i) =>
|
|
49
|
-
showLabel: !
|
|
49
|
+
onValueChange: (i) => x(i, e.from, e.to, r),
|
|
50
|
+
showLabel: !R,
|
|
50
51
|
value: l
|
|
51
|
-
}),
|
|
52
|
+
}), P && /* @__PURE__ */ A("div", {
|
|
52
53
|
className: c.rangeInputsContainer,
|
|
53
54
|
children: [(T || v) && /* @__PURE__ */ n("div", {
|
|
54
55
|
className: c.inputContainer,
|
|
55
56
|
children: /* @__PURE__ */ n(N, {
|
|
56
57
|
...b,
|
|
57
58
|
disabled: p,
|
|
58
|
-
error: T ? t.error :
|
|
59
|
+
error: T ? t.error : j,
|
|
59
60
|
hideLabel: !0,
|
|
60
61
|
label: s.formatMessage(u.fieldFromLabel, {
|
|
61
62
|
label: m
|
|
62
63
|
}),
|
|
63
|
-
onChange: (i) =>
|
|
64
|
+
onChange: (i) => D(i.currentTarget.value, e.to, r),
|
|
64
65
|
placeholder: v ? s.formatMessage(u.minValuePlaceholder) : s.formatMessage(u.enterNumberPlaceholder),
|
|
65
66
|
value: e.from
|
|
66
67
|
})
|
|
@@ -69,12 +70,12 @@ const le = ({
|
|
|
69
70
|
children: /* @__PURE__ */ n(N, {
|
|
70
71
|
...b,
|
|
71
72
|
disabled: p,
|
|
72
|
-
error:
|
|
73
|
+
error: B,
|
|
73
74
|
hideLabel: !0,
|
|
74
75
|
label: s.formatMessage(u.fieldToLabel, {
|
|
75
76
|
label: m
|
|
76
77
|
}),
|
|
77
|
-
onChange: (i) =>
|
|
78
|
+
onChange: (i) => H(i.currentTarget.value, e.from, r),
|
|
78
79
|
placeholder: s.formatMessage(u.maxValuePlaceholder),
|
|
79
80
|
value: e.to
|
|
80
81
|
})
|
|
@@ -86,6 +87,6 @@ const le = ({
|
|
|
86
87
|
});
|
|
87
88
|
};
|
|
88
89
|
export {
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
se as MetadataFloatFieldAdvanced,
|
|
91
|
+
se as default
|
|
91
92
|
};
|
|
@@ -1,37 +1,38 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
1
|
+
import { Text as P, TextInput as y } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as S, getIn as M, Field as E } from "formik";
|
|
3
|
+
import { useState as k, useRef as V } from "react";
|
|
4
|
+
import { useIntl as A } from "react-intl";
|
|
5
5
|
import x from "../../../../messages.js";
|
|
6
6
|
import { R as r } from "../../../../../../chunks/types.js";
|
|
7
7
|
import { fieldDefaultProps as L } from "../constants.js";
|
|
8
8
|
import { s as i } from "../../../../../../chunks/metadata-float-field.module.js";
|
|
9
|
-
import { u as
|
|
9
|
+
import { u as G, E as H } from "../../../../../../chunks/use-float-validation.js";
|
|
10
10
|
import { jsxs as N, jsx as t } from "react/jsx-runtime";
|
|
11
|
-
const
|
|
11
|
+
const Z = ({
|
|
12
12
|
label: n,
|
|
13
13
|
fieldNamePrefix: m,
|
|
14
|
-
disableForm: f
|
|
14
|
+
disableForm: f,
|
|
15
|
+
hasAccordion: I
|
|
15
16
|
}) => {
|
|
16
|
-
const p =
|
|
17
|
+
const p = A(), [h, d] = k(r.FROM), {
|
|
17
18
|
values: g,
|
|
18
19
|
setFieldValue: F,
|
|
19
|
-
setFieldTouched:
|
|
20
|
-
} =
|
|
20
|
+
setFieldTouched: $
|
|
21
|
+
} = S(), l = `${m}.value.range.gt`, s = `${m}.value.range.lt`, b = M(g, l), B = M(g, s), c = V(b), u = V(B), {
|
|
21
22
|
validateFloats: T,
|
|
22
23
|
fromErrorType: O,
|
|
23
24
|
toErrorType: v
|
|
24
|
-
} =
|
|
25
|
+
} = G(), j = (e) => {
|
|
25
26
|
c.current = e, F(l, e), d(r.FROM);
|
|
26
|
-
},
|
|
27
|
+
}, D = (e) => {
|
|
27
28
|
u.current = e, F(s, e), d(r.TO);
|
|
28
29
|
}, R = (e, o) => {
|
|
29
|
-
|
|
30
|
-
}, C = (e, o, a) => !!(e ===
|
|
30
|
+
$(e, !0), d(o);
|
|
31
|
+
}, C = (e, o, a) => !!(e === H.OVERLAPPING && a);
|
|
31
32
|
return /* @__PURE__ */ N("div", {
|
|
32
33
|
className: i.container,
|
|
33
34
|
"data-testid": `${n}-field`,
|
|
34
|
-
children: [/* @__PURE__ */ t(
|
|
35
|
+
children: [!I && /* @__PURE__ */ t(P, {
|
|
35
36
|
as: "span",
|
|
36
37
|
color: "textOnLightSecondary",
|
|
37
38
|
variant: "bodyDefaultBold",
|
|
@@ -55,7 +56,7 @@ const Y = ({
|
|
|
55
56
|
label: n
|
|
56
57
|
}),
|
|
57
58
|
onBlur: () => R(l, r.FROM),
|
|
58
|
-
onChange: (a) =>
|
|
59
|
+
onChange: (a) => j(a.currentTarget.value),
|
|
59
60
|
placeholder: "0"
|
|
60
61
|
})
|
|
61
62
|
})
|
|
@@ -76,7 +77,7 @@ const Y = ({
|
|
|
76
77
|
label: n
|
|
77
78
|
}),
|
|
78
79
|
onBlur: () => R(s, r.TO),
|
|
79
|
-
onChange: (a) =>
|
|
80
|
+
onChange: (a) => D(a.currentTarget.value),
|
|
80
81
|
placeholder: "0"
|
|
81
82
|
})
|
|
82
83
|
})
|
|
@@ -85,6 +86,6 @@ const Y = ({
|
|
|
85
86
|
});
|
|
86
87
|
};
|
|
87
88
|
export {
|
|
88
|
-
|
|
89
|
-
|
|
89
|
+
Z as MetadataFloatField,
|
|
90
|
+
Z as default
|
|
90
91
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { TooltipProvider as
|
|
2
|
-
import { useFormikContext as
|
|
1
|
+
import { TooltipProvider as D, Combobox as P } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as U, getIn as q, Field as v } from "formik";
|
|
3
3
|
import { useState as f, useCallback as p } from "react";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import { fieldDefaultProps as
|
|
7
|
-
import { getInitialAdvancedFilterValue as
|
|
8
|
-
import { jsx as a, jsxs as
|
|
9
|
-
import { A as
|
|
10
|
-
const x = (t) => t === "isBlank" || t === "isNotBlank",
|
|
4
|
+
import { useIntl as z } from "react-intl";
|
|
5
|
+
import G from "../../../../messages.js";
|
|
6
|
+
import { fieldDefaultProps as H } from "../constants.js";
|
|
7
|
+
import { getInitialAdvancedFilterValue as J, createFieldValue as k, getInputValue as K } from "./utils.js";
|
|
8
|
+
import { jsx as a, jsxs as N, Fragment as Q } from "react/jsx-runtime";
|
|
9
|
+
import { A as R } from "../../../../../../chunks/index.js";
|
|
10
|
+
const x = (t) => t === "isBlank" || t === "isNotBlank", se = ({
|
|
11
11
|
label: t,
|
|
12
12
|
fieldNamePrefix: m,
|
|
13
13
|
disableForm: h,
|
|
@@ -15,61 +15,62 @@ const x = (t) => t === "isBlank" || t === "isNotBlank", te = ({
|
|
|
15
15
|
onAdvancedFilterOptionChange: l,
|
|
16
16
|
fieldAdvancedFilterOptions: g,
|
|
17
17
|
filterOptionsMap: V,
|
|
18
|
-
portalElement: C
|
|
18
|
+
portalElement: C,
|
|
19
|
+
hasAccordion: I
|
|
19
20
|
}) => {
|
|
20
21
|
const {
|
|
21
|
-
setFieldValue:
|
|
22
|
-
values:
|
|
23
|
-
} =
|
|
24
|
-
|
|
22
|
+
setFieldValue: S,
|
|
23
|
+
values: w
|
|
24
|
+
} = U(), L = z(), n = `${m}.value.enum`, y = q(w, `${m}.options`, []).map((e) => e == null ? void 0 : e.key).filter((e) => typeof e == "string"), [c, B] = f(J(g, V)), [O, d] = f(!1), [$, b] = f(!1), j = (e, s) => typeof s != "string" ? !1 : s.toLowerCase().includes(e.toLowerCase()), F = p((e, s, o) => {
|
|
25
|
+
B(e), l == null || l(n, e);
|
|
25
26
|
const r = x(e) ? [] : s, i = k(r, e, u);
|
|
26
27
|
o.setFieldValue(n, i);
|
|
27
|
-
}, [n, u, l]),
|
|
28
|
+
}, [n, u, l]), M = p((e) => {
|
|
28
29
|
d(e), e && b(!1);
|
|
29
|
-
}, []),
|
|
30
|
+
}, []), T = p((e) => {
|
|
30
31
|
b(e), e && d(!1);
|
|
31
32
|
}, []);
|
|
32
33
|
return /* @__PURE__ */ a("div", {
|
|
33
34
|
"data-testid": `${t}-field`,
|
|
34
|
-
children: /* @__PURE__ */ a(
|
|
35
|
+
children: /* @__PURE__ */ a(v, {
|
|
35
36
|
name: n,
|
|
36
37
|
children: ({
|
|
37
38
|
field: e,
|
|
38
39
|
form: s
|
|
39
40
|
}) => {
|
|
40
|
-
const o =
|
|
41
|
-
return /* @__PURE__ */
|
|
42
|
-
children: [/* @__PURE__ */ a(
|
|
41
|
+
const o = K(e.value, u);
|
|
42
|
+
return /* @__PURE__ */ N(Q, {
|
|
43
|
+
children: [/* @__PURE__ */ a(R, {
|
|
43
44
|
disableForm: h,
|
|
44
45
|
fieldAdvancedFilterOptions: g,
|
|
45
46
|
fieldNamePrefix: m,
|
|
46
47
|
filterOptionsMap: V,
|
|
47
48
|
label: t,
|
|
48
49
|
onAdvancedFilterOptionChange: l,
|
|
49
|
-
onOpenChange:
|
|
50
|
-
onValueChange: (r) =>
|
|
51
|
-
open:
|
|
50
|
+
onOpenChange: T,
|
|
51
|
+
onValueChange: (r) => F(r, o, s),
|
|
52
|
+
open: $,
|
|
52
53
|
portalElement: C,
|
|
53
|
-
showLabel: !
|
|
54
|
+
showLabel: !I,
|
|
54
55
|
value: c
|
|
55
|
-
}), !x(c) && /* @__PURE__ */ a(
|
|
56
|
-
children: /* @__PURE__ */ a(
|
|
57
|
-
...
|
|
56
|
+
}), !x(c) && /* @__PURE__ */ a(D, {
|
|
57
|
+
children: /* @__PURE__ */ a(P, {
|
|
58
|
+
...H,
|
|
58
59
|
as: "input",
|
|
59
60
|
disabled: h,
|
|
60
|
-
filterFn:
|
|
61
|
+
filterFn: j,
|
|
61
62
|
hideLabel: !0,
|
|
62
63
|
label: t,
|
|
63
64
|
multiselect: !0,
|
|
64
65
|
name: e.name,
|
|
65
|
-
onOpenChange:
|
|
66
|
+
onOpenChange: M,
|
|
66
67
|
onValueChange: (r) => {
|
|
67
68
|
const i = k(r, c, u);
|
|
68
|
-
|
|
69
|
+
S(n, i);
|
|
69
70
|
},
|
|
70
|
-
open:
|
|
71
|
-
options:
|
|
72
|
-
placeholder: !o || o.length === 0 ?
|
|
71
|
+
open: O,
|
|
72
|
+
options: y,
|
|
73
|
+
placeholder: !o || o.length === 0 ? L.formatMessage(G.multiselectPlaceholder) : "",
|
|
73
74
|
portalElement: C,
|
|
74
75
|
value: o
|
|
75
76
|
})
|
|
@@ -80,5 +81,5 @@ const x = (t) => t === "isBlank" || t === "isNotBlank", te = ({
|
|
|
80
81
|
});
|
|
81
82
|
};
|
|
82
83
|
export {
|
|
83
|
-
|
|
84
|
+
se as MetadataMultiSelectFieldAdvanced
|
|
84
85
|
};
|
|
@@ -1,46 +1,48 @@
|
|
|
1
|
-
import { TooltipProvider as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { useIntl as
|
|
1
|
+
import { TooltipProvider as h, Combobox as v } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as F, getIn as g, Field as C } from "formik";
|
|
3
|
+
import { useIntl as b } from "react-intl";
|
|
4
4
|
import x from "../../../../messages.js";
|
|
5
|
-
import { fieldDefaultProps as
|
|
5
|
+
import { fieldDefaultProps as L } from "../constants.js";
|
|
6
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
7
|
-
const
|
|
8
|
-
disableForm:
|
|
7
|
+
const j = ({
|
|
8
|
+
disableForm: i,
|
|
9
9
|
fieldNamePrefix: l,
|
|
10
10
|
label: r,
|
|
11
|
-
portalElement:
|
|
11
|
+
portalElement: n,
|
|
12
|
+
hasAccordion: s
|
|
12
13
|
}) => {
|
|
13
14
|
const {
|
|
14
|
-
setFieldValue:
|
|
15
|
-
values:
|
|
16
|
-
} =
|
|
15
|
+
setFieldValue: m,
|
|
16
|
+
values: u
|
|
17
|
+
} = F(), d = b(), a = `${l}.value.enum`, c = g(u, `${l}.options`, []).map(({
|
|
17
18
|
key: e
|
|
18
|
-
}) => e),
|
|
19
|
+
}) => e), p = (e, t) => t.toLowerCase().includes(e.toLowerCase());
|
|
19
20
|
return /* @__PURE__ */ o("div", {
|
|
20
21
|
"data-testid": `${r}-field`,
|
|
21
|
-
children: /* @__PURE__ */ o(
|
|
22
|
+
children: /* @__PURE__ */ o(C, {
|
|
22
23
|
name: a,
|
|
23
24
|
children: ({
|
|
24
25
|
field: e
|
|
25
26
|
}) => {
|
|
26
27
|
var t;
|
|
27
|
-
return /* @__PURE__ */ o(
|
|
28
|
-
children: /* @__PURE__ */ o(
|
|
29
|
-
...
|
|
28
|
+
return /* @__PURE__ */ o(h, {
|
|
29
|
+
children: /* @__PURE__ */ o(v, {
|
|
30
|
+
...L,
|
|
30
31
|
as: "input",
|
|
31
|
-
disabled:
|
|
32
|
-
filterFn:
|
|
32
|
+
disabled: i,
|
|
33
|
+
filterFn: p,
|
|
34
|
+
hideLabel: s,
|
|
33
35
|
label: r,
|
|
34
36
|
multiselect: !0,
|
|
35
37
|
name: e.name,
|
|
36
|
-
onValueChange: (
|
|
37
|
-
options:
|
|
38
|
+
onValueChange: (f) => m(a, f),
|
|
39
|
+
options: c,
|
|
38
40
|
placeholder: (
|
|
39
41
|
// Empty array must be substituded if there is no value found
|
|
40
42
|
// Otherwise an no placeholder appears despite no selection
|
|
41
|
-
((t = e.value || []) == null ? void 0 : t.length) === 0 ?
|
|
43
|
+
((t = e.value || []) == null ? void 0 : t.length) === 0 ? d.formatMessage(x.multiselectPlaceholder) : ""
|
|
42
44
|
),
|
|
43
|
-
portalElement:
|
|
45
|
+
portalElement: n,
|
|
44
46
|
value: e.value
|
|
45
47
|
})
|
|
46
48
|
});
|
|
@@ -49,6 +51,6 @@ const V = ({
|
|
|
49
51
|
});
|
|
50
52
|
};
|
|
51
53
|
export {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
j as MetadataMultiSelectField,
|
|
55
|
+
j as default
|
|
54
56
|
};
|
|
@@ -1,71 +1,72 @@
|
|
|
1
|
-
import { TextInput as
|
|
2
|
-
import { Field as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import { fieldDefaultProps as
|
|
7
|
-
import { getInitialAdvancedFilterValue as
|
|
8
|
-
import { jsx as p, jsxs as
|
|
9
|
-
import { A as
|
|
10
|
-
const
|
|
11
|
-
label:
|
|
1
|
+
import { TextInput as T } from "@box/blueprint-web";
|
|
2
|
+
import { Field as j } from "formik";
|
|
3
|
+
import { useState as $, useCallback as n } from "react";
|
|
4
|
+
import { useIntl as k } from "react-intl";
|
|
5
|
+
import x from "../../../../messages.js";
|
|
6
|
+
import { fieldDefaultProps as y } from "../constants.js";
|
|
7
|
+
import { getInitialAdvancedFilterValue as D, createFieldValue as w, getInputValue as H, shouldHideTextInput as N } from "./utils.js";
|
|
8
|
+
import { jsx as p, jsxs as P, Fragment as q } from "react/jsx-runtime";
|
|
9
|
+
import { A as z } from "../../../../../../chunks/index.js";
|
|
10
|
+
const B = ({
|
|
11
|
+
label: s,
|
|
12
12
|
fieldNamePrefix: f,
|
|
13
|
-
disableForm:
|
|
13
|
+
disableForm: g,
|
|
14
14
|
isAdvancedFilterEnabled: t,
|
|
15
15
|
onAdvancedFilterOptionChange: o,
|
|
16
16
|
fieldAdvancedFilterOptions: h,
|
|
17
|
-
filterOptionsMap:
|
|
17
|
+
filterOptionsMap: I,
|
|
18
|
+
hasAccordion: c
|
|
18
19
|
}) => {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
}, [r, t, o]),
|
|
24
|
-
const
|
|
25
|
-
|
|
20
|
+
const i = k(), r = `${f}.value.enum[0]`, [l, S] = $(D(h, I)), L = n((e, m, u) => {
|
|
21
|
+
S(e), o == null || o(r, e);
|
|
22
|
+
const a = w(m, e, t);
|
|
23
|
+
u.setFieldValue(r, a);
|
|
24
|
+
}, [r, t, o]), M = n((e, m) => {
|
|
25
|
+
const u = e.target.value, a = w(u, l, t);
|
|
26
|
+
m.setFieldValue(r, a);
|
|
26
27
|
}, [l, t, r]);
|
|
27
28
|
return /* @__PURE__ */ p("div", {
|
|
28
|
-
"data-testid": `${
|
|
29
|
-
children: /* @__PURE__ */ p(
|
|
29
|
+
"data-testid": `${s}-field`,
|
|
30
|
+
children: /* @__PURE__ */ p(j, {
|
|
30
31
|
name: r,
|
|
31
32
|
children: ({
|
|
32
33
|
field: e,
|
|
33
|
-
meta:
|
|
34
|
-
form:
|
|
34
|
+
meta: m,
|
|
35
|
+
form: u
|
|
35
36
|
}) => {
|
|
36
|
-
const
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
children: [t && /* @__PURE__ */ p(
|
|
39
|
-
disableForm:
|
|
37
|
+
const a = H(e.value, t);
|
|
38
|
+
return /* @__PURE__ */ P(q, {
|
|
39
|
+
children: [t && /* @__PURE__ */ p(z, {
|
|
40
|
+
disableForm: g,
|
|
40
41
|
fieldAdvancedFilterOptions: h,
|
|
41
42
|
fieldNamePrefix: f,
|
|
42
|
-
filterOptionsMap:
|
|
43
|
-
label:
|
|
43
|
+
filterOptionsMap: I,
|
|
44
|
+
label: s,
|
|
44
45
|
onAdvancedFilterOptionChange: o,
|
|
45
|
-
onValueChange: (V) =>
|
|
46
|
-
showLabel: t,
|
|
46
|
+
onValueChange: (V) => L(V, a, u),
|
|
47
|
+
showLabel: t && !c,
|
|
47
48
|
value: l
|
|
48
|
-
}), !
|
|
49
|
-
...
|
|
49
|
+
}), !N(t, l) && /* @__PURE__ */ p(T, {
|
|
50
|
+
...y,
|
|
50
51
|
...e,
|
|
51
|
-
"aria-label":
|
|
52
|
-
label:
|
|
52
|
+
"aria-label": i.formatMessage(x.enterValueAriaLabel, {
|
|
53
|
+
label: s
|
|
53
54
|
}),
|
|
54
|
-
disabled:
|
|
55
|
-
error:
|
|
56
|
-
hideLabel: t,
|
|
57
|
-
label:
|
|
58
|
-
onChange: (V) =>
|
|
59
|
-
placeholder:
|
|
60
|
-
value:
|
|
55
|
+
disabled: g,
|
|
56
|
+
error: m.error,
|
|
57
|
+
hideLabel: t || c,
|
|
58
|
+
label: s,
|
|
59
|
+
onChange: (V) => M(V, u),
|
|
60
|
+
placeholder: i.formatMessage(x.setValuePlaceholder),
|
|
61
|
+
value: a
|
|
61
62
|
})]
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
})
|
|
65
66
|
});
|
|
66
67
|
};
|
|
67
|
-
|
|
68
|
+
B.displayName = "MetadataStringField";
|
|
68
69
|
export {
|
|
69
|
-
|
|
70
|
-
|
|
70
|
+
B as MetadataStringField,
|
|
71
|
+
B as default
|
|
71
72
|
};
|
|
@@ -1,60 +1,62 @@
|
|
|
1
|
-
import { ComboboxWithApiTreeView as T, ComboboxWithApiPagination as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { useCallback as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
1
|
+
import { ComboboxWithApiTreeView as T, ComboboxWithApiPagination as I } from "@box/combobox-with-api";
|
|
2
|
+
import { useFormikContext as P, getIn as W, Field as $ } from "formik";
|
|
3
|
+
import { useCallback as j } from "react";
|
|
4
|
+
import { useIntl as w } from "react-intl";
|
|
5
|
+
import A from "../../../../messages.js";
|
|
6
6
|
import { jsx as e } from "react/jsx-runtime";
|
|
7
|
-
const
|
|
7
|
+
const D = ({
|
|
8
8
|
className: m,
|
|
9
|
-
disableForm:
|
|
10
|
-
fieldNamePrefix:
|
|
11
|
-
label:
|
|
9
|
+
disableForm: l,
|
|
10
|
+
fieldNamePrefix: u,
|
|
11
|
+
label: a,
|
|
12
12
|
portalElement: d,
|
|
13
13
|
taxonomyOptionsFetcher: s,
|
|
14
|
-
isMultilevelTaxonomyFieldEnabled:
|
|
14
|
+
isMultilevelTaxonomyFieldEnabled: k,
|
|
15
|
+
hasAccordion: p
|
|
15
16
|
}) => {
|
|
16
17
|
const {
|
|
17
18
|
setFieldValue: c,
|
|
18
|
-
values:
|
|
19
|
-
} =
|
|
19
|
+
values: h
|
|
20
|
+
} = P(), {
|
|
20
21
|
metadata: {
|
|
21
|
-
templateKey:
|
|
22
|
-
scope:
|
|
22
|
+
templateKey: v,
|
|
23
|
+
scope: g
|
|
23
24
|
}
|
|
24
|
-
} =
|
|
25
|
-
key:
|
|
25
|
+
} = h, y = w(), i = `${u}.value`, F = W(h, u), {
|
|
26
|
+
key: f,
|
|
26
27
|
optionsRules: {
|
|
27
|
-
multiSelect:
|
|
28
|
+
multiSelect: n,
|
|
28
29
|
selectableLevels: t
|
|
29
30
|
},
|
|
30
|
-
levels:
|
|
31
|
-
} =
|
|
31
|
+
levels: b
|
|
32
|
+
} = F, M = k && (t == null ? void 0 : t.some((o) => o > 1)), x = j((o) => s(g, v, f, t == null ? void 0 : t[0], o), [f, g, t, s, v]), C = (o) => n || !(o != null && o.length) ? y.formatMessage(A.taxonomyPlaceholder) : void 0;
|
|
32
33
|
return /* @__PURE__ */ e("div", {
|
|
33
|
-
"data-testid": `${
|
|
34
|
-
children: /* @__PURE__ */ e(
|
|
35
|
-
name:
|
|
34
|
+
"data-testid": `${a}-field`,
|
|
35
|
+
children: /* @__PURE__ */ e($, {
|
|
36
|
+
name: i,
|
|
36
37
|
children: ({
|
|
37
38
|
field: o
|
|
38
39
|
}) => M ? /* @__PURE__ */ e(T, {
|
|
39
40
|
className: m,
|
|
40
|
-
defaultFetcher:
|
|
41
|
-
disabled:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
defaultFetcher: x,
|
|
42
|
+
disabled: l,
|
|
43
|
+
hideLabel: p,
|
|
44
|
+
label: a,
|
|
45
|
+
levels: b,
|
|
46
|
+
multiselect: n,
|
|
47
|
+
onValueChange: (r) => c(i, r),
|
|
48
|
+
placeholder: C(o.value),
|
|
47
49
|
portalElement: d,
|
|
48
50
|
selectableLevels: t,
|
|
49
51
|
value: o.value
|
|
50
|
-
}) : /* @__PURE__ */ e(
|
|
52
|
+
}) : /* @__PURE__ */ e(I, {
|
|
51
53
|
className: m,
|
|
52
|
-
defaultFetcher:
|
|
53
|
-
disabled:
|
|
54
|
-
label:
|
|
55
|
-
multiselect:
|
|
56
|
-
onValueChange: (r) => c(
|
|
57
|
-
placeholder:
|
|
54
|
+
defaultFetcher: x,
|
|
55
|
+
disabled: l,
|
|
56
|
+
label: p ? void 0 : a,
|
|
57
|
+
multiselect: n,
|
|
58
|
+
onValueChange: (r) => c(i, r),
|
|
59
|
+
placeholder: C(o.value),
|
|
58
60
|
portalElement: d,
|
|
59
61
|
value: o.value
|
|
60
62
|
})
|
|
@@ -62,6 +64,6 @@ const B = ({
|
|
|
62
64
|
});
|
|
63
65
|
};
|
|
64
66
|
export {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
+
D as MetadataTaxonomyField,
|
|
68
|
+
D as default
|
|
67
69
|
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import t from "../../messages.js";
|
|
2
|
+
import { filterFieldTypes as d, advancedFilterFieldTypes as m } from "./filter-field-types.js";
|
|
3
|
+
const c = ({
|
|
4
|
+
field: a,
|
|
5
|
+
isAdvancedFilterEnabled: s,
|
|
6
|
+
intl: e,
|
|
7
|
+
filterOptionsMap: r
|
|
8
|
+
}) => {
|
|
9
|
+
const o = s ? m : d, F = o[a.type] || d[a.type], i = F && !a.hidden;
|
|
10
|
+
return {
|
|
11
|
+
fieldTypesMap: o,
|
|
12
|
+
MetadataFilterField: F,
|
|
13
|
+
showField: i,
|
|
14
|
+
getFilterOptionsForField: () => a.key === "modified_at" && s ? [["selectFilterType", e.formatMessage(t.selectAdvancedFilterType)], ["isNotBlank", e.formatMessage(t.modifiedAtFilterAnyTime)], ["today", e.formatMessage(t.relativeDateFilterToday)], ["past", e.formatMessage(t.relativeDateFilterPast)], ["olderThan", e.formatMessage(t.relativeDateFilterOlderThan)], ["customRange", e.formatMessage(t.relativeDateFilterCustomRange)]] : (r == null ? void 0 : r[a.type]) || []
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
c as processMetadataField
|
|
19
|
+
};
|