@box/metadata-filter 1.62.4 → 1.63.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/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 +7 -7
|
@@ -1,79 +1,81 @@
|
|
|
1
|
-
import { TooltipProvider as
|
|
2
|
-
import { useFormikContext as
|
|
1
|
+
import { TooltipProvider as $, Combobox as j } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as D, getIn as H, Field as P } from "formik";
|
|
3
3
|
import { useState as p, useCallback as f } from "react";
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
4
|
+
import { useIntl as U } from "react-intl";
|
|
5
|
+
import Y from "../../../../messages.js";
|
|
6
|
+
import { F as d } from "../../../../../../chunks/types.js";
|
|
7
|
+
import { fieldDefaultProps as q } from "../constants.js";
|
|
8
|
+
import { getInitialAdvancedFilterValue as z, createFieldValue as I, getInputValue as G } from "./utils.js";
|
|
9
|
+
import { jsx as a, jsxs as J, Fragment as Q } from "react/jsx-runtime";
|
|
9
10
|
import { A as R } from "../../../../../../chunks/index.js";
|
|
10
|
-
const
|
|
11
|
+
const S = (t) => t === d.IS_BLANK || t === d.IS_NOT_BLANK, ae = ({
|
|
11
12
|
label: t,
|
|
12
13
|
fieldNamePrefix: i,
|
|
13
14
|
disableForm: h,
|
|
14
15
|
isAdvancedFilterEnabled: r,
|
|
15
|
-
onAdvancedFilterOptionChange:
|
|
16
|
-
fieldAdvancedFilterOptions:
|
|
17
|
-
filterOptionsMap:
|
|
18
|
-
portalElement:
|
|
19
|
-
hasAccordion:
|
|
20
|
-
isModified:
|
|
16
|
+
onAdvancedFilterOptionChange: c,
|
|
17
|
+
fieldAdvancedFilterOptions: g,
|
|
18
|
+
filterOptionsMap: C,
|
|
19
|
+
portalElement: V,
|
|
20
|
+
hasAccordion: b,
|
|
21
|
+
isModified: x
|
|
21
22
|
}) => {
|
|
22
23
|
const {
|
|
23
|
-
setFieldValue:
|
|
24
|
-
values:
|
|
25
|
-
} =
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
24
|
+
setFieldValue: L,
|
|
25
|
+
values: v
|
|
26
|
+
} = D(), w = U(), l = `${i}.value.enum`, y = H(v, `${i}.options`, []).map((e) => e?.key).filter((e) => typeof e == "string"), [u, T] = p(z(g, C) || d.MATCH_ANY), [k, O] = p(!1), [A, F] = p(!1), _ = (e, o) => typeof o != "string" ? !1 : o.toLowerCase().includes(e.toLowerCase()), B = f((e, o, n) => {
|
|
27
|
+
const s = e;
|
|
28
|
+
T(s), c?.(l, s);
|
|
29
|
+
const m = S(e) ? [] : o, N = I(m, e, r);
|
|
30
|
+
n.setFieldValue(l, N);
|
|
31
|
+
}, [l, r, c]), K = f((e) => {
|
|
32
|
+
O(e), e && F(!1);
|
|
33
|
+
}, []), M = f((e) => {
|
|
34
|
+
F(e), e && O(!1);
|
|
33
35
|
}, []);
|
|
34
36
|
return /* @__PURE__ */ a("div", {
|
|
35
37
|
"data-testid": `${t}-field`,
|
|
36
|
-
children: /* @__PURE__ */ a(
|
|
37
|
-
name:
|
|
38
|
+
children: /* @__PURE__ */ a(P, {
|
|
39
|
+
name: l,
|
|
38
40
|
children: ({
|
|
39
41
|
field: e,
|
|
40
42
|
form: o
|
|
41
43
|
}) => {
|
|
42
|
-
const n =
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
+
const n = G(e.value, r);
|
|
45
|
+
return /* @__PURE__ */ J(Q, {
|
|
44
46
|
children: [/* @__PURE__ */ a(R, {
|
|
45
47
|
disableForm: h,
|
|
46
|
-
fieldAdvancedFilterOptions:
|
|
48
|
+
fieldAdvancedFilterOptions: g,
|
|
47
49
|
fieldNamePrefix: i,
|
|
48
|
-
filterOptionsMap:
|
|
49
|
-
isModified:
|
|
50
|
+
filterOptionsMap: C,
|
|
51
|
+
isModified: x,
|
|
50
52
|
label: t,
|
|
51
|
-
onAdvancedFilterOptionChange:
|
|
52
|
-
onOpenChange:
|
|
53
|
-
onValueChange: (
|
|
54
|
-
open:
|
|
55
|
-
portalElement:
|
|
56
|
-
showLabel: !
|
|
57
|
-
value:
|
|
58
|
-
}), !
|
|
59
|
-
children: /* @__PURE__ */ a(
|
|
60
|
-
...
|
|
53
|
+
onAdvancedFilterOptionChange: c,
|
|
54
|
+
onOpenChange: M,
|
|
55
|
+
onValueChange: (s) => B(s, n, o),
|
|
56
|
+
open: A,
|
|
57
|
+
portalElement: V,
|
|
58
|
+
showLabel: !b,
|
|
59
|
+
value: u
|
|
60
|
+
}), !S(u) && /* @__PURE__ */ a($, {
|
|
61
|
+
children: /* @__PURE__ */ a(j, {
|
|
62
|
+
...q,
|
|
61
63
|
as: "input",
|
|
62
64
|
disabled: h,
|
|
63
|
-
filterFn:
|
|
65
|
+
filterFn: _,
|
|
64
66
|
hideLabel: !0,
|
|
65
67
|
label: t,
|
|
66
68
|
multiselect: !0,
|
|
67
69
|
name: e.name,
|
|
68
|
-
onOpenChange:
|
|
69
|
-
onValueChange: (
|
|
70
|
-
const m =
|
|
71
|
-
|
|
70
|
+
onOpenChange: K,
|
|
71
|
+
onValueChange: (s) => {
|
|
72
|
+
const m = I(s, u, r);
|
|
73
|
+
L(l, m);
|
|
72
74
|
},
|
|
73
|
-
open:
|
|
74
|
-
options:
|
|
75
|
-
placeholder: !n || n.length === 0 ? w.formatMessage(
|
|
76
|
-
portalElement:
|
|
75
|
+
open: k,
|
|
76
|
+
options: y,
|
|
77
|
+
placeholder: !n || n.length === 0 ? w.formatMessage(Y.multiselectPlaceholder) : "",
|
|
78
|
+
portalElement: V,
|
|
77
79
|
value: n
|
|
78
80
|
})
|
|
79
81
|
})]
|
|
@@ -83,5 +85,5 @@ const k = (t) => t === "isBlank" || t === "isNotBlank", ne = ({
|
|
|
83
85
|
});
|
|
84
86
|
};
|
|
85
87
|
export {
|
|
86
|
-
|
|
88
|
+
ae as MetadataMultiSelectFieldAdvanced
|
|
87
89
|
};
|
|
@@ -1,76 +1,78 @@
|
|
|
1
|
-
import { TextInput as
|
|
2
|
-
import { Field as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
1
|
+
import { TextInput as L } from "@box/blueprint-web";
|
|
2
|
+
import { Field as M } from "formik";
|
|
3
|
+
import { useState as $, useCallback as I } from "react";
|
|
4
|
+
import { useIntl as j } from "react-intl";
|
|
5
|
+
import T from "../../../../messages.js";
|
|
6
|
+
import { F } from "../../../../../../chunks/types.js";
|
|
7
|
+
import { fieldDefaultProps as N } from "../constants.js";
|
|
8
|
+
import { getInitialAdvancedFilterValue as k, createFieldValue as d, getInputValue as D, shouldHideTextInput as H } from "./utils.js";
|
|
9
|
+
import { jsx as n, jsxs as K, Fragment as O } from "react/jsx-runtime";
|
|
10
|
+
import { A as q } from "../../../../../../chunks/index.js";
|
|
11
|
+
const z = ({
|
|
11
12
|
label: l,
|
|
12
|
-
fieldNamePrefix:
|
|
13
|
-
disableForm:
|
|
13
|
+
fieldNamePrefix: p,
|
|
14
|
+
disableForm: c,
|
|
14
15
|
isAdvancedFilterEnabled: t,
|
|
15
|
-
onAdvancedFilterOptionChange:
|
|
16
|
-
fieldAdvancedFilterOptions:
|
|
17
|
-
filterOptionsMap:
|
|
18
|
-
hasAccordion:
|
|
19
|
-
isModified:
|
|
16
|
+
onAdvancedFilterOptionChange: i,
|
|
17
|
+
fieldAdvancedFilterOptions: g,
|
|
18
|
+
filterOptionsMap: V,
|
|
19
|
+
hasAccordion: h,
|
|
20
|
+
isModified: x,
|
|
20
21
|
placeholder: S
|
|
21
22
|
}) => {
|
|
22
|
-
const f =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
23
|
+
const f = j(), o = `${p}.value.enum[0]`, [m, w] = $(k(g, V) || F.CONTAINS), C = I((e, u, r) => {
|
|
24
|
+
const a = e;
|
|
25
|
+
w(a), i?.(o, a);
|
|
26
|
+
const s = d(u, e, t);
|
|
27
|
+
r.setFieldValue(o, s);
|
|
28
|
+
}, [o, t, i]), y = I((e, u) => {
|
|
29
|
+
const r = e.target.value, a = d(r, m, t);
|
|
30
|
+
u.setFieldValue(o, a);
|
|
31
|
+
}, [m, t, o]);
|
|
32
|
+
return /* @__PURE__ */ n("div", {
|
|
31
33
|
"data-testid": `${l}-field`,
|
|
32
|
-
children: /* @__PURE__ */
|
|
33
|
-
name:
|
|
34
|
+
children: /* @__PURE__ */ n(M, {
|
|
35
|
+
name: o,
|
|
34
36
|
children: ({
|
|
35
37
|
field: e,
|
|
36
38
|
meta: u,
|
|
37
39
|
form: r
|
|
38
40
|
}) => {
|
|
39
|
-
const
|
|
40
|
-
return /* @__PURE__ */
|
|
41
|
-
children: [t && /* @__PURE__ */
|
|
42
|
-
disableForm:
|
|
43
|
-
fieldAdvancedFilterOptions:
|
|
44
|
-
fieldNamePrefix:
|
|
45
|
-
filterOptionsMap:
|
|
46
|
-
isModified:
|
|
41
|
+
const a = D(e.value, t);
|
|
42
|
+
return /* @__PURE__ */ K(O, {
|
|
43
|
+
children: [t && /* @__PURE__ */ n(q, {
|
|
44
|
+
disableForm: c,
|
|
45
|
+
fieldAdvancedFilterOptions: g,
|
|
46
|
+
fieldNamePrefix: p,
|
|
47
|
+
filterOptionsMap: V,
|
|
48
|
+
isModified: x,
|
|
47
49
|
label: l,
|
|
48
|
-
onAdvancedFilterOptionChange:
|
|
49
|
-
onValueChange: (
|
|
50
|
-
showLabel: t && !
|
|
51
|
-
value:
|
|
52
|
-
}), !
|
|
53
|
-
...
|
|
50
|
+
onAdvancedFilterOptionChange: i,
|
|
51
|
+
onValueChange: (s) => C(s, a, r),
|
|
52
|
+
showLabel: t && !h,
|
|
53
|
+
value: m
|
|
54
|
+
}), !H(t, m) && /* @__PURE__ */ n(L, {
|
|
55
|
+
...N,
|
|
54
56
|
...e,
|
|
55
|
-
"aria-label": f.formatMessage(
|
|
57
|
+
"aria-label": f.formatMessage(T.enterValueAriaLabel, {
|
|
56
58
|
label: l
|
|
57
59
|
}),
|
|
58
|
-
"data-target-id": `TextInput-${
|
|
59
|
-
disabled:
|
|
60
|
+
"data-target-id": `TextInput-${p}`,
|
|
61
|
+
disabled: c,
|
|
60
62
|
error: u.error,
|
|
61
|
-
hideLabel: t ||
|
|
63
|
+
hideLabel: t || h,
|
|
62
64
|
label: l,
|
|
63
|
-
onChange: (
|
|
64
|
-
placeholder: S || f.formatMessage(
|
|
65
|
-
value:
|
|
65
|
+
onChange: (s) => y(s, r),
|
|
66
|
+
placeholder: S || f.formatMessage(T.setValuePlaceholder),
|
|
67
|
+
value: a
|
|
66
68
|
})]
|
|
67
69
|
});
|
|
68
70
|
}
|
|
69
71
|
})
|
|
70
72
|
});
|
|
71
73
|
};
|
|
72
|
-
|
|
74
|
+
z.displayName = "MetadataStringField";
|
|
73
75
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
+
z as MetadataStringField,
|
|
77
|
+
z as default
|
|
76
78
|
};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { ComboboxWithApiTreeView as J, ComboboxWithApiPagination as N } from "@box/combobox-with-api";
|
|
2
|
+
import L from "clsx";
|
|
3
|
+
import { useFormikContext as Q, getIn as X, Field as Y } from "formik";
|
|
4
|
+
import { useState as y, useCallback as h } from "react";
|
|
5
|
+
import { useIntl as Z } from "react-intl";
|
|
6
|
+
import E from "../../../../messages.js";
|
|
7
|
+
import { getInitialAdvancedFilterValue as ee, createFieldValue as A, getInputValue as oe, isBlankOption as j } from "./utils.js";
|
|
8
|
+
import { jsx as t, jsxs as te, Fragment as le } from "react/jsx-runtime";
|
|
9
|
+
import { A as se } from "../../../../../../chunks/index.js";
|
|
10
|
+
import '../../../../../../styles/metadata-taxonomy-field-advanced.css';const ae = "_comboboxWrapper_1e1d8_1", ne = "_disabled_1e1d8_1", ie = "_disabledTreeView_1e1d8_5", b = {
|
|
11
|
+
comboboxWrapper: ae,
|
|
12
|
+
disabled: ne,
|
|
13
|
+
disabledTreeView: ie
|
|
14
|
+
}, Ve = ({
|
|
15
|
+
className: g,
|
|
16
|
+
disableForm: l,
|
|
17
|
+
fieldNamePrefix: r,
|
|
18
|
+
label: d,
|
|
19
|
+
portalElement: u,
|
|
20
|
+
taxonomyOptionsFetcher: m,
|
|
21
|
+
isMultilevelTaxonomyFieldEnabled: M,
|
|
22
|
+
hasAccordion: P,
|
|
23
|
+
isAdvancedFilterEnabled: n,
|
|
24
|
+
onAdvancedFilterOptionChange: V,
|
|
25
|
+
fieldAdvancedFilterOptions: f,
|
|
26
|
+
filterOptionsMap: v,
|
|
27
|
+
isModified: $
|
|
28
|
+
}) => {
|
|
29
|
+
const {
|
|
30
|
+
setFieldValue: C,
|
|
31
|
+
values: x
|
|
32
|
+
} = Q(), {
|
|
33
|
+
metadata: {
|
|
34
|
+
templateKey: _,
|
|
35
|
+
scope: w
|
|
36
|
+
}
|
|
37
|
+
} = x, B = Z(), s = `${r}.value`, K = X(x, r), {
|
|
38
|
+
key: T,
|
|
39
|
+
optionsRules: R,
|
|
40
|
+
levels: U
|
|
41
|
+
} = K, W = !0, i = R?.selectableLevels, q = M && i?.some((e) => e > 1), [c, z] = y(ee(f, v)), [D, k] = y(!1), I = h((e) => m ? m(w, _, T, i?.[0] ?? 0, e) : Promise.resolve({
|
|
42
|
+
options: []
|
|
43
|
+
}), [T, w, i, m, _]), O = (e) => e?.length === 0 ? B.formatMessage(E.multiselectPlaceholder) : "", G = (e, a, o) => {
|
|
44
|
+
z(e), V?.(s, e);
|
|
45
|
+
const p = j(e) ? [] : a, H = A(p, e, n);
|
|
46
|
+
o.setFieldValue(s, H);
|
|
47
|
+
}, S = h((e) => {
|
|
48
|
+
e && k(!1);
|
|
49
|
+
}, []), F = h((e) => {
|
|
50
|
+
const a = A(e, c, n);
|
|
51
|
+
C(s, a);
|
|
52
|
+
}, [c, s, n, C]);
|
|
53
|
+
return /* @__PURE__ */ t("div", {
|
|
54
|
+
"data-testid": `${d}-field`,
|
|
55
|
+
children: /* @__PURE__ */ t(Y, {
|
|
56
|
+
name: s,
|
|
57
|
+
children: ({
|
|
58
|
+
field: e,
|
|
59
|
+
form: a
|
|
60
|
+
}) => {
|
|
61
|
+
const o = oe(e.value, n);
|
|
62
|
+
return /* @__PURE__ */ te(le, {
|
|
63
|
+
children: [/* @__PURE__ */ t(se, {
|
|
64
|
+
disableForm: l ?? !1,
|
|
65
|
+
fieldAdvancedFilterOptions: f,
|
|
66
|
+
fieldNamePrefix: r,
|
|
67
|
+
filterOptionsMap: v,
|
|
68
|
+
isModified: $,
|
|
69
|
+
label: d,
|
|
70
|
+
onAdvancedFilterOptionChange: V,
|
|
71
|
+
onOpenChange: k,
|
|
72
|
+
onValueChange: (p) => G(p, o, a),
|
|
73
|
+
open: D,
|
|
74
|
+
portalElement: u,
|
|
75
|
+
showLabel: !P,
|
|
76
|
+
value: c
|
|
77
|
+
}), !j(c) && /* @__PURE__ */ t("div", {
|
|
78
|
+
className: L(b.comboboxWrapper, l && b.disabled),
|
|
79
|
+
children: q ? /* @__PURE__ */ t(J, {
|
|
80
|
+
className: L(g, l && b.disabledTreeView),
|
|
81
|
+
defaultFetcher: I,
|
|
82
|
+
disabled: l,
|
|
83
|
+
hideLabel: !0,
|
|
84
|
+
label: d,
|
|
85
|
+
levels: U,
|
|
86
|
+
multiselect: W,
|
|
87
|
+
onOpenChange: S,
|
|
88
|
+
onValueChange: F,
|
|
89
|
+
placeholder: O(o),
|
|
90
|
+
portalElement: u,
|
|
91
|
+
selectableLevels: i,
|
|
92
|
+
value: o
|
|
93
|
+
}) : /* @__PURE__ */ t(N, {
|
|
94
|
+
className: g,
|
|
95
|
+
defaultFetcher: I,
|
|
96
|
+
disabled: l,
|
|
97
|
+
label: void 0,
|
|
98
|
+
multiselect: W,
|
|
99
|
+
onOpenChange: S,
|
|
100
|
+
onValueChange: F,
|
|
101
|
+
placeholder: O(o),
|
|
102
|
+
portalElement: u,
|
|
103
|
+
value: o
|
|
104
|
+
})
|
|
105
|
+
})]
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
export {
|
|
112
|
+
Ve as MetadataTaxonomyFieldAdvanced,
|
|
113
|
+
Ve as default
|
|
114
|
+
};
|
package/dist/esm/lib/components/metadata-filter-fields/components/metadata-taxonomy-field/utils.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { F as s } from "../../../../../../chunks/types.js";
|
|
2
|
+
let e = /* @__PURE__ */ (function(t) {
|
|
3
|
+
return t.MATCH_ANY = "matchAny", t.MATCH_ALL = "matchAll", t.IS_BLANK = "isBlank", t.IS_NOT_BLANK = "isNotBlank", t;
|
|
4
|
+
})({});
|
|
5
|
+
const n = (t, r) => t ? r?.some(([A]) => A === t) ? t : s.MATCH_ANY : s.MATCH_ANY, N = (t) => t === s.IS_BLANK || t === s.IS_NOT_BLANK, I = (t, r) => Array.isArray(t) ? t : r && typeof t == "object" && t !== null ? t.value || [] : [], c = (t, r, u) => u ? {
|
|
6
|
+
value: N(r) ? [] : t,
|
|
7
|
+
advancedFilterOption: r
|
|
8
|
+
} : t;
|
|
9
|
+
export {
|
|
10
|
+
e as TaxonomyAdvancedFilterOption,
|
|
11
|
+
c as createFieldValue,
|
|
12
|
+
n as getInitialAdvancedFilterValue,
|
|
13
|
+
I as getInputValue,
|
|
14
|
+
N as isBlankOption
|
|
15
|
+
};
|
|
@@ -1,19 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import a from "../../messages.js";
|
|
2
|
+
import { F as s } from "../../../../chunks/types.js";
|
|
3
|
+
import { advancedFilterFieldTypes as F, filterFieldTypes as m } from "./filter-field-types.js";
|
|
4
|
+
const l = (e, o, t, r) => {
|
|
5
|
+
if (e.key === "modified_at" && o)
|
|
6
|
+
return [[s.SELECT_FILTER_TYPE, t.formatMessage(a.selectAdvancedFilterType)], [s.IS_NOT_BLANK, t.formatMessage(a.modifiedAtFilterAnyTime)], [s.TODAY, t.formatMessage(a.relativeDateFilterToday)], [s.PAST, t.formatMessage(a.relativeDateFilterPast)], [s.OLDER_THAN, t.formatMessage(a.relativeDateFilterOlderThan)], [s.CUSTOM_RANGE, t.formatMessage(a.modifiedAtFilterCustomRange)]];
|
|
7
|
+
if (e.type === "taxonomy") {
|
|
8
|
+
const i = e.optionsRules?.multiSelect ? "taxonomyMultiSelect" : "taxonomySingleSelect";
|
|
9
|
+
return r?.[i] || [];
|
|
10
|
+
}
|
|
11
|
+
return r?.[e.type] || [];
|
|
12
|
+
}, T = (e, o, t, r) => e.type === "taxonomy" ? t && o ? F.taxonomy : m.taxonomy : r[e.type] || m[e.type], M = ({
|
|
13
|
+
field: e,
|
|
14
|
+
isAdvancedFilterEnabled: o,
|
|
15
|
+
isAdvancedTaxonomy: t,
|
|
16
|
+
intl: r,
|
|
17
|
+
filterOptionsMap: i
|
|
8
18
|
}) => {
|
|
9
|
-
const
|
|
19
|
+
const y = o ? F : m, n = T(e, o, t, y), p = !!n && !e.hidden;
|
|
10
20
|
return {
|
|
11
|
-
fieldTypesMap:
|
|
12
|
-
MetadataFilterField:
|
|
13
|
-
showField:
|
|
14
|
-
getFilterOptionsForField: () =>
|
|
21
|
+
fieldTypesMap: y,
|
|
22
|
+
MetadataFilterField: n,
|
|
23
|
+
showField: p,
|
|
24
|
+
getFilterOptionsForField: () => l(e, o, r, i)
|
|
15
25
|
};
|
|
16
26
|
};
|
|
17
27
|
export {
|
|
18
|
-
|
|
28
|
+
M as processMetadataField
|
|
19
29
|
};
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { MetadataDateField as
|
|
2
|
-
import { MetadataDateFieldAdvanced as
|
|
3
|
-
import { MetadataEnumField as
|
|
4
|
-
import { MetadataFloatField as
|
|
5
|
-
import { MetadataFloatFieldAdvanced as
|
|
6
|
-
import { MetadataMultiSelectField as
|
|
1
|
+
import { MetadataDateField as d } from "./components/metadata-date-field/metadata-date-field.js";
|
|
2
|
+
import { MetadataDateFieldAdvanced as i } from "./components/metadata-date-field/metadata-date-field-advanced.js";
|
|
3
|
+
import { MetadataEnumField as m } from "./components/metadata-enum-field/metadata-enum-field.js";
|
|
4
|
+
import { MetadataFloatField as r } from "./components/metadata-float-field/metadata-float-field.js";
|
|
5
|
+
import { MetadataFloatFieldAdvanced as l } from "./components/metadata-float-field/metadata-float-field-advanced.js";
|
|
6
|
+
import { MetadataMultiSelectField as n } from "./components/metadata-multi-select-field/metadata-multi-select-field.js";
|
|
7
7
|
import { MetadataMultiSelectFieldAdvanced as e } from "./components/metadata-multi-select-field/metadata-multi-select-field-advanced.js";
|
|
8
8
|
import { MetadataStringField as o } from "./components/metadata-string-field/metadata-string-field.js";
|
|
9
|
-
import { MetadataTaxonomyField as
|
|
9
|
+
import { MetadataTaxonomyField as F } from "./components/metadata-taxonomy-field/metadata-taxonomy-field.js";
|
|
10
|
+
import { MetadataTaxonomyFieldAdvanced as f } from "./components/metadata-taxonomy-field/metadata-taxonomy-field-advanced.js";
|
|
10
11
|
import { jsx as a } from "react/jsx-runtime";
|
|
11
12
|
const g = {
|
|
12
|
-
date: (t) => /* @__PURE__ */ a(
|
|
13
|
+
date: (t) => /* @__PURE__ */ a(d, {
|
|
13
14
|
...t
|
|
14
15
|
}),
|
|
15
|
-
enum: (t) => /* @__PURE__ */ a(
|
|
16
|
+
enum: (t) => /* @__PURE__ */ a(m, {
|
|
16
17
|
...t
|
|
17
18
|
}),
|
|
18
|
-
float: (t) => /* @__PURE__ */ a(
|
|
19
|
+
float: (t) => /* @__PURE__ */ a(r, {
|
|
19
20
|
...t
|
|
20
21
|
}),
|
|
21
|
-
multiSelect: (t) => /* @__PURE__ */ a(
|
|
22
|
+
multiSelect: (t) => /* @__PURE__ */ a(n, {
|
|
22
23
|
...t
|
|
23
24
|
}),
|
|
24
25
|
string: (t) => /* @__PURE__ */ a(o, {
|
|
25
26
|
...t
|
|
26
27
|
}),
|
|
27
|
-
taxonomy: (t) => /* @__PURE__ */ a(
|
|
28
|
+
taxonomy: (t) => /* @__PURE__ */ a(F, {
|
|
28
29
|
...t
|
|
29
30
|
})
|
|
30
|
-
},
|
|
31
|
-
date: (t) => /* @__PURE__ */ a(
|
|
31
|
+
}, D = {
|
|
32
|
+
date: (t) => /* @__PURE__ */ a(i, {
|
|
32
33
|
...t
|
|
33
34
|
}),
|
|
34
35
|
enum: (t) => /* @__PURE__ */ a(e, {
|
|
35
36
|
...t
|
|
36
37
|
}),
|
|
37
|
-
float: (t) => /* @__PURE__ */ a(
|
|
38
|
+
float: (t) => /* @__PURE__ */ a(l, {
|
|
38
39
|
...t
|
|
39
40
|
}),
|
|
40
41
|
multiSelect: (t) => /* @__PURE__ */ a(e, {
|
|
@@ -43,11 +44,11 @@ const g = {
|
|
|
43
44
|
string: (t) => /* @__PURE__ */ a(o, {
|
|
44
45
|
...t
|
|
45
46
|
}),
|
|
46
|
-
taxonomy: (t) => /* @__PURE__ */ a(
|
|
47
|
+
taxonomy: (t) => /* @__PURE__ */ a(f, {
|
|
47
48
|
...t
|
|
48
49
|
})
|
|
49
50
|
};
|
|
50
51
|
export {
|
|
51
|
-
|
|
52
|
+
D as advancedFilterFieldTypes,
|
|
52
53
|
g as filterFieldTypes
|
|
53
54
|
};
|