@box/metadata-filter 1.80.4 → 1.80.5
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.
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
import { ComboboxWithApiTreeView as J, ComboboxWithApiPagination as N } from "@box/combobox-with-api";
|
|
2
|
-
import
|
|
3
|
-
import { useFormikContext as Q, getIn as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { useIntl as
|
|
6
|
-
import
|
|
7
|
-
import { getInitialAdvancedFilterValue as
|
|
8
|
-
import { jsx as
|
|
2
|
+
import F from "clsx";
|
|
3
|
+
import { useFormikContext as Q, getIn as R, Field as X } from "formik";
|
|
4
|
+
import { useState as M, useCallback as c } from "react";
|
|
5
|
+
import { useIntl as Y } from "react-intl";
|
|
6
|
+
import Z from "../../../../messages.js";
|
|
7
|
+
import { getInitialAdvancedFilterValue as E, isBlankOption as P, createFieldValue as $, getInputValue as ee } from "./utils.js";
|
|
8
|
+
import { jsx as l, jsxs as oe, Fragment as te } from "react/jsx-runtime";
|
|
9
9
|
import { A as le } from "../../../../../../chunks/index.js";
|
|
10
|
-
import '../../../../../../styles/metadata-taxonomy-field-advanced.css';const
|
|
11
|
-
comboboxWrapper:
|
|
12
|
-
disabled:
|
|
13
|
-
disabledTreeView:
|
|
14
|
-
},
|
|
10
|
+
import '../../../../../../styles/metadata-taxonomy-field-advanced.css';const se = "_comboboxWrapper_1e1d8_1", ae = "_disabled_1e1d8_1", ne = "_disabledTreeView_1e1d8_5", V = {
|
|
11
|
+
comboboxWrapper: se,
|
|
12
|
+
disabled: ae,
|
|
13
|
+
disabledTreeView: ne
|
|
14
|
+
}, Ve = ({
|
|
15
15
|
className: g,
|
|
16
|
-
disableForm:
|
|
16
|
+
disableForm: s,
|
|
17
17
|
fieldNamePrefix: d,
|
|
18
|
-
label:
|
|
19
|
-
portalElement:
|
|
18
|
+
label: m,
|
|
19
|
+
portalElement: u,
|
|
20
20
|
taxonomyOptionsFetcher: p,
|
|
21
|
-
isMultilevelTaxonomyFieldEnabled:
|
|
22
|
-
hasAccordion:
|
|
21
|
+
isMultilevelTaxonomyFieldEnabled: A,
|
|
22
|
+
hasAccordion: B,
|
|
23
23
|
isAdvancedFilterEnabled: a,
|
|
24
24
|
onAdvancedFilterOptionChange: h,
|
|
25
25
|
fieldAdvancedFilterOptions: f,
|
|
26
26
|
filterOptionsMap: C,
|
|
27
|
-
isModified:
|
|
27
|
+
isModified: K
|
|
28
28
|
}) => {
|
|
29
29
|
const {
|
|
30
30
|
setFieldValue: v,
|
|
@@ -34,72 +34,71 @@ import '../../../../../../styles/metadata-taxonomy-field-advanced.css';const ae
|
|
|
34
34
|
templateKey: _,
|
|
35
35
|
scope: w
|
|
36
36
|
}
|
|
37
|
-
} = x, T =
|
|
37
|
+
} = x, T = Y(), t = `${d}.value`, U = R(x, d), {
|
|
38
38
|
key: W,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
} = K, k = !0, i = R?.selectableLevels, q = $ && i?.some((e) => e > 1), [r, z] = F(ee(f, C)), [D, I] = F(!1), S = c((e) => p ? p(w, _, W, i?.[0] ?? 0, e) : Promise.resolve({
|
|
39
|
+
levels: k
|
|
40
|
+
} = U, I = !0, i = k?.map((e) => e.level), q = A && i?.some((e) => e > 1), [r, z] = M(E(f, C)), [D, S] = M(!1), O = c((e) => p ? p(w, _, W, i?.[0] ?? 0, e) : Promise.resolve({
|
|
42
41
|
options: []
|
|
43
|
-
}), [W, w, i, p, _]),
|
|
42
|
+
}), [W, w, i, p, _]), y = c((e) => e?.length === 0 ? T.formatMessage(Z.multiselectPlaceholder) : "", [T]), G = c((e, n, o) => {
|
|
44
43
|
z(e), h?.(t, e);
|
|
45
|
-
const b =
|
|
44
|
+
const b = P(e) ? [] : n, H = $(b, e, a);
|
|
46
45
|
o.setFieldValue(t, H);
|
|
47
|
-
}, [t, a, h]),
|
|
48
|
-
e &&
|
|
49
|
-
}, []),
|
|
50
|
-
const n =
|
|
46
|
+
}, [t, a, h]), L = c((e) => {
|
|
47
|
+
e && S(!1);
|
|
48
|
+
}, []), j = c((e) => {
|
|
49
|
+
const n = $(e, r, a);
|
|
51
50
|
v(t, n);
|
|
52
51
|
}, [r, t, a, v]);
|
|
53
|
-
return /* @__PURE__ */
|
|
54
|
-
"data-testid": `${
|
|
55
|
-
children: /* @__PURE__ */
|
|
52
|
+
return /* @__PURE__ */ l("div", {
|
|
53
|
+
"data-testid": `${m}-field`,
|
|
54
|
+
children: /* @__PURE__ */ l(X, {
|
|
56
55
|
name: t,
|
|
57
56
|
children: ({
|
|
58
57
|
field: e,
|
|
59
58
|
form: n
|
|
60
59
|
}) => {
|
|
61
|
-
const o =
|
|
62
|
-
return /* @__PURE__ */ te
|
|
63
|
-
children: [/* @__PURE__ */
|
|
64
|
-
disableForm:
|
|
60
|
+
const o = ee(e.value, a);
|
|
61
|
+
return /* @__PURE__ */ oe(te, {
|
|
62
|
+
children: [/* @__PURE__ */ l(le, {
|
|
63
|
+
disableForm: s ?? !1,
|
|
65
64
|
fieldAdvancedFilterOptions: f,
|
|
66
65
|
fieldNamePrefix: d,
|
|
67
66
|
filterOptionsMap: C,
|
|
68
|
-
isModified:
|
|
69
|
-
label:
|
|
67
|
+
isModified: K,
|
|
68
|
+
label: m,
|
|
70
69
|
onAdvancedFilterOptionChange: h,
|
|
71
|
-
onOpenChange:
|
|
70
|
+
onOpenChange: S,
|
|
72
71
|
onValueChange: (b) => G(b, o, n),
|
|
73
72
|
open: D,
|
|
74
|
-
portalElement:
|
|
75
|
-
showLabel: !
|
|
73
|
+
portalElement: u,
|
|
74
|
+
showLabel: !B,
|
|
76
75
|
value: r
|
|
77
|
-
}), !
|
|
78
|
-
className:
|
|
79
|
-
children: q ? /* @__PURE__ */
|
|
80
|
-
className:
|
|
81
|
-
defaultFetcher:
|
|
82
|
-
disabled:
|
|
76
|
+
}), !P(r) && /* @__PURE__ */ l("div", {
|
|
77
|
+
className: F(V.comboboxWrapper, s && V.disabled),
|
|
78
|
+
children: q ? /* @__PURE__ */ l(J, {
|
|
79
|
+
className: F(g, s && V.disabledTreeView),
|
|
80
|
+
defaultFetcher: O,
|
|
81
|
+
disabled: s,
|
|
83
82
|
hideLabel: !0,
|
|
84
|
-
label:
|
|
85
|
-
levels:
|
|
86
|
-
multiselect:
|
|
87
|
-
onOpenChange:
|
|
88
|
-
onValueChange:
|
|
89
|
-
placeholder:
|
|
90
|
-
portalElement:
|
|
83
|
+
label: m,
|
|
84
|
+
levels: k,
|
|
85
|
+
multiselect: I,
|
|
86
|
+
onOpenChange: L,
|
|
87
|
+
onValueChange: j,
|
|
88
|
+
placeholder: y(o),
|
|
89
|
+
portalElement: u,
|
|
91
90
|
selectableLevels: i,
|
|
92
91
|
value: o
|
|
93
|
-
}) : /* @__PURE__ */
|
|
92
|
+
}) : /* @__PURE__ */ l(N, {
|
|
94
93
|
className: g,
|
|
95
|
-
defaultFetcher:
|
|
96
|
-
disabled:
|
|
94
|
+
defaultFetcher: O,
|
|
95
|
+
disabled: s,
|
|
97
96
|
label: void 0,
|
|
98
|
-
multiselect:
|
|
99
|
-
onOpenChange:
|
|
100
|
-
onValueChange:
|
|
101
|
-
placeholder:
|
|
102
|
-
portalElement:
|
|
97
|
+
multiselect: I,
|
|
98
|
+
onOpenChange: L,
|
|
99
|
+
onValueChange: j,
|
|
100
|
+
placeholder: y(o),
|
|
101
|
+
portalElement: u,
|
|
103
102
|
value: o
|
|
104
103
|
})
|
|
105
104
|
})]
|
|
@@ -109,6 +108,6 @@ import '../../../../../../styles/metadata-taxonomy-field-advanced.css';const ae
|
|
|
109
108
|
});
|
|
110
109
|
};
|
|
111
110
|
export {
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
Ve as MetadataTaxonomyFieldAdvanced,
|
|
112
|
+
Ve as default
|
|
114
113
|
};
|