@box/metadata-filter 1.18.7 → 1.18.8
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 +26 -22
- package/dist/esm/lib/components/metadata-filter-fields/components/metadata-multi-select-field/metadata-multi-select-field-advanced.js +54 -45
- package/dist/types/lib/components/metadata-filter-fields/components/shared/advanced-filter-select.d.ts +3 -1
- package/package.json +1 -1
package/dist/chunks/index.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Text as
|
|
2
|
-
import { Field as
|
|
3
|
-
import { useState as
|
|
4
|
-
import { useIntl as
|
|
1
|
+
import { Text as D, Select as c } from "@box/blueprint-web";
|
|
2
|
+
import { Field as I } from "formik";
|
|
3
|
+
import { useState as k, useCallback as B } from "react";
|
|
4
|
+
import { useIntl as $ } from "react-intl";
|
|
5
5
|
import i from "../esm/lib/messages.js";
|
|
6
|
-
import { jsxs as
|
|
7
|
-
import '../styles/index.css';const
|
|
8
|
-
noAttributesText:
|
|
9
|
-
fieldLabel:
|
|
10
|
-
selectContainer:
|
|
11
|
-
comboboxContainer:
|
|
12
|
-
},
|
|
6
|
+
import { jsxs as q, Fragment as w, jsx as e } from "react/jsx-runtime";
|
|
7
|
+
import '../styles/index.css';const z = "_noAttributesText_12d80_1", E = "_fieldLabel_12d80_5", G = "_selectContainer_12d80_10", H = "_comboboxContainer_12d80_15", _ = {
|
|
8
|
+
noAttributesText: z,
|
|
9
|
+
fieldLabel: E,
|
|
10
|
+
selectContainer: G,
|
|
11
|
+
comboboxContainer: H
|
|
12
|
+
}, V = ({
|
|
13
13
|
label: d,
|
|
14
14
|
fieldNamePrefix: n,
|
|
15
15
|
fieldAdvancedFilterOptions: h,
|
|
@@ -23,19 +23,21 @@ import '../styles/index.css';const q = "_noAttributesText_12d80_1", w = "_fieldL
|
|
|
23
23
|
advancedFilterFieldName: C = `${n}.value.advancedFilterOption`,
|
|
24
24
|
value: o,
|
|
25
25
|
labelClassName: L = _.fieldLabel,
|
|
26
|
-
labelAs: g = "div"
|
|
26
|
+
labelAs: g = "div",
|
|
27
|
+
open: A,
|
|
28
|
+
onOpenChange: T
|
|
27
29
|
}) => {
|
|
28
|
-
const s =
|
|
29
|
-
o === void 0 &&
|
|
30
|
+
const s = $(), [F, p] = k(h || f), y = o !== void 0 ? o : F, S = B((t, ...r) => {
|
|
31
|
+
o === void 0 && p(t), l && l(n, t), m(t, ...r);
|
|
30
32
|
}, [n, l, m, o]);
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
children: [v && /* @__PURE__ */ e(
|
|
33
|
+
return /* @__PURE__ */ q(w, {
|
|
34
|
+
children: [v && /* @__PURE__ */ e(D, {
|
|
33
35
|
as: g,
|
|
34
36
|
className: L,
|
|
35
37
|
color: "textOnLightDefault",
|
|
36
38
|
variant: "bodyDefaultBold",
|
|
37
39
|
children: d
|
|
38
|
-
}), /* @__PURE__ */ e(
|
|
40
|
+
}), /* @__PURE__ */ e(I, {
|
|
39
41
|
name: C,
|
|
40
42
|
children: ({
|
|
41
43
|
field: t,
|
|
@@ -52,13 +54,15 @@ import '../styles/index.css';const q = "_noAttributesText_12d80_1", w = "_fieldL
|
|
|
52
54
|
error: r.touched && r.error ? r.error : void 0,
|
|
53
55
|
hideLabel: !0,
|
|
54
56
|
label: s.formatMessage(i.selectFilterType),
|
|
55
|
-
|
|
57
|
+
onOpenChange: T,
|
|
58
|
+
onValueChange: S,
|
|
59
|
+
open: A,
|
|
56
60
|
placeholder: s.formatMessage(i.selectOptionPlaceholder),
|
|
57
|
-
value:
|
|
61
|
+
value: y,
|
|
58
62
|
children: /* @__PURE__ */ e(c.Content, {
|
|
59
63
|
container: x,
|
|
60
|
-
children: a == null ? void 0 : a.map(([u,
|
|
61
|
-
text:
|
|
64
|
+
children: a == null ? void 0 : a.map(([u, j]) => /* @__PURE__ */ e(c.Option, {
|
|
65
|
+
text: j,
|
|
62
66
|
value: u
|
|
63
67
|
}, u))
|
|
64
68
|
})
|
|
@@ -68,6 +72,6 @@ import '../styles/index.css';const q = "_noAttributesText_12d80_1", w = "_fieldL
|
|
|
68
72
|
});
|
|
69
73
|
};
|
|
70
74
|
export {
|
|
71
|
-
|
|
75
|
+
V as A,
|
|
72
76
|
_ as s
|
|
73
77
|
};
|
|
@@ -1,68 +1,77 @@
|
|
|
1
|
-
import { TooltipProvider as
|
|
2
|
-
import { useFormikContext as
|
|
3
|
-
import { useState as
|
|
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
|
|
1
|
+
import { TooltipProvider as T, Combobox as D } from "@box/blueprint-web";
|
|
2
|
+
import { useFormikContext as P, getIn as U, Field as q } from "formik";
|
|
3
|
+
import { useState as f, useCallback as p } from "react";
|
|
4
|
+
import { useIntl as v } from "react-intl";
|
|
5
|
+
import z from "../../../../messages.js";
|
|
6
|
+
import { fieldDefaultProps as G } from "../constants.js";
|
|
7
|
+
import { getInitialAdvancedFilterValue as H, createFieldValue as k, getInputValue as J } from "./utils.js";
|
|
8
|
+
import { jsx as a, jsxs as K, Fragment as N } from "react/jsx-runtime";
|
|
9
|
+
import { A as Q } from "../../../../../../chunks/index.js";
|
|
10
|
+
const x = (t) => t === "isBlank" || t === "isNotBlank", te = ({
|
|
11
11
|
label: t,
|
|
12
|
-
fieldNamePrefix:
|
|
13
|
-
disableForm:
|
|
14
|
-
isAdvancedFilterEnabled:
|
|
15
|
-
onAdvancedFilterOptionChange:
|
|
16
|
-
fieldAdvancedFilterOptions:
|
|
12
|
+
fieldNamePrefix: m,
|
|
13
|
+
disableForm: h,
|
|
14
|
+
isAdvancedFilterEnabled: u,
|
|
15
|
+
onAdvancedFilterOptionChange: l,
|
|
16
|
+
fieldAdvancedFilterOptions: g,
|
|
17
17
|
filterOptionsMap: V,
|
|
18
|
-
portalElement:
|
|
18
|
+
portalElement: C
|
|
19
19
|
}) => {
|
|
20
20
|
const {
|
|
21
|
-
setFieldValue:
|
|
22
|
-
values:
|
|
23
|
-
} =
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
}, [
|
|
21
|
+
setFieldValue: I,
|
|
22
|
+
values: S
|
|
23
|
+
} = P(), w = v(), n = `${m}.value.enum`, L = U(S, `${m}.options`, []).map((e) => e == null ? void 0 : e.key).filter((e) => typeof e == "string"), [c, y] = f(H(g, V)), [B, d] = f(!1), [O, b] = f(!1), $ = (e, s) => typeof s != "string" ? !1 : s.toLowerCase().includes(e.toLowerCase()), j = p((e, s, o) => {
|
|
24
|
+
y(e), l == null || l(n, e);
|
|
25
|
+
const r = x(e) ? [] : s, i = k(r, e, u);
|
|
26
|
+
o.setFieldValue(n, i);
|
|
27
|
+
}, [n, u, l]), F = p((e) => {
|
|
28
|
+
d(e), e && b(!1);
|
|
29
|
+
}, []), M = p((e) => {
|
|
30
|
+
b(e), e && d(!1);
|
|
31
|
+
}, []);
|
|
28
32
|
return /* @__PURE__ */ a("div", {
|
|
29
33
|
"data-testid": `${t}-field`,
|
|
30
|
-
children: /* @__PURE__ */ a(
|
|
31
|
-
name:
|
|
34
|
+
children: /* @__PURE__ */ a(q, {
|
|
35
|
+
name: n,
|
|
32
36
|
children: ({
|
|
33
37
|
field: e,
|
|
34
38
|
form: s
|
|
35
39
|
}) => {
|
|
36
|
-
const
|
|
37
|
-
return /* @__PURE__ */
|
|
38
|
-
children: [/* @__PURE__ */ a(
|
|
39
|
-
disableForm:
|
|
40
|
-
fieldAdvancedFilterOptions:
|
|
41
|
-
fieldNamePrefix:
|
|
40
|
+
const o = J(e.value, u);
|
|
41
|
+
return /* @__PURE__ */ K(N, {
|
|
42
|
+
children: [/* @__PURE__ */ a(Q, {
|
|
43
|
+
disableForm: h,
|
|
44
|
+
fieldAdvancedFilterOptions: g,
|
|
45
|
+
fieldNamePrefix: m,
|
|
42
46
|
filterOptionsMap: V,
|
|
43
47
|
label: t,
|
|
44
|
-
onAdvancedFilterOptionChange:
|
|
45
|
-
|
|
48
|
+
onAdvancedFilterOptionChange: l,
|
|
49
|
+
onOpenChange: M,
|
|
50
|
+
onValueChange: (r) => j(r, o, s),
|
|
51
|
+
open: O,
|
|
52
|
+
portalElement: C,
|
|
46
53
|
showLabel: !0,
|
|
47
54
|
value: c
|
|
48
|
-
}), !
|
|
49
|
-
children: /* @__PURE__ */ a(
|
|
50
|
-
...
|
|
55
|
+
}), !x(c) && /* @__PURE__ */ a(T, {
|
|
56
|
+
children: /* @__PURE__ */ a(D, {
|
|
57
|
+
...G,
|
|
51
58
|
as: "input",
|
|
52
|
-
disabled:
|
|
53
|
-
filterFn:
|
|
59
|
+
disabled: h,
|
|
60
|
+
filterFn: $,
|
|
54
61
|
hideLabel: !0,
|
|
55
62
|
label: t,
|
|
56
63
|
multiselect: !0,
|
|
57
64
|
name: e.name,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
k(
|
|
65
|
+
onOpenChange: F,
|
|
66
|
+
onValueChange: (r) => {
|
|
67
|
+
const i = k(r, c, u);
|
|
68
|
+
I(n, i);
|
|
61
69
|
},
|
|
70
|
+
open: B,
|
|
62
71
|
options: L,
|
|
63
|
-
placeholder: !
|
|
64
|
-
portalElement:
|
|
65
|
-
value:
|
|
72
|
+
placeholder: !o || o.length === 0 ? w.formatMessage(z.multiselectPlaceholder) : "",
|
|
73
|
+
portalElement: C,
|
|
74
|
+
value: o
|
|
66
75
|
})
|
|
67
76
|
})]
|
|
68
77
|
});
|
|
@@ -71,5 +80,5 @@ const d = (t) => t === "isBlank" || t === "isNotBlank", Z = ({
|
|
|
71
80
|
});
|
|
72
81
|
};
|
|
73
82
|
export {
|
|
74
|
-
|
|
83
|
+
te as MetadataMultiSelectFieldAdvanced
|
|
75
84
|
};
|
|
@@ -13,6 +13,8 @@ export interface AdvancedFilterSelectProps {
|
|
|
13
13
|
value?: string;
|
|
14
14
|
labelClassName?: string;
|
|
15
15
|
labelAs?: 'div' | 'span';
|
|
16
|
+
open?: boolean;
|
|
17
|
+
onOpenChange?: (open: boolean) => void;
|
|
16
18
|
}
|
|
17
|
-
export declare const AdvancedFilterSelect: ({ label, fieldNamePrefix, fieldAdvancedFilterOptions, filterOptionsMap, disableForm, portalElement, onAdvancedFilterOptionChange, onValueChange, defaultValue, showLabel, advancedFilterFieldName, value, labelClassName, labelAs, }: AdvancedFilterSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare const AdvancedFilterSelect: ({ label, fieldNamePrefix, fieldAdvancedFilterOptions, filterOptionsMap, disableForm, portalElement, onAdvancedFilterOptionChange, onValueChange, defaultValue, showLabel, advancedFilterFieldName, value, labelClassName, labelAs, open, onOpenChange, }: AdvancedFilterSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
20
|
export default AdvancedFilterSelect;
|